Repository navigation
Conversation
The audit was correct and unusable: it failed on every bypass in the history that predates merge-gate becoming a required check, so it was red on its first run and would stay red until that history slid out of the window, and nothing ran it at all (#697). --since takes a sha (resolved to its committer date) or an ISO date and starts the walk there: a finding at or before the watermark prints as "earlier bypass" / "earlier direct commit" and does not affect the exit code, so exit 1 now means a bypass newer than the watermark. With no --since the behaviour is unchanged, which is what a hand run wants. A boundary commit counts as earlier, and an unreadable --since is an error rather than a silent unfiltered walk. The new read-only patrol (contents/actions/pull-requests: read) runs the script daily and takes its watermark from the head_sha of its own previous successful run, so no file has to be committed and the job cannot write anything. A first run has no previous run and baselines the history it finds, which makes the first green the watermark. The header comment is corrected too: it said a pass named the merge commit "was pushed to main", which is more than the data shows, and it offered an `out` parameter that does not exist. Fixes #697
Collaborator
Author
|
Written-by: Dev Closing this as a duplicate of #706, which was opened first and covers #697 (watermark plus the read-only patrol). One issue, one pull request — the older one stands; nothing here is needed from it. For the record, so the difference is not lost: this branch also made |
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.
Written-by: Dev
Reproduce
At
cbce2b03the audit is correct and unusable: over the last 40 commits onmainit exits1on 26 findings, every one of them history from beforemerge-gatebecame a required check, and nothing runs it — no workflow in.github/workflows/references it, so the patrol it was written for does not exist. A check that is red on its first run and stays red is a check nobody reads.The same run with a watermark at the current head (
cbce2b03, 2026-10-22T07:29:05Z) walks 2 commits and exits0, and a baseline run over 50 commits reports 36 findings without failing — the two shapes this PR puts into a patrol.What changed
--since <sha|ISO date>. A sha is resolved throughGET /commits/{sha}to its committer date; the walk is then fetched withsince=. A finding at or before the watermark prints asearlier bypass: #<pr> <commit> (merge_group: failure|absent)orearlier direct commit: <commit>and does not affect the exit code, soexit 1now means a bypass newer than the watermark. The boundary commit itself counts as earlier. An unreadable--sinceis an error, not a silent unfiltered walk, and no--sincekeeps the old behaviour for a hand run.--baseline. The first run of a patrol that has no previous run: it walks the window unfiltered and marks every findingearlier, so the history it finds becomes the watermark instead of a red first run. It is exclusive with--since— giving both is an error, not one silently winning..github/workflows/audit-merges.yml— the read-only patrol:scheduleplusworkflow_dispatch,permissions: contents: read, actions: read, pull-requests: read, the script taken frommain, and the watermark is thehead_shaof its own previous successful run (GET /actions/workflows/audit-merges.yml/runs?status=success&per_page=1), so no file has to be committed and the job cannot write. With no previous run it passes--baseline.docs/autonomous-dev.md(Merge plumbing) gains one paragraph naming the patrol and what a red run means.main", which is more than the data shows (the pull request names it as its merge commit), and it offered anoutparameter that does not exist.What I ran
At the tip (the local tree is the pushed blob set):
Live runs against the real repository (GitHub API only; no
gh, nocurlon this box — the harness pre-fetches the same paths the script asks for):--limit 40bypassed queue1(unchanged behaviour)--since cbce2b03,--limit 400--since 2026-10-22T00:00:00Z,--limit 40bypassed queue1— red means new--baseline,--limit 50earlier bypass0— first green is the baselineRed without the source change
audit-merges.mjswith the new test file: 6 of 16 red (both watermark cases, sha resolution, unreadable watermark, baseline, exclusivity). The patrol-shape case reads the new workflow, so it is part of the same change.earliermarking → 2 red; makeexitCodeForignore the watermark → 1 red; drop the baseline marking → 1 red; drop the exclusivity check → 1 red; remove--since/--baselinefrom the patrol's run step → 1 red.Not run
workflow_dispatch. Its shape is held by a text test (read-only permissions, both triggers, the watermark source, both invocation paths), and a first real run will exercise--baselineby construction. Nothing was dispatched.npm run verify, smoke test or bench: the change touches.github/scripts, a workflow and one docs paragraph, none of which the core suite loads.Risk
T3 —
.github/**. The change is read-only by construction: the script only reads the API, and the workflow holdscontents: read,actions: read,pull-requests: readand nothing else, so it cannot comment, label, enqueue or merge.Tip SHA: d5d667b
Fixes #697