REPORT — phase5-run-entry-fixes-8-review
STEP: phase5-run-entry-fixes-8 (Phase 5: kernel_id refused at load — FRK-1; FFR-1–FFR-3 close by text)
REV: b68be80aa9762eb964bd27190331617e404014ae   FINAL: ca9a25a82aa562692ff4302275970fc52658c43c
CHANGED: docs/research/phase5-run-entry-fixes-8-review.md — this report (no new test file: the one finding is ORIGIN: BRIEF and has no regression test).
VERIFIED: scripts/check-scope b68be80aa9762eb964bd27190331617e404014ae ca9a25a82aa562692ff4302275970fc52658c43c docs/research/phase5-run-entry-fixes-8-brief.md — exit 0, run first as REVIEW ACCEPTANCE. Prints `claimed: src/orchestrator/run_entry.py tests/test_run_entry_kernel_id_refusal.py` (exactly the two intended paths), `tripped: none`, `scope: ok (3 path(s) in b68be80aa9762eb964bd27190331617e404014ae..ca9a25a82aa562692ff4302275970fc52658c43c)`.
VERIFIED: .venv/bin/python -m pytest tests/test_run_entry_kernel_id_refusal.py tests/test_run_entry_loader_envelope.py tests/test_phase5_run_entry_fixes_6_review.py — 7 passed in 6.02s, exit 0 (2 new + 2 envelope + 3 probes). Re-run of the implementer's line at FINAL, no test edit.
VERIFIED: .venv/bin/python -m pytest tests/test_phase5_run_entry_fixes_5_review.py tests/test_phase5_run_entry_fixes_4_review.py tests/test_run_entry.py tests/test_phase5_run_entry_fixes_2_review.py — 54 passed in 21.72s, exit 0 (the loader's whole committed battery, no regression).
VERIFIED: .venv/bin/python -m pytest tests/test_phase3_project_oracle.py — 5 passed in 226.95s (0:03:46), exit 0 (the oracle line's five passed re-measured).
VERIFIED: scripts/check-static — exit 0. Gated `ruff check --select BLE001,S110 src/orchestrator` prints "All checks passed!"; the advisory line prints "Found 104 errors." (unchanged from REV's 104).
VERIFIED: scripts/check-docs — exit 0. This tree prints `372 Total (in 875ms) 172 Unique 372 OK 0 Errors`; in a git worktree of FINAL (`git worktree add … ca9a25a82aa562692ff4302275970fc52658c43c`) the same command prints `371 Total (in 1s 25ms) 172 Unique 371 OK 0 Errors` — the implementer's figure is the gate's own printed line at FINAL, not the REV `370` quote and not a prediction. The +1 between the two runs is this review brief's one counted `[record.md](../record.md)` link (its second occurrence sits inside a code span; the implementer report carries no link).
VERIFIED: scripts/check-tests --fast — `963 passed, 106 deselected in 69.38s (0:01:09)`, exit 0. Account of 106: a git worktree at REV prints `963 passed, 104 deselected in 67.97s` (re-measured, my copied probe removed first) and the new module carries `pytestmark = pytest.mark.slow` over exactly two cases (104 + 2 = 106; passed stays 963).
VERIFIED: scripts/check-tests — `1069 passed in 410.11s (0:06:50)`, exit 0 (the full suite, this review's standing battery and falsification ground; 1069 = 963 fast + 106 slow).
VERIFIED: FRK-1's red→green pair. Red at REV: on a git worktree at REV `b68be80aa9762eb964bd27190331617e404014ae` whose `src/orchestrator/run_entry.py` is diff-identical to `git show b68be80aa9762eb964bd27190331617e404014ae:src/orchestrator/run_entry.py`, with the new module copied in, `.venv/bin/python -m pytest tests/test_run_entry_kernel_id_refusal.py -v` — `1 failed, 1 passed in 0.18s`, the named failing assertion `tests/test_run_entry_kernel_id_refusal.py:86: Failed: FRK-1: a dict kernel_id was admitted by validate_run_spec` (the `pytest.fail` line — exactly the report's node id, `:86`, and translation). Green at FINAL with the fix alone (2 passed). The brief's live-bug reproducer (`PYTHONPATH=src .venv/bin/python -c "…validate_run_spec(document)['project_kernel']…"` with `kernel_id={'a': 1}`) prints `{'kernel_id': {'a': 1}}` at REV and raises `orchestrator.run_entry.RunSpecError: project_kernel.kernel_id must be a non-empty string is invalid: {'a': 1}` at FINAL.
VERIFIED: refusal completeness at FINAL (hand runners; guarantee attacked-and-not-falsified). Direct `validate_run_spec` matrix — dict, list, int, bool True/False, explicit null, empty string, whitespace `   `, tab-newline, float 3.14/nan/inf, tuple, bytes, bytearray, empty list, empty dict, nested mapping, dict subclass, frozenset, Ellipsis, zero/negative int, zero float: every member REFUSED as a named `RunSpecError` with `repr(value) in str(error)` True (`_failure` formats `{value!r}`). File-backed `load_run_spec` with a dict `kernel_id`: REFUSED naming `{'a': 1}`, tmp dir holds only `spec.yaml` (no store file). Missing `kernel_id` key: validates clean and `run_configuration` against the stub target admits `kernel_id == 'TARGET-SNAPSHOT'` (the snapshot id; the fallback and only the fallback). No present-but-wrong-typed value still loads; no finding per loading class.
VERIFIED: YAML-typed edges at the file-backed head (hand runner). `!!int 42`, `!!float 1.5`, `!!bool true`, `!!null ''`, `!!timestamp 2020-01-01`, `!!binary aGVsbG8=` each construct a non-string before validation and are refused at the validation stage with `__cause__ is None`, the value named (`42`, `1.5`, `True`, `None`, `datetime.date(2020, 1, 1)`, `b'hello'`). `kernel_id: !!int 'garbage'` fails to construct and is refused by the loader wrap (`invalid literal for int() with base 10: 'garbage'`) with `__cause__` `ValueError` — it never reaches validation. A custom `!foo` tag and `!!python/tuple` refuse with `__cause__` `ConstructorError`; malformed YAML refuses with `__cause__` `ParserError`. `!!str 42` and `KERNEL-1` are admitted as strings (right-typed). Every case leaves no extra file in the tmp dir.
VERIFIED: the undisturbed-either/or (Q4). `git diff b68be80… ca9a25a… -- tests/test_run_entry_loader_envelope.py tests/test_phase5_run_entry_fixes_6_review.py tests/test_phase5_run_entry_fixes_5_review.py tests/test_phase5_run_entry_fixes_4_review.py tests/test_run_entry.py tests/test_phase5_run_entry_fixes_2_review.py` is empty. A wrong-typed `kernel_id` through `load_run_spec` raises `RunSpecError` with `__cause__ is None` (a direct validation refusal — `validate_run_spec` is called outside the loader's `try`), versus a malformed-YAML refusal's chained `ParserError` — the refusal's cause face is the direct/wrapped seam the envelope does not enclose (the property's either/or undisturbed: a refused document is its refusal arm).
VERIFIED: the seam's delivered shape (guarantee attacked-and-not-falsified). `git diff b68be80… ca9a25a… -- src/orchestrator/run_entry.py` names exactly the six added lines after the existing `project_kernel` checks (the `if "kernel_id" in spec["project_kernel"]:` guard with the `isinstance(str)` + `strip()` refusal via `_failure("project_kernel.kernel_id must be a non-empty string", kernel_id)`), nothing else. Per-function body diff REV vs FINAL: `run_configuration`, `load_run_spec`, `freeze_target`, `start_run`, `_bind_acceptance`, `_failure`, and every `_require_*` helper IDENTICAL (so the `str(target.project_kernel.get("kernel_id") or target.snapshot_id)` coercion is byte-identical, both docstrings and the `RunSpecError`/module docstrings are untouched, and the normalised copy stays `project_kernel: dict(spec["project_kernel"])`); `validate_run_spec` alone DIFFERS. `git diff … -- tests/` names only the new module.
VERIFIED: mutants on scratch copies, each diff-verified against `git show ca9a25a82aa562692ff4302275970fc52658c43c:src/orchestrator/run_entry.py` before use. (a) Drop the new six-line check: the new pin reds at `tests/test_run_entry_kernel_id_refusal.py:86` with its named translation `Failed: FRK-1: a dict kernel_id was admitted by validate_run_spec` while the envelope property, the read pin, and the absorbed F38/F39/F40 probes stay green (`5 passed`). (b) `isinstance(kernel_id, str)` without `strip()`: measured member-by-member, the empty, whitespace-only, and tab members all pass; the pin reds at `:86` on the **empty** member (`Failed: FRK-1: a empty kernel_id was admitted by validate_run_spec`) — empty precedes whitespace in `_WRONG_TYPED_KERNEL_IDS`, so the loop never reaches the whitespace member (FFR-4). The boundary the mutant pins is as stated: the guard fires on presence, the type test on non-strings, the strip test on empty/whitespace. (c) Matrix-omitted wrong types on the delivered code — float, tuple, bytes, empty list, zero int — all REFUSED and named (guarantee attacked-and-not-falsified).
VERIFIED: the Phase 5 exit gate through the documented head, `python3 scripts/orchestrate.py start --spec … --workdir … --store …`, with a dict `kernel_id` spec: exit 1 with the named refusal as the terminal exception (`orchestrator.run_entry.RunSpecError: project_kernel.kernel_id must be a non-empty string is invalid: {'a': 1}`), empty stdout (0 bytes), store file ABSENT and workdir not created — the refusal precedes any store open (guarantee attacked-and-not-falsified with this reproducer). `python3 scripts/orchestrate.py inspect --run-id RUN-EXIT --store …` in its unchanged form: exit 0, a well-formed empty document (no root node, empty event history — nothing of the refused run admitted). `python3 scripts/orchestrate.py stop --run-id RUN-EXIT --store …` in its unchanged form: exit 1 with `RunSpecError: run 'RUN-EXIT' has no root node to cancel` (`run_entry.py:673`, `stop_run`'s named refusal for a never-admitted run). Both unchanged forms attacked and not falsified.
VERIFIED: the report's forms and counts (J-class; guarantee attacked-and-not-falsified). Every figure is the gate's own printed line, re-measured above. `FINAL` is the work commit `ca9a25a82aa562692ff4302275970fc52658c43c`, never the report commit `26d6616`. `TRIPPED: none` matches check-scope's `tripped:` line. Every field of the template present and filled, nothing outside it added. `SHAPES: none` read against the form's rule: both named shapes have tests in the new module and the maintained envelope/read-pin/absorbed-probe surfaces are named as the green battery, not hidden prose. `INHERITED: none` holds against the received set (the brief's two copied blocks and the four moved findings FRK-1/FFR-1/FFR-2/FFR-3: FRK-1 fixed by the step under review, the three FFRs closed by the brief's own text, F41 already closed at the fixes-7 closeout). The embedded brief copy is byte-exact against the committed `docs/research/phase5-run-entry-fixes-8-brief.md`. The commits under review carry `Actor: IMPLEMENTER` (`ca9a25a`, `26d6616`); the brief commits carry `Actor: PLANNER` — this session wrote none of them. The three `FIXED:` citations name `12738ff27ef8a03b34cdb85e8d5742d144b054a1`, which equals `git log -1 --format=%H -- docs/research/phase5-run-entry-fixes-8-brief.md` and equals `git rev-parse ca9a25a82aa562692ff4302275970fc52658c43c^` (the tree's tip at dispatch).
VERIFIED: the three FFR text-closes (guarantees attacked-and-not-falsified). FFR-1: the brief's `IN SCOPE:` line is plain un-backticked comma-separated paths and REVIEW ACCEPTANCE is green with the `claimed:` line naming exactly the two intended paths and `tripped: none`. FFR-2: grep of the brief finds no predicted docs total for this step's gate — the only totals are CONTEXT's REV line (`370 Total…`, quoted as the base measurement) and the moved FFR-2 block's 361/363/366 as the old finding's record; ACCEPTANCE names exit-0-with-0-errors and the sentence `exit-0-with-0-errors rather than a number expected to hold` describes that absence rather than restating a prediction, so it closes; every figure this review records is the gate's own printed line. FFR-3: the falsified mutant-(d) prediction appears only inside the moved FFR-3 block (and its INHERITED quote) as the record of what was closed, and no new message-prefix or red-member prediction rides in the brief under review — the omission close per R11 holds.
NOT VERIFIED: the implementer's historical claim that `git diff b68be80… HEAD -- src/orchestrator/run_entry.py` was empty before their edit (a past working-tree state; the red is independently reproduced on a diff-verified REV scratch copy). Wall-clock durations drift run to run; every count is re-measured. `git rev-parse HEAD` at dispatch is historical; parentage (`ca9a25a…^` = `12738ff…`) confirms the tip the FIXED lines name.
FINDINGS:
  FFR-4 | SEVERITY: P2 | ORIGIN: BRIEF | STATE: carried
  The review brief's mutant-(b) prediction — "narrow the check to `isinstance(kernel_id, str)` without the `strip()` — does the whitespace-only member pass (the pin red on that member)" — is falsified as written on the red-member attribution: without `strip()` the empty, whitespace-only, and tab members all pass the type test, and the pin reds on the **empty** member (`Failed: FRK-1: a empty kernel_id was admitted by validate_run_spec` at `tests/test_run_entry_kernel_id_refusal.py:86`), because empty precedes whitespace in `_WRONG_TYPED_KERNEL_IDS` so the loop never reaches the whitespace member. The whitespace-only member does pass (the question's main clause holds) and the seam boundary the mutant pins is as stated (the strip test covers empty/whitespace); only which member names the red is wrong. Source: `docs/research/phase5-run-entry-fixes-8-review-brief.md`, QUESTIONS TO ATTACK item 3 (commit `3862fbb325932bb335f6fd13f95ff2ba4fb686d9`).
  FIXED: no regression test — a mutant prediction in a committed review brief's prose has none (the FFR-3 class); a later committed brief corrects the prediction to the measured member (the pin reds on the empty member first; the whitespace member would red only in a matrix that reached it).
SHAPES: probed by this review's hand runners; the existing suite builds none of these (the brief's two named shapes, `kernel_id load refusal` and `kernel_id fallback`, are built in the new module and are not repeated here):
  - wrong-typed edge classes beyond the named matrix (float including nan/inf, tuple, bytes, bytearray, empty list/dict, nested mapping, dict subclass, frozenset, Ellipsis, zero/negative int, zero float) — all refused and named; no loading class.
  - YAML-typed scalars constructing non-strings at the file-backed head (`!!int 42`, `!!float 1.5`, `!!bool true`, `!!null ''`, `!!timestamp`, `!!binary`) — all refused at validation with `__cause__ is None`.
  - loader-wrap faces at the file-backed head (`!!int 'garbage'` → `ValueError`, custom `!foo` and `!!python/tuple` → `ConstructorError`, malformed YAML → `ParserError`) — named `RunSpecError`s with chained causes; `!!int 'garbage'` never constructs a non-string.
  - `!!str 42` admitted as the string `'42'` (right-typed; not a loading class).
  - the `__cause__` contrast itself (direct validation refusal vs wrapped loader refusal) — the envelope asserts the refusal arm but not the cause face.
  - a `str` subclass whose `strip()` lies (admitting `WeirdStr("   ")`) — typed `str`, so not wrong-typed, unreachable from `yaml.safe_load`, and the same face as `_require_non_empty_str` module-wide; named here, not a loading class, so no finding.
  - `inspect`/`stop` against a never-admitted run id — unchanged forms; `inspect`'s `EventStore` constructor creates the store file if absent (24576 bytes, empty run document) and `stop` refuses with "no root node to cancel" — pre-existing faces outside this step's seam, named here so they are not hidden prose.
  - mutant-(b)'s red-member attribution — FFR-4.
TRIPPED: none
PROPOSED ROWS: none
METHOD FRICTION: none
INHERITED:
Nothing from the received set is still open: FRK-1 is fixed by the step under review (its red→green pair re-measured above), FFR-1, FFR-2, FFR-3 close by the brief under review's own text as R11 and rule 8 prescribe (each close adjudicated above), and F41 was closed at the fixes-7 closeout (no action). One new item is still open and carried forward by this review:
  FFR-4 (STATE: carried) — the review brief's mutant-(b) parenthetical "(the pin red on that member)" is falsified as written (the pin reds on the empty member first); a later committed brief corrects the prediction to the measured member.

CLOSEOUT
DECLINED: none
DIVERGENCES CLOSED: none
