Repository navigation
fix(secret-sweep): say what a re-run really reads, and log its own-record lookup (#950) - #966
Conversation
…cord lookup (#950) A re-run of a sweep never found its own earlier attempt's record. The live re-run's logs show why: once a re-run starts, GitHub no longer lists the earlier attempt's artifact (the re-run's upload with overwrite found none to delete, and the record is gone from the run and the repository). No API lists an earlier attempt's artifacts, so the lookup cannot be fixed; a re-run reads as a new run does, which is safe. - On a re-run, the read step logs whether the workflow ref was the sweep's and how many of the run's own records were listed. - The headers and comments say what a re-run really reads. - The scan's 20-minute limit now says to start a new run, not a re-run: only a new run goes on from the tips the stopped run proved. - Contract tests: a re-run whose own record is not listed, with an older record, an empty one, an expired one, none at all, and a reset run; a re-run that then stops half-way keeps the same partial record as a first attempt; the log lines; the new time-limit message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
lens: merge-path · reviewer: lens agent · read at: 2d60465 🤖 Generated with Claude Code |
|
lens: code · reviewer: lens agent · read at: 2d60465 🤖 Generated with Claude Code |
|
lens: state · reviewer: lens agent (Claude) · read at: 2d60465 🤖 Generated with Claude Code |
Part of #950.
What was wrong
A re-run of a secret sweep never found its own earlier attempt's record. The logs of the live re-run (attempt 2 of the 2026-11-22 dispatched sweep on main) show why. It is the second candidate in #950: once a re-run starts, GitHub no longer lists the earlier attempt's artifact.
overwrite: true. When it finds an artifact of that name, it deletes it and logsArtifact '…' (ID: …) deleted(upload-artifact v7.0.2,deleteArtifactInternal). Attempt 2's log has no such line, so the artifact backend did not see attempt 1's record either.404. It is gone from the run's artifact list and from the repository's list by name. Only attempt 2's record is left.runs/{id}/attempts/{n}/artifactsis404; an attempt'sartifacts_urlis the run's).So the lookup cannot be fixed. This PR does the other half of point 3: the headers and comments now describe what really happens. It also adds the logging from point 1, so a re-run's log shows both checks.
The first candidate (the called workflow not seeing the caller's
GITHUB_WORKFLOW_REF) is unlikely. GitHub documents that a called workflow'sgithubcontext is the caller's, andfork-checks-ran.pyalready relies on that. The new log line confirms it on the next live re-run.Changes
fork-secret-scan.yml): on a re-run (attempt 2 or later) it logsattempt N of run R, workflow ref …: the sweep's, so its own earlier record is looked for first(ornot the sweep's …),and, when it asks about its own run,
this run's own records listed: 0|1. The lookup itself is unchanged.fork-secret-sweep.yml, the read and keep steps): "meant to … not yet confirmed (Secret sweep: a re-run does not find its own earlier attempt's record #950)" is replaced with what a re-run really reads.State cases (each has a contract test; red on
main's workflow, green here)listed: 0a re-run whose first attempt's record is not listed (#950)reset_recordruna re-run of a reset_record run whose first attempt's record is not listed (#950)not the sweep'slisted: 1read=found) and keeps the same partial record a first attempt keepsa re-run whose own record is not listed, then the scan's lookups fail half-waytime_limit_caseasserts the message… whose newest earlier run's expired: the one before (#950)read=found)… kept an empty one (#950)read=none)… no earlier sweep kept one (or it expired): a first run (#950)a first attempt: … no re-run log (#950)All of these were safe before, and nothing is skipped. The change is to what the run logs, what the comments say, and the time-limit advice.
Left for #950
workflow ref …/fork-secret-sweep.yml@refs/heads/main: the sweep's …andthis run's own records listed: 0. If it lists 1, the own-record path works after all and the comments need another look.Checks
python3 -B .github/scripts/fork-contracts.test.py: all 736 checks pass. Withmain'sfork-secret-scan.ymland this test file, the new cases, the pinned texts and the time-limit case fail.actionlint1.7.12 on.github/workflows/fork-*.yml: clean.vp run check:changed: pass.🤖 Generated with Claude Code