fix(request): show Completed on a fully funded request pot#2430
fix(request): show Completed on a fully funded request pot#2430innolope-dev wants to merge 1 commit into
Conversation
A request link's status is an OPEN/CLOSED column that only flips to CLOSED when the requester explicitly closes it, so it never reports that the goal was met. mapEntryStatusToUiStatus had no OPEN case and fell through to the default branch, which returns 'pending' — so a fully funded pot and an untouched one rendered the same "Pending" badge, even at $0 remaining. Derive the badge from the collected sum against the goal for OPEN request links, which is the same data the progress bar already renders. Goal 0 is the "no goal set" pot and can never be fully funded, so it stays pending. Also add OPEN to EHistoryStatus — the backend casts past the type when it sends the field, so nothing flagged that the enum was missing a value the wire actually carries.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughAdds ChangesRequest pot status
Estimated code review effort: 2 (Simple) | ~15 minutes Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install timed out. The project may have too many dependencies for the sandbox. 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. Comment |
Code-analysis diffPainscore total: 6121.74 → 6122.26 (+0.52) 🆕 New findings (9)
✅ Resolved (9)
|
🧪 UI test report — ✅ all greenSuites
📊 Coverage (unit)
⏱ 10 slowest test cases
|
The issue
A request pot that had been fully paid still showed a Pending badge, even with the progress bar at 100% and $0 remaining right next to it:
Why it happened
The badge wasn't reading the collected amount at all — it was reading the wrong field entirely.
A request link's status is an
OPEN/CLOSEDenum on the backend (RequestLinkStatus). It only flips toCLOSEDwhen the requester explicitly closes the request, so it never reports "the goal was met". MeanwhilemapEntryStatusToUiStatusintransactionTransformer.tshad nocase 'OPEN'at all, so an open pot fell through to the default branch:'open'isn't inknownStatuses, so every open pot returned'pending'. A fully funded pot and an untouched one were indistinguishable to the badge.Compounding it:
OPENwasn't even a member of the frontend'sEHistoryStatusenum, even though the backend sends it —history.tscasts past the type (link.status as HistoryEntry['status']), so nothing flagged the gap.The fix
For request links with status
OPEN, derive the badge from the collected sum against the goal — the same data the progress bar already renders:goal > 0guards the "no goal set" pot, which can never be fully funded — without it, such a pot would flip to Completed instantly. Closed pots keep their existingclosed/cancelledbehaviour, which is decided further down the switch.OPENis also added toEHistoryStatusso the type reflects what actually arrives on the wire.Tests
5 new cases in
transactionTransformer.test.tscovering exactly-funded, over-funded, partially funded, goal-less, and closed pots. FullTransactionDetailssuite passes (39 in this file),tscclean.Related
The number this badge now keys off is summed on the backend, and the requester's rollup and the payer's request route were computing it two different ways (intent
COMPLETED+ requested amount vs. entry-backedSUCCESSFUL+ settled amount). That's fixed separately in apeanut-api-tsPR. This change is independent and safe to ship on its own — it just inherits whatever the current sum reports until that lands.