Skip to content

Add a vault webhook event-replay-from-outbox endpoint scoped by vault id to src/services/outboxRelay.ts #844

Description

@1nonlypiece

📌 Description

The transactional outbox in src/services/outboxRelay.ts drains vault
lifecycle events to webhooks and ETL, marking rows processed. When a subscriber
was misconfigured or down, there is a replay-by-time-range admin tool, but no way
to replay all events for a single vault — the common support request when one
integration missed one vault's lifecycle.

This issue adds a per-vault outbox replay that re-dispatches a vault's recorded
lifecycle events to a chosen subscriber without re-emitting to everyone.

🎯 Requirements and Context

  • Add POST /api/admin/vaults/:id/replay-events taking an optional subscriber id.
  • Must read from the persisted outbox (source of truth), not reconstruct events.
  • Must preserve original event ordering and idempotency keys so a subscriber that
    already saw an event de-dupes it.
  • Admin-only, audit-logged, and rate-limited.

🛠️ Suggested Execution

1. Fork the repo and create a branch

git checkout -b feature/vault-outbox-replay

2. Implement changes

  • Add a replayForVault(vaultId, subscriberId?) to src/services/outboxRelay.ts.
  • Add the route to src/routes/adminWebhooks.ts.
  • Add src/tests/outboxRelay.vaultReplay.test.ts.
  • Document in docs/webhooks.md.

3. Test and commit

  • Run: npm test -- src/tests/outboxRelay.vaultReplay.test.ts
  • Cover edge cases: vault with no events, ordering preserved, idempotency-key
    reuse, single-subscriber targeting, non-admin forbidden.

Example commit message

feat: per-vault outbox event replay endpoint

✅ Guidelines

  • Minimum 95% test coverage on new/changed lines.
  • Replays from persisted outbox only; preserves ordering and idempotency keys.
  • Timeframe: 96 hours.

🏷️ Labels

type-feature · type-enhancement · area-backend · MAYBE REWARDED · GRANTFOX OSS · OFFICIAL CAMPAIGN

💬 Community & Support

  • Join the contributor Discord to coordinate, ask questions, and get unblocked fast: https://discord.gg/xvNAvMJf
  • Please introduce yourself in the channel before you start so we can avoid duplicate work, pair you with a reviewer, and get your PR merged quickly.
  • Maintainers actively triage this channel and aim for fast, clear, respectful reviews — reach out any time you're blocked.

Metadata

Metadata

Labels

GRANTFOX OSSGrantFox open-source campaignMAYBE REWARDEDEligible for GrantFox rewardOFFICIAL CAMPAIGNOfficial GrantFox campaign issueStellar WaveIssues in the Stellar wave programarea-backendBackend / API worktype-enhancementImprovement to existing functionalitytype-featureNew feature work
No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions