Skip to main content

Behavior Preservation Lab

Attempt these tasks before opening feedback. Preserve initial predictions, diffs, commands, actual results and assistance. Reuse valid lab evidence; extra lesson drills are repair or optional depth.

P01: Freeze the boundary​

For invoice, list return values, ordered effects and failures. Explain which observations a helper extraction may change and which it must preserve.

P02: Characterize rounding​

Predict totals for two rows (1,335) at times 9,10,11 with deadline 10. Explain why whole-cent fixtures are insufficient.

P03: Preserve a failure trace​

Use an iterator that yields one valid row then raises. Record output and whether the clock was called.

P04: Specify a clock seam​

Compare injecting a clock callable with reading a timestamp before calling invoice. Describe a case that distinguishes them.

P05: Challenge the oracle​

Seed a deadline-equality fault and identify the failing public observation. Explain why old/new agreement alone cannot establish desirable behavior.

Use the behavior contracts and offline labs. For a named gap, consult the Refactoring book index and module reading guide.