Module 10 Activity
Scenario
Something in your workflow produces a wrong answer without raising. This module is how you find it in minutes rather than an afternoon.
What you build
A debugging pass using state history and a trace record, ending in a logging schema you would want during an incident.
Steps
- Plant a bug in a middle node that produces a wrong value without raising. Have a colleague run it if you can.
- Find it using
get_state_historyalone, reading forwards for the first wrong value. Record how long it took. - Take a trace of a run and read it backwards from the symptom, marking which steps are correct given their input.
- Reproduce a failure by replaying the recorded inputs on a fresh thread. Report whether it reproduced, and what that tells you.
- Recover a failed run by editing state and resuming, and count how many times the expensive node ran versus a restart.
- Write your trace schema, including
state_before,state_afterandroute_reason.
Evidence to hand in
- The planted bug and how it was found, with the time taken.
- The backwards trace reading with each step marked.
- The replay result and what it establishes.
- The recovery, with the expensive-node call count against a restart.
- The trace schema.
Review checklist
- The bug was found from state history, not print statements.
- The backwards reading identifies the first wrong value, not the slowest step.
- The replay changed nothing except the thread id.
- Recovery ran the expensive node fewer times than a restart would have.
- The schema includes
route_reasonand covers successful runs, not only failures.
