Trace invalid data back to its origin
Walk backward from a failing effect through callers and values to identify where the bad input originated.
These examples and illustrative results are independently authored teaching materials, not measured model results.
Use case
A workspace operation runs in the wrong directory. Teaching exec receives an empty projectDir, possibly read from tempDir before initialization. The downstream symptom does not justify swallowing command errors.
Mechanism
Observe actual arguments/cwd/time and identify the immediate caller. Record value propagation/transformation backward to the first invalid initialization or decision; inspect lifecycle/default-path semantics. Validate a source hypothesis with minimized reproduction or static evidence. Fix the origin and recheck symptoms/path gates, keeping mutation reproductions in isolated temporary directories.
Bad example
Catch and ignore git initialization failure without reading projectDir, or guess permissions are responsible.
Good example
Record empty projectDir, cwd and callers, tracing the teaching read before beforeEach initializes tempDir. Verify timing and runtime interpretation of empty cwd, then create only after initialization. Check the original symptom and expected target in an isolated directory.
Why the change matters
Bad values can cross boundaries before producing visible failure. Backward tracing targets the first wrong decision rather than layered patches, with timing checks addressing lifecycle origins.
Observable expectation
Teaching trace is empty tempDir→Project.create→Session→exec, becoming an allowed temporary path after initialization. After reordering, confirm the command targets it. Without execution, report code inference rather than invented output or certain root cause.
Limits
Empty cwd semantics vary by API/platform. Async/dynamic dispatch and multiple origins require identity checks. Defensive validation limits effects but does not alone prove origin or nonrecurrence.