Capstone ops lab
Design retries, degradation, and recovery
When app runs on laptop only — no probes, no owner, secret in .env committed, the system must degrade on purpose without widening blast radius.
1Try it yourself
Decision drill
Capstone ops gate
Before demo day — metrics, flags, and recovery must be real.
1/3Before demo day: latency + groundedness must page someone.
2Learn the idea
Read
Classify and bound retries
Map failure classes for https://pka.example/v1/ask: retryable vs fatal vs needs-human. Retries need budgets, jitter, and idempotency rules aligned to versioned release with readyz, flag kill switch, rotated secret, named on-call. The chapter’s signature failure — app runs on laptop only — no probes, no owner, secret in .env committed — must take a deliberate branch, not a generic catch-all.
Read
Containment path
Implement the degrade/rollback/refuse behavior solo builder operating pka.example for 50 beta users needs when CAP-OPS-PKA-12 repeats. Prefer scoped controls (one flag, one weight, one tenant, one secret version) over fleet-wide restarts. Preserve evidence; do not delete logs to “clean the demo.”
Read
Implementation artifact
flags set pka_serve off --reason CAP-OPS-PKA-12
Read
Verify harm reduction
After containment, check readyz_ok, kill_switch_seconds, secret_age_days ≤ 30 moves in the safe direction and watch for retry amplification. Write the stop condition that ends the incident response for this lab.
Read
Stage depth
Chaos note: inject only one fault class at a time and restore fixtures after. Watch for dual failures — dependency down and retry amplifier — which is how app runs on laptop only — no probes, no owner, secret in .env committed becomes an outage. Customer communication templates (even if only for the drill) beat silence. If you queue deferred work, define poison-message handling. Budget documents should state the maximum extra spend allowed during retries. Close the loop by linking the containment action to a dashboard panel for readyz_ok, kill_switch_seconds, secret_age_days ≤ 30.
Read
Field notes for `capstone-ops-lab` / `failure-handling`
Draw a state diagram for degrade modes and put it in the repo as ASCII if needed. Cap concurrent retries across the process, not only per request. Ensure cancellation propagates to downstream HTTP clients. When failing closed, choose a user-visible message that does not leak internals. Practice the single command that flips the kill switch or weight to zero. After recovery, drain or inspect deferred work before declaring green. In this chapter the product is Personal Knowledge Assistant API with flags, probes, secrets, on-call owner, the human stakeholder is solo builder operating pka.example for 50 beta users, and the incident id you design against is CAP-OPS-PKA-12. Re-state the oracle in your notes — ship v1.2.0: smoke+readyz pass; kill switch drill < 60s; on-call roster non-empty — and keep the invariant visible: versioned release with readyz, flag kill switch, rotated secret, named on-call. Track readyz_ok, kill_switch_seconds, secret_age_days ≤ 30 as the scoreboard. Surface under change control: https://pka.example/v1/ask. If you only have forty minutes, finish the fixture for app runs on laptop only — no probes, no owner, secret in .env committed before polishing UI. Promotion language stays ternary: promote, hold, or roll back based on evidence, not hope.
Go deeper
Before you start
Why this matters
Assume app runs on laptop only — no probes, no owner, secret in .env committed is happening right now. Write the first safe action, the signal that confirms containment, and the action you will not take (infinite retry, broad restart, deleting evidence). Tie the plan to invariant: versioned release with readyz, flag kill switch, rotated secret, named on-call.
Capstone failure drills reuse CAP-OPS-PKA-12 as the story you tell in the ship review.
In the wild
See how this idea shows up as a product and a company — then come back to the lesson. Skills transfer across vendors.
Related lessons
Check your understanding
Page assessment
Answer from memory. Completion is saved from this evidence, not from opening the next page.
All responses are required.