📋 Description
The settlement reconciler in src/jobs/settlementReconciler.ts (tested in src/jobs/settlementReconciler.test.ts) compares the payouts table against the Horizon ledger and detects discrepancies, but there is no operator endpoint to retrieve the latest reconciliation result for triage.
This issue adds a read-only admin endpoint that returns the most recent reconciliation run's summary and the list of unmatched records, with cursor pagination.
Why this matters: reconciliation that runs in the dark forces operators to read logs during incidents. A queryable discrepancy report makes settlement drift actionable.
🎯 Requirements & Context
Functional requirements
Context & constraints
- Endpoint is read-only; never mutates payout records.
- Reuse the reconciler's existing result types rather than re-deriving discrepancies in the route.
🛠️ Suggested Execution
1. Fork & branch
git checkout -b feat/settlement-reconciliation-report
2. Implement changes
- Persist run results; add the route, zod schema, pagination, and gauge.
- Add TSDoc + a
zod-to-openapi annotation.
- Add
supertest tests for empty, matched-only, and discrepancy-present runs plus RBAC.
3. Test & commit
npm run test -- settlementReconcil
npm run lint
npm run build
- Edge cases: no run yet, large unmatched set spanning multiple pages, non-admin caller.
Example commit message
feat(settlement): expose reconciliation discrepancy report endpoint
Persists settlementReconciler results and serves a paginated, RBAC-gated
report at GET /api/admin/settlement/reconciliation.
✅ Acceptance Criteria & Guidelines
| Requirement |
Target |
| Read-only paginated RBAC report |
Required |
| Unmatched-count gauge |
Required |
| Supertest coverage incl. discrepancy path |
≥ 95% of route branches |
npm run lint + npm run build clean |
Required |
| Timeframe |
96 hours from assignment |
💬 Community & Support
Questions and design discussion — join the GrantFox contributor community on Discord: https://discord.gg/nmnPBkBge
Please comment on this issue to ask to be assigned before you start. 🚀
📋 Description
The settlement reconciler in
src/jobs/settlementReconciler.ts(tested insrc/jobs/settlementReconciler.test.ts) compares the payouts table against the Horizon ledger and detects discrepancies, but there is no operator endpoint to retrieve the latest reconciliation result for triage.This issue adds a read-only admin endpoint that returns the most recent reconciliation run's summary and the list of unmatched records, with cursor pagination.
🎯 Requirements & Context
Functional requirements
GET /api/admin/settlement/reconciliationundersrc/routes/admin, RBAC-gated.src/lib/pagination.ts.prom-clientgauge for current unmatched count.Context & constraints
🛠️ Suggested Execution
1. Fork & branch
2. Implement changes
zod-to-openapiannotation.supertesttests for empty, matched-only, and discrepancy-present runs plus RBAC.3. Test & commit
npm run test -- settlementReconcil npm run lint npm run buildExample commit message
✅ Acceptance Criteria & Guidelines
npm run lint+npm run buildclean💬 Community & Support
Questions and design discussion — join the GrantFox contributor community on Discord: https://discord.gg/nmnPBkBge
Please comment on this issue to ask to be assigned before you start. 🚀