Guided Labs
Download the offline refactoring kit. Extract it and run in its directory with Python 3.10+ and the standard library.
python check.py --module baseline
python check.py --module starter
python check.py --module step_01
python check.py --module reference
python run_labs.py --module starter
All four supplied implementations should pass. The starter is deliberately working legacy-style code. Refactor it in small steps; keep baseline.py and the public contracts frozen. First write your own characterization cases before reading the checker or reference. Passing an untouched starter does not complete the labs.
| Lab | Work | Acceptance evidence |
|---|---|---|
| L1 | Extract invoice arithmetic and preserve the clock seam | Per-line exact rounding; deadline boundary; header, iterator, clock and sink failure traces |
| L2 | Consolidate conditional checks | Lazy evaluation, original order, truthy values and exception propagation |
| L3 | Split order parsing and pricing | Lookup-before-conversion, preserved negative quantities and old failure precedence |
| L4 | Migrate Grid APIs | Shared state across mixed old/new operations, overwrites, invalid inputs and independent instances |
| L5 | Refactor provider selection | Exactly one selected invocation, preserved uncertain outcome and no fallback duplication |
Budget 20–30 hours. Use the behavior contracts and included README. Save actual diffs and check output at each coherent step. step_01.py shows one extraction checkpoint, not a complete historical commit sequence. Evaluate one deliberate fault per lab and explain which observation rejects it.
These are offline teaching models. A passing grid or provider test does not certify a database cutover or production messaging system. Design and process require review.