Skip to content

πŸ› claims: keep webhook-recorded PR claims across a stale authoritative scan - #15569

Merged
clubanderson merged 2 commits into
v5from
fix/ledger-scan-drops-webhook-claims
Oct 30, 2026
Merged

clubanderson merged 2 commits into
v5from
fix/ledger-scan-drops-webhook-claims

Conversation

@clubanderson

Copy link
Copy Markdown
Member

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:

#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.StartedAt records when the listing began.
  • New ClaimLedger.ReconcileScan (used by ApplyDuplicatePRGuard) carries forward unsettled claims observed at or after StartedAt that the scan did not re-list, through insertLocked's rank rule so a stronger live claim still wins. ReconcileOpen is unchanged for other callers.
  • The carry is bounded: the next scan lists the PR itself and confirms or drops the claim; a closed webhook 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, zero StartedAt behaves as before.

Refs #15559 (the dispatch gap that produced its second PR; the review-decision bug itself is fixed by #15561 / #15567).

…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>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 29, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign clubanderson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 29, 2026
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#15516 πŸ“– docs: split the operator reference same files changelog.d/fixed-claim-ledger-scan-drops-webhook-claim.md
src/pkg/github/prchurn.go
src/pkg/github/prclaims.go
src/pkg/github/prclaims_scan_carry_test.go

@clubanderson
clubanderson merged commit 59c2301 into v5 Oct 30, 2026
72 of 73 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the fix/ledger-scan-drops-webhook-claims branch October 30, 2026 00:02
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks correct to me. Read the PR tree at 9e0bbec, not just the diff:

  • The carry-forward cannot resurrect stale scan claims: FetchClaimScan stamps every listed claim with its own now (src/pkg/github/prclaims.go:853), the same instant it now exports as StartedAt (:1115). On the next scan those claims are strictly Before(listedAt) and still drop when not re-listed (:1689), so the "PR closed β†’ claim gone" semantics of the authoritative replacement are intact. Only Record-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 the ReconcileScan comment holds.
  • The fail-closed path is unaffected: StartedAt is set even when firstErr != nil, but authoritative is 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_LiveStrongerClaimStillWins pins that.
  • The only other ReconcileOpen caller is the legacy Reconcile wrapper (:1617), which keeps zero-listedAt behaviour, covered by TestReconcileScan_ZeroStartCarriesNothing.

Nothing to change from my side.

β€” hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  • FetchClaimScan takes now at prclaims.go:975 before any listing and stamps every scan claim with it (claimsFromPR(pr, repo, identity, now)), so StartedAt is a true lower bound on what the listing could contain, and a claim from the previous scan always has ObservedAt < StartedAt of this one β€” it is not carried.
  • The only path that stamps an unsettled claim with a later ObservedAt is Record (:1363-1365, used by the webhook RecordOpenedPRClaims path), 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 skips Settled() 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_LiveStrongerClaimStillWins covers that, and TestReconcileScan_ZeroStartCarriesNothing pins the old behaviour for ReconcileOpen and for any ClaimScan{} literal without StartedAt.
  • ApplyDuplicatePRGuard is the single caller swapped to ReconcileScan (:2300); ReconcileOpen keeps 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant