You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(consumergate): runtime stop/start of queue controllers + deterministic e2e cancel test
Implement doc/rfc/consumer-gate.md:
- platform/extension/consumergate: extension contract — Gate.Enter checks a
delivery against its gate synchronously and returns an Entry future: an
open gate admits the delivery immediately, a closed gate hands out a
blocked Entry whose Wait records the parked delivery and blocks until the
gate opens (implementations own the wait mechanism, so a
notification-capable store can release instantly, and the parked-delivery
observation records). Admin is the write surface for tests and tooling;
Config, Factory interface, and gomock mocks round out the contract.
- platform/extension/consumergate/file: polling implementation — gate state
as plain files in a shared directory (gate file present = closed, rm =
open), parked-delivery records as JSON stamped parked/released by the
store, per-partition cached verdicts (TTL = poll interval) so an open gate
costs no stat per delivery, and temp-file-plus-rename writes with
converged error handling.
- platform/extension/consumergate/noop: no-op gate for services and tests
that do not need runtime gating.
- platform/consumer: consumer.New takes the Gate as a required argument and
clears every delivery through Enter. Only a blocked delivery pays for
queue mechanics: a lazily armed timer keeps it in-flight by periodically
extending visibility (no goroutine unless actually blocked, no retry
budget burned, partition order preserved), and blocked wait time is
recorded on a latency histogram. Shutdown while blocked leaves the
delivery for normal redelivery; gate errors and failed visibility
extensions cancel the wait and fail open with a log and counter.
- Wiring: gateway, orchestrator (primary + DLQ), and runway construct the
file-backed gate rooted at CONSUMER_GATE_DIR, defaulting to
/var/submitqueue/consumergate — the path the compose stack bind-mounts
into every service; stovepipe wires the no-op gate.
- test/e2e/submitqueue: replace TestCancel_RecordsIntent with
TestCancel_CaughtPreBatch_NeverLands — the stop→observe→start scenario from
the RFC. The gate parks runway's merge-conflict check for the test queue's
partition before landing, the parked record proves the request is held
pre-batch, the cancel drives it terminal cancelled, and after the gate
opens a sentinel request landing on the same partitions proves the stale
check signal was consumed and dropped — the cancelled change is never
batched and never lands.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
0 commit comments