fix(queue): override the Gate on the live PR head, not the stale cached SHA - #1408
Merged
Conversation
…ed SHA `@gittensory gate-override` built the neutral check-run from the cached pr.headSha (via buildAuthorizedPrActionAdvisory). When a commit landed between the override comment and its processing, the stored head was stale, so the override was posted on a phantom old SHA — a silent no-op on the LIVE head, whose Gittensory Gate check stayed blocking and kept the PR unmergeable. Add resolveOverrideHeadSha: re-fetch the live head (new fetchLivePullRequestHeadSha) and override THAT commit, threading it through the advisory so the check-run and audit target the right SHA. Fail-open to the cached head on an unreadable fetch, mirroring the rebase path's live re-fetch (prReadyForReview). The audit metadata now records both the resolved and cached head for stale-override observability. Covers resolveOverrideHeadSha (token-mint success + throw-fallback + fail-open), a live-head-differs integration test, and the unresolved-head fail-safe.
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1408 +/- ##
==========================================
+ Coverage 95.34% 95.36% +0.01%
==========================================
Files 192 192
Lines 20770 20777 +7
Branches 7508 7511 +3
==========================================
+ Hits 19804 19814 +10
Misses 383 383
+ Partials 583 580 -3
🚀 New features to boost your workflow:
|
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.
Summary
@gittensory gate-override <reason>built the neutral check-run from the cachedpr.headSha(viabuildAuthorizedPrActionAdvisory). If a commit landed between the override comment and its processing, the stored head was stale — so the override was posted on a phantom old SHA. The result: a silent no-op on the LIVE head, whoseGittensory Gatecheck stays blocking and keeps the PR unmergeable (audit #16). The override looks like it worked (the bot confirms) but the maintainer's escape hatch does nothing.The fix re-fetches the live head before posting:
resolveOverrideHeadShare-fetches the live head viafetchLivePullRequestHeadSha(GET /pulls/{n}) and overrides that commit — the neutral check-run is per-commit by design (its own summary says "a new push re-evaluates it").{ ...pr, headSha: liveHead }) so the check-run and the audit event target the right SHA.prReadyForReview.gate_overriddenaudit metadata now records both the resolvedheadShaand thecachedHeadSha, so a stale-head correction is observable.No GitHub issue — internal review-subsystem audit finding (#16). Self-contained fix to the live-merge / override path.
Scope
src/) only —src/queue/processors.ts,src/github/backfill.tswrangler.jsonc, or UI changeValidation
npm run test:ci— green (4464 passed | 4 skipped)npm run test:coverage— every changed line and branch covered (verified againstcoverage/lcov.info), incl. the previously-uncoveredsafeReasonempty-reason fallback in the same functionnpm audit --audit-level=moderate— 0 vulnerabilitiesnpm run typecheck/ui:typecheck— clean;git diff --checkcleanresolve-override-head-sha.test.ts(token-mint success / throw→public-token fallback / live-fetch fail-open / missing-head fail-open);queue.test.ts— a live-head-differs override (asserts the PATCH targets the live SHA's Gate run, never the stale one) and an unresolved-head fail-safe.Safety
author_association)