Skip to content

fix(bench): move the store guards ahead of the output file, again - #1733

Merged
inureyes merged 1 commit into
mainfrom
fix/store-guard-placement
Sep 9, 2026
Merged

inureyes merged 1 commit into
mainfrom
fix/store-guard-placement

Conversation

@inureyes

@inureyes inureyes commented Sep 9, 2026

Copy link
Copy Markdown
Member

Follow-up to #1732. The three guards it added sit after the point where each script creates its output, so they refuse only once the damage is done.

bench_na_attention.sh truncates $OUTPUT and writes a header before reaching the guard. bench_longprompt.sh runs : > "$OUTPUT" thirty lines before its own. bench_all_models.sh takes $1 as the log filename and writes to it immediately, so a stray argument creates a file named after it.

This is the same defect #1729 fixed in bench_decode.sh, reintroduced two PRs later. It surfaced because running the guards during review left a file called all and an empty na_attention_m5max_2026-09-10.csv in the tree, both from invocations that had been correctly refused.

All three now check before the output path is chosen. The test is the one that distinguishes the two versions: an existing file named with --output has to survive a refused run. All three exit 1 with the file byte-identical and leave nothing behind. Verifying that the guard fires is not enough, because a guard that fires after the truncation still fires, and that is what passed review the first time.

The guards added in #1732 sat after the point where each script creates its output, which is the defect they were modelled on and which #1729 had already fixed once in `bench_decode.sh`. `bench_na_attention.sh` truncates `$OUTPUT` and writes a header before reaching its guard; `bench_longprompt.sh` runs `: > "$OUTPUT"` thirty lines before its own; `bench_all_models.sh` takes `$1` as the log name and starts writing to it immediately, so a stray argument created a file named after it. Running the guards during review produced exactly that: a file named `all` and an empty `na_attention_m5max_2026-09-10.csv`, both from invocations the guard then refused.

All three now run the check before the output path is chosen, so nothing has been created or truncated when they refuse.

The test is the one that would have caught it: an existing file named with `--output` has to survive a refused run. All three exit 1 with the file byte-identical, and no stray output is left behind. Checking only that the guard fires is what let this through the first time, because a guard that fires after the damage still fires.
@inureyes
inureyes merged commit f48d757 into main Sep 9, 2026
12 checks passed
@inureyes
inureyes deleted the fix/store-guard-placement branch September 9, 2026 15:08
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