# Build 3 — Investigate before changing code

Run `python demo.py debug --broken`. Read the last traceback line, then the
closest frame you own in `examples/buggy.py`: an all-missing review list yields
an empty supplied list, so division has no denominator. This is a worked
diagnosis, not your independent observation. There is no async scheduler here.

Use the following investigation on a changed failing fixture:

1. Write the exact input and expected contract, not just "it crashes".
2. State three falsifiable hypotheses. Example: wrong provider status, wrong
   rating type, or no authored denominator. For each, name one observation that
   would contradict it. Do not change all three areas at once.
3. Inspect the declared fake response to disprove a schema hypothesis. Inspect
   the supplied reviews to disprove a type hypothesis. Reduce to one job with
   no authored rating; retain the smallest failing input and traceback locally.
4. Repair only the cause. Missing must remain missing; converting None to zero
   or returning a constant mean creates a different bug.
5. Add a regression plus a changed-input check with some supplied ratings. Check
   typed counts, controlled stages, original cause and no success-shaped fallback.

| Hypothesis in your own words | Disproving observation | Actual result | Retained / rejected |
| --- | --- | --- | --- |
| | | | |
| | | | |
| | | | |

Record your repair, actual failing test before it, passing test after it and
changed-input result. Explain why catching `Exception` and returning zero would
erase useful failure evidence. Contextual wrapping may catch a provider exception
to raise `PipelineFailure` **from the original cause**; it must not swallow it.
Validation catches its expected ValueError. A logger fault is itself visible.

Transfer: introduce an invalid rating `True` for a different invented job. Why
is it refused even though Python compares True equal to 1? Show the review-stage
failure event and locally inspect the chained ValueError. Then repair only the
fixture value and rerun. Do not turn this into an automatic creative-quality
verdict. Never paste private raw exception data, credentials, prompts or client
assets into a public issue or the tutor; the fixture logs are controlled, but a
full traceback can still contain original provider text.
