JSON/CSV run export from the dashboard (VOI-31)#6
Conversation
Fixes VOI-31. Codex-worker-authored, Claude-verified. New pure
src/sim/exportRun.ts (runToJSON: {seed,tick,generation,stats,history,
events}; runToCSV: stable header + gene_<key> columns in GENE_KEYS
order, empty history -> header only). Two disabled-when-no-snapshot
buttons in Controls.tsx download via Blob+anchor with
darwins-lab-<seed>-gen<gen>.{json,csv} filenames. All data derived
solely from the in-memory snapshot — no fabricated numbers.
Evidence: npx tsc -b clean; npx vitest run 18/18 green (3 new export
tests + determinism). Inspection harness N/A (no sim/visual change).
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ffc7ab5254
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Addresses Codex P2 on PR #6: after New world / new seed, store.reset updated seed immediately while snapshot still held the previous run, so an export in that window paired the new seed with stale data (filename + JSON not reproducible). reset() now also clears snapshot; the export buttons (disabled when !snapshot) stay disabled until the fresh run posts its first snapshot. tsc clean; export tests 3/3.
|
@codex addressed the P2 ("Keep the exported seed tied to the snapshot") in 6abed89: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6abed8912c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Addresses Codex follow-up P2 on PR #6: clearing snapshot on reset did not close the async race — a stale in-flight snapshot from the prior run can land after reset() set the new seed, re-enabling export with mismatched seed. Fix by construction: SimSnapshot now carries its own seed (simulation.snapshot() sets seed=this.config.seed); Controls exports use latestSnapshot.seed for JSON payload AND filename, never the store seed. Whatever snapshot is current, its file is reproducible from its own recorded seed regardless of reset timing. tsc clean; vitest 18/18 (determinism included).
|
@codex addressed the follow-up P2 ("Tie exported snapshots to their originating seed") in f6f199b, deeper than the prior fix: |
|
Codex Review: Didn't find any major issues. Bravo. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Fixes VOI-31. First Codex-worker-authored app feature through the tracked pipeline.
Change
src/sim/exportRun.ts(pure):runToJSON(snapshot, seed)→{seed,tick,generation,stats,history,events};runToCSV(history)→ stable header +gene_<key>columns inGENE_KEYSorder; empty history → header only.src/ui/Controls.tsx:⤓ JSON/⤓ CSVbuttons (disabled with no snapshot), download via Blob + temp anchor, filenamesdarwins-lab-<seed>-gen<generation>.{json,csv}.src/sim/exportRun.test.ts: JSON round-trip, CSV header/line-count/row-data, empty-history.Process
execworker (bounded packet); scope held to the 3 allowed files.Evidence
npx tsc -bcleannpx vitest run→ 18/18 (sim 9 + phylogeny 6 + exportRun 3; determinism included)