REPORT — phase5-run-entry-fixes-5-review
STEP: phase5-run-entry-fixes-5 (Phase 5: the loader face — F34 and the F33 clause restate)
REV: 8adc6c544277e002e7c555df395582043920f098   FINAL: 8af58e8f86359e33dafbae74d2ceee94da0e7cfe
CHANGED: tests/test_phase5_run_entry_fixes_5_review.py — two review probes (F36 red at FINAL, F37 green at FINAL); this report.
VERIFIED: scripts/check-scope 8adc6c544277e002e7c555df395582043920f098 8af58e8f86359e33dafbae74d2ceee94da0e7cfe docs/research/phase5-run-entry-fixes-5-brief.md — tripped: none; scope: ok (2 path(s)), exit 0
VERIFIED: scripts/check-tests — 1 failed (tests/test_phase5_run_entry_fixes_5_review.py::test_review_f36_deeply_nested_spec_refused_as_a_named_run_spec_error, the review's own red probe), 1059 passed, 570.86s, exit 1. The one failure is the review's F36 probe; every pre-existing node is green.
VERIFIED: scripts/check-tests --fast — 961 passed, 99 deselected, 95.51s, exit 0. 99 = 97 pre-existing slow nodes + 2 new slow nodes in the review probe module (this step adds 2 cases).
VERIFIED: .venv/bin/python -m pytest tests/test_phase5_run_entry_fixes_4_review.py tests/test_run_entry.py tests/test_phase5_run_entry_fixes_2_review.py — 52 passed, 20.45s, exit 0. 52 = 5 + 40 + 7 (fixes_4_review: 5 test functions; run_entry: 25 test functions + 15 parametrised instances = 40 collected; fixes_2_review: 7 test functions).
VERIFIED: scripts/check-static — exit 0 (104 advisory lint rows, 5 B904, unchanged from REV; the delivered `raise … from error` introduces no new B904).
VERIFIED: scripts/check-docs — table verification passed, links 361/361 OK, 0 errors, exit 0 (at HEAD 15d2600; at FINAL 8af58e8 the count is 359/359; at the report tree ad9fe4b the count is 359/359; at REV 8adc6c5 the count is 358/358 — the growth is the brief commit 83444b4's `docs/research/` file).
VERIFIED: Red evidence at REV 8adc6c5 (diff-verified scratch against `git show 8adc6c5:tests/test_phase5_run_entry_fixes_4_review.py`) — `.venv/bin/python -m pytest tests/test_phase5_run_entry_fixes_4_review.py -k f34 -q` → 1 failed, 4 deselected, 0.14s. Named failing assertion: the probe's `pytest.fail` translation at tests/test_phase5_run_entry_fixes_4_review.py:313 — `Failed: F34: an unparseable spec file is refused as ParserError, not the documented named \`RunSpecError\`: ParserError('while parsing a flow sequence', …, "expected ',' or ']', but got '<stream end>'", …)`. The fail shape is named, message-full, the translation of the uncaught class, not a crash or collect error (the fixes-4 review's answer 3d conditions hold). Green at FINAL in the 52-passed battery above.
VERIFIED: Malformed-class corpus at FINAL (`.venv/bin/python`, `load_run_spec` on written tmp files) — unparseable YAML → `RunSpecError` (cause=`ParserError`); tab-scanned indent → `RunSpecError` (cause=`ScannerError`); NUL byte → `RunSpecError` (cause=`ReaderError`); invalid UTF-8 → `RunSpecError` (cause=`UnicodeDecodeError`); truncated multi-byte → `RunSpecError` (cause=`UnicodeDecodeError`); empty file → `RunSpecError` (cause=None, `validate_run_spec`); wrong top-level type → `RunSpecError` (cause=None); missing keys → `RunSpecError` (cause=None); alias-cyclic (`a: &a\n  b: *a\n`) → `RunSpecError` (cause=None, `validate_run_spec` rejects the shape — no RecursionError); billion-laughs alias bomb → `RunSpecError` (cause=None); cyclic root alias → `RunSpecError` (cause=None); truncated UTF-8 tail → `RunSpecError` (cause=`UnicodeDecodeError`); UTF-16 BOM → `RunSpecError` (cause=`UnicodeDecodeError`); directory → `RunSpecError` (cause=`IsADirectoryError`); symlink loop → `RunSpecError` (cause=`OSError`); missing path → `RunSpecError` (cause=`FileNotFoundError`). One class escapes raw: deeply-nested flow sequences (2000+ nested `[`) → `RecursionError` (F36). `__cause__` chain is the decode error (not `None`) for every decode-refusal face; message names the path.
VERIFIED: CLI head at FINAL (`python3 scripts/orchestrate.py start --spec … --workdir … --store …`) — unparseable YAML: exit 1, `RunSpecError` traceback on stderr (cause chain shows `ParserError`), no JSON document, store file ABSENT. Invalid UTF-8: exit 1, `RunSpecError` traceback, store file ABSENT. Deeply-nested: exit 1, raw `RecursionError` traceback, store file ABSENT. `inspect` against a refused-load run id: exit 0, clean JSON with null fields, no traceback. `stop` against a refused-load run id: exit 1, `RunSpecError` traceback ("run … has no root node to cancel"), no traceback from any other class. All three documented heads run as written (`python3 scripts/orchestrate.py …` forms).
VERIFIED: Diff `git diff 8adc6c5 8af58e8 -- src/orchestrator/run_entry.py` — exactly two lines added (the decoder except clause at src/orchestrator/run_entry.py:272-273); the `OSError` refusal message strings, the `from error`, and `validate_run_spec` are byte-for-byte unchanged. `git diff 8adc6c5 8af58e8 -- src/orchestrator/reducer.py tests/` — empty (F33 surface untouched).
VERIFIED: Mutants (scratch copies diff-verified against `git show 8adc6c5:…` before use) — (a) revert except to `OSError`-only: absorbed probe goes red at tests/test_phase5_run_entry_fixes_4_review.py:313 with the named message (the probe is the pre-image's red). (b) Drop `UnicodeDecodeError` from the tuple: absorbed probe stays green (it drives the `ParserError` face only); the three-module battery stays green (52 passed); the `UnicodeDecodeError` face hand-probe shows raw `UnicodeDecodeError` escapes — the unpinned face, now pinned by tests/test_phase5_run_entry_fixes_5_review.py::test_review_f37_invalid_utf8_spec_refused_as_a_named_run_spec_error. (c) `_retained_artefact_admission` to always-raise: the residual pin and the race-log replay both go red (the residual pin's `late_event_retained` assertion fails; `test_stale_admission_race_log_replays` fails at line 1211 with `F29: the durable race log did not replay: ReducerError(...)`). (d) `_retained_artefact_admission` to always-retain: the residual pin and the unknown-id assertion stay green, but `test_review_f33_owner_payload_branch_is_admission_inaccessible` goes red at line 207 (the live-attempt face is pinned there). The residual probe is a property pin (asserts `late_event_retained` and the boundary `artefact_id not in new_state.artefacts`), not a restatement.
VERIFIED: Two named F33 pins at FINAL — `tests/test_phase5_run_entry_fixes_4_review.py::test_review_f33_residual_crafted_terminal_owned_artefact_retained` and `tests/test_run_entry.py::test_stale_admission_race_log_replays` — both green unchanged in the 52-passed battery.
VERIFIED: `test_clean_env_cli_shape` — 1 passed (the documented `python3` form runs from a clean env).
VERIFIED: Held sets of the whole run-entry stream (load and refusal shapes, settle-claim interleave pins, import matrix, `test_clean_env_cli_shape`'s documented forms, F21 drift pin, absorbed F27/F28/F30 pins, cancel-race and stale-admission pins) — all green in the 1059-passed full run (every pre-existing node).
VERIFIED: Question 1(b) — F35's close form is honest on the same ground as F33 (the fixes-4 review's answer 1d; record.md's lesson "the close form follows where the text lives"): the fix-order words ("the YAML decode errors") were imprecise but unambiguous against the GOAL's controlling sentence ("the sentence holds as written with nothing to reword" — which requires catching every decoder failure). The GOAL's text is correct as written; no later brief's text correction is owed. The fix-order words are subordinate to the GOAL and live in the same brief; the GOAL's sentence is the text whose correction rule 8 would govern, and it needs none.
VERIFIED: Question 1(c) — the reading was forced. The literal `yaml.YAMLError`-only reading leaves `UnicodeDecodeError` escaping raw, falsifying the GOAL's sentence one class over. No other reading is consistent with the GOAL and `OUT OF SCOPE` (which forbids rewording the doc sentences and forbids changing `validate_run_spec`). The delivered except order (`OSError` first, then the decoder tuple) does not matter for a failure that could match both: `UnicodeDecodeError` is a subclass of `ValueError`, not `OSError`, so the three caught classes are disjoint.
VERIFIED: Question 6 — the five operator classes as subprocesses against a real frozen repository (accept, failing-command refusal, wall-clock timeout, mid-run cancel, the injected-`ProtocolViolation` class) are each a settled terminal outcome with the documented JSON and exit codes and document == durable fresh outcome: attacked-and-not-falsified via `tests/test_run_entry.py::test_start_shape_authorises_acceptance`, `test_settled_start_shape_relative_workdir`, `test_settled_start_shape_wall_clock_overrun`, `test_cancelled_launcher_shape`/`test_cancel_race_class_shape`, and `test_protocol_violation_refusal_shape` (all green in the 1059-passed full run). Every documented head runs as written (`python3 scripts/orchestrate.py …` forms): attacked-and-not-falsified via `test_clean_env_cli_shape` and `test_review_f28_documented_commands_are_python3_and_run_as_written`. The loader's refusal face at every malformed class: attacked-and-not-falsified for 18 of 19 classes (the corpus above); falsified-with-reproducer for the deep-nesting class (F36). The three documented faces hold as written for every class the delivered except clause covers; F36 falsifies the `RunSpecError` docstring's "one named failure" face for the deep-nesting class. The clause restate's boundary is measurable at the seam (`_retained_artefact_admission` sees `state` + `event` only) and does not inherit F33's unmeasurability: attacked-and-not-falsified via the residual pin, the unknown-id assertion, the live-attempt face, and the four mutants above.
NOT VERIFIED: none — every claim is covered by a run named above.
FINDINGS:
  F36 | SEVERITY: P2 | ORIGIN: CODE | STATE: carried
  A spec file whose YAML is deeply nested (2000+ nested flow sequences) raises `RecursionError` inside `yaml.safe_load`, which escapes `load_run_spec` raw — the delivered except catches `(yaml.YAMLError, UnicodeDecodeError)` but not `RecursionError`. The `RunSpecError` docstring's "the operator sees one named failure, never a run-time surprise" is falsified for this class (the operator sees a raw `RecursionError` traceback, not a named refusal). Whether `RecursionError` is inside `docs/run-entry.md`'s quiet word "loader-refusable" is a judgment call; the delivered clause's boundary falls at "YAML decode errors + file-decode errors", not at "loader-refusable", so one sentence needs a narrowing the fix did not make (a document amended is an OWNER commit). Pre-existing since the run entry point's own origin (dae836f), not a regression of this step. The alias-cyclic class does NOT escape (`yaml` composes the cyclic alias and `validate_run_spec` rejects the shape); the deep-nesting class does.
  FIXED: tests/test_phase5_run_entry_fixes_5_review.py::test_review_f36_deeply_nested_spec_refused_as_a_named_run_spec_error — at FINAL the named assertion fails at tests/test_phase5_run_entry_fixes_5_review.py:31: `Failed: F36: a deeply-nested spec file is refused as RecursionError, not the documented named \`RunSpecError\`: RecursionError('maximum recursion depth exceeded')` (`.venv/bin/python -m pytest tests/test_phase5_run_entry_fixes_5_review.py -v`, 1 failed). The test needs registering in `tests/open_defects.yaml` — registration left to the next implementer brief.
  F37 | SEVERITY: P2 | ORIGIN: CODE | STATE: fixed
  The `UnicodeDecodeError` face of the Loader-decode refusal shape had no committed pin: the absorbed probe drives the `ParserError` face only, and the drop-`UnicodeDecodeError` mutant leaves the committed suite green (52 passed) while the face escapes raw. The brief's `SHAPES` rule named the face as unbuilt, but the face is inside the documented sentence's claim and needs a pin.
  FIXED: tests/test_phase5_run_entry_fixes_5_review.py::test_review_f37_invalid_utf8_spec_refused_as_a_named_run_spec_error — no regression test (the face was working at REV and at FINAL; the pin asserts the `UnicodeDecodeError` face is refused as a named `RunSpecError` and goes red under the drop-`UnicodeDecodeError` mutant). Green at FINAL in the 2-collected probe run.
SHAPES: the `RecursionError` (deeply-nested YAML) face of the Loader-decode refusal shape — probed at FINAL as a raw `RecursionError` escape, now pinned by the F36 red probe (which is itself red at FINAL and needs `tests/open_defects.yaml` registration). The `UnicodeDecodeError` face — now pinned by the F37 probe (green at FINAL). The `OSError` face — unchanged behaviour, kept as-is, no new pin owed; hand-probed at FINAL (missing path, directory, symlink loop → `RunSpecError("cannot read run-spec …")`). The Clause-restate shape is not a probe I built: its two faces are the already-committed pins `tests/test_phase5_run_entry_fixes_4_review.py::test_review_f33_residual_crafted_terminal_owned_artefact_retained` (crafted `{terminal_attempt}-artefact` id retained) and `tests/test_run_entry.py::test_stale_admission_race_log_replays`'s unknown-id assertion (an id no terminal attempt owns still raises `ReducerError`), both green unchanged; the live-attempt refusal face is pinned by `tests/test_phase5_run_entry_fixes_4_review.py::test_review_f33_owner_payload_branch_is_admission_inaccessible` (the always-retain mutant goes red there).
TRIPPED: none
PROPOSED ROWS: none
METHOD FRICTION: The review brief requires "Answer every item under QUESTIONS TO ATTACK" while report.txt requires "every field is filled and nothing outside it is added". The answers that are findings live in FINDINGS; the answers that are adjudications or verification narratives are recorded in VERIFIED and SHAPES above. No template field is added; no content outside the form is required to answer the brief. No other departure.
INHERITED:
none — the received INHERITED (the brief's two copied blocks and the moved F34 entry) carried exactly one open item, F34. It is fixed by the step under review (the implementer's FINDINGS, F34). F35 is disposed by the step under review. Two new findings are filed by this review: F36 (carried, above) and F37 (fixed, above). Nothing else 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
DIVERGENCES CLOSED: none
