47. Reproducible debugging (pocket version)

TL;DR (5 lines)

  • Debugging begins with reduction.
  • A stable failing scenario is better than a huge noisy one.
  • The contract matters more than the symptom wording.
  • Reproducibility is a technical asset.
  • Fixes should be explained against the reduced case.

Concrete Problem

Debugging chapters often list tools without showing how a failure becomes reproducible and explainable.

Coherent example

space demo/debug

proc normalize_port(raw: int) -> int {
  if raw < 0 { give 0 }
  if raw > 65535 { give 65535 }
  give raw
}

Global explanation

Debugging should be taught as reduction and evidence. The useful move is to isolate a contract, reproduce the failure with the smallest still-meaningful case, and keep the path stable while you inspect it.

Short exercise

Reduce the invalid example to the smallest still-failing shape and write the contract it breaks.

Next best action

Keep the example small, reproduce it locally, then continue to the full chapter if you need the broader context.