Milestone 8 of 9
Save, reload, visualize, and replay the analysis
Persist exact token, group, pair, evidence, sensitivity, plot, identity, and manifest artifacts; read them back; and reproduce them separately.
The final analysis must survive a reload and an independent run. Save the rules and evidence, and make every figure traceable to exact plot data.
Goal
Persist token, group, occurrence, pair, evidence, sensitivity, configuration, identity, and summary artifacts; read them back; create figures from saved plot data; and reproduce primary and audit results in a separate replay tree.
Inputs
Use all earlier artifacts, configuration and identity records, complete pair metrics, flagged evidence, sensitivity rows, and deterministic plot-order rules. Replay must use a separate directory and fresh process or clean in-memory state.
Deliverables
Extend src/report.py and src/main.py to save:
near_duplicate_manifest.jsonwith artifact paths, schema and rule versions, source identities, settings, counts, and deterministic ordering;- selected tokens, excluded summaries, groups, occurrences, complete pair
metrics, flagged pairs, shared evidence, excerpts, sensitivity summaries,
exact
plot_data.json, and figures; - read-back checks for every CSV, JSON, and JSONL artifact; and
- a replay agreement or first-mismatch record naming artifact, path, expected value, and observed value.
The replay tree must be regenerated independently, not copied from the first output. Figures must be reproducible from saved plot data rather than image inspection.
Checks
Read every artifact back and compare identities, setting order, token and group records, pair counts, exact numerators and denominators, flagged order, evidence limits, sensitivity IDs, and plot data. Check deterministic CSV, JSON, and JSONL output across repeated runs.
Change one controlled setting or source record in a separate replay test and confirm the first mismatch is reported. Reject corrupt, missing, incompatible, or reordered artifacts. Confirm the original inputs and first output tree are not mutated.
Workspace
Keep orchestration, serialization, read-back, and replay in src/main.py; keep
figures and exact plot data in src/report.py. Write the first run to output/
and the independent run to replay/ or another separate tree.
Hints
HintManifest the rule
HintCompare semantic records
HintMake mismatch actionable
Review
Use the manifest to locate one selected token, one repeated group occurrence, one excluded pair, one excerpt, and one sensitivity addition. Then alter the threshold and inspect the first mismatch.
How to check your work
Checks compare the manifest, read-back checks, figures, plot data, and replay outcome with the supplied fixtures. The supplied fixture regenerates primary and audit outputs in a separate tree and reports mismatch evidence honestly.