Repository navigation
fix(expenses): recover retries and enforce currency - #1016
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (4)
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review. WalkthroughExpense mutation idempotency now uses the committed expense currency when a request omits currency. Payment and reversal settlements now require the expense currency to match the current store currency. API documentation and tests cover these changes. ChangesExpense mutations
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant Client
participant runExpenseMutation
participant ExpenseMutation
participant IdempotencyReceipts
Client->>runExpenseMutation: Submit mutation request
runExpenseMutation->>ExpenseMutation: Execute mutation
ExpenseMutation-->>runExpenseMutation: Return expense with resolved currency
runExpenseMutation->>IdempotencyReceipts: Store hash using returned currency
Client->>runExpenseMutation: Retry mutation request
runExpenseMutation->>IdempotencyReceipts: Read stored response and request hash
runExpenseMutation->>runExpenseMutation: Recalculate hash from stored response
Merge Risk: ⚪ Minimal · up to The supplied evidence identifies no issue that needs resolution before merge; normal checks still apply. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)✅ Passed checks (3 passed)Full details: Description checkExplanation The description explains the main behavior changes, references issue Resolution Complete the required template sections. State the related issue explicitly, define the scope, document database and user-visible impacts, mark applicable cross-cutting surfaces, record the documentation choice, and complete the contributor checklist. Full details: Docstring CoverageExplanation Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 3 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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 |
Expense retries with omitted currency could conflict after the store currency changed, and historical expenses still accepted new non-cash settlements. Resolve omitted currency against the committed expense snapshot, preserve existing receipt hashes and explicit/omitted equivalence, and require every new payment or reversal to match the store currency.
Committed requests replay before mutable currency, session, balance, date and category checks. The no-mistakes review correction also makes the store-currency guard return
409 currency_mismatchbefore caller-currency validation for new mismatched settlements.Validation:
npm test,npm run lint,npm run build,npm run docs:check, and diff checks passed on the recovered result.Refs #645.
Summary by CodeRabbit
Bug Fixes
Documentation