<!-- informative -->

# Re-review 4 (closure): Bounded Recursive-Planning Pilot — the Model Producer at `dd34bca`

Final verification pass, of `dd34bca` ("Close the producer re-review-3 residual R7")
against R7 in the
[third producer re-review](phase4-recursive-planning-pilot-producer-re-review-3.md),
plus the self-reported `continue` gap. Reviewed revision
`dd34bca6b880049c412a3d7ce36b9d689a8dadb0` in a detached worktree at
`/tmp/kilo/pilot-fix4`. No source edits.

## Verdict

**R7 is closed, the self-reported `continue` gap is closed, and I found no new
residual of the keying class.** The payload the guard admits is one the authority can
apply, for every field the handler keys that I could reach. The producer is
correctness-clean through this review chain; the only outstanding item is
integration, not producer logic.

Baseline reproduced on `dd34bca`: `scripts/check-tests --fast` **896 passed, 30
deselected**; full `pytest -q` **926 passed**; `scripts/check-docs` **258 links OK**;
`scripts/check-static` rc 0.

## R7 — closed

`_check_budget_id_availability` requires each child's `budget_id` to be unused in
`state.ledger.budgets` and unique within the proposal, checked after the per-child
shape checks so the key exists. Verified at `GUARD`: a child reusing the parent's
`budget_id`; two siblings sharing one; `budget_id` colliding with any registered
budget. A pair with unique ids is admitted and passes `validate_decomposition`.

## The self-reported `continue` gap — closed and verified

The `_check_child_contract` call no longer sits behind a `continue`; the contract is
checked for every child. Verified with a child declaring **no** `criterion_ids`:

| child without `criterion_ids` | result |
| --- | --- |
| valid contract | guard admits; reducer refuses empty coverage (correct division of labour) |
| contract missing / `contract=7` | refused `GUARD` |
| `budget_id` missing/empty | refused `GUARD` |
| `acceptance_criteria=[]` | refused `GUARD` |
| `budget_id` collides | refused `GUARD` |

This is the same door the review's own probes never opened, and the fix is a real
broadening, not a re-test of the same shapes.

## Keyed-field sweep — no new residual

I re-ran the thirteen no-record classes and the F1 reproducer: unchanged. I then
walked every value `_on_decomposition_admitted`, `_apply_node_event`, and
`validate_decomposition` use as a dict key or uniqueness token:

- `node_id` — non-empty string, and uniqueness against existing nodes is a graceful
  `DecompositionError` in the validator.
- criterion ids — non-empty strings; unknown-criterion references are a graceful
  `DecompositionError`.
- `contract.budget_id` — non-empty string, now also unused/unique (R7).
- `acceptance_criteria` entry ids — non-empty strings; not keyed by the handler.
- dependency endpoints — non-empty strings; membership is a graceful
  `DecompositionError`.
- `budget_allocation` — `check_budget_authority` refuses non-mapping, non-numeric,
  unknown-dimension, negative, `nan`, and `inf` values at `BUDGET`. An empty
  allocation passes the guard and is then refused by the reducer with a
  `DecompositionError` — a graceful refusal, not a crash, and consistent with the
  reducer being the authority.

I could not construct a payload that the guard admits and on which the reducer
raises a non-`DecompositionError` through any of these fields.

## Standing risk

The commit records the generalization in the spec — *well-formed is not the same as
usable* — and the meta-lesson the review chain demonstrated three times: a check
tested through one constructed shape says nothing about the shapes the test did not
build. Every residual in this chain (F2's thirteen classes, R1's unhashable
identifiers, R5's `budget_id`, R7's uniqueness, and the `continue` gap) was found by
probing a shape the green suite never built. The gate helps only where a shape is
already known; the standing control is adversarial shape enumeration at the
boundary, not test count.

## Outstanding

Unchanged and outside producer logic: nothing calls `propose_decomposition`, and the
concern-2 ruling requires a scripted provider arm plus making the model path
structurally unable to reach the unguarded `Controller.propose_decomposition` before
wiring is safe.

## Reproduce

```
git worktree add --detach /tmp/kilo/pilot-fix4 dd34bca
ln -s <repo>/.venv /tmp/kilo/pilot-fix4/.venv
cd /tmp/kilo/pilot-fix4
PYTHONPATH=src <repo>/.venv/bin/python /tmp/kilo/probe_a3.py
PYTHONPATH=src <repo>/.venv/bin/python /tmp/kilo/probe_provider_state.py
# R7 / continue-gap / allocation sweep inline probes as above
./scripts/check-tests --fast && ./scripts/check-docs && ./scripts/check-static
```

## Implementer's acknowledgement (2026-10-01)

Closure accepted. Nothing further to fix in the producer; `dd34bca` is the state
the chain cleared. **926 passed**; `check`, `check-static` and `check-docs` rc 0.

The keyed-field sweep is the part worth keeping. The review did not re-run the
thirteen classes and the F1 reproducer and stop there — it walked every value the
handler, the node applier, and the validator use as a dict key or uniqueness token,
and for each one recorded what happens when it is malformed: refused at the guard,
or refused by the authority as a graceful `DecompositionError`. "I could not construct
a payload that the guard admits and on which the reducer raises a
non-`DecompositionError`" is a stronger statement than any single finding in this
chain, because it is a claim about a *sweep* rather than about a probe.

Two things I am taking from the standing-risk section rather than filing it:

**The meta-lesson is now measured, not asserted.** Every residual in this chain —
F2's thirteen classes, R1's unhashable identifiers, R5's `budget_id`, R7's
uniqueness, and the `continue` gap I reported myself — was found by probing a shape
the green suite never built. Not one was found by a failing test I wrote. The
review's formulation is the accurate one: the style gate helps only where a shape is
already known, so the standing control is adversarial shape enumeration at the
boundary, not test count. That is a better description of how this work actually
fails than "write more tests".

**The `continue` gap is the clearest instance.** The R5 fix was verified by two
reviews and was still narrower than it looked, because it sat behind a branch and
the tests happened to take the other one. The re-review confirms the broadening
rather than re-testing the same shapes, and noticed that this was the one door its
own probes had never opened. If the chain had stopped at "R5 verified", a
criterion-less child would still have reached the ledger with an unvalidated
`budget_id`.

Integration remains open and is not producer logic: the scripted provider arm, and
making the model-output path structurally unable to reach the unguarded
`Controller.propose_decomposition`. `docs/self-host.md` now records Phase 4 as done
except integration, with both requirements named.
