You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Decoded specs skip trace validation: invalid display values give HTTP 500 at /view, and /share accepts them #99
/view, /h/{n} and /share do not validate the traces of a decoded spec.
_render_spec_html (flexviz/server.py) decodes the spec and checks the link types. It never builds the traces, so the trace validation in from_trace_spec does not run.
The Plotly adapter checks some display fields again while it builds the page: _plotly_heatmap_color_scale and _plotly_heatmap_color_range (and color_norm after PR feat(heatmap): add color_norm with a log option to histogram2d and geo_histogram2d #95). These checks raise ValueError or TypeError in adapter._build_dashboard_html, which runs outside the try block. The result is HTTP 500, not 400.
/share runs parse_spec and _check_link_types. Its comment says that it applies the checks of /view, but neither runs the trace validation. So /share returns 200 and a URL that fails later.
Other invalid fields are not caught before the page loads at all. They fail only on the first data request.
Reachability
A hand-edited or imported spec (share URL, flexviz history, Export/Import). Reproduced on main (f0b8e7c) with a histogram2d whose display.color_range is "nope" or [5, 1]:
Request
Status
POST /share
200
GET /view (the URL from /share)
500 Internal Server Error
Fix
Validate a decoded spec once, where it enters the server:
In _render_spec_html and /share, build every trace with build_trace_from_spec inside the existing try block, so an invalid spec returns 400 Invalid spec: … with the message of the trace. This costs about 0.1 ms for a dashboard with six traces.
Note: after step 2, the trace validation is the only guard against a log color_range at or below 0. Without a guard, logColorbarTicks(-Infinity, …) in the browser never ends.
Regression tests
At the HTTP level, in tests/test_server.py:
GET /view with an invalid color_range returns 400, not 500.
POST /share with the same spec returns 400.
The same for color_norm="sqrt", a log range from 0, and a corr_heatmap with color_norm="log".
Activity
jvdd commentedon Sep 29, 2026
Fixed by #114.