Repository navigation
π claims: keep webhook-recorded PR claims across a stale authoritative scan - #15569
Conversation
β¦tive scan A PR opened after the eval cycle's claim scan began listing is recorded by the webhook path but absent from the scan; the authoritative reconcile replaced the map and dropped it, re-offering the issue while its PR was open. Carry forward unsettled claims observed at or after ClaimScan.StartedAt; the next scan confirms or drops them. Signed-off-by: Andrew Anderson <andy@clubanderson.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
There was a problem hiding this comment.
Looks correct to me. Read the PR tree at 9e0bbec, not just the diff:
- The carry-forward cannot resurrect stale scan claims:
FetchClaimScanstamps every listed claim with its ownnow(src/pkg/github/prclaims.go:853), the same instant it now exports asStartedAt(:1115). On the next scan those claims are strictlyBefore(listedAt)and still drop when not re-listed (:1689), so the "PR closed β claim gone" semantics of the authoritative replacement are intact. OnlyRecord-path claims (:1364, webhook/verdict) observed after the listing began survive, and the following scan either lists their PR or drops them β the one-interval bound stated in theReconcileScancomment holds. - The fail-closed path is unaffected:
StartedAtis set even whenfirstErr != nil, butauthoritativeis false there (:2291) and the carry loop sits inside the authoritative branch (:1683). - Carried claims go through
insertLocked(:1342), so a stronger live claim the scan did list still wins;TestReconcileScan_LiveStrongerClaimStillWinspins that. - The only other
ReconcileOpencaller is the legacyReconcilewrapper (:1617), which keeps zero-listedAtbehaviour, covered byTestReconcileScan_ZeroStartCarriesNothing.
Nothing to change from my side.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Read prclaims.go and prchurn.go at v5 around the reconcile, insert and record paths, and built ./pkg/github on 9e0bbec. Looks correct to me.
What I verified:
FetchClaimScantakesnowatprclaims.go:975before any listing and stamps every scan claim with it (claimsFromPR(pr, repo, identity, now)), soStartedAtis a true lower bound on what the listing could contain, and a claim from the previous scan always hasObservedAt < StartedAtof this one β it is not carried.- The only path that stamps an unsettled claim with a later
ObservedAtisRecord(:1363-1365, used by the webhookRecordOpenedPRClaimspath), which is exactly the evidence the carry-forward is meant to keep. The other two refreshes (:1722,:1779) are settled-only, and the new loop skipsSettled()claims (:1686), so it does not interfere with the #8003 retention logic below it. - The carry inserts via
insertLocked, so the rank rule still lets a stronger live claim win βTestReconcileScan_LiveStrongerClaimStillWinscovers that, andTestReconcileScan_ZeroStartCarriesNothingpins the old behaviour forReconcileOpenand for anyClaimScan{}literal withoutStartedAt. ApplyDuplicatePRGuardis the single caller swapped toReconcileScan(:2300);ReconcileOpenkeeps its signature.
One note, not a defect: this closes the race between the listing and the webhook, but not search-index lag β a PR opened before StartedAt that the listing still does not return is dropped exactly as today. That is out of #15559's scope; mentioning it only so the changelog line ("no longer drops a PR claim the webhook recorded after the claim scan's listing began") is read as the precise claim it is.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
Why
#15559 got two PRs: Karibhou's #15561 (opened 23:15:41Z,
Refs #15559) and the scanner's #15567 (23:31:44Z).Timeline from the hosted-available-oke-11 spoke:
pull_request openedwebhook recorded 15561β15559 in the PR-claim ledger and suppressed the issue ("open external PR covers it").ApplyDuplicatePRGuardreconciled authoritatively from aFetchClaimScanwhose listing began before π fix: retain in-flight review decision dispatchesΒ #15561 existed.ReconcileOpenreplaced the map; the webhook claim was gone (ledger history never saw π fix: retain in-flight review decision dispatchesΒ #15561 at all).010-actionable.#15506's PR-open preempt does not cover this: the covering PR opened 13 minutes before the second dispatch; the gap is the ledger losing the claim.
What
ClaimScan.StartedAtrecords when the listing began.ClaimLedger.ReconcileScan(used byApplyDuplicatePRGuard) carries forward unsettled claims observed at or afterStartedAtthat the scan did not re-list, throughinsertLocked's rank rule so a stronger live claim still wins.ReconcileOpenis unchanged for other callers.closedwebhook releases it as before.Tests
pkg/github/prclaims_scan_carry_test.go: carried when newer than the listing (fails on v5), dropped when older, stronger live claim wins, zeroStartedAtbehaves as before.Refs #15559 (the dispatch gap that produced its second PR; the review-decision bug itself is fixed by #15561 / #15567).