payments: count total with date filters#10874
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request ensures that the TotalCount field in payment queries accurately reflects the date-filtered results. By applying consistent filtering logic across both KV and SQL backends, the system now correctly reports the total number of payments within a specified time range, even when pagination is applied to the result set. Highlights
New Features🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces support for counting total payments with date filters in both the KV and SQL database backends. In the KV store, a new matchesCreationDate helper is used to filter payments, and countFn is updated to apply these filters when counting total payments. In the SQL store, a new CountFilteredPayments query is added to perform the filtered count. However, feedback highlights a performance issue in the KV store implementation: calling fetchPaymentWithSequenceNumber inside countFn for every payment is highly inefficient as it fully deserializes the entire payment and its HTLC attempts. It is recommended to optimize this by only fetching the creation time.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
PR Severity: HIGH. sqldb/* files (querier.go, payments.sql) drive HIGH classification. payments/* files are MEDIUM. 4 non-excluded files, ~120 non-excluded lines. No bump triggered. <!-- pr-severity-bot --> |
8bbb544 to
fb56914
Compare
fb56914 to
3a09cdb
Compare
|
Thanks for the review. I updated the KV counting path so date-filtered CountTotal no longer calls fetchPaymentWithSequenceNumber. It now uses a lightweight fetchCreationTimeWithSequenceNumber helper that only reads PaymentCreationInfo for the matching sequence number, including legacy duplicate-payment buckets, and avoids loading/deserializing HTLC attempts.\n\nI also added the release note entry and refreshed the PR body.\n\nRe-ran:\n- go test ./payments/db -run TestQueryPayments -count=1\n- go test -tags test_db_sqlite ./payments/db -run TestQueryPayments -count=1\n- (cd sqldb && go test ./sqlc -count=1) |
Summary
Fixes #8530.
Tests