REVIEW BRIEF — phase4-recursive-planning-integration-provider (the scripted provider at the pilot seam, its routing into the recursive arms, and the replay evidence)

REV: 2b269fc47184c67333087ff808c6df8d7744ae96
FINAL: afc5316b5d3b3111704830849efcd2257b3366fe
REVIEW ACCEPTANCE: scripts/check-scope 2b269fc afc5316 docs/research/phase4-recursive-planning-integration-provider-brief.md
SEVERITY SCALE: P0 blocks the step; P1 is serious; P2 is minor.
QUESTIONS TO ATTACK:
1. The implementer's F1 questions the brief: its `OUT OF SCOPE` list blocked the fix, and the `Refusal shape` named only bounds that bind (scope, fan-out), leaving the depth bound unprobed. The report also declares `TRIPPED: PILOT-R2`. Verbatim from the implementer's report:

   F1 | SEVERITY: P1 | ORIGIN: CODE | STATE: carried
   `Controller.node_depth` (and the pilot's `_node_depth_from_state` that delegates to it) walks CHILD_OF in the wrong direction: `propose_decomposition` records `from_node_id=child, to_node_id=parent`, but `_node_depth` filters `to_node_id == current` and treats `from_node_id` as the parent, so it walks down from a node's existing children. At proposal time the proposing parent has no children yet, so the depth read is always 0 and the pilot's `MAX_PROPOSAL_DEPTH` guard and the controller's `maximum_depth` run limit never bind; a depth-unbounded provider would be admitted.
   FIXED: no regression test — the defect is in `src/orchestrator/controller.py` and `src/orchestrator/planning_pilot.py`, which the brief lists as OUT OF SCOPE; the brief's refusal shape was satisfied with a SCOPE refusal (a bound that does bind). Evidence: a direct relation dump showed `node_depth(report-format)=0` for a leaf at depth 2 and `node_depth(root)=1` for the root; the pilot's own tests hand-build relations with the opposite direction (`from_node_id=parent, to_node_id=child`), so `tests/test_planning_pilot.py` cannot see it.

2. The implementer's F2 questions the brief (`ORIGIN: BRIEF`). Verbatim from the implementer's report:

   F2 | SEVERITY: P2 | ORIGIN: BRIEF | STATE: declined
   The No-mutation shape says the children, coverage and dependencies the reducer admits "are exactly the structures the guard returned". Literally this is unsatisfiable: `Controller.propose_decomposition` adds `contract.parent_proposal` (and default budget id/allocation) to the copies it builds for the event, and the brief forbids changing that method. The single consistent reading is "the driver forwards the producer payload without editing it"; the controller's normalization is its own documented admission behaviour applied to its own copies.
   FIXED: n/a — declined, not a defect. The reading is enforced by the No-mutation test, which asserts the producer payload stays pristine after the run (`parent_proposal` absent from the captured guard payload) while the logged child carries exactly that one added field.

3. This METHOD FRICTION entry questions the brief's ACCEPTANCE note. Verbatim from the implementer's report:

   - The acceptance note says a new module under `tests/` breaks the project oracle and that "both the fast suite and the commit hook deselect it". The mechanism is not stated: the new module's tests must be slow-marked so the oracle's internal `scripts/check-tests --fast` (`-m "not slow"`) deselects them. I inferred this from the other trial-running modules; it worked, and the oracle is green. Recorded because the note reads as an unavoidable breakage rather than a convention to follow.

4. PLANNER concern (rule 11), not a copy: the implementer report's `REV` claims `1a4c0a72dd388ca1a2adb3f76b265529035331f8` as the base sha, but `afc5316`'s parent is `2b269fc47184c67333087ff808c6df8d7744ae96`, the implementer brief's commit — the brief's own `REV:` field named `1a4c0a72dd388ca1a2adb3f76b265529035331f8`, so the report appears to copy that field as its base. Measured: `scripts/check-scope 2b269fc afc5316 docs/research/phase4-recursive-planning-integration-provider-brief.md` passes (2 paths), while the same command with the report's claimed REV fails (`scope: docs/record.md is in the diff and not in IN SCOPE`). Attack which artifact is wrong — the brief's `REV:` field, the report's `REV` claim, or both — and record the verdict as a claim not declared against its source if it stands.

5. PLANNER concern (rule 11), not a copy: F2 is `ORIGIN: BRIEF` and `STATE: declined`. Method rule 8 says a defect in a brief is a finding with `ORIGIN: BRIEF`, and a defect you will not fix now is `carried`, never `declined`; method.md assigns a finding's `ORIGIN` to the REVIEWER. Attack the state and the origin of F2, and state in your report what the correct closeout treatment is (the brief text still stands as written).

--- BEGIN BRIEF UNDER REVIEW (copy of docs/research/phase4-recursive-planning-integration-provider-brief.md; the committed file is authoritative) ---
IMPLEMENTER BRIEF — phase4-recursive-planning-integration-provider (Phase 4: the scripted provider at the pilot seam, its routing into the recursive arms, and the replay evidence)

GOAL: `RECURSIVE_LAZY` and `RECURSIVE_CONCURRENT` route every decomposition through
`planning_pilot.propose_decomposition` with a deterministic scripted provider at the
`(state, parent_node_id) -> children` seam; the admitted payload reaches
`Controller.propose_decomposition` unmutated and lands as `DECOMPOSITION_ADMITTED`; every routed
proposal's `record_outcome` instrument and the trial's decomposition provider id are recorded on the
trial where `TrialMetrics.to_dict()` and the metric disclosure read them; `store.replay_fresh`
reproduces the admitted decomposition from the log alone; DIRECT and FIXED_ONE_LEVEL keep their
current observable behavior.

CONTEXT: Owner rulings R1 and R2 (`docs/record.md`) split the integration: this brief is the
scripted provider, the routing, and the replay evidence only — the API shape (a required admission
capability with its two mint points, and renaming the unguarded `Controller.propose_decomposition`)
is a second brief behind it. The scripted provider is a provider at the pilot seam
(`(state, parent_node_id) -> children`) used inside `RECURSIVE_LAZY`/`RECURSIVE_CONCURRENT`, with
the provider id recorded per trial and read by reports; it is not a new arm — no
`docs/glossary.md` Arms entry, `ARM_ORDER`, manifest-matrix, or `docs/tables/limits.yaml` change.
Today nothing calls `planning_pilot.propose_decomposition`: `_process_ready_node` derives children
with `plan_decomposition` and admits them through `Controller.propose_decomposition`; the guard and
the producer (`admit_proposal`, `propose_decomposition`, `record_outcome`) are cleared work (the
pilot spec and its review chain through producer re-review 4) — reuse them unchanged. The fixed
target's obligations nest one level (`report` to `report-format`, `report-emit`), so recursive
trials decompose at parent depths 0 and 1, inside the pilot's `MAX_PROPOSAL_DEPTH`. The wiring
constraint recorded in the residual surface: do not mutate a payload between the guard and event
admission.

INHERITED: none

IN SCOPE: src/orchestrator/trial_driver.py, tests/test_planning_pilot_routing.py

OUT OF SCOPE:
- `Controller.propose_decomposition`'s API shape or semantics: its signature, a required admission
  capability, the capability's two mint points, or renaming the unguarded constructor — R1's second
  brief. Call it; do not change it.
- `src/orchestrator/planning_pilot.py`, `src/orchestrator/decomposition.py`,
  `src/orchestrator/controller.py`, `src/orchestrator/reducer.py`, `src/orchestrator/model.py`,
  `src/orchestrator/derive_obligations.py`, `src/orchestrator/project_oracle.py`. The guard and the
  producer are cleared work. If one of these must change, stop and report `IN SCOPE` as
  insufficient.
- Any `docs/` file except your report: no `docs/event-catalogue.md` change and no new event type. A
  refused proposal is recorded on the trial's instrument, not as a log event; making refusals
  replay-visible in the log is not this brief.
- No new arm: no `docs/glossary.md` Arms entry, `ARM_ORDER`, manifest-matrix, or
  `docs/tables/limits.yaml` change (R2).
- No real model adapter and no new `*Executor`, `*ModelClient`, or provider-registry registration
  (the fixture-fidelity meta-tests): the scripted provider is a plain deterministic callable at the
  seam.
- Do not mutate an admitted payload between the guard and event admission.
- Do not edit existing test modules or registry files; create no `test_bug_*` file.

ACCEPTANCE: Commands (run every one and paste what each prints into `VERIFIED`; expected result is
green, exit 0, for each):

    scripts/check-tests --fast
    pytest tests/test_planning_pilot_routing.py
    pytest tests/test_phase3_project_oracle.py
    scripts/check-static
    scripts/check-docs

`pytest tests/test_phase3_project_oracle.py` is named because a new module under `tests/` breaks the
oracle and both the fast suite and the commit hook deselect it. Never put a full run in
`ACCEPTANCE`; the reviewer runs `scripts/check-tests`.

Named shapes to build — the list of shapes, not the number of tests. One shape needs at least one
test, and every named shape needs one:

- `Routing shape`: for both `RECURSIVE_LAZY` and `RECURSIVE_CONCURRENT`, every decomposition step
  calls `planning_pilot.propose_decomposition` with a provider at the
  `(state, parent_node_id) -> children` seam and admits through `Controller.propose_decomposition`
  into `DECOMPOSITION_ADMITTED`; a guard-refusing probe proves the seam is live — the refusal never
  reaches the log and never falls back to another admission path.
- `Derived-equivalence shape`: the admitted structure for a parent contract equals what
  `plan_decomposition` derives for it — same child node ids, owned scopes, criterion ids and
  coverage, budget allocations, and dependency edges — and DIRECT and FIXED_ONE_LEVEL keep their
  current observable behavior.
- `Refusal shape`: a provider proposal that trips a pilot bound (a child whose scope escapes the
  parent's declared scopes, or a fan-out over the per-node limit) is refused end to end: no
  `DECOMPOSITION_ADMITTED` event, no fallback to the unguarded constructor, the instrument records
  `admitted` false with the refusing stage and `accepted` 0, and the driver records a decomposition
  rejection (`_TrialRecorder.note_decomposition_rejection`) and propagates the admission failure as
  a rejection does today.
- `No-mutation shape`: the children, criterion coverage, and dependencies the reducer admits in
  `DECOMPOSITION_ADMITTED` are exactly the structures the guard returned — nothing edits an
  admitted payload between guard and event admission (supply dependency edges via
  `propose_decomposition`'s `dependencies` argument, not by carving them out of children
  afterwards).
- `Provider-id shape`: every trial records its `decomposition_provider_id` in `TrialMetrics` —
  `SCRIPTED` for routed recursive-arm trials, `DERIVED` for FIXED_ONE_LEVEL's un-routed
  deterministic derivation, `NONE` for DIRECT — exposed by `to_dict()` and named in the `routing`
  entry of `METRIC_GROUPS`.
- `Instrument shape`: every routed proposal, admitted or refused, leaves its `record_outcome` record
  on the trial in proposal order; an admitted proposal's record has `admitted` true,
  `refusing_stage` null, and `accepted` equal to the children in the admitted event; a refused one
  names its refusing stage and counts the provider's proposed children.
- `Replay shape`: after a routed run, `store.replay_fresh(run_id)` reproduces the admitted
  decomposition from the log alone — same child node ids, owned scopes, `DEPENDS_ON` edges, and
  coverage entries as the live state — and the instrument's counts for admitted proposals agree
  with the structure the log actually carries.

REV: 1a4c0a72dd388ca1a2adb3f76b265529035331f8
CLOSE OUT: yes
DIVERGENCES: none

You implement one brief. You do not plan, re-scope, or decide what the work is. Read every file
in IN SCOPE before editing it; if what you find contradicts the brief, report that instead of
guessing. Modify only what IN SCOPE names. Stop and report rather than improvise when IN SCOPE is
insufficient, the brief contradicts the code, you have already failed twice at this goal, or the
requirement is ambiguous and no single reading is consistent with the rest of the brief. If exactly
one reading is consistent, take it and file a FINDING with ORIGIN: BRIEF that names the reading you
took. No new dependencies, no tooling configuration, no reformatting. Run every ACCEPTANCE command;
fix what is in scope and report what is not.

A defect in the brief is a FINDING, never METHOD FRICTION. METHOD FRICTION is only for the method and
its templates: any place you deviated from them, found them ambiguous, or found them silent. Report
friction you worked around — that is the section the method learns from.

Commit your own work. When ACCEPTANCE passes, commit the files you changed, and only those, in one
commit whose message ends with the trailer `Actor: IMPLEMENTER`. That commit's full sha is FINAL.
Then append docs/templates/report.txt verbatim, fill it in, write it to
docs/research/<phase>-<subject>-implementer.md, and commit it in a second commit with the same
trailer. Do not amend the first commit to add the report: FINAL must not change after the report
names it. If you cannot commit, stop and say so; do not leave work uncommitted for someone else to
commit.

# report.txt

REPORT — <phase>-<subject>-<role>
STEP: <implementer brief subject>
REV: <base sha>   FINAL: <implementer: sha of your work commit, never the commit that holds this report;
  reviewer: the sha under review, copied from the review brief>
CHANGED: <files, one line each>
VERIFIED: <command, duration, counts>
NOT VERIFIED: <why, or none>
FINDINGS: none | one block each:
  ID | SEVERITY: P0|P1|P2 | ORIGIN: BRIEF|CODE|DOCUMENT | STATE: fixed|declined|carried
  <root cause, one line>
  FIXED: <node id, command, and the named failing assertion at REV — or "no regression test">
         An error or a collection failure is not red. The assertion has to be the thing that
         failed; a run that merely crashed proves nothing.
  STATE means: fixed (above); declined = not a defect, with the reason; carried = a real defect
  left unfixed, passed on in INHERITED. A defect you will not fix now is carried, never declined.
SHAPES: <shapes probed that the suite does not build, or none with a reason>
TRIPPED: <residual ids, or none>
PROPOSED ROWS: <ledger rows, or none>
METHOD FRICTION: none | <where you deviated from the method or its templates, misread them, or
  found them silent. A defect in the brief is a FINDING, not friction.>
INHERITED:
<<every INHERITED item you received that is still open, copied verbatim; then each
  finding you marked carried, with its ID>>
Rule 2 governs the planner's copy of this block. What goes in it is yours: an implementer or
reviewer who received an obligation, finding, entry or trigger carries it forward verbatim, and
adds anything new that is still open. A block reading `none` is correct only when nothing came in
and nothing is open.

--- when CLOSE OUT is yes, the PLANNER appends this to the step's LAST report only, copying and
    adding no judgement: ---
CLOSEOUT
DECLINED: none | <finding + reason>
DIVERGENCES CLOSED: <state, with the rev or commit, per rule 5>
--- END BRIEF UNDER REVIEW ---

You did not write this code and you will not fix it; a finding is output, not an action. The
commits under review carry the trailer `Actor: IMPLEMENTER`; if your session wrote any of them, stop
and say so. Run REVIEW ACCEPTANCE first: it is the only automated check in the method. The
ACCEPTANCE lines inside the brief under review are the implementer's; re-run them to verify the
delivery and record the results in VERIFIED. The embedded brief is a convenience copy: if the
standalone file it names differs, file a FINDING with ORIGIN: BRIEF and review against the committed
file.

You may create new test files to prove a finding, and modify nothing else. If a failing test would
need registering in tests/open_defects.yaml, say so in the report and leave the registration to the
next implementer brief rather than editing that file. Read pre-images with git show <rev>:..., not
the implementation's account of them. Run every mutant on a scratch copy of the tree, and diff each
mutant against git show <rev>:... before trusting its result. Attempt to falsify the brief, not only
the code: a finding that the brief was wrong is a finding, and so is a defect the implementer filed
only as friction. Answer every item under QUESTIONS TO ATTACK. Enumerate the shapes you probed that
the existing suite does not build, as a list; zero with a stated reason is legitimate. Report each
guarantee as falsified-with-reproducer or attacked-and-not-falsified with the method.

Commit your own work: your new test files and your report, together, in one commit whose message
ends with the trailer `Actor: REVIEWER`. Append docs/templates/report.txt verbatim, fill it in, and
write it to docs/research/<phase>-<subject>-review.md. If you cannot commit, stop and say so.

# report.txt

REPORT — <phase>-<subject>-<role>
STEP: <implementer brief subject>
REV: <base sha>   FINAL: <implementer: sha of your work commit, never the commit that holds this report;
  reviewer: the sha under review, copied from the review brief>
CHANGED: <files, one line each>
VERIFIED: <command, duration, counts>
NOT VERIFIED: <why, or none>
FINDINGS: none | one block each:
  ID | SEVERITY: P0|P1|P2 | ORIGIN: BRIEF|CODE|DOCUMENT | STATE: fixed|declined|carried
  <root cause, one line>
  FIXED: <node id, command, and the named failing assertion at REV — or "no regression test">
         An error or a collection failure is not red. The assertion has to be the thing that
         failed; a run that merely crashed proves nothing.
  STATE means: fixed (above); declined = not a defect, with the reason; carried = a real defect
  left unfixed, passed on in INHERITED. A defect you will not fix now is carried, never declined.
SHAPES: <shapes probed that the suite does not build, or none with a reason>
TRIPPED: <residual ids, or none>
PROPOSED ROWS: <ledger rows, or none>
METHOD FRICTION: none | <where you deviated from the method or its templates, misread them, or
  found them silent. A defect in the brief is a FINDING, not friction.>
INHERITED:
<<every INHERITED item you received that is still open, copied verbatim; then each
  finding you marked carried, with its ID>>
Rule 2 governs the planner's copy of this block. What goes in it is yours: an implementer or
reviewer who received an obligation, finding, entry or trigger carries it forward verbatim, and
adds anything new that is still open. A block reading `none` is correct only when nothing came in
and nothing is open.

--- when CLOSE OUT is yes, the PLANNER appends this to the step's LAST report only, copying and
    adding no judgement: ---
CLOSEOUT
DECLINED: none | <finding + reason>
DIVERGENCES CLOSED: <state, with the rev or commit, per rule 5>
