Repository navigation
ci(bench): publish under a lease so overlapping runs cannot revert history - #2007
Merged
Merged
Conversation
…story Since #2005 the nightly and a push run own separate concurrency slots, so two `publish` jobs can run at the same time. The history union only helps when the published copy is read after the rival's push; the publisher closed the window with `git push --force`, which cannot fail, so a rival that landed between the fetch and the push was silently reverted -- and `history.jsonl` is append-only, so that measurement was a permanent hole. Reproduced with two real publishers against one bare remote seeded with the live 162-row history: A pushed its row, then B (which had snapshotted the branch before A's push) force-pushed its own tree and the final history held the seed rows plus B only. `ci/publish_bench_site.py` now re-reads the branch on every attempt and pushes with `--force-with-lease=refs/heads/benchmark-stats:<sha-it-read>`; a rejection re-assembles and retries (idempotent: the union de-duplicates on `(ts, sha)`) and exhausting the budget fails the step loudly. The workflow's inline bash becomes a call to that module, which is covered by 6 tests driving real git repositories (bare remote, two publish dirs); the interleaved test is red under the old force push (`'runBBBB' not found in [... 'runAAAA']`). Refs #2006
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
This was referenced Nov 12, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
benchmark-build-comparison.yml's publish step ended withSince #2005 the nightly and a push run own separate
concurrency:groups, sotwo
publishjobs can overlap.ci/merge_bench_history.pyonly helps when thepublished copy is read after the rival's push. When both publishes interleave
(both fetch, then both push),
--forcecannot fail and the loser's tree silentlyreverts the winner's row — and
history.jsonlis append-only, so that night is apermanent hole. That is the exact loss #2005 set out to stop.
Reproduced, not inferred
Two real publishers against one real bare remote, seeded with the live published
history (162 rows), using the current workflow's bash with the fetches interleaved:
A published first; B, which had snapshotted the branch before A's push,
force-pushed its own tree and A's row was gone.
Fix
New
ci/publish_bench_site.py(the workflow's inline bash becomes a call to it):benchmark-statsfirst, so the union input is whatis published now, not what was published when the run started;
--force-with-lease=refs/heads/benchmark-stats:<sha-it-read>(anempty expected value means "the branch must not exist yet"), so a rival's push
becomes a rejected push instead of a lost row;
de-duplicates on
(ts, sha)— and after--max-attemptsthe step fails loudlyinstead of clobbering;
retry budget.
ci/is imported as a namespace package in the sparse checkout, so the publisherneeds only its two modules checked out (listing the package marker would make
ci/gate_script_coverage.pyread it as an invoked gate script).Tests
ci/test_publish_bench_site.py— 6 tests driving real git repositories (abare
originplus two independent publish dirs), because the defect lives ingit's ref semantics:
--forcepush (AssertionError: 'runBBBB' not found in ['seed0000', 'seed0001', 'seed0002', 'runAAAA']),GREEN with the lease + retry;
PublishErrorinstead of clobbering;--forcein the module).ci/test_benchmark_publish.pywas updated to assert the wiring (the step runs-m ci.publish_bench_site, the sparse checkout carries both modules, the mirroris copied by the publisher, a no-op publish never pushes) instead of the removed
inline bash.
Gates run locally:
End-to-end against a bare mirror seeded with the live 162-row
benchmark-statshistory, running the wired command:
Refs #2006