fix(engine): serialize durable delivery writes with cumulative acknowledgments

Merged
WI
7h ago
+1992-106

Cumulative delivery.ack preserves queued work and failed-row evidence while allowing allocated retention holes and exact higher delivered rows to settle. Failed work pins the cursor and can be deferred and replayed.

Socket owners serialize writes, delivered-state commits and ACK handling. Logical cumulative frames retain one admitted subject across retries. Replay continues past an exact covered or expired row, including an actual TTL-swept dead_lettered row. Identity, route, status, expiry, connection and write-refusal fences remain enforced. Swift registration reads use the existing lock.

This is a Major adapter upgrade. A missing owner port leaves work queued; bare cumulative ACK requires current connection identity. The Cloud companion needs a compatible published Engine dependency, matching exports/entrypoint/migrations and its own CI before landing. Local package tests do not establish published compatibility.

Current head: 3c3a3792064c8589e9a892dbf08ee74982dae760, tree 355d44021ca38a1aaac9e8b759c3bfde782665a9. It changes only a test title over 20bb14e8; production files and all 1,160 V7 package payloads remain byte-identical. The renamed file passed all 14 tests. The complete local qualification on those production bytes was:

  • Engine: 3,475 passed / 56 skipped, focused 117 passed, typecheck/lint/build passed.
  • TypeScript SDK: 105 passed, including both sequence-gap ACK modes; production and workspace type checks passed.
  • PostgreSQL 17.11/TLS1.3: 21 passed / 7 skips, restricted roles, existing 4 GiB VM. Owned cluster/forwarder cleanup passed; shared configuration stayed unchanged.
  • Cloud: 9 integration / 17 protocol passed, plus typecheck. All 1,160 fresh V7 payloads matched the build and local installation before and after Cloud tests.

All 13 command stages and the PG lifecycle had observed outer exit zero and verified cleanup. Focused/full totals overlap. Fresh current-head official CI remains separate; at the latest primary checkpoint, 16 checks succeeded, CodeRabbit was neutral, 3 skipped and Lint/Build/Test remained in progress. Current-head Rust, Swift, smoke, real-image and Bun/SQLite checks passed.

Two boundaries remain explicit follow-ups: the documented strict cursor-v1 expiry gap in #744, and prompt recovery of failed named ACKs in #745. A failed named ACK remains replayable and cannot be hidden by a later named ACK. Current direct-SDK tests do not qualify strict legacy/custom brokers or immediate ACK settlement on a healthy socket.

Earlier failures remain retained. No native read/consume, deployment, new TLC execution, total-history performance bound or network/database atomicity is claimed.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.