Skip to content

ci(adr): resolve the ADR checker from the effective tree, not the PR head - #1508

Merged
lilyshen0722 merged 1 commit into
mainfrom
fix/adr-guard-script-resolution
Sep 2, 2026
Merged

lilyshen0722 merged 1 commit into
mainfrom
fix/adr-guard-script-resolution

Conversation

@lilyshen0722

Copy link
Copy Markdown
Contributor

ADR numbers are unique is red on #1504 with no ADR output in the log. That is my bug, not #1504's.

The PR arm checks out the PR head on purpose — refs/pull/N/merge is recomputed lazily and can be badly stale. But GitHub takes the workflow file from the merge ref. So any PR branched before #1481 landed (12:27Z today) runs this workflow against a tree that has no scripts/verify-adr-numbering.js, and the step dies with MODULE_NOT_FOUND before printing a single ADR line. #1504 was first; nearly every open PR would have hit it on its next event.

Fix: resolve the checker the same way the ADRs are already resolved — the PR's version if the PR changed the script, main's otherwise.

Verified, all three from a real checkout at the affected head:

case result
#1504 head 9bb229df (script absent) green — ✓ 29 ADRs, 29 distinct numbers
same head + a synthetic second ADR-025 red — names both files
main head (script present) resolves from HEAD, green

The mutation matters: without it, "green on #1504" is equally consistent with a guard that now checks nothing.

Unrelated but re-measured while testing: #1295 no longer adds a second ADR-025. It was rebased at 13:52Z and now only modifies ADR-025/027. The collision I filed against it is resolved.

🤖 Generated with Claude Code

The PR arm checks out the PR HEAD by design (the merge ref is stale),
but GitHub takes the WORKFLOW from the merge ref. So a PR branched
before #1481 gets the workflow file and not scripts/verify-adr-numbering.js,
and the step dies with MODULE_NOT_FOUND before printing a single ADR line —
red, with nothing an author can act on. Hit #1504 first; it would have hit
most open PRs on their next event.

Resolve the checker the same way the ADRs are resolved: the PR's version if
it changed the script, main's otherwise.

Verified against #1504's head (script absent): green, 29 ADRs. Same head
with a synthetic second ADR-025 added: red, naming both files. Against main
(script present): resolves from HEAD, green.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@lilyshen0722
lilyshen0722 merged commit 80669b7 into main Sep 2, 2026
14 checks passed
@lilyshen0722
lilyshen0722 deleted the fix/adr-guard-script-resolution branch September 2, 2026 14:23
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