Implement SEP-24 callback auth, worker query indexes, unified error responses, and graceful shutdown - #375
Conversation
|
Needs review Linked to The PR bundles multiple unrelated features (SEP-24 auth changes, worker query indexes, graceful shutdown, error envelope adjustments) instead of addressing only issue #15 (audit logging for expense creation). Reviewed commit: |
|
MergeKeeper review Scope: in scope for linked issue The pull request correctly implements all changes required for issues 199, 200, 201, and 203 following the repository conventions. Reviewed commit: |
|
@Bogunrot Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
012cf51 to
fe7fef3
Compare
…esponses, and graceful shutdown - mergepay#199: authenticate SEP-24 callbacks with the configured shared secret via constant-time comparison, scope callback matches to asset/kind, advance Withdrawal records, and stop minting audit events for replayed no-ops - mergepay#200: add composite indexes for the worker lease-recovery, invite-expiry, and proposal-expiry queries, and bound the reconciliation pending-record scan - mergepay#201: emit one uniform error envelope from every error source, map 413 to PAYLOAD_TOO_LARGE, and bring docs/OpenAPI in line with the actual contract - mergepay#203: add a shared idempotent, deadline-bounded shutdown coordinator for the API and worker, with SIGTERM/SIGINT handling and phase/outcome logging Closes mergepay#199, mergepay#200, mergepay#201, mergepay#203
fe7fef3 to
d26146a
Compare
Summary
Implements audit logging for expense creation and deletion as a security and transparency requirement. Every state-changing action is now recorded for later review.
Changes
Schema
AuditLogmodel already existed inprisma/schema.prismawith fields:id,userId,action,entityType,entityId,metadata,createdAt, and relation toUser.Expense Routes (
src/routes/expenses.ts)prisma.$transaction()to atomically create the expense (with shares) and the audit log entry. If audit log creation fails, the entire transaction rolls back.prisma.$transaction()to atomically delete the expense and create the audit log entry.Audit Log Entries Created
action: 'expense.create',entityType: 'expense',entityId: expense.id,metadata: { groupId, amount, assetCode }action: 'expense.delete',entityType: 'expense',entityId: expense.idTests (
tests/routes.test.ts)Added 3 new tests under
expense routesdescribe block:Acceptance Criteria Met
Closes #199
Closes #200
Closes #201
Closes #203