Context
Cache, queue, outbox, workflows, realtime and the scheduler are each a capability that a product turns on, and each has a production driver that needs infrastructure. If each capability is built with its own wiring rules, every phase rewrites code written in an earlier phase, and a product cannot test a capability before its infrastructure exists. The owner settled on 2026-10-21 one rule for every capability, and an order in which they arrive.Decision
- One option, one driver. Each capability is turned on by one option or flag on an existing declaration, and a driver is chosen in config. Nothing else changes in the author’s code.
- Memory driver and fake first. Each capability ships a
memorydriver and a fake in its./testingentry before it ships its production driver. The gate for each capability is: the module’s tests pass with the memory driver and the fake, then the integration tier passes with the production driver (0182). - No phase rewrites an earlier phase. A later phase adds a driver or a flag. It does not change the code written for an earlier phase.
- The order. The capabilities arrive in this order, and each one’s option and driver list is:
- Cache:
cache: { ttl, invalidateOn: [Events.x] }on a@Query, or@Cacheableand@CacheEvicton a service method. Drivers:memory, thenvalkey. - Queue:
queueon@OnEvent,@AsJobon an action, and.queue()on a client call. Drivers:memory, thenpostgres, thenencore-pubsub. - Outbox and integration events:
public: trueon adefineEventsentry, and@OnEvent(Producer.x)on the consumer. Drivers:memory, then apostgresoutbox, thenencore-pubsub. - Workflows:
runs: XWorkflowon an action. Drivers:native, thentemporal. - Realtime:
broadcast: { channel }on an event, andrefreshOn: [Events.x]on a widget. Drivers:memory, then SSE or WebSocket. - Scheduler:
@Cronon a job action. It runs alongside the others. Drivers: the Encore CronJob in SaaS, with a croner timer and an advisory lock on-prem.
- Cache:
- Config picks the driver. The driver is named in the config layers of
0146, including
runway.yaml. Code never names a production driver.
Consequences
- A product can build and test a capability before its infrastructure exists, and an agent reads one option to know what is turned on.
- The memory driver is a real implementation, so it must be kept in step with its production driver by the conformance tests.
- A capability’s fake is part of its package, which adds a small amount of code per capability.
- The order is a sequencing rule. It does not stop a team from building two capabilities in parallel, but no capability may ship its production driver before its memory driver and fake.
Enforcement
planned — the conformance test of 0144 checks that each capability’s driver list includesmemory and a fake in ./testing, and stackra gen fails when a declared capability names a driver that is not in its list. Nothing checks
this yet.