Skip to content

feat(redrive): DLQ redrive tooling — safe replay (ADR-0026)#3

Merged
muhammetsafak merged 1 commit into
mainfrom
feat/redrive
Jun 19, 2026
Merged

feat(redrive): DLQ redrive tooling — safe replay (ADR-0026)#3
muhammetsafak merged 1 commit into
mainfrom
feat/redrive

Conversation

@muhammetsafak

Copy link
Copy Markdown
Member

The Node mirror of babelqueue-go/redrive.go (ADR-0026) — DLQ inspect/redrive, the operator tool the contract deferred.

What

Because the Node core is codec-only (no runtime / no transport), the shape adapts the way the optional otel.publish helper did:

  • resetForRedrive(envelope): Envelope — the pure, transport-free core: strip the dead_letter block, reset attempts to 0, preserve job/trace_id/data/meta verbatim (input not mutated).
  • redrive(io, dlq, opts) — drains a DLQ via a small RedriveIO (pop/publish) the caller implements over their transport, and re-publishes each reset message to its dead_letter.original_queue or opts.toQueue. Options: toQueue (sandbox), max, dryRun, select. Drains-then-processes; restores skipped/dry-run/undecodable bodies (never drops); on a publish failure restores to the DLQ and re-throws; acks only after a successful re-publish.

A normal root export (src/redrive.tssrc/index.ts) — pure, no dependency. The envelope stays frozen (GR-1).

Tests / gate

8 tests via an in-memory RedriveIO (to-source, sandbox, dry-run, select, max, publish-failure-restores, undecodable restored, resetForRedrive purity). redrive.ts at 100% lines/functions; typecheck + eslint clean; c8 gate green (lines/functions ≥90, branches ≥85). tsup build succeeds.

Follow-up

The Replay-Bypass guard (a bq-replay-bypass transport header so a replay can skip external side-effects) is a documented phase two — it touches the runtime + every transport, like ADR-0025's traceparent follow-up.

🤖 Generated with Claude Code

The Node mirror of babelqueue-go/redrive.go. Since the core is codec-only, redrive(io, dlq, opts) takes a small RedriveIO (pop/publish) over the caller's transport, and resetForRedrive(env) is the pure core: strip dead_letter, attempts->0, preserve job/trace_id/data/meta. Options toQueue (sandbox), max, dryRun, select. Drains-then-processes; restores skipped/dry-run/undecodable bodies; restores + re-throws on a publish failure. A normal root export (no dependency). Envelope frozen (GR-1); Replay-Bypass header is a documented phase two.
@muhammetsafak muhammetsafak merged commit 3008886 into main Jun 19, 2026
11 checks passed
@muhammetsafak muhammetsafak deleted the feat/redrive branch June 19, 2026 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant