[BUG]: Receipt lookup stops at the first page containing a broadcasting record, missing later settlement confirmations

Open
#90 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 6 days

@AyushSrivastava1818 is already working on this.

Since Nov 14, 2026.

  • #93 by @AyushSrivastava1818 — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
65/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
github-actions, typescript
Domain
ci-cd, payments

Research direction

Start with PullRequestReceiptLedger.lookup() and its helper findReceipt(), which currently returns on the first page that has a match. Change the scan so matching receipts accumulate across all comment pages (pages of 100), then pick the strongest state, with settled over broadcasting. Add the pagination regression test described in the issue, with broadcasting on page 1 and settled on page 2 under the same key, and confirm lookup() returns the settled receipt while the fail-closed path still holds when the scan cannot finish.

Written by the indexing model from the issue text.

Description

bug
Bug Description

PullRequestReceiptLedger.lookup() returns immediately when findReceipt() finds a matching receipt on the current page.

However, a single successful payout generates two receipt comments:

  1. A broadcasting receipt recorded before transaction broadcast.
  2. A settled confirmation recorded after successful broadcast.

The implementation scans comments in pages of 100, but performs the receipt selection independently on each page.

Consequently, when the original broadcasting receipt appears on an earlier page and its settlement confirmation appears on a subsequent page, the lookup returns the earlier broadcasting receipt without examining the remaining comments.

Steps to Reproduce
  1. Create a PR with more than 100 comments.
  2. Ensure its earlier comments contain a valid GitPay broadcasting receipt.
  3. Add enough subsequent discussion comments for the pagination boundary to fall between the two receipts.
  4. Add the corresponding settled confirmation on a later page.
  5. Execute another payout run using the same idempotency key.
Expected Behaviour

The lookup should scan all relevant comment pages before determining the final receipt state.

When multiple trusted receipts carry the same key, a settled confirmation should take precedence over its earlier broadcasting record.

Actual Behaviour

The lookup returns the broadcasting receipt from the first page containing a match.

The later settled confirmation is never examined.

This causes a successfully completed payout to be reported as unconfirmed, unnecessarily requiring manual transaction verification.

Suggested Fix

Accumulate matching receipts across all pages and determine the strongest receipt state after pagination completes.

Preserve the existing fail-closed behaviour when the comment scan cannot be completed.

Testing

Add a pagination regression test where:

  • Page 1 contains a broadcasting receipt.
  • Page 2 contains the corresponding settled receipt.
  • Both receipts have the same idempotency key.

Verify that lookup() returns the settled receipt.

Dominant language
TypeScript
Stars
5
Forks
4
Avg merge
2d 12h
Merged PRs (30d)
18

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from StabilityNexus/GitPay

All issues in StabilityNexus/GitPay

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.