feat(natsmsg,backoff): legacy JetStream publish + redelivery bridges

main

Commit

nodo1mo ago

Phase 2 of the go-nuts convergence (COR-984): deepen the shared publishing and redelivery seams so they can replace the proven production implementations in Phase 3, without widening what the shared package owns.

Publishing (natsmsg):

  • Publisher gains a caller-selected Operation span name (recorded as messaging.operation.name); StartProducerSpan now sets the standard messaging.operation.type=publish attribute.
  • New LegacyPublisher + LegacyJetStream bridge the legacy nats.JetStreamContext API, returning its native *nats.PubAck. Both publishers delegate to one unexported publish core, so the only step that differs is the actual PublishMsg call. DLQPublisher is now an alias of LegacyJetStream (identical publish surface).

Redelivery (backoff):

  • Add NakOrTermLegacy / NumDeliveredLegacy / IsFinalDeliveryLegacy over a LegacyMsg (*nats.Msg) interface; the modern jetstream.Msg entry points are unchanged. Both drive one unexported disposer core.
  • Add UnlimitedMaxDeliver=-1 and document the zero-value/unlimited semantics and the jsconsumer.EffectiveMaxDeliver() bridge. Metadata-unavailable is consolidated to base NakDelay.

The modern API is the migration destination and stays pristine; the Legacy* symbols are a transitional bridge that deletes cleanly once no caller remains.

Tests: legacy/modern parity against the shared core, the full disposition matrix (first/intermediate/final, metadata failure, overflow, unlimited, Nak/Term errors), production envelope pinning (repoops 5s→30s, permswebhook configurable ceiling, ingest 1s→300s), DLQ-before-disposition, legacy publish integration against an embedded broker, and cross-package MaxDeliver consistency. natsmsgtest gains FakeLegacyMsg and FakeMsg NakErr/TermErr.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com Claude-Session: https://claude.ai/code/session_014AwxtNg8JzfS82AiMEYnfM Entire-Checkpoint: 2e9096fe3f89

Checkpoints

Deepen Publishing and Redelivery APIs

Claude CodeOpus 4.8[1m]
View session
Checkpoint 1