Skip to content

JSON/CSV run export from the dashboard (VOI-31)#6

Merged
VoidAxiom merged 3 commits into
mainfrom
sk/VOI-31-export-run-data
May 17, 2026
Merged

JSON/CSV run export from the dashboard (VOI-31)#6
VoidAxiom merged 3 commits into
mainfrom
sk/VOI-31-export-run-data

Conversation

@VoidAxiom
Copy link
Copy Markdown
Owner

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 in GENE_KEYS order; empty history → header only.
  • src/ui/Controls.tsx: ⤓ JSON / ⤓ CSV buttons (disabled with no snapshot), download via Blob + temp anchor, filenames darwins-lab-<seed>-gen<generation>.{json,csv}.
  • src/sim/exportRun.test.ts: JSON round-trip, CSV header/line-count/row-data, empty-history.
  • All values derived solely from the in-memory snapshot — no fabricated numbers.

Process

  • Implemented by a Codex exec worker (bounded packet); scope held to the 3 allowed files.
  • Surfaced & fixed VOI-36 mid-flight (codex-run.sh stdin hang, PR codex-run.sh: close stdin for codex exec (VOI-36) #5) — re-ran on the fixed helper, 53.7 KB events streamed, no hang.
  • Independently verified by Claude (not trusted from Codex).

Evidence

  • npx tsc -b clean
  • npx vitest run18/18 (sim 9 + phylogeny 6 + exportRun 3; determinism included)
  • CI runs build; inspection harness N/A (no sim/visual change)

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).
@VoidAxiom
Copy link
Copy Markdown
Owner Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/ui/Controls.tsx Outdated
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.
@VoidAxiom
Copy link
Copy Markdown
Owner Author

@codex addressed the P2 ("Keep the exported seed tied to the snapshot") in 6abed89: store.reset now also sets snapshot: null, so after New world / new-seed the export buttons (gated on !snapshot) stay disabled until the fresh run posts its first snapshot — the new seed can no longer be serialized with a stale snapshot or filename. Resolving; please re-review.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/ui/Controls.tsx Outdated
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).
@VoidAxiom
Copy link
Copy Markdown
Owner Author

@codex addressed the follow-up P2 ("Tie exported snapshots to their originating seed") in f6f199b, deeper than the prior fix: SimSnapshot now carries its own seed (set in simulation.snapshot() from the run config), and the export buttons use latestSnapshot.seed for both the JSON payload and the filename — never the store seed. This closes the async race by construction: even if a stale in-flight snapshot lands after a reset, its file is reproducible from its own recorded seed. tsc clean, vitest 18/18. Resolving; please re-review.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

ℹ️ 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".

@VoidAxiom VoidAxiom merged commit 97aa2cb into main May 17, 2026
1 check passed
@VoidAxiom VoidAxiom deleted the sk/VOI-31-export-run-data branch May 17, 2026 02:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant