feat(redrive): DLQ redrive tooling — safe replay (ADR-0026)#3
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.publishhelper did:resetForRedrive(envelope): Envelope— the pure, transport-free core: strip thedead_letterblock, resetattemptsto 0, preservejob/trace_id/data/metaverbatim (input not mutated).redrive(io, dlq, opts)— drains a DLQ via a smallRedriveIO(pop/publish) the caller implements over their transport, and re-publishes each reset message to itsdead_letter.original_queueoropts.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.ts→src/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,resetForRedrivepurity).redrive.tsat 100% lines/functions; typecheck + eslint clean; c8 gate green (lines/functions ≥90, branches ≥85).tsupbuild succeeds.Follow-up
The Replay-Bypass guard (a
bq-replay-bypasstransport header so a replay can skip external side-effects) is a documented phase two — it touches the runtime + every transport, like ADR-0025'straceparentfollow-up.🤖 Generated with Claude Code