On this page

Exercises for reading the real server

  1. Find the ownership boundary. Run pnpm matching:dispatch with matching-dispatch.ts open. Compare the retained History transfer intent after rejection with the Matching backlog after acceptance. Follow the same boundary in Temporal’s workflow lifecycle.
  2. 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.
  3. 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, run persistence:start, change the activity name in persistence.ts, and run persistence:resume with the printed workflow ID.
  4. Add a second application worker. Register another worker on the same task queue and alternate runOne calls. Watch Matching deliver each task to one poller while History retains the execution state.
  5. Swap Matching storage. Provide an alternative TaskStore layer (another in-memory shape) while leaving History and its ExecutionStore alone. 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.
  6. Race partition creation with failover. In test/lifecycle.test.ts, call beginLoad, change namespace state, then finishLoad. Explain why the old generation cannot become running. Repeat with a host ownership change instead.
  7. 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.
  8. Diagnose a false scaling signal. Run pnpm matching:policies, then set waitingPolls to zero in its synthetic scaling input. Compare the two hypothetical decisions; neither changes running services. Run pnpm matching:metrics for a separate synthetic example of how dropped labels hide the cause, and pnpm matching:failover-metrics for a live one: a tag that was right at load and wrong after failover.
  9. 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 the ShardOwnershipLost exit in the recorded frames, and compare the retry with upstream's CachingRedirector.
  10. Read a task token. Run pnpm wire --full. Decode a taskToken from a PollWorkflowTaskQueue exit (base64, then JSON). Which host issued it, which RPC carries it back, and how does HistoryClient route by it?

Useful OSS starting points: service/matching, common/persistence, and the Matching architecture page.