fix: address CodeRabbit review on PR #393

- docs: scope the self.layout note to BasePlugin subclasses (others build
  a LayoutContext directly) and make explicit that adaptive layout is
  opt-in — classic rendering stays unless a plugin adopts the APIs.
- dev_server: broaden the render-request catch (a bad manifest.json now
  returns a clean 400 instead of an unhandled 500) and stop echoing raw
  exception text in the loader-failure responses — full tracebacks go to
  the dev server's console log instead.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FqzC1nzTWL4kaqgMaQZFam
This commit is contained in:
Chuck
2026-07-11 10:40:11 -04:00
co-authored by Claude Fable 5
parent 278d757de0
commit c5f5e25150
3 changed files with 29 additions and 14 deletions
+18 -8
View File
@@ -276,14 +276,20 @@ def api_render():
try:
plugin_dir, manifest, config, mock_data, skip_update = _parse_render_request(data)
except LookupError as e:
return jsonify({'error': str(e)}), 404
except LookupError:
return jsonify({'error': f"Plugin not found: {data['plugin_id']}"}), 404
except Exception:
# Bad manifest.json / schema / fixture — details go to the dev's
# console, not the HTTP response
app.logger.exception('render request preparation failed')
return jsonify({'error': 'Could not prepare render request; see server log'}), 400
try:
result = _render_once(data['plugin_id'], plugin_dir, manifest, config,
mock_data, width, height, skip_update)
except Exception as e:
return jsonify({'error': f'Failed to load plugin: {e}'}), 500
except Exception:
app.logger.exception('plugin load failed during render')
return jsonify({'error': 'Failed to load plugin; see server log'}), 500
return jsonify(result)
@@ -321,18 +327,22 @@ def api_render_matrix():
try:
plugin_dir, manifest, config, mock_data, skip_update = _parse_render_request(data)
except LookupError as e:
return jsonify({'error': str(e)}), 404
except LookupError:
return jsonify({'error': f"Plugin not found: {data['plugin_id']}"}), 404
except Exception:
app.logger.exception('render request preparation failed')
return jsonify({'error': 'Could not prepare render request; see server log'}), 400
results = []
for w, h in parsed_sizes:
try:
results.append(_render_once(data['plugin_id'], plugin_dir, manifest,
config, mock_data, w, h, skip_update))
except Exception as e:
except Exception:
app.logger.exception('plugin load failed during %dx%d render', w, h)
results.append({'image': None, 'width': w, 'height': h,
'render_time_ms': 0,
'errors': [f'Failed to load plugin: {e}'],
'errors': ['Failed to load plugin; see server log'],
'warnings': []})
return jsonify({'results': results})