The results viewer formats -0 and non-finite values like Python, survives
engines without toFixed(100), and shows an error when readAsText throws. CSV
export writes an empty metric name as `metric:` and orders columns by name
across all rows. StudyConfig rejects `metrics: []` at parse. The evaluator logs
the position_ids fallback and matches more rejection wordings, runs in eval
mode (restoring module modes afterwards), and handles left padding in
classification. Preset getters return deep copies.
Fixes#666
Ablation CSV change columns are now delta:<metric> and pct_change:<metric>;
metrics whose names are reserved are written as metric:<name>, so no metric
can overwrite another column. The results viewer formats numbers half to even
like Python (12.25% shows as +12.2%), with tests for a stale read error after a
demo load and readAsText throwing; the report fallback comment says name order.
Fixes#648Fixes#650
Codex review r4 for #618: when the study metric has no measured change, the
fallback is the first measured metric in name order (the order save_json
writes), so a live run, replay and the viewer agree; the order-preserving
reader is no longer needed and is removed. Every upload, drop or demo load
starts a new generation and stale reads are ignored. Viewer percentages use
the absolute baseline and show unavailable for a zero baseline, as the
report does.
Codex review r3 for #618: the viewer trims ASCII whitespace by scanning
instead of a backtracking regex; report availability, plotted deltas, the
heatmap and the summary compute changes from each metric's own value and
baseline so generated column names cannot collide with raw metric names;
failed uploads clear the results and show an error; strict JSON (no NaN or
Infinity tokens) is documented as the shared input contract.
Codex review r2 for #618: the results viewer reads uploaded files with an
order-preserving JSON reader so metric selection walks baseline keys in file
order like Python (integer-like keys included), and the viewer and
report._metric_value share one strict numeric-string grammar (ASCII digits,
sign, decimal point, exponent; ASCII whitespace only; finite).
Codex review r1 for #618: the results viewer builds its stats, chart and
table with DOM nodes and text only (no innerHTML), so a crafted results.json
cannot inject markup; its impact-metric selection mirrors save_plots exactly
(string primary only, measured baseline plus at least one measured ablation);
every render clears all result regions. Plots are written to a temp file and
moved into place only on success, figures are always closed, and a fallback
metric is labelled on the chart. A node-based test exercises the viewer.
The results viewer preferred primary_metric whenever the key existed, but
unavailable metrics are saved as null, so the #607 case threw in toFixed
and rendered nothing. Use the study metric only when its baseline is a
finite number (own property only), otherwise the first measured metric, as
`obliteratus report` does; skip ablations without a measured value and show
a message when nothing is measurable.
Record the study's chosen impact metric as an optional `primary_metric` key
in results.json so `report` replays the same chart; files without the key
keep the first-metric behaviour. Write the impact and heatmap plots
independently, fall back to a metric with a measured change, and print only
the files written in this run, flagging stale plots from earlier runs.
Fixes#606Fixes#607Fixes#604