Skip to content

fix(main): preserve per-run dot output under --simulation_first_traces#363

Merged
jp-fizzbee merged 1 commit into
mainfrom
user/jp/fix-simulation-first-traces-overwrite
Jun 24, 2026
Merged

fix(main): preserve per-run dot output under --simulation_first_traces#363
jp-fizzbee merged 1 commit into
mainfrom
user/jp/fix-simulation-first-traces-overwrite

Conversation

@jp-fizzbee

Copy link
Copy Markdown
Collaborator

Each captured run wrote to a shared outDir/graph.dot path, so all but the last overwrite silently. Only the final write survived and the flag's intent — capture the first N runs as separate samples — was unreachable. Reproduced on the salon spec with --max_runs 1000 --simulation_first_traces 5: five "Writen graph dotfile" log lines all pointed at the same path and the on-disk content was the fifth run only.

Thread a fileName argument through writeDotFileIfNeeded:

  • non-simulation call site keeps "graph.dot" (unchanged behavior)
  • simulation in-loop site uses "graph_run_.dot" so the first N runs land in distinct files
  • post-loop "last run" write keeps the canonical "graph.dot" name so any downstream tooling reading the well-known path keeps working

Backward compatible: anything that consumed graph.dot keeps finding it (the post-loop write now fires unconditionally in simulation mode, including the edge case where --max_runs <= --simulation_first_traces and the canonical name would otherwise not exist). New consumers can also read graph_run_*.dot for the captured first-N samples.

Verified on the salon spec for both --max_runs 5 --simulation_first_traces 5 (regression case, all 5 captures + graph.dot) and --max_runs 1000 --simulation_first_traces 5 (5 captures + graph.dot from a non-captured later run).

Each captured run wrote to a shared `outDir/graph.dot` path, so all
but the last overwrite silently. Only the final write survived and
the flag's intent — capture the first N runs as separate samples —
was unreachable. Reproduced on the salon spec with
`--max_runs 1000 --simulation_first_traces 5`: five "Writen graph
dotfile" log lines all pointed at the same path and the on-disk
content was the fifth run only.

Thread a fileName argument through writeDotFileIfNeeded:
  - non-simulation call site keeps "graph.dot" (unchanged behavior)
  - simulation in-loop site uses "graph_run_<i>.dot" so the first
    N runs land in distinct files
  - post-loop "last run" write keeps the canonical "graph.dot" name
    so any downstream tooling reading the well-known path keeps
    working

Backward compatible: anything that consumed `graph.dot` keeps
finding it (the post-loop write now fires unconditionally in
simulation mode, including the edge case where --max_runs <=
--simulation_first_traces and the canonical name would otherwise
not exist). New consumers can also read `graph_run_*.dot` for the
captured first-N samples.

Verified on the salon spec for both `--max_runs 5
--simulation_first_traces 5` (regression case, all 5 captures +
graph.dot) and `--max_runs 1000 --simulation_first_traces 5` (5
captures + graph.dot from a non-captured later run).
@jp-fizzbee
jp-fizzbee merged commit fd49300 into main Jun 24, 2026
1 check passed
@jp-fizzbee
jp-fizzbee deleted the user/jp/fix-simulation-first-traces-overwrite branch June 24, 2026 19:16
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.

2 participants