Repository navigation
fix(secret-sweep): sweeps of a ref one at a time; a reset run never falls back to the old record (#791) - #948
Conversation
…alls back to the old record (#791) - fork-secret-sweep.yml: a per-ref concurrency group (cancel-in-progress false), so a sweep that starts during a reset run waits for it and reads its record; header reworded (a new run by hand with reset_record, not a re-run; "newest earlier attempt"). - fork-secret-scan.yml: in a reset run on a branch, any failed or doubtful read (tag check, own record listed, compared, downloaded or read) gives the empty record (read=reset), never read=failed, so the record from before the reset cannot stay in use. - fork-contracts.test.py: the sweep's concurrency contract and mutants; six reset re-run read cases and a read-then-scan case; the time-limit check fails when its line is missing or reworded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
lens: merge-path · reviewer: lens agent (Opus 5.5) · read at: 68479a3 |
|
lens: state · reviewer: lens agent · read at: 68479a3 |
…un path unconfirmed (#791, #950) - Contract: the sweep's alert job's concurrency group must differ from the new workflow-level group (the same group is a deadlock: GitHub cancels the alert). Two mutants: the sweep's group, and the same group spaced otherwise. - Headers of fork-secret-sweep.yml and the read step of fork-secret-scan.yml: a re-run going on from its own earlier attempt's record is intended but not yet confirmed live (#950). A cancelled re-run makes the whole run cancelled and its record unread, so never re-run a finished reset run; start a new reset run by hand. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes #791
Point 3 of #791 (the live check, result "not shown") is now tracked in #950, so this PR still closes #791.
What changed
The five follow-ups from the two reviews of #782. Only fork-owned files:
fork-secret-sweep.yml,fork-secret-scan.yml(the read step) andfork-contracts.test.py.fork-secret-sweep.yml). A cancelled reset run is started again "as a new run by hand with reset_record, not a re-run" (a re-run stays the older run, so the next sweep would read the newer sweep's record). "First attempt" now says "newest earlier attempt" (the upload usesoverwrite, so from attempt 3 on it is the newest one). The read step's comments say the same.fork-secret-sweep.ymlgets a workflowconcurrencygroupfork-secret-sweep-${{ github.ref }},cancel-in-progress: false.successorfailure). The header says to start it again by hand.fork-secret-scan.ymlstill has none: a push's scan must not wait or be cancelled (the existing contract still checks that).run-namemarker: it prevents the undo instead of detecting it, and needs no new API reads.GITHUB_WORKFLOW_REFin the called workflow: see "Live check" below.none failedin a reset run on a branch now writes the empty record (read=reset) and logs the reason as a warning. Before, a failed tag check, a tag named like the branch, or a failure to list, compare, download or read its own record gaveread=failed. If attempt 1 had kept nothing (for example it was cancelled before the keep step), attempt 2 then kept nothing unless it ran to the end, and the next sweep read the record from before the reset. The empty record trusts nothing, so it is always safe and costs only progress. A reset run on a tag is unchanged (no record; the keep step never keeps one on a tag).((SECONDS > N))line is missing or reworded,lookup_problemsnow reports "no lookups' time limit". Before,if limit and …skipped the check, and only the exact-text contract held the line.Fix round after the two lens reviews (both "safe to merge", minors only)
fork-secret-sweep-${{ github.ref }}), GitHub would see a deadlock and cancel the alert, so a failed scheduled sweep would alert no one. The contract now refuses an alert group equal to the workflow group (spaces inside${{ }}ignored). Two new mutants: the alert given the sweep's group, and the same group spaced otherwise.fork-secret-sweep.ymland the read step infork-secret-scan.yml): a re-run going on from its own earlier attempt's record is meant to work but is not yet confirmed live (Secret sweep: a re-run does not find its own earlier attempt's record #950). "A sweep cancelled so loses nothing" is replaced by the true statement: a new sweep cancelled so loses only its own run, but a re-run cancelled so makes the whole runcancelled, and its earlier attempt's record is no longer read. Added: never re-run a finished reset run; start a new reset run by hand.Tests
python3 .github/scripts/fork-contracts.test.py(Linux, bash 5.2): all passed: 732 ok, 0 skipped (after the fix round; 730 before it).read=failedand no record on main;cancel-in-progress: true, a per-run group, the alert's group);if not limithunk of the test file reverted): both new checks fail with "no time-limit problem": the line reworded to>=, and the line gone.vp fmt --checkon the touched files: clean (the two workflows; the formatter does not cover.py).elif same_group(...)lines removed): both new mutants fail ("2 failed").fork-seam-check.cjs --config-ref origin/main origin/main HEAD: only the pinned seams (no upstream file touched).Live check (point 3)
Result: not shown. The re-run did not read its own record, so this check does not prove the called workflow sees the caller's
GITHUB_WORKFLOW_REF. Follow-up: #950.reset_record) on main: run 45017065212. A first attempt can only show "record from run ". "Record from run " appears only on a re-run, so I also re-ran that run once (attempt 2). Nothing else was dispatched.comparesaysdiverged, 779 ahead / 379 behind, because main was rewritten since). The read step skips a record whose commit the branch does not have. Attempt 1 kept its own record (2222 bytes).overwrite: true; the old artifact id now returns 404). So the own-record branch was skipped, and the log cannot say which of two causes did it:GITHUB_WORKFLOW_REFis not…/fork-secret-sweep.yml@…, soselfstays empty and the run skips its own id; orThe state question
read=resetallows it (the new read-then-scan case). Before, it kept none, which left the pre-reset record in use.cancelled, so later sweeps do not read it. That is visible, not silent.failedkeeps none).nonewhen no run kept a record;failedwhen one may exist but cannot be read; a corrupt record is rejected.General vs project
🤖 Generated with Claude Code