Skip to content

funding: add opt-in receipt totals - #101

Merged
Kzoeps merged 2 commits into
mainfrom
api/receipt-total-count
Nov 25, 2026
Merged

Kzoeps merged 2 commits into
mainfrom
api/receipt-total-count

Conversation

@Kzoeps

@Kzoeps Kzoeps commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Refs TECH-929.

Clients can count matching funding receipts without paging through every result.

Changes

  • Add includeTotal=true to org.hypercerts.funding.listReceipts. It returns totalCount before cursor and limit, including on empty pages.
  • Leave requests that omit the flag or set it to false unchanged.

Summary by CodeRabbit

  • New Features
    • Receipt listings now support an optional includeTotal setting. When enabled, responses include the exact number of matching receipts before pagination, including when the requested page is empty.
    • When the setting is omitted or set to false, responses do not include a total count. Cursor and limit behavior remains unchanged.

@vercel

vercel Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
api-endpoints Skipped Skipped Nov 24, 2026 5:00pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Explain Change →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 36 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6db65243-b22e-4c03-8476-84b243594d1d
Commits

Reviewing files that changed from the base of the PR and between 2e8600f and 7bf3fc3.

Files selected for processing: 12

  • happyview-modules/lua/endpoints/listActivities.lua
  • happyview-modules/lua/endpoints/listCollections.lua
  • happyview-modules/lua/endpoints/listReceipts.lua
  • happyview-modules/lua/endpoints/searchActivities.lua
  • happyview-modules/lua/endpoints/searchCollections.lua
  • happyview-modules/lua/shared/activityList.lua
  • happyview-modules/lua/shared/collectionList.lua
  • happyview-modules/lua/shared/fundingReceiptList.lua
  • happyview-modules/lua/shared/includeTotal.lua
  • happyview-modules/modules/activity/manifest.json
  • happyview-modules/modules/collection/manifest.json
  • happyview-modules/modules/funding/manifest.json

No actionable comments were generated in the recent review.

Walkthrough

The receipt list now accepts an optional includeTotal parameter. When enabled, it returns the count of matching receipts before cursor and limit, including when the page is empty. The API contracts, endpoint implementation, documentation, and tests reflect this behavior.

Changes: Receipt list total count

Layer / File(s) Summary
Define the count contract
packages/api/src/lexicons/org/hypercerts/funding/listReceipts.defs.ts, happyview-modules/lexicons/org.hypercerts.funding.listReceipts.json, docs/sources/lexicons/org.hypercerts.funding.listReceipts.json, docs/openapi.json, .agents/skills/hypercerts-api/references/openapi.json, .agents/skills/hypercerts-api/references/endpoint-map.md, .agents/skills/hypercerts-api/references/request-patterns.md, .changeset/receipt-list-total-count.md
The API contract and reference documentation define optional includeTotal and totalCount. They describe the count as matching receipts before cursor and limit, including on empty pages.
Implement and validate receipt counts
happyview-modules/lua/endpoints/listReceipts.lua, happyview-modules/lua/shared/fundingReceiptList.lua, happyview-modules/tests/http/funding-listReceipts.http.test.js, happyview-modules/tests/unit/list-golden/*, happyview-modules/tests/unit/tooling/funding-receipts.test.js
The receipt query optionally counts filtered matches before pagination and returns the count with the page. It validates count values and query parameters. Tests cover paginated and empty pages, absent counts, and invalid values.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant funding_receipts_response
  participant query_funding_receipts
  participant ReceiptDatabase
  Caller->>funding_receipts_response: Send listReceipts request with includeTotal
  funding_receipts_response->>query_funding_receipts: Pass filters and include_total
  query_funding_receipts->>ReceiptDatabase: Run filtered count and paginated query
  ReceiptDatabase-->>query_funding_receipts: Return count and receipt page
  query_funding_receipts-->>funding_receipts_response: Return receipts, cursor, and total_count
  funding_receipts_response-->>Caller: Return response with totalCount
Loading

Suggested reviewers: kristoferlund

Merge Risk: Minimal · previous review 2e860

This change adds an opt-in total count to the receipt list without changing default responses. No concrete merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "funding: add opt-in receipt totals" matches the main change. The PR adds an opt-in includeTotal flag to org.hypercerts.funding.listReceipts, which returns a totalCount of matching rec…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "funding: add opt-in receipt totals" matches the main change. The PR adds an opt-in includeTotal flag to org.hypercerts.funding.listReceipts, which returns a totalCount of matching receipts before cursor and limit. The title is short, specific, and uses the scope prefix "funding:" that names the affected area. It omits the endpoint name and the exact count behavior, but the summary is accurate and a teammate scanning history would understand the primary change.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fb4edf91-b3d7-4bb6-ae0a-d283538ee3e4
Commits

Reviewing files that changed from the base of the PR and between ea46751 and 2e8600f.

Files selected for processing: 14

  • .agents/skills/hypercerts-api/references/endpoint-map.md
  • .agents/skills/hypercerts-api/references/openapi.json
  • .agents/skills/hypercerts-api/references/request-patterns.md
  • .changeset/receipt-list-total-count.md
  • docs/openapi.json
  • docs/sources/lexicons/org.hypercerts.funding.listReceipts.json
  • happyview-modules/lexicons/org.hypercerts.funding.listReceipts.json
  • happyview-modules/lua/endpoints/listReceipts.lua
  • happyview-modules/lua/shared/fundingReceiptList.lua
  • happyview-modules/tests/http/funding-listReceipts.http.test.js
  • happyview-modules/tests/unit/list-golden/list-endpoints.golden.jsonl
  • happyview-modules/tests/unit/list-golden/list-endpoints.test.js
  • happyview-modules/tests/unit/tooling/funding-receipts.test.js
  • packages/api/src/lexicons/org/hypercerts/funding/listReceipts.defs.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@changeset-bot

changeset-bot Bot commented Nov 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7bf3fc3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@hypercerts-org/happyview-modules Minor
@hypercerts-org/api Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@sonarqubecloud

Copy link
Copy Markdown

❌ The last analysis has failed.

See analysis details on SonarQube Cloud

@Kzoeps
Kzoeps merged commit b74d02c into main Nov 25, 2026
10 of 11 checks passed
@Kzoeps
Kzoeps deleted the api/receipt-total-count branch November 25, 2026 07:47
@hypercerts-release-bot hypercerts-release-bot Bot mentioned this pull request Nov 25, 2026

This branch was previously deployed

1 inactive deployment
Preview — 7bf3fc3e Deployed Nov 24, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant