On this page
Exercises for reading the real server
- Find the ownership boundary. Run
pnpm matching:dispatchwithmatching-dispatch.tsopen. Compare the retained History transfer intent after rejection with the Matching backlog after acceptance. Follow the same boundary in Temporal’s workflow lifecycle. - Make Matching unavailable. Read the first test in
test/dispatch.test.ts. It injects a rejected transfer and verifies that History keeps the intent for retry. Extend it to reject another delivery before starting the background services. - Change workflow code after a snapshot. Read the “changed workflow command” test in
test/system.test.ts. It restores saved state with a different activity command and checks that replay fails the Workflow Task while keeping the execution open. For a PostgreSQL exercise, runpersistence:start, change the activity name inpersistence.ts, and runpersistence:resumewith the printed workflow ID. - Add a second application worker. Register another worker on the same task queue and alternate
runOnecalls. Watch Matching deliver each task to one poller while History retains the execution state. - Swap Matching storage. Provide an alternative
TaskStorelayer (another in-memory shape) while leavingHistoryand itsExecutionStorealone. Keep the scheduled-event identity and delivery-record identity distinct. This explores the conceptual backlog-store boundary; it does not specify Walker's storage API. - Race partition creation with failover. In
test/lifecycle.test.ts, callbeginLoad, change namespace state, thenfinishLoad. Explain why the old generation cannot become running. Repeat with a host ownership change instead. - Delay user-data propagation. In
test/versioning.test.ts, leave an activity partition on an old cached deployment while the root moves to a new one. Find which physical queues receive each attempt. - Diagnose a false scaling signal. Run
pnpm matching:policies, then setwaitingPollsto zero in its synthetic scaling input. Compare the two hypothetical decisions; neither changes running services. Runpnpm matching:metricsfor a separate synthetic example of how dropped labels hide the cause, andpnpm matching:failover-metricsfor a live one: a tag that was right at load and wrong after failover. - Move a History shard. Read “a replaced shard lease fences the old History host” in
test/cluster.test.ts. Explain why the old host's write fails even though membership still names it, find theShardOwnershipLostexit in the recorded frames, and compare the retry with upstream'sCachingRedirector. - Read a task token. Run
pnpm wire --full. Decode ataskTokenfrom aPollWorkflowTaskQueueexit (base64, then JSON). Which host issued it, which RPC carries it back, and how doesHistoryClientroute by it?
Useful OSS starting points: service/matching, common/persistence, and the Matching architecture page.