From 708591bb05a07d09ce858777c9e0dfce077f2fa4 Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 13:41:40 +0000 Subject: [PATCH 01/33] =?UTF-8?q?Bump=20opendox=20pin=20to=20openDox-code?= =?UTF-8?q?=200b4e8bbf=20(=C2=A7=203.4=20slice=20S8=20leg=20B=20landed),?= =?UTF-8?q?=20and=20sweep=20the=20claims=20the=20old=20pin=20left=20true?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pyproject.toml:106 pins `opendox` at openDox-code main `0b4e8bbf68fabfcd 65d4f0d80e619c20a013e888` (#23, § 3.4 slice S8 leg B, 2026-09-16 01:23Z), following the pin past `a99eba03` (#11, § 4.3 lazy proxy, pinned here by #15 on 2026-09-11). Owed twice in openxFactory#656's own record: the S5 LANDED note 5656797299 item 4, and pin lockstep #2's LANDED note 5689609863 residue item 1 — Copilot's suppressed finding on openxFactory#1054, that a `pip install` of the pinned openXdox code resolves an older `opendox` than the lockstep contract names. MEASURED, in fresh venvs at each pin, under validate.yml's exact invocation (python 3.12.3 / pytest 8.4.2): a99eba03 301 passed, 23 skipped 0b4e8bbf 317 passed, 6 skipped Seventeen skips cleared. The three S5 materialization assertions RUN and PASS (test_gate_loop_views.py 32 passed / 3 skipped -> 35 passed / 0 skipped: test_the_facet_conforms_to_the_view_extension_protocol, test_the_column_collects_through_openDox_beside_its_own_routes, test_every_region_this_column_names_is_a_declared_shell_region); the thirteen node probes run (test_gate_loop_probes.py 0 passed / 13 skipped -> 13 passed); the six remaining skips are the three seam suites' doc_health pairs, which no pin bump touches. ONE FILE LEAVES validate.yml's LIST, for the BUILD arc's defect and not this bump's. tests/test_doxbench_mutation_boundary.py was named by S8 on the measurement that it COLLECTS and then skips whole at tests/opendox_bundle.py's module-level skip. With the bundle in the wheel that skip no longer fires, the module runs on to its line 481 `from openxdox import gate_console` -> src/openxdox/gate_console.py:63 `from doc_health import corpus`, and collection ERRORS. It is dropped rather than repaired for the reason tests/test_doxbench_turns.py is not named at all — naming it would put the required check red for split-opendox § 3.5/3.6 (RULED Q-L8 (b')) — and because it is an arrived carve row whose edits are declared at openxFactory. THE SWEEP, whole-repository, distinguishing a stale CLAIM from a true statement about the past. `git grep a99eba03` returns exactly one line, the pin itself; no lockfile, requirements or constraints file exists, and no test asserts the pin string. Six files carried sentences stating what IS pinned and are corrected, each quoting its old wording as provenance rather than deleting it: validate.yml (three blocks), src/openxdox/view_extensions.py's module docstring, tests/opendox_bundle.py's docstring and _REASON, tests/test_gate_loop_probes.py's docstring / fixture / skip, tests/test_gate_loop_views.py's _view_extension_or_skip, and tests/test_dependency_direction.py's two (one of them stale since #15 — it called BUILD slice 2b's merge the commit "this file's pin now names"). Left untouched as conditional or historical: ViewContractUnsupported and both GateLoopViews.views() refusals (about an arbitrary assembly's openDox), and the 29 `# noqa: E402 (skips where the pin carries no bundle)` import comments across 29 files, every one of them a declared `openxdox_code` destination_path in openxFactory's own carve manifest (checked against the 92, not inferred). THE RATCHET IS RE-MEASURED, NOT CARRIED FORWARD: _back_import_census() against the newly pinned tree returns exactly OPENDOX_BACK_IMPORTS' five rows — 0 import-time / 19 deferred, unchanged across two openDox slices. WHOLE-TREE, the rehearsal lockstep #2's residue item 2 asks for (pytest tests/ -q --noconftest --continue-on-collection-errors, both venvs): a99eba03 153 failed, 568 passed, 29 skipped, 127 errors 0b4e8bbf 153 failed, 586 passed, 10 skipped, 128 errors No new failure anywhere in the tree; the one new error is the file named above. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- .github/workflows/validate.yml | 66 +++++++++++++++++++++++------- pyproject.toml | 2 +- src/openxdox/view_extensions.py | 23 ++++++++--- tests/opendox_bundle.py | 33 ++++++++++----- tests/test_dependency_direction.py | 30 ++++++++++---- tests/test_gate_loop_probes.py | 41 +++++++++++-------- tests/test_gate_loop_views.py | 31 ++++++++++---- 7 files changed, 163 insertions(+), 63 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 8d4c16a..09cdad4 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -92,9 +92,12 @@ jobs: # # `--noconftest` safe and needs no consumer: it imports this package's own # modules and reads this package's own files as text. Its three - # materialization assertions SKIP — never fail — where the pinned - # `opendox` predates the view contract, which is this leg's state until - # the pin bump that lands with the openDox half. + # materialization assertions used to SKIP — never fail — because the + # pinned `opendox` predated the view contract, "which is this leg's state + # until the pin bump that lands with the openDox half". THAT BUMP HAS + # LANDED: `pyproject.toml` names `0b4e8bbf` (openDox-code#23, § 3.4 slice + # S8 leg B) since 2026-09-16, and this file goes 32 passed / 3 skipped -> + # 35 passed / 0 skipped under the invocation below. # # `tests/test_gate_loop_probes.py` joins it on the same footing and for # the reason the slice exists: slice S4 proved its two new modules by @@ -105,10 +108,13 @@ jobs: # assertion silently breaks a verb. Each probe assembles a COMPOSED bundle # — openDox's own `web/` with this column's six modules placed into it by # `web_assets.install_view_modules()`, RULED Q5's own hook — so what is - # measured is the shipped byte in the shipped position. Where the - # installed `opendox` carries no bundle (this leg's pinned state until the - # pin bump) every probe SKIPS with that reason named, and where `node` is - # absent they skip for that one. + # measured is the shipped byte in the shipped position. This block used to + # end "where the installed `opendox` carries no bundle (this leg's pinned + # state until the pin bump) every probe SKIPS". THE SAME BUMP CLEARED IT: + # at `0b4e8bbf` the bundle is in the wheel and this file goes 0 passed / + # 13 skipped -> 13 passed / 0 skipped. The skip survives for an assembly + # that installs an older openDox than this leg declares, and the `node` + # one for a runner without node. # § 3.4 SLICE S8 UN-NARROWS THIS LIST AS FAR AS THE MEASUREMENT ALLOWS, # which is the half of RULED Q-L8 (b′) this slice was scoped to lift. # The note's § 5 S8 row says the narrowings "lift FOR THE WEB SUITES", and @@ -128,12 +134,15 @@ jobs: # both a pre-carve `MODULE_PATH`; the module under test is # openDox's and is read through the PIN, as the bundle now is. # tests/test_doxbench_mutation_boundary.py 1 error -> 1 skipped - # A WEB SUITE, and the one of the 23 that can be named today: it - # reads only bundle files, so with the path repaired it COLLECTS - # and skips on the stated reason (this leg's `opendox` pin predates - # openDox's `web/**` package-data declaration) instead of erroring - # on a directory that does not exist. That it collects at all is - # § 1.2(d)'s defect closed; the pin bump is what makes it run. + # A WEB SUITE, and the one of the 23 S8 could name: it reads bundle + # files, so with the path repaired it COLLECTED and skipped on the + # stated reason (this leg's `opendox` pin predated openDox's + # `web/**` package-data declaration) instead of erroring on a + # directory that does not exist. That it collects at all is + # § 1.2(d)'s defect closed. S8 then predicted "the pin bump is what + # makes it run". THE PIN BUMP MEASURED IT AND THE PREDICTION WAS + # WRONG — the block below says what actually happens, and the file + # LEAVES this list in the same act that moved the pin. # tests/test_evidence_provenance_surface.py 19 passed # tests/test_evidence_provenance_surface_seam.py 8 passed 2 skipped # tests/test_model_scenario_workbench.py 23 passed @@ -163,6 +172,36 @@ jobs: # named: it is all-skip today, on the same footing openDox-code#23 left # its two all-skip suites off ITS list. # + # ONE FILE LEAVES THIS LIST WITH THE 2026-09-16 PIN BUMP + # (`a99eba03` -> `0b4e8bbf`), and the reason is the BUILD arc's, not the + # bump's. `tests/test_doxbench_mutation_boundary.py` was named by S8 on + # the measurement quoted above: it COLLECTS, then skips whole at + # `tests/opendox_bundle.py`'s module-level skip, which is what happened + # while the pinned `opendox` carried no `web/` bundle. At `0b4e8bbf` the + # bundle IS in the wheel, so the module-level skip on its line 46 no + # longer fires and the module runs on to its line 481 `from openxdox + # import gate_console` -> `src/openxdox/gate_console.py:63 from + # doc_health import corpus`, the openxFactory-only package named two + # paragraphs up. Measured under this exact invocation, in a fresh venv at + # the new pin: `ERROR tests/test_doxbench_mutation_boundary.py … + # ModuleNotFoundError: No module named 'doc_health'`, a COLLECTION error + # that interrupts the whole run. + # + # It is DROPPED rather than repaired, for the reason + # `tests/test_doxbench_turns.py` is not named at all: naming it would put + # the required check red for the BUILD arc's defect (split-opendox + # § 3.5/3.6, RULED Q-L8 (b′)), and the file is an ARRIVED carve row whose + # edits are declared at openxFactory — deferring its `gate_console` import + # would be an undeclared edit to a declared surface. It comes back to this + # list with the BUILD arc, in the act that makes `doc_health` reachable, + # alongside `test_doxbench_turns.py`. + # + # WITH IT GONE AND THE PIN MOVED, this invocation goes 301 passed / + # 23 skipped -> 317 passed / 6 skipped. The 17 skips that cleared are the + # 3 materialization assertions, the 13 node probes and this file's own + # module-level skip; the 6 that remain are the three seam suites' + # `doc_health` pairs, which no pin bump touches. + # # `--noconftest` STAYS, and it is why this list is a list: `tests/ # conftest.py` imports the carved session fixtures, which reach both # absent packages. Every file named here stands on its own under it. @@ -176,7 +215,6 @@ jobs: tests/test_gate_loop_views.py tests/test_gate_loop_probes.py tests/test_doxbench_abstract_store.py - tests/test_doxbench_mutation_boundary.py tests/test_doxbench_telemetry.py tests/test_evidence_provenance_surface.py tests/test_evidence_provenance_surface_seam.py diff --git a/pyproject.toml b/pyproject.toml index 38331a7..8141dd7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -103,7 +103,7 @@ requires-python = ">=3.12" # PR) — and not an arbitrary choice: `Draft202012Validator`, the name # `gate_console.py:563` imports, was added in jsonschema 4.18.0. dependencies = [ - "opendox @ git+https://github.com/opensoft/openDox-code@a99eba03e31a0aee1cc15a061fdf718cc88a2c44", + "opendox @ git+https://github.com/opensoft/openDox-code@0b4e8bbf68fabfcd65d4f0d80e619c20a013e888", "PyYAML>=6.0", "jsonschema>=4.18", ] diff --git a/src/openxdox/view_extensions.py b/src/openxdox/view_extensions.py index 46f4d69..35b9ab3 100644 --- a/src/openxdox/view_extensions.py +++ b/src/openxdox/view_extensions.py @@ -19,12 +19,23 @@ repository that PINS openDox conforms without inheriting from it. WHY THE BINDINGS ARE DECLARED AS DATA AND MATERIALIZED LATE. This leg pins -`opendox` by commit (`pyproject.toml`), and the pinned commit is older than the -view registry itself — `opendox.view_extension` does not exist there, and the -`exports` field RULED Q2 adds is newer still, landing in openDox-code's own S5 -leg. Importing either at module-import time would make this module unimportable -under its own declared dependency and would put this leg's `validate` red for a -reason that has nothing to do with this column. So `VIEW_BINDING_SPECS` below is +`opendox` by commit (`pyproject.toml`). Until 2026-09-16 that pin named +`a99eba03` and this paragraph said the pinned commit "is older than the view +registry itself — `opendox.view_extension` does not exist there, and the +`exports` field RULED Q2 adds is newer still". THAT IS NO LONGER TRUE, and the +old wording is quoted here as provenance rather than deleted: the pin now names +openDox-code#23 (`0b4e8bbf`, § 3.4 slice S8 leg B), where `view_extension` is +importable and `ViewBinding` takes `exports` — measured, and the three +materialization assertions in `tests/test_gate_loop_views.py` run and pass +against it instead of skipping. + +THE LATENESS STAYS, for the reason that outlives any one pin: an ASSEMBLY +chooses the `opendox` this module runs under, not this file, and a consumer +that pins an openDox behind the view contract must still be able to IMPORT this +module — an import-time reach would make it unimportable under THAT consumer's +pin and would put its `validate` red for a reason that has nothing to do with +this column. `ViewContractUnsupported` below is what names that +condition when it arises. So `VIEW_BINDING_SPECS` below is plain data — the same JSON shape the manifest crosses the process boundary as — and `GateLoopViews.views()` materializes it through whatever `opendox` the ASSEMBLY installed, at the one moment an assembly exists to have installed one. diff --git a/tests/opendox_bundle.py b/tests/opendox_bundle.py index 3d0b2f8..c65ff15 100644 --- a/tests/opendox_bundle.py +++ b/tests/opendox_bundle.py @@ -35,11 +35,20 @@ web = Path(opendox.__file__).resolve().parent / "web" and S5 leg B (`openDox-code#20`) landed the packaging declaration that puts -`opendox/web/**` into a wheel at all. Until this leg's pin advances past that -commit, an installed `opendox` carries no bundle — so a module that imports this -one SKIPS, exactly as S5's probes do, rather than failing on a stand-in. A -skipped suite says "the pin is behind"; a failing one would say "the code is -wrong", and only one of those is true. +`opendox/web/**` into a wheel at all. THIS LEG'S PIN HAS NOW ADVANCED PAST IT — +2026-09-16, `a99eba03` -> `0b4e8bbf` (openDox-code#23, § 3.4 slice S8 leg B) — +and the bundle is there: `find()` returns a real directory under the installed +`opendox`, and the suites that import `OPENDOX_WEB` run instead of skipping. +This paragraph used to end "Until this leg's pin advances past that commit, an +installed `opendox` carries no bundle", which was true of `a99eba03` and is +quoted here as provenance, not as a claim. + +THE SKIP STAYS, and it is not dead weight. An `opendox` installed from a source +older than the packaging declaration — a consumer assembling at its own pin, a +developer with a stale editable checkout — still carries no bundle, and the +honest outcome there is a SKIP, not a failure against a stand-in: a skipped +suite says "the pin is behind"; a failing one would say "the code is wrong", and +only one of those is true. """ from __future__ import annotations @@ -57,12 +66,14 @@ _MARKER = ("views", "helpers.js") _REASON = ( - "the installed `opendox` carries no `web/` bundle: this leg pins a commit " - "older than openDox's own packaging declaration (`[tool.setuptools." - "package-data] opendox = [\"web/**\"]`, openDox-code#20, § 3.4 slice S5), " - "so there is nothing here to read. The pin bump makes this suite run — the " - "same bump `tests/test_gate_loop_probes.py` and `tests/test_gate_loop_" - "views.py` already wait on. SKIPPED, never failed: the code under test is " + "the installed `opendox` carries no `web/` bundle, so there is nothing here " + "to read. This leg's own pin is NOT the explanation any more: it names " + "openDox-code#23 (`0b4e8bbf`), which is past openDox's packaging " + "declaration (`[tool.setuptools.package-data] opendox = [\"web/**\"]`, " + "openDox-code#20, § 3.4 slice S5), and under that pin this suite RUNS. " + "Reaching this reason means the `opendox` actually installed came from " + "somewhere older than the declared pin — an assembly at its own pin, or a " + "stale editable checkout. SKIPPED, never failed: the code under test is " "not what is missing.") diff --git a/tests/test_dependency_direction.py b/tests/test_dependency_direction.py index 6b1f58f..843eaf8 100644 --- a/tests/test_dependency_direction.py +++ b/tests/test_dependency_direction.py @@ -240,10 +240,15 @@ def test_every_deferred_cross_package_reach_out_of_src_is_known() -> None: # as `serve_gate.py` contributes its routes to the `route_extension` one, so # it belongs on this list for the same reason: a contribution surface that # stops consuming openDox has forked it. Its reach is DEFERRED (inside - # `GateLoopViews.views()`) and deliberately so — this leg pins an `opendox` - # older than the view registry itself, and an import-time reach would make - # the module unimportable under its own declared dependency. The census - # below counts a deferred reach, which is what makes that lawful here. + # `GateLoopViews.views()`) and deliberately so. This comment used to give + # the reason as "this leg pins an `opendox` older than the view registry + # itself" — true of `a99eba03`, no longer true since the 2026-09-16 bump to + # `0b4e8bbf` (openDox-code#23), where `opendox.view_extension` is + # importable. The deferral stays on the reason that outlives any one pin: an + # ASSEMBLY chooses the openDox this module runs under, and an import-time + # reach would make the module unimportable under a consumer pinned behind + # the view contract. The census below counts a deferred reach, which is what + # makes that lawful here. "src/openxdox/view_extensions.py", ) @@ -317,10 +322,19 @@ def test_the_doc_health_implementation_surface_is_exactly_declared() -> None: #: The openDox -> openXdox back-imports, MEASURED at the commit this leg pins. #: #: LOWERED TO ZERO AT IMPORT TIME BY BUILD SLICE 2b — `opensoft/openDox-code` -#: #10, which this file's pin now names (`pyproject.toml`). **0 import-time / -#: 19 deferred over five modules**, from 9 / 19 at the head of that slice and -#: from the 13 / 19 over six modules that the census RULED 5626260214 called -#: "the 13-line openDox->openXdox inversion" stood at. +#: #10. **0 import-time / 19 deferred over five modules**, from 9 / 19 at the +#: head of that slice and from the 13 / 19 over six modules that the census +#: RULED 5626260214 called "the 13-line openDox->openXdox inversion" stood at. +#: +#: THE PIN HAS MOVED TWICE SINCE, AND THE TABLE HAS NOT — measured, not assumed. +#: This note used to say slice 2b's merge was the commit "this file's pin now +#: names"; that stopped being true at openXdox-code#15 (`0f1f2e59` -> +#: `a99eba03`) and the sentence was not followed, which is the stale-claim class +#: this repository has since had to sweep for. The pin names `0b4e8bbf` +#: (openDox-code#23, § 3.4 slice S8 leg B) as of 2026-09-16, and +#: `_back_import_census()` recomputed against THAT tree returns exactly the five +#: rows below — so the ratchet neither fell nor rose across two openDox slices, +#: and the numbers here are the measurement, not a carried-forward memory. #: #: THE WHOLE OF THE INVERSION IS GONE, which is worth stating plainly because #: this table has never been able to say it before: no module of the pinned diff --git a/tests/test_gate_loop_probes.py b/tests/test_gate_loop_probes.py index bbe1095..49ab966 100644 --- a/tests/test_gate_loop_probes.py +++ b/tests/test_gate_loop_probes.py @@ -21,13 +21,20 @@ asserted once. THE ASSEMBLY IS THE PRECONDITION, AND IT IS THE PIN. This leg pins `opendox` by -commit (`pyproject.toml`), and the pinned commit predates BOTH the view registry -and the packaging fix that puts `opendox/web/` into a wheel at all -(openDox-code#20's own first commit). Where the installed `opendox` carries no -bundle there is nothing to assemble INTO, and every probe SKIPS with that reason -named — never fails, and never silently passes against a stand-in. They run in -full the moment the pin bump lands, which is the same bump the three -materialization assertions in `test_gate_loop_views.py` wait for. +commit (`pyproject.toml`). When these probes landed with slice S5 that pin was +`a99eba03`, which predated BOTH the view registry and the packaging fix that +puts `opendox/web/` into a wheel at all (openDox-code#20's own first commit), so +this paragraph said the probes "run in full the moment the pin bump lands". +THE BUMP LANDED — 2026-09-16, `a99eba03` -> `0b4e8bbf` (openDox-code#23, § 3.4 +slice S8 leg B) — and all thirteen of them now RUN: 13 skipped became 13 passed +under `validate.yml`'s own invocation, in the same act that moved the pin, and +the three materialization assertions in `test_gate_loop_views.py` that waited on +the same bump went 3 skipped -> 3 passed beside them. + +The skip below is kept for the case it was always really about: where the +installed `opendox` carries no bundle there is nothing to assemble INTO, and a +probe SKIPS with that reason named — never fails, and never silently passes +against a stand-in. A CREATED file: no row in openxFactory's `docs/opendox-carve-manifest.yaml` (RULED OQ-C), admitted by path in the S5 annotation. @@ -132,19 +139,21 @@ def bundle(tmp_path) -> Path: """A COMPOSED bundle: openDox's own `web/`, with this column's six modules placed into it by the assembly hook RULED Q5 names. - Skipped — never failed — where the assembled `opendox` carries no bundle: - that is this leg's pinned state until the pin bump, and a probe that quietly - ran against a stand-in `helpers.js` would measure the stand-in rather than - the shipped file. + Skipped — never failed — where the assembled `opendox` carries no bundle. + That was this leg's pinned state until the 2026-09-16 pin bump and is not + any more; the skip remains for an assembly that installs an older openDox + than this leg declares, because a probe that quietly ran against a stand-in + `helpers.js` would measure the stand-in rather than the shipped file. """ source = _opendox_bundle() if source is None: pytest.skip( - "the installed `opendox` carries no `web/` bundle: this leg pins a " - "commit older than openDox's own packaging fix, so there is nothing " - "to assemble into. The pin bump owed at landing makes these probes " - "run (the same bump `test_gate_loop_views.py`'s three " - "materialization assertions wait for)") + "the installed `opendox` carries no `web/` bundle, so there is " + "nothing to assemble into. This leg's declared pin is NOT the " + "explanation any more — it names openDox-code#23 (`0b4e8bbf`), " + "which carries the bundle, and under it these probes run. Reaching " + "this reason means the installed `opendox` came from somewhere " + "older than the declared pin") target = tmp_path / "web" shutil.copytree(source, target) web_assets.install_view_modules(target) diff --git a/tests/test_gate_loop_views.py b/tests/test_gate_loop_views.py index 2864efa..38c5fe9 100644 --- a/tests/test_gate_loop_views.py +++ b/tests/test_gate_loop_views.py @@ -615,17 +615,34 @@ def test_the_style_residue_is_recorded_rather_than_skipped() -> None: # --------------------------------------------------------------------------- def _view_extension_or_skip(): + """The assembled openDox's view registry, or SKIP where it has none. + + BOTH GUARDS ARE SATISFIED BY THIS LEG'S OWN PIN, since 2026-09-16. + They were not when slice S5 wrote them: the pin was `a99eba03`, the first + reason read "this leg pins an `opendox` older than the § 3.4 slice S3 view + registry" and the second said the bump "is owed at landing". The bump landed + (`a99eba03` -> `0b4e8bbf`, openDox-code#23, § 3.4 slice S8 leg B) and the + three assertions below went 3 skipped -> 3 passed under `validate.yml`'s own + invocation. The old wording is quoted here as provenance, not asserted. + + THE GUARDS STAY, because what they test is the ASSEMBLED openDox, not this + leg's declared pin — the section header above says so — and an assembly is + free to install an openDox behind the view contract. That is the same + condition `view_extensions.ViewContractUnsupported` names at runtime, and + these two skips are its test-time counterpart. + """ view_extension = pytest.importorskip( "opendox.view_extension", - reason="this leg pins an `opendox` older than the § 3.4 slice S3 view " - "registry; the specs above are asserted as data, and the " - "materialization is asserted wherever a contract-bearing " - "opendox is installed") + reason="the assembled `opendox` has no `view_extension` module (§ 3.4 " + "slice S3's view registry); the specs above are asserted as " + "data, and the materialization is asserted wherever a " + "contract-bearing opendox is installed") if "exports" not in getattr(view_extension.ViewBinding, "__annotations__", {}): pytest.skip( - "the pinned `opendox.view_extension.ViewBinding` predates RULED Q2's " - "`exports` field (openxFactory#656 comment 5648049748); the pin bump " - "to the openDox carrying § 3.4 slice S5 is owed at landing") + "the assembled `opendox.view_extension.ViewBinding` does not take " + "RULED Q2's `exports` field (openxFactory#656 comment 5648049748); " + "this leg's own pin does — reaching this skip means the installed " + "`opendox` is older than the declared one") return view_extension From 4a7ccb2d544a9484f95f8da8f1e55c4bf227fac9 Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 15:11:04 +0000 Subject: [PATCH 02/33] Copilot round 1: a missing bundle or registry at the DECLARED pin now fails instead of skipping, and the ratchet note's range is corrected MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copilot's round-1 review of #21 (5224499774, "Needs a closer look") opened ZERO threads and filed FOUR SUPPRESSED COMMENTS in the body. All four are accurate and all four are fixed here; three of them are one finding said three times. THE FINDING. The new skip reasons this PR wrote claimed the installed `opendox` "came from somewhere older than the declared pin", but the guards only tested for a MARKER (`web/views/helpers.js`) or for importability — they never established identity. Before the bump that cost nothing, because a missing bundle WAS the declared state. After it the same skip hides the opposite fact: if `0b4e8bbf` itself stopped shipping `web/**` or `view_extension`, thirteen node probes, three materialization assertions and every bundle suite would go quietly green in a REQUIRED check, and the coverage this bump exists to gain would be lost in silence. THE FIX — the two facts are now READ, not asserted. `tests/opendox_bundle.py` gains `declared_pin()` (the 40-hex out of this leg's own pyproject.toml) and `installed_commit()` (out of the distribution's PEP 610 `direct_url.json`, which a VCS install always records), and one decision used by all three sites: bundle/registry missing AND the two commits agree -> FAIL, named a regression bundle/registry missing AND they differ -> SKIP, both commits named provenance unrecorded -> SKIP, saying exactly that `_REASON` is deleted with the branch it served: the reason is now composed from what was just measured, so it cannot go stale the way the old string did. `test_gate_loop_probes.py`'s `bundle` fixture and `test_gate_loop_views.py`'s `_view_extension_or_skip` (which drops `importorskip`, the call that cannot tell the two cases apart) both route through it. PROVED BY SIMULATING BOTH REGRESSIONS, not by argument: declared pin loses `web/` 13 skipped -> 13 errors declared pin loses `view_extension` 3 skipped -> 3 failed and the SKIP path still behaves for a genuinely older consumer: against a venv holding `a99eba03` while pyproject declares `0b4e8bbf`, every reason reads "the installed distribution was built from a99eba03, while pyproject.toml declares 0b4e8bbf". Under the declared pin: 317 passed / 6 skipped, unchanged. THE FOURTH FINDING, a count of mine that was wrong. The ratchet note said the table held "across two openDox slices". Two is the number of PIN BUMPS of this file's declaration; the RANGE this bump covers is THREE openDox-code landings, now named: from `a99eba03` (#11, § 4.3) across `8efb3cf5` (#20, S5 leg B), `1e469713` (#21, S7) and `0b4e8bbf` (#23, S8 leg B). Both counts are stated so neither can be read as the other. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- tests/opendox_bundle.py | 107 ++++++++++++++++++++++++++--- tests/test_dependency_direction.py | 14 +++- tests/test_gate_loop_probes.py | 30 ++++---- tests/test_gate_loop_views.py | 37 ++++++---- 4 files changed, 150 insertions(+), 38 deletions(-) diff --git a/tests/opendox_bundle.py b/tests/opendox_bundle.py index c65ff15..763ab47 100644 --- a/tests/opendox_bundle.py +++ b/tests/opendox_bundle.py @@ -54,6 +54,8 @@ from __future__ import annotations import atexit +import json +import re import shutil import tempfile from pathlib import Path @@ -65,16 +67,12 @@ #: one of the six modules openXdox itself contributes back under RULED Q5. _MARKER = ("views", "helpers.js") -_REASON = ( - "the installed `opendox` carries no `web/` bundle, so there is nothing here " - "to read. This leg's own pin is NOT the explanation any more: it names " - "openDox-code#23 (`0b4e8bbf`), which is past openDox's packaging " - "declaration (`[tool.setuptools.package-data] opendox = [\"web/**\"]`, " - "openDox-code#20, § 3.4 slice S5), and under that pin this suite RUNS. " - "Reaching this reason means the `opendox` actually installed came from " - "somewhere older than the declared pin — an assembly at its own pin, or a " - "stale editable checkout. SKIPPED, never failed: the code under test is " - "not what is missing.") +# `_REASON`, the module-level skip string, is GONE — `_absent()` below composes the +# reason from what it measured instead of stating it in advance. It read "this leg +# pins a commit older than openDox's own packaging declaration … The pin bump makes +# this suite run", which was true of `a99eba03` and became false at `0b4e8bbf`; the +# replacement's whole point is that it cannot go stale, because it names the two +# commits it just compared. def find() -> Path | None: @@ -87,6 +85,93 @@ def find() -> Path | None: return web if web.joinpath(*_MARKER).is_file() else None + +# --------------------------------------------------------------------------- +# PROVENANCE — WHICH openDox IS ACTUALLY INSTALLED, and why the skip must ask. +# +# Copilot's round-1 review of openXdox-code#21 (suppressed comment on this file, +# and the same finding twice more on `tests/test_gate_loop_probes.py` and +# `tests/test_gate_loop_views.py`) was ACCURATE and is answered here rather than +# argued: `find()` tests for a MARKER, never for an identity, so a skip reason +# that says "the installed `opendox` came from somewhere older than the declared +# pin" was asserting something it had not measured. Before the pin bump that cost +# nothing — a missing bundle WAS the declared state. After it the same skip would +# hide the opposite fact: if the declared pin itself ever stopped shipping +# `web/**`, thirteen node probes, three materialization assertions and every +# bundle suite would go quietly green in a REQUIRED check, and the coverage this +# bump exists to gain would be lost in silence. +# +# So the two facts are now READ, and the skip is conditional on them: +# * `declared_pin()` — the 40-hex this leg's own `pyproject.toml` declares. +# * `installed_commit()` — the commit pip actually built, out of the +# distribution's `direct_url.json` (PEP 610), which a VCS install always +# records. +# Bundle missing AND the two agree -> FAIL: a regression at the declared pin. +# Bundle missing AND they differ -> SKIP: a consumer assembling at its own, +# older pin, named in the reason. +# Provenance unreadable -> SKIP, saying so: nothing was measured, so +# nothing may be claimed either way. +# --------------------------------------------------------------------------- + +_PIN_RE = re.compile(r"opendox\s*@\s*git\+[^@\s\"']+@([0-9a-f]{40})") + + +def declared_pin() -> str | None: + """The openDox-code commit `pyproject.toml` declares, or None if unreadable.""" + toml = Path(__file__).resolve().parents[1] / "pyproject.toml" + try: + match = _PIN_RE.search(toml.read_text(encoding="utf-8")) + except OSError: # pragma: no cover - no checkout + return None + return match.group(1) if match else None + + +def installed_commit() -> str | None: + """The commit the INSTALLED `opendox` was built from (PEP 610), or None. + + None is not "no provenance exists"; it is "this installation did not record + one" — an editable checkout, a wheel copied in by hand. The callers treat it + as unknown and skip rather than guess. + """ + try: + from importlib.metadata import distribution + raw = distribution("opendox").read_text("direct_url.json") + except Exception: # pragma: no cover - not installed + return None + if not raw: + return None + try: + commit = json.loads(raw).get("vcs_info", {}).get("commit_id") + except (ValueError, AttributeError): # pragma: no cover - malformed + return None + return commit if isinstance(commit, str) and len(commit) == 40 else None + + +def _absent(subject: str, *, module_level: bool): + """Raise the RIGHT outcome for a missing `subject` — fail at the declared pin.""" + declared, installed = declared_pin(), installed_commit() + if declared is not None and installed is not None and declared == installed: + pytest.fail( + f"{subject} is missing from the `opendox` this leg DECLARES " + f"(`pyproject.toml` pins {declared[:8]}, and the installed " + f"distribution records that same commit in its `direct_url.json`). " + f"That is a REGRESSION at the declared pin, not a stale consumer, so " + f"it fails here instead of skipping: a skip would take thirteen node " + f"probes, three materialization assertions and every bundle suite " + f"quietly green in a required check.") + where = (f"the installed distribution was built from {installed[:8]}, while " + f"`pyproject.toml` declares {declared[:8]}" + if declared and installed else + "this installation records no PEP 610 provenance, so the two cannot " + "be compared and nothing is claimed about which commit is installed") + pytest.skip( + f"{subject} is missing, and this is NOT the declared pin's doing: {where}. " + f"Under the declared pin these suites RUN — reaching this reason means the " + f"`opendox` actually installed came from somewhere else (an assembly at " + f"its own pin, or a stale editable checkout).", + allow_module_level=module_level) + + _STAGED: Path | None = None @@ -124,7 +209,7 @@ def require(*, module_level: bool = True) -> Path: if _STAGED is None: web = find() if web is None: - pytest.skip(_REASON, allow_module_level=module_level) + _absent("openDox's `web/` bundle", module_level=module_level) staging = Path(tempfile.mkdtemp(prefix="opendox-bundle-")) atexit.register(shutil.rmtree, staging, True) target = staging / "web" diff --git a/tests/test_dependency_direction.py b/tests/test_dependency_direction.py index 843eaf8..9d52bf3 100644 --- a/tests/test_dependency_direction.py +++ b/tests/test_dependency_direction.py @@ -326,15 +326,23 @@ def test_the_doc_health_implementation_surface_is_exactly_declared() -> None: #: head of that slice and from the 13 / 19 over six modules that the census #: RULED 5626260214 called "the 13-line openDox->openXdox inversion" stood at. #: -#: THE PIN HAS MOVED TWICE SINCE, AND THE TABLE HAS NOT — measured, not assumed. +#: THE PIN HAS MOVED TWICE SINCE — two bumps of THIS file's own declaration, +#: `0f1f2e59` -> `a99eba03` (openXdox-code#15) and `a99eba03` -> `0b4e8bbf` +#: (this act) — AND THE TABLE HAS NOT. Measured, not assumed. (Two pin bumps, +#: three upstream landings: they are different counts of different things, and +#: both are stated here so neither can be read as the other.) #: This note used to say slice 2b's merge was the commit "this file's pin now #: names"; that stopped being true at openXdox-code#15 (`0f1f2e59` -> #: `a99eba03`) and the sentence was not followed, which is the stale-claim class #: this repository has since had to sweep for. The pin names `0b4e8bbf` #: (openDox-code#23, § 3.4 slice S8 leg B) as of 2026-09-16, and #: `_back_import_census()` recomputed against THAT tree returns exactly the five -#: rows below — so the ratchet neither fell nor rose across two openDox slices, -#: and the numbers here are the measurement, not a carried-forward memory. +#: rows below. THE RANGE THAT COVERS IS THREE openDox-code LANDINGS, not two, and +#: naming them is the correction Copilot's round-1 review of openXdox-code#21 +#: asked for: from `a99eba03` (#11, § 4.3) this pin crosses `8efb3cf5` (#20, +#: § 3.4 slice S5 leg B), `1e469713` (#21, § 3.4 slice S7) and `0b4e8bbf` (#23, +#: § 3.4 slice S8 leg B). The ratchet neither fell nor rose across any of them, +#: and the numbers here are that measurement, not a carried-forward memory. #: #: THE WHOLE OF THE INVERSION IS GONE, which is worth stating plainly because #: this table has never been able to say it before: no module of the pinned diff --git a/tests/test_gate_loop_probes.py b/tests/test_gate_loop_probes.py index 49ab966..f1f2269 100644 --- a/tests/test_gate_loop_probes.py +++ b/tests/test_gate_loop_probes.py @@ -139,21 +139,27 @@ def bundle(tmp_path) -> Path: """A COMPOSED bundle: openDox's own `web/`, with this column's six modules placed into it by the assembly hook RULED Q5 names. - Skipped — never failed — where the assembled `opendox` carries no bundle. - That was this leg's pinned state until the 2026-09-16 pin bump and is not - any more; the skip remains for an assembly that installs an older openDox - than this leg declares, because a probe that quietly ran against a stand-in - `helpers.js` would measure the stand-in rather than the shipped file. + Skipped where the assembled `opendox` carries no bundle AND that openDox is + demonstrably not the one this leg declares; FAILED where it IS the declared + one. That was a plain skip until the 2026-09-16 pin bump, when a missing + bundle stopped being the expected state and started being a regression — + see `tests/opendox_bundle.py::_absent`, which reads both commits before it + decides. A probe that quietly ran against a stand-in `helpers.js` would + measure the stand-in rather than the shipped file, so the skip is still the + right outcome for a genuinely older consumer. """ source = _opendox_bundle() if source is None: - pytest.skip( - "the installed `opendox` carries no `web/` bundle, so there is " - "nothing to assemble into. This leg's declared pin is NOT the " - "explanation any more — it names openDox-code#23 (`0b4e8bbf`), " - "which carries the bundle, and under it these probes run. Reaching " - "this reason means the installed `opendox` came from somewhere " - "older than the declared pin") + # FAIL at the declared pin, SKIP only for a different one — the shared + # rule in `tests/opendox_bundle.py::_absent`, which READS the installed + # distribution's PEP 610 provenance instead of asserting it. Copilot's + # round-1 review of #21 found this file claiming "came from somewhere + # older than the declared pin" on a check that only tested for a marker; + # if `0b4e8bbf` itself ever stopped shipping `web/**`, all thirteen + # probes below would have skipped and this required check would have + # stayed green over the regression. + import opendox_bundle + opendox_bundle._absent("openDox's `web/` bundle", module_level=False) target = tmp_path / "web" shutil.copytree(source, target) web_assets.install_view_modules(target) diff --git a/tests/test_gate_loop_views.py b/tests/test_gate_loop_views.py index 38c5fe9..31238d8 100644 --- a/tests/test_gate_loop_views.py +++ b/tests/test_gate_loop_views.py @@ -629,20 +629,33 @@ def _view_extension_or_skip(): leg's declared pin — the section header above says so — and an assembly is free to install an openDox behind the view contract. That is the same condition `view_extensions.ViewContractUnsupported` names at runtime, and - these two skips are its test-time counterpart. + these two guards are its test-time counterpart. + + BUT THEY NO LONGER SKIP BLINDLY. Copilot's round-1 review of openXdox-code#21 + was right that `pytest.importorskip` cannot tell "an older assembly" from "a + regression in the openDox this leg DECLARES", and after the bump only the + first of those may skip: if `0b4e8bbf` lost `view_extension` or the `exports` + field, all three assertions below would have gone quietly green in a required + check. `tests/opendox_bundle.py::_absent` decides by READING the declared pin + out of `pyproject.toml` and the installed commit out of the distribution's + PEP 610 `direct_url.json`: equal -> FAIL, different (or unrecorded) -> SKIP, + with both commits named in the reason either way. """ - view_extension = pytest.importorskip( - "opendox.view_extension", - reason="the assembled `opendox` has no `view_extension` module (§ 3.4 " - "slice S3's view registry); the specs above are asserted as " - "data, and the materialization is asserted wherever a " - "contract-bearing opendox is installed") + import opendox_bundle + try: + from opendox import view_extension + except ImportError: + # FAIL at the declared pin, SKIP only for a different one. `importorskip` + # could not tell those apart, and after the pin bump that difference is + # the whole point: a packaging or API regression at `0b4e8bbf` would have + # taken all three assertions below quietly green in a required check. + opendox_bundle._absent( + "`opendox.view_extension` (§ 3.4 slice S3's view registry)", + module_level=False) if "exports" not in getattr(view_extension.ViewBinding, "__annotations__", {}): - pytest.skip( - "the assembled `opendox.view_extension.ViewBinding` does not take " - "RULED Q2's `exports` field (openxFactory#656 comment 5648049748); " - "this leg's own pin does — reaching this skip means the installed " - "`opendox` is older than the declared one") + opendox_bundle._absent( + "RULED Q2's `exports` field on `opendox.view_extension.ViewBinding` " + "(openxFactory#656 comment 5648049748)", module_level=False) return view_extension From 7bd76b1cdf1b71df7bfc6b6076abeb38ebb6a9cf Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 15:19:29 +0000 Subject: [PATCH 03/33] Copilot round 2: unknown provenance FAILS on the required path, the probe docstring stops contradicting the guard, and the guard's four branches get direct tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Round 2 (5224608579 at 4a7ccb2, "Changes recommended") filed TWO suppressed comments and ONE thread. All three are accurate and all three are fixed. 1. SUPPRESSED, tests/opendox_bundle.py:166 — "when installed_commit() is unavailable or malformed, this branch skips instead of failing … the required validate job can still go green with a missing bundle". Correct, and it is the exact silence the guard exists to break. `_absent()` now splits the unknown case by PATH: under CI it FAILS, off CI it still skips. The reason is not arbitrary — validate.yml installs `-e ".[test]"` against a PEP 508 direct VCS reference and pip records direct_url.json for that every time, so on the required path an unreadable provenance is itself the anomaly; on a developer box an editable checkout or a hand-placed wheel lawfully has none. `CI=true` is what GitHub Actions sets, and `under_ci()` reads exactly that. 2. SUPPRESSED, tests/test_gate_loop_probes.py:37 — the module docstring still said a probe "SKIPS … never fails", which the round-1 guard had already stopped being true. Rewritten to state both outcomes and which input chooses which. 3. THREAD PRRT_kwDOUPv7_s6i_iiz — "the new provenance decision is only exercised indirectly … there are no tests". Correct: round 1 proved it by hand, by renaming the installed bundle and re-running. SIX direct tests now pin all four branches plus `under_ci()`'s parsing and the fact that declared_pin() re-reads this leg's own pyproject rather than holding a constant. They live in test_gate_loop_probes.py, not a new file: a created file at this leg needs an admission row in openxFactory's docs/opendox-carve-admissions.yaml (RULED OQ-C), and adding one is not a pin bump's act — while this module is already admitted, already on validate.yml's list, and already owns the fixture the decision gates. RE-PROVED BY SIMULATION, all four branches, with CI=true as the runner has it: declared pin loses web/ 13 skipped -> 13 errors declared pin loses view_extension 3 skipped -> 3 failed bundle missing + provenance unrecorded, CI 13 skipped -> 13 errors bundle missing + provenance unrecorded, off CI 13 skipped (unchanged, lawful) Under the declared pin the required invocation is 317 passed / 6 skipped -> 323 passed / 6 skipped, the six being the new tests and nothing else moving. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- tests/opendox_bundle.py | 62 ++++++++++++++++++---- tests/test_gate_loop_probes.py | 94 ++++++++++++++++++++++++++++++++-- 2 files changed, 141 insertions(+), 15 deletions(-) diff --git a/tests/opendox_bundle.py b/tests/opendox_bundle.py index 763ab47..dd54984 100644 --- a/tests/opendox_bundle.py +++ b/tests/opendox_bundle.py @@ -55,10 +55,12 @@ import atexit import json +import os import re import shutil import tempfile from pathlib import Path +from typing import NoReturn import pytest @@ -147,8 +149,31 @@ def installed_commit() -> str | None: return commit if isinstance(commit, str) and len(commit) == 40 else None -def _absent(subject: str, *, module_level: bool): - """Raise the RIGHT outcome for a missing `subject` — fail at the declared pin.""" +def under_ci() -> bool: + """True on the REQUIRED path — GitHub Actions sets `CI=true` on every runner.""" + return os.environ.get("CI", "").strip().lower() in {"1", "true", "yes"} + + +def _absent(subject: str, *, module_level: bool) -> NoReturn: + """Raise the RIGHT outcome for a missing `subject`. + + | installed vs declared | outcome | + | --- | --- | + | equal | FAIL — a regression at the pin this leg declares | + | different | SKIP — a consumer assembling at its own, older pin | + | UNKNOWN, under CI | FAIL — see below | + | UNKNOWN, off CI | SKIP — a developer box may install however it likes | + + THE "UNKNOWN, UNDER CI" ROW IS COPILOT ROUND 2's FINDING, and it was right: + skipping on unknown provenance left the required `validate` job able to go + green with the bundle missing, which is the exact silence this guard exists to + break. On the required path unknown provenance is not a neutral state — + `validate.yml` installs with `pip install -e ".[test]"` against a PEP 508 + direct VCS reference, and pip records `direct_url.json` for that every time — + so failing to read one there is itself the anomaly. Off CI the permissive + branch stays, because an editable checkout or a hand-placed wheel is a lawful + way to work and has no provenance to record. + """ declared, installed = declared_pin(), installed_commit() if declared is not None and installed is not None and declared == installed: pytest.fail( @@ -159,16 +184,31 @@ def _absent(subject: str, *, module_level: bool): f"it fails here instead of skipping: a skip would take thirteen node " f"probes, three materialization assertions and every bundle suite " f"quietly green in a required check.") - where = (f"the installed distribution was built from {installed[:8]}, while " - f"`pyproject.toml` declares {declared[:8]}" - if declared and installed else - "this installation records no PEP 610 provenance, so the two cannot " - "be compared and nothing is claimed about which commit is installed") + if declared is None or installed is None: + if under_ci(): + pytest.fail( + f"{subject} is missing AND this run cannot say which `opendox` is " + f"installed (declared={declared or 'unreadable'}, " + f"installed={installed or 'unrecorded'}). On CI that is itself the " + f"anomaly: `validate.yml` installs `-e \".[test]\"` against a PEP 508 " + f"direct VCS reference, and pip records `direct_url.json` for that " + f"every time. Failing rather than skipping, because a skip here is " + f"exactly the silent green this guard exists to prevent.") + pytest.skip( + f"{subject} is missing, and this installation records no PEP 610 " + f"provenance (declared={declared or 'unreadable'}, " + f"installed={installed or 'unrecorded'}), so nothing is claimed about " + f"which commit is installed. Off the CI path that is lawful — an " + f"editable checkout or a hand-placed wheel has none. Under CI this same " + f"condition FAILS.", + allow_module_level=module_level) pytest.skip( - f"{subject} is missing, and this is NOT the declared pin's doing: {where}. " - f"Under the declared pin these suites RUN — reaching this reason means the " - f"`opendox` actually installed came from somewhere else (an assembly at " - f"its own pin, or a stale editable checkout).", + f"{subject} is missing, and this is NOT the declared pin's doing: the " + f"installed distribution was built from {installed[:8]}, while " + f"`pyproject.toml` declares {declared[:8]}. Under the declared pin these " + f"suites RUN — reaching this reason means the `opendox` actually installed " + f"came from somewhere else (an assembly at its own pin, or a stale editable " + f"checkout).", allow_module_level=module_level) diff --git a/tests/test_gate_loop_probes.py b/tests/test_gate_loop_probes.py index f1f2269..f6d4075 100644 --- a/tests/test_gate_loop_probes.py +++ b/tests/test_gate_loop_probes.py @@ -31,10 +31,15 @@ the three materialization assertions in `test_gate_loop_views.py` that waited on the same bump went 3 skipped -> 3 passed beside them. -The skip below is kept for the case it was always really about: where the -installed `opendox` carries no bundle there is nothing to assemble INTO, and a -probe SKIPS with that reason named — never fails, and never silently passes -against a stand-in. +WHAT A MISSING BUNDLE MEANS NOW, stated precisely — Copilot's round-2 review of +#21 caught this paragraph still saying "SKIPS … never fails", which the guard had +already stopped doing. Where the installed `opendox` carries no bundle there is +nothing to assemble INTO, and `tests/opendox_bundle.py::_absent` decides between +two different outcomes by READING which openDox is installed: a DIFFERENT (older) +one, or no recorded provenance off the CI path, SKIPS with both commits named; the +DECLARED one — or unreadable provenance under CI — FAILS, because that is a +regression here and a skip would take these thirteen probes quietly green in a +required check. Neither outcome ever passes silently against a stand-in. A CREATED file: no row in openxFactory's `docs/opendox-carve-manifest.yaml` (RULED OQ-C), admitted by path in the S5 annotation. @@ -643,3 +648,84 @@ def test_js_a_built_transport_keeps_the_model_it_validated(bundle) -> None: assert result["b"]["tag"] == "second", result["b"] # and the BODIES were shaped by the right model too, not only the verdicts assert result["sent"] == ["first", "second"] + + +# --------------------------------------------------------------------------- +# THE GUARD ITSELF, TESTED DIRECTLY — Copilot round-2 thread on #21 +# (`PRRT_kwDOUPv7_s6i_iiz`, "the new provenance decision is only exercised +# indirectly on the normal bundle-present path; there are no tests"). Accurate: +# the four branches had been proven by hand, by renaming the installed bundle and +# re-running. That proof is now permanent and runs in `validate`. +# +# These live HERE rather than in a new file on purpose: a created file at this leg +# needs an admission row in openxFactory's `docs/opendox-carve-admissions.yaml` +# (RULED OQ-C), and adding one is not a pin bump's act. This module is already +# admitted, already on `validate.yml`'s list, and already owns the fixture whose +# thirteen probes the decision gates. +# --------------------------------------------------------------------------- + +import opendox_bundle as _ob # noqa: E402 (a helper import, never OPENDOX_WEB) + +_PIN_A = "a" * 40 +_PIN_B = "b" * 40 + + +def _decide(monkeypatch, declared, installed, *, ci): + monkeypatch.setattr(_ob, "declared_pin", lambda: declared) + monkeypatch.setattr(_ob, "installed_commit", lambda: installed) + monkeypatch.setenv("CI", "true" if ci else "") + return lambda: _ob._absent("the subject under test", module_level=False) + + +def test_the_declared_pin_missing_its_bundle_FAILS(monkeypatch) -> None: + """The regression case: what is installed IS what this leg declares.""" + call = _decide(monkeypatch, _PIN_A, _PIN_A, ci=False) + with pytest.raises(pytest.fail.Exception) as raised: + call() + assert "REGRESSION at the declared pin" in str(raised.value) + assert _PIN_A[:8] in str(raised.value) + + +def test_a_different_installed_commit_SKIPS_and_names_both(monkeypatch) -> None: + """The lawful case: a consumer assembling at its own, older pin.""" + call = _decide(monkeypatch, _PIN_A, _PIN_B, ci=True) + with pytest.raises(pytest.skip.Exception) as raised: + call() + message = str(raised.value) + assert _PIN_A[:8] in message and _PIN_B[:8] in message + assert "NOT the declared pin's doing" in message + + +def test_unknown_provenance_FAILS_under_ci(monkeypatch) -> None: + """The round-2 finding: on the REQUIRED path, unknown is not neutral.""" + call = _decide(monkeypatch, _PIN_A, None, ci=True) + with pytest.raises(pytest.fail.Exception) as raised: + call() + assert "cannot say which `opendox` is installed" in str(raised.value) + + +def test_unknown_provenance_SKIPS_off_ci(monkeypatch) -> None: + """...and off it, an editable checkout has no provenance to record.""" + call = _decide(monkeypatch, _PIN_A, None, ci=False) + with pytest.raises(pytest.skip.Exception) as raised: + call() + assert "no PEP 610 provenance" in str(raised.value) + + +def test_under_ci_reads_the_environment_the_runner_sets(monkeypatch) -> None: + """`CI=true` is what GitHub Actions sets; nothing else is treated as CI.""" + for value, expected in (("true", True), ("TRUE", True), ("1", True), + ("yes", True), ("false", False), ("", False)): + monkeypatch.setenv("CI", value) + assert _ob.under_ci() is expected, value + monkeypatch.delenv("CI", raising=False) + assert _ob.under_ci() is False + + +def test_the_declared_pin_is_read_from_this_legs_own_pyproject() -> None: + """Not a constant: the guard re-reads the file the bump edits.""" + declared = _ob.declared_pin() + assert declared is not None and len(declared) == 40 + toml = (Path(__file__).resolve().parents[1] / "pyproject.toml").read_text( + encoding="utf-8") + assert f"openDox-code@{declared}" in toml From 296bda716be81eda5866e72c536f212c0f0fb551 Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 15:27:21 +0000 Subject: [PATCH 04/33] Copilot round 3: the PEP 610 parser gets its own tests, and three documents stop contradicting the guard they describe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Round 3 (5224712952 at 7bd76b1, "Changes recommended") filed FOUR suppressed comments and TWO threads. All six are accurate; none needed a design change. 1. SUPPRESSED, tests/opendox_bundle.py:149 — "all six direct guard tests monkeypatch installed_commit() and therefore bypass this code … a parser regression can change the CI decision while the required tests remain green." Exactly right: round 2's tests pinned the DECISION, nothing pinned the READING it decides on. SEVEN more tests now drive the parser itself through a fake distribution installed over `importlib.metadata.distribution`: a real `vcs_info.commit_id`, an absent direct_url.json, malformed JSON, a non-VCS (archive_info) install, a commit id that is not 40 hex, and no distribution at all — plus one that states in an assertion why the other six exist. 2. SUPPRESSED, tests/opendox_bundle.py:136 — `installed_commit()`'s docstring said callers "skip rather than guess" on None, which stopped being true when round 2 made None FAIL under CI. Corrected, and it now points at `_absent()`'s table rather than restating it. 3. THREAD PRRT_kwDOUPv7_s6i_wED — the module's own decision table still said unreadable provenance always SKIPs. Rewritten to carry both rows. 4. THREAD PRRT_kwDOUPv7_s6i_wE8 — test_gate_loop_views.py's docstring said "different (or unrecorded) -> SKIP". The parenthesis was false for the same reason. Corrected, with the real table in place of it. 5-6. SUPPRESSED, .github/workflows/validate.yml:203, TWO findings on one block and both right. (a) the recorded count 317 predated the guard tests, which live in test_gate_loop_probes.py and are therefore on the required list: it is now 330. (b) "the 17 skips that cleared" conflated two different things. SIXTEEN skips became passes (3 materialization assertions + 13 node probes) — that is the bump's own effect. The seventeenth did NOT clear: it was test_doxbench_mutation_boundary.py's module-level skip, which at the new pin becomes a COLLECTION ERROR, so the file left the list and that skip is no longer RUN rather than cleared. The block now says all three numbers and which act each belongs to: 301/23 -> 317/6 by the bump, -> 330/6 with the 13 tests review rounds 2 and 3 asked for. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- .github/workflows/validate.yml | 25 +++++++++-- tests/opendox_bundle.py | 22 ++++++++-- tests/test_gate_loop_probes.py | 78 ++++++++++++++++++++++++++++++++++ tests/test_gate_loop_views.py | 8 +++- 4 files changed, 123 insertions(+), 10 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 09cdad4..051dff3 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -197,10 +197,27 @@ jobs: # alongside `test_doxbench_turns.py`. # # WITH IT GONE AND THE PIN MOVED, this invocation goes 301 passed / - # 23 skipped -> 317 passed / 6 skipped. The 17 skips that cleared are the - # 3 materialization assertions, the 13 node probes and this file's own - # module-level skip; the 6 that remain are the three seam suites' - # `doc_health` pairs, which no pin bump touches. + # 23 skipped -> 330 passed / 6 skipped, and BOTH HALVES OF THAT DELTA HAVE + # TO BE SAID SEPARATELY, because Copilot's round-3 review of #21 caught this + # block conflating them: + # + # * SIXTEEN skips became PASSES — the 3 materialization assertions in + # `tests/test_gate_loop_views.py` and the 13 node probes in + # `tests/test_gate_loop_probes.py`. That is the pin bump's own effect, + # and it is the whole point of the act. + # * The seventeenth skip did NOT clear. It was + # `tests/test_doxbench_mutation_boundary.py`'s module-level skip, and at + # the new pin it becomes a COLLECTION ERROR (see the block above); the + # file leaves this list, so that skip is no longer RUN rather than + # cleared. Counting it as cleared would describe a transition that never + # happened. + # * The remaining rise to 330 is NOT the bump: it is the 13 direct tests + # of the provenance guard that Copilot's rounds 2 and 3 asked for, which + # live in `tests/test_gate_loop_probes.py` and are therefore on this + # list. The bump alone measured 317. + # + # The 6 skips that remain are the three seam suites' `doc_health` pairs, + # which no pin bump touches. # # `--noconftest` STAYS, and it is why this list is a list: `tests/ # conftest.py` imports the carved session fixtures, which reach both diff --git a/tests/opendox_bundle.py b/tests/opendox_bundle.py index dd54984..0f66463 100644 --- a/tests/opendox_bundle.py +++ b/tests/opendox_bundle.py @@ -111,8 +111,17 @@ def find() -> Path | None: # Bundle missing AND the two agree -> FAIL: a regression at the declared pin. # Bundle missing AND they differ -> SKIP: a consumer assembling at its own, # older pin, named in the reason. -# Provenance unreadable -> SKIP, saying so: nothing was measured, so -# nothing may be claimed either way. +# Provenance unreadable, UNDER CI -> FAIL. Round 2 of the same review was right +# that skipping here left the required job +# able to go green with the bundle missing; +# on the required path an unreadable +# provenance is itself the anomaly, because +# `validate.yml` installs a PEP 508 direct +# VCS reference and pip records one every +# time. +# Provenance unreadable, OFF CI -> SKIP, saying so: an editable checkout or a +# hand-placed wheel lawfully has none, and +# nothing measured means nothing claimed. # --------------------------------------------------------------------------- _PIN_RE = re.compile(r"opendox\s*@\s*git\+[^@\s\"']+@([0-9a-f]{40})") @@ -132,8 +141,13 @@ def installed_commit() -> str | None: """The commit the INSTALLED `opendox` was built from (PEP 610), or None. None is not "no provenance exists"; it is "this installation did not record - one" — an editable checkout, a wheel copied in by hand. The callers treat it - as unknown and skip rather than guess. + one" — an editable checkout, a wheel copied in by hand. + + WHAT THE CALLER DOES WITH None IS NOT "always skip", and this docstring said + so until Copilot's round-3 review of #21 caught it: `_absent()` FAILS on None + under CI and SKIPS off it. The rule is the required path, not the value — + see `_absent()`'s own table. A future caller that reads only this line would + otherwise bypass the safety rule the required check depends on. """ try: from importlib.metadata import distribution diff --git a/tests/test_gate_loop_probes.py b/tests/test_gate_loop_probes.py index f6d4075..6e3cdaf 100644 --- a/tests/test_gate_loop_probes.py +++ b/tests/test_gate_loop_probes.py @@ -729,3 +729,81 @@ def test_the_declared_pin_is_read_from_this_legs_own_pyproject() -> None: toml = (Path(__file__).resolve().parents[1] / "pyproject.toml").read_text( encoding="utf-8") assert f"openDox-code@{declared}" in toml + + +# --- THE PEP 610 PARSER ITSELF, not a monkeypatched stand-in ----------------- +# Copilot round 3 on #21: "all six direct guard tests monkeypatch +# `installed_commit()` and therefore bypass this code … a parser regression can +# change the CI decision while the required tests remain green." Accurate — the +# tests above pin the DECISION, these pin the READING it decides on. A fake +# distribution is installed over `importlib.metadata.distribution`, which is the +# exact name `installed_commit()` resolves at call time. + +class _FakeDist: + """Just enough of `importlib.metadata.Distribution` for `read_text`.""" + + def __init__(self, payload): + self._payload = payload + + def read_text(self, name): + if name != "direct_url.json": # pragma: no cover - never asked + return None + if isinstance(self._payload, Exception): + raise self._payload + return self._payload + + +def _with_dist(monkeypatch, payload): + import importlib.metadata as md + monkeypatch.setattr(md, "distribution", lambda name: _FakeDist(payload)) + + +def test_installed_commit_reads_a_real_vcs_record(monkeypatch) -> None: + _with_dist(monkeypatch, json.dumps( + {"url": "https://github.com/opensoft/openDox-code", + "vcs_info": {"vcs": "git", "commit_id": _PIN_B}})) + assert _ob.installed_commit() == _PIN_B + + +def test_installed_commit_is_none_when_the_file_is_absent(monkeypatch) -> None: + _with_dist(monkeypatch, None) + assert _ob.installed_commit() is None + + +def test_installed_commit_is_none_on_malformed_json(monkeypatch) -> None: + _with_dist(monkeypatch, "{not json at all") + assert _ob.installed_commit() is None + + +def test_installed_commit_is_none_for_a_non_vcs_install(monkeypatch) -> None: + """A wheel installed from an archive records `archive_info`, not `vcs_info`.""" + _with_dist(monkeypatch, json.dumps( + {"url": "file:///tmp/opendox-0.0.0-py3-none-any.whl", + "archive_info": {"hash": "sha256=abc"}})) + assert _ob.installed_commit() is None + + +def test_installed_commit_refuses_a_commit_id_that_is_not_40_hex(monkeypatch) -> None: + """A short id is not a commit this guard may compare — round 3's parser case.""" + _with_dist(monkeypatch, json.dumps({"vcs_info": {"commit_id": "0b4e8bbf"}})) + assert _ob.installed_commit() is None + + +def test_installed_commit_is_none_when_the_package_is_not_installed(monkeypatch) -> None: + from importlib.metadata import PackageNotFoundError + _with_dist(monkeypatch, PackageNotFoundError("opendox")) + assert _ob.installed_commit() is None + + +def test_a_parser_regression_would_now_be_caught_before_it_reaches_the_decision() -> None: + """The point of the six above, stated as an assertion rather than a comment. + + `_absent()` branches on `installed_commit()`'s RETURN VALUE, so every test of + the decision that monkeypatches that function proves nothing about the + reading. These six cover the reading: a real VCS record, an absent file, + malformed JSON, a non-VCS install, a too-short id, and no distribution at all. + """ + import inspect + source = inspect.getsource(_ob.installed_commit) + assert "direct_url.json" in source and "vcs_info" in source + assert "len(commit) == 40" in source diff --git a/tests/test_gate_loop_views.py b/tests/test_gate_loop_views.py index 31238d8..a0f6923 100644 --- a/tests/test_gate_loop_views.py +++ b/tests/test_gate_loop_views.py @@ -638,8 +638,12 @@ def _view_extension_or_skip(): field, all three assertions below would have gone quietly green in a required check. `tests/opendox_bundle.py::_absent` decides by READING the declared pin out of `pyproject.toml` and the installed commit out of the distribution's - PEP 610 `direct_url.json`: equal -> FAIL, different (or unrecorded) -> SKIP, - with both commits named in the reason either way. + PEP 610 `direct_url.json`. This docstring said "different (or unrecorded) -> + SKIP", and Copilot's round-3 review of #21 was right that the parenthesis is + false: UNRECORDED provenance FAILS under CI and skips only off it, because a + skip on the required path is the silent green the guard exists to prevent. + The table `_absent()` actually carries: equal -> FAIL; different -> SKIP with + both commits named; unrecorded -> FAIL under CI, SKIP off it. """ import opendox_bundle try: From 42741fdb3f6b7990462c905502766f8dfd3aa09f Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 15:28:48 +0000 Subject: [PATCH 05/33] SonarCloud, advisory: split three composite assertions in the new provenance tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SonarCloud's quality gate on this PR now carries three MAJOR code smells, all in tests added by rounds 2 and 3 of this review and all the same rule (S5754-class "Split this composite assertion into separate assertions"): test_gate_loop_probes.py :695, :728 and :808. They are mine and they are trivially right — a compound assertion reports only that the conjunction failed, not which half — so they are split rather than argued with. No behaviour changes; 26 passed in this file either way. SonarCloud's remaining finding is unchanged and is answered in the pull request body: a VULNERABILITY at .github/workflows/validate.yml:40, a line byte-identical to main and in no changed hunk of this PR, under a rule (--only-binary :all:) that an editable install of a PEP 508 direct VCS reference cannot satisfy. SonarCloud is advisory here; validate is the required check and is SUCCESS. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- tests/test_gate_loop_probes.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/test_gate_loop_probes.py b/tests/test_gate_loop_probes.py index 6e3cdaf..b313d3e 100644 --- a/tests/test_gate_loop_probes.py +++ b/tests/test_gate_loop_probes.py @@ -692,7 +692,8 @@ def test_a_different_installed_commit_SKIPS_and_names_both(monkeypatch) -> None: with pytest.raises(pytest.skip.Exception) as raised: call() message = str(raised.value) - assert _PIN_A[:8] in message and _PIN_B[:8] in message + assert _PIN_A[:8] in message + assert _PIN_B[:8] in message assert "NOT the declared pin's doing" in message @@ -725,7 +726,8 @@ def test_under_ci_reads_the_environment_the_runner_sets(monkeypatch) -> None: def test_the_declared_pin_is_read_from_this_legs_own_pyproject() -> None: """Not a constant: the guard re-reads the file the bump edits.""" declared = _ob.declared_pin() - assert declared is not None and len(declared) == 40 + assert declared is not None + assert len(declared) == 40 toml = (Path(__file__).resolve().parents[1] / "pyproject.toml").read_text( encoding="utf-8") assert f"openDox-code@{declared}" in toml @@ -805,5 +807,6 @@ def test_a_parser_regression_would_now_be_caught_before_it_reaches_the_decision( """ import inspect source = inspect.getsource(_ob.installed_commit) - assert "direct_url.json" in source and "vcs_info" in source + assert "direct_url.json" in source + assert "vcs_info" in source assert "len(commit) == 40" in source From 7c0a3b64d361b30018944ea041a1f6109af8e821 Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 15:38:41 +0000 Subject: [PATCH 06/33] Copilot at 42741fd: a 40-character non-hex id is no longer a commit, and three summaries stop promising a skip the guard will not give MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Review 5224863846 at 42741fd ("Needs a closer look") filed THREE suppressed comments and left one thread open from the head before it. All four are accurate. 1. THE ONE THAT MATTERED, and it is the silent green reached through the PARSER rather than through the decision. `installed_commit()` accepted any forty CHARACTERS as a commit id, so a malformed `direct_url.json` carrying a forty-character non-hex value read as "a different pin" and `_absent()` SKIPPED under CI — exactly the outcome the provenance check exists to prevent. It now requires `vcs_info.vcs == "git"` AND a 40-lowercase-hex `commit_id`, and two more parser tests pin both refusals (a 40-character non-hex id, and a 40-hex id under a non-git VCS). The earlier fixtures gained the `vcs` field they were always describing. 2-4. THREE SUMMARIES still promising an unconditional skip while the code below them fails closed — the same defect this pull request exists to sweep for, three more times, in text I wrote two rounds ago: `require()`'s docstring, `web()`'s, and `_view_extension_or_skip()`'s opening line (which contradicted the decision table four paragraphs further down in its own docstring). All three now carry the outcome, because the summary is the line a reader trusts. AND THE THREAD, PRRT_kwDOUPv7_s6i_8cx: the workflow said 330 while the PR description still said 323 and "six" tests. The description was updated at 15:29Z; the workflow figure is now re-derived again as 332 / FIFTEEN, and the block records the whole series — 317 -> 323 -> 330 -> 332, one step per round that added tests — rather than a bare current number, so the next reader can see which act each part belongs to. MEASURED after all of it: the required invocation is 332 passed / 6 skipped, and the guard still fails closed — with `CI=true` and `opendox/web` removed, the thirteen probes are 13 errors, not 13 skips. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- .github/workflows/validate.yml | 11 +++++++---- tests/opendox_bundle.py | 28 ++++++++++++++++++++++------ tests/test_gate_loop_probes.py | 23 ++++++++++++++++++++++- tests/test_gate_loop_views.py | 8 +++++++- 4 files changed, 58 insertions(+), 12 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 051dff3..031149d 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -197,7 +197,7 @@ jobs: # alongside `test_doxbench_turns.py`. # # WITH IT GONE AND THE PIN MOVED, this invocation goes 301 passed / - # 23 skipped -> 330 passed / 6 skipped, and BOTH HALVES OF THAT DELTA HAVE + # 23 skipped -> 332 passed / 6 skipped, and BOTH HALVES OF THAT DELTA HAVE # TO BE SAID SEPARATELY, because Copilot's round-3 review of #21 caught this # block conflating them: # @@ -211,10 +211,13 @@ jobs: # file leaves this list, so that skip is no longer RUN rather than # cleared. Counting it as cleared would describe a transition that never # happened. - # * The remaining rise to 330 is NOT the bump: it is the 13 direct tests - # of the provenance guard that Copilot's rounds 2 and 3 asked for, which + # * The remaining rise to 332 is NOT the bump: it is the 15 direct tests + # of the provenance guard that Copilot's review rounds asked for, which # live in `tests/test_gate_loop_probes.py` and are therefore on this - # list. The bump alone measured 317. + # list. The bump alone measured 317. (This figure has been re-derived at + # every head rather than carried: 317 -> 323 -> 330 -> 332, once per + # round that added tests, which is the same discipline the block above + # applies to the skip counts.) # # The 6 skips that remain are the three seam suites' `doc_health` pairs, # which no pin bump touches. diff --git a/tests/opendox_bundle.py b/tests/opendox_bundle.py index 0f66463..a853292 100644 --- a/tests/opendox_bundle.py +++ b/tests/opendox_bundle.py @@ -124,6 +124,8 @@ def find() -> Path | None: # nothing measured means nothing claimed. # --------------------------------------------------------------------------- +_SHA_RE = re.compile(r"[0-9a-f]{40}") + _PIN_RE = re.compile(r"opendox\s*@\s*git\+[^@\s\"']+@([0-9a-f]{40})") @@ -157,10 +159,20 @@ def installed_commit() -> str | None: if not raw: return None try: - commit = json.loads(raw).get("vcs_info", {}).get("commit_id") + vcs_info = json.loads(raw).get("vcs_info") or {} + vcs, commit = vcs_info.get("vcs"), vcs_info.get("commit_id") except (ValueError, AttributeError): # pragma: no cover - malformed return None - return commit if isinstance(commit, str) and len(commit) == 40 else None + # BOTH CHECKS ARE LOAD-BEARING, and the second is Copilot's finding at the + # head before this one: `len(commit) == 40` admitted any forty CHARACTERS, so + # a malformed record carrying a forty-character non-hex id read as "a + # different pin" and `_absent()` SKIPPED under CI — the silent green this + # whole guard exists to prevent, reached through the parser instead of + # through the decision. A commit id is 40 lowercase hex and the record must + # say it is git, or this function does not know what is installed. + if vcs != "git" or not isinstance(commit, str): + return None + return commit if _SHA_RE.fullmatch(commit) else None def under_ci() -> bool: @@ -230,8 +242,11 @@ def _absent(subject: str, *, module_level: bool) -> NoReturn: def require(*, module_level: bool = True) -> Path: - """The pinned bundle, STAGED once per process as an ESM-marked tree — or - SKIP where the pin carries no bundle. + """The pinned bundle, STAGED once per process as an ESM-marked tree — or, + where there is none, whatever `_absent()` decides: FAIL for the pin this leg + DECLARES (and for unknown provenance under CI), SKIP for a demonstrably + different consumer. It is not an unconditional skip, and this docstring said + it was until Copilot's review of `42741fd` on #21. `module_level=True` skips the IMPORTING MODULE, which is what the thirty suites whose whole subject is the bundle want. `web()` below passes False, @@ -293,8 +308,9 @@ def require(*, module_level: bool = True) -> Path: def web() -> Path: - """The pinned bundle, skipping ONLY THE CALLING TEST where the pin carries - none. + """The pinned bundle; where there is none, `_absent()`'s outcome scoped to + the CALLING TEST rather than the module — a FAIL for the declared pin (or + unknown provenance under CI) and a SKIP for a different consumer. FOR THE SUITE WHOSE SUBJECT IS NOT THE BUNDLE (Copilot review of `openXdox-code#19` is the class of finding this anticipates, and the diff --git a/tests/test_gate_loop_probes.py b/tests/test_gate_loop_probes.py index b313d3e..f327b77 100644 --- a/tests/test_gate_loop_probes.py +++ b/tests/test_gate_loop_probes.py @@ -787,7 +787,28 @@ def test_installed_commit_is_none_for_a_non_vcs_install(monkeypatch) -> None: def test_installed_commit_refuses_a_commit_id_that_is_not_40_hex(monkeypatch) -> None: """A short id is not a commit this guard may compare — round 3's parser case.""" - _with_dist(monkeypatch, json.dumps({"vcs_info": {"commit_id": "0b4e8bbf"}})) + _with_dist(monkeypatch, json.dumps( + {"vcs_info": {"vcs": "git", "commit_id": "0b4e8bbf"}})) + assert _ob.installed_commit() is None + + +def test_installed_commit_refuses_forty_characters_that_are_not_hex(monkeypatch) -> None: + """THE SILENT-GREEN PATH THROUGH THE PARSER, caught at `42741fd`. + + `len(commit) == 40` admitted any forty characters, so a malformed record + carrying a forty-character non-hex id read as "a different pin" and `_absent()` + SKIPPED under CI — the exact outcome this guard exists to prevent, reached + through the reading rather than through the decision. + """ + _with_dist(monkeypatch, json.dumps( + {"vcs_info": {"vcs": "git", "commit_id": "z" * 40}})) + assert _ob.installed_commit() is None + + +def test_installed_commit_refuses_a_record_that_is_not_git(monkeypatch) -> None: + """A 40-hex id under a non-git VCS is not an openDox-code commit.""" + _with_dist(monkeypatch, json.dumps( + {"vcs_info": {"vcs": "hg", "commit_id": _PIN_B}})) assert _ob.installed_commit() is None diff --git a/tests/test_gate_loop_views.py b/tests/test_gate_loop_views.py index a0f6923..020d119 100644 --- a/tests/test_gate_loop_views.py +++ b/tests/test_gate_loop_views.py @@ -615,7 +615,13 @@ def test_the_style_residue_is_recorded_rather_than_skipped() -> None: # --------------------------------------------------------------------------- def _view_extension_or_skip(): - """The assembled openDox's view registry, or SKIP where it has none. + """The assembled openDox's view registry, or — where it has none — a FAIL if + that openDox is the one this leg DECLARES (or its provenance is unreadable + under CI) and a SKIP only for a demonstrably different consumer. + + The summary line used to read "or SKIP where it has none", which contradicted + the table four paragraphs down; Copilot's review of `42741fd` on #21 caught + it. The summary is the line a reader trusts, so it carries the outcome now. BOTH GUARDS ARE SATISFIED BY THIS LEG'S OWN PIN, since 2026-09-16. They were not when slice S5 wrote them: the pin was `a99eba03`, the first From 27a89fd09b1edd29ad7ed3477e8542936675393f Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 15:51:46 +0000 Subject: [PATCH 07/33] Review at 7c0a3b6: a test that asserted source text is gone, the uninstalled-package path is actually exercised, and four more summaries stop over-promising MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Review 5225005282 ("Changes recommended") filed SEVEN suppressed comments and one thread. All eight are accurate. Two are real test defects; six are prose that promised an outcome the guard does not give. TEST DEFECTS 1. `test_a_parser_regression_would_now_be_caught…` asserted strings against `inspect.getsource(installed_commit)`. Once the implementation stopped containing `len(commit) == 40` it passed only because an explanatory COMMENT still held that text: coupled to source, fails on a rename, catches no behaviour. DELETED rather than repaired — the parser cases already assert the results it was gesturing at — and the section comment now carries the case inventory instead, accurately (NINE, not the "six" the deleted docstring claimed, which was the fifth suppressed comment). 2. `_with_dist(PackageNotFoundError(...))` made `read_text` raise, so the test named for an uninstalled package never exercised `distribution("opendox")` failing — the call `installed_commit()` actually guards. A new `_with_no_dist` makes the LOOKUP raise, and the read-raises case keeps its own test, so both paths are now covered instead of one being mistaken for the other. PROSE, all of it mine from earlier rounds in this same review 3. `opendox_bundle.py`'s module docstring called an older source or stale editable checkout "an honest skip". Only two cases skip — a DIFFERENT recorded commit, and unrecorded provenance OFF CI — and "different" is all this guard proves: it measures disagreement, never an ordering. Rewritten to say exactly that. 4. `_absent()`'s failure message is shared with `_view_extension_or_skip()`, yet always claimed thirteen node probes and every bundle suite would go green. With only `view_extension` missing the bundle may be present and those probes run. The message now names its own `subject` instead of a fixed inventory. 5. The probes module docstring said the unrecorded case "SKIPS with both commits named" — it cannot name what it could not read. The three outcomes are now three bullets, and the unrecorded one says plainly that it names the declared commit and reports the installed one as unrecorded. 6. The `bundle` fixture's branch comment carried the same half-table. Fixed. 7. THREAD PRRT_kwDOUPv7_s6jAYwH — `_view_extension_or_skip`'s summary line, for the SECOND time: the first version omitted the failure, the replacement omitted the off-CI unrecorded skip. All four rows are on the line now. A half-table is how this sentence went wrong twice, so it no longer paraphrases the table. MEASURED: the required invocation is 332 passed / 6 skipped, unchanged — one test deleted, one added — so validate.yml's recorded figure needs no edit. Fail-closed still holds: CI=true with `opendox/web` removed gives 13 errors, not 13 skips. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- tests/opendox_bundle.py | 21 ++++---- tests/test_gate_loop_probes.py | 90 ++++++++++++++++++++++------------ tests/test_gate_loop_views.py | 19 ++++--- 3 files changed, 84 insertions(+), 46 deletions(-) diff --git a/tests/opendox_bundle.py b/tests/opendox_bundle.py index a853292..68a4c80 100644 --- a/tests/opendox_bundle.py +++ b/tests/opendox_bundle.py @@ -43,12 +43,16 @@ installed `opendox` carries no bundle", which was true of `a99eba03` and is quoted here as provenance, not as a claim. -THE SKIP STAYS, and it is not dead weight. An `opendox` installed from a source -older than the packaging declaration — a consumer assembling at its own pin, a -developer with a stale editable checkout — still carries no bundle, and the -honest outcome there is a SKIP, not a failure against a stand-in: a skipped -suite says "the pin is behind"; a failing one would say "the code is wrong", and -only one of those is true. +A SKIP STAYS FOR TWO CASES AND TWO ONLY, and this paragraph overstated it until +the review of `7c0a3b6` on openXdox-code#21. A missing bundle is honest to skip +where the installed distribution records a commit that is NOT the one this leg +declares — note the claim is "different", never "older": nothing here proves an +ordering, only a disagreement — and where the installation records no provenance +at all AND the run is off CI. Everywhere else `_absent()` fails closed, the +declared pin included, and under CI unrecorded provenance included. A skipped +suite says "this is not the openDox we declare"; a failing one says "the openDox +we declare is wrong", and the guard's whole job is to tell those apart instead of +answering "skip" to both. """ from __future__ import annotations @@ -207,9 +211,8 @@ def _absent(subject: str, *, module_level: bool) -> NoReturn: f"(`pyproject.toml` pins {declared[:8]}, and the installed " f"distribution records that same commit in its `direct_url.json`). " f"That is a REGRESSION at the declared pin, not a stale consumer, so " - f"it fails here instead of skipping: a skip would take thirteen node " - f"probes, three materialization assertions and every bundle suite " - f"quietly green in a required check.") + f"it fails here instead of skipping: a skip would take every suite " + f"that depends on {subject} quietly green in a required check.") if declared is None or installed is None: if under_ci(): pytest.fail( diff --git a/tests/test_gate_loop_probes.py b/tests/test_gate_loop_probes.py index f327b77..5465784 100644 --- a/tests/test_gate_loop_probes.py +++ b/tests/test_gate_loop_probes.py @@ -31,15 +31,21 @@ the three materialization assertions in `test_gate_loop_views.py` that waited on the same bump went 3 skipped -> 3 passed beside them. -WHAT A MISSING BUNDLE MEANS NOW, stated precisely — Copilot's round-2 review of -#21 caught this paragraph still saying "SKIPS … never fails", which the guard had -already stopped doing. Where the installed `opendox` carries no bundle there is -nothing to assemble INTO, and `tests/opendox_bundle.py::_absent` decides between -two different outcomes by READING which openDox is installed: a DIFFERENT (older) -one, or no recorded provenance off the CI path, SKIPS with both commits named; the -DECLARED one — or unreadable provenance under CI — FAILS, because that is a -regression here and a skip would take these thirteen probes quietly green in a -required check. Neither outcome ever passes silently against a stand-in. +WHAT A MISSING BUNDLE MEANS NOW, stated precisely — the review rounds on #21 +rewrote this paragraph twice, and both times because it promised an outcome the +guard does not give. Where the installed `opendox` carries no bundle there is +nothing to assemble INTO, and `tests/opendox_bundle.py::_absent` chooses by +READING which openDox is installed: + + * a DIFFERENT commit from the one this leg declares -> SKIP, naming BOTH; + * NO recorded provenance, off CI -> SKIP, naming the declared one and saying + plainly that the installed one is unrecorded (it cannot name what it could + not read, which is why this is a different sentence from the one above); + * the DECLARED commit, or no recorded provenance UNDER CI -> FAIL, because that + is a regression here and a skip would take these thirteen probes quietly + green in a required check. + +Neither outcome ever passes silently against a stand-in. A CREATED file: no row in openxFactory's `docs/opendox-carve-manifest.yaml` (RULED OQ-C), admitted by path in the S5 annotation. @@ -155,14 +161,15 @@ def bundle(tmp_path) -> Path: """ source = _opendox_bundle() if source is None: - # FAIL at the declared pin, SKIP only for a different one — the shared - # rule in `tests/opendox_bundle.py::_absent`, which READS the installed - # distribution's PEP 610 provenance instead of asserting it. Copilot's - # round-1 review of #21 found this file claiming "came from somewhere - # older than the declared pin" on a check that only tested for a marker; - # if `0b4e8bbf` itself ever stopped shipping `web/**`, all thirteen - # probes below would have skipped and this required check would have - # stayed green over the regression. + # The shared rule in `tests/opendox_bundle.py::_absent`, which READS the + # installed distribution's PEP 610 provenance instead of asserting it: + # FAIL for the DECLARED commit and for unrecorded provenance UNDER CI; + # SKIP for a DIFFERENT commit, and for unrecorded provenance OFF CI. + # Round 1 of the review on #21 found this file claiming "came from + # somewhere older than the declared pin" on a check that only tested for + # a marker; if `0b4e8bbf` itself ever stopped shipping `web/**`, all + # thirteen probes below would have skipped and this required check would + # have stayed green over the regression. import opendox_bundle opendox_bundle._absent("openDox's `web/` bundle", module_level=False) target = tmp_path / "web" @@ -756,10 +763,26 @@ def read_text(self, name): def _with_dist(monkeypatch, payload): + """Install a fake distribution whose `read_text` returns (or raises) `payload`.""" import importlib.metadata as md monkeypatch.setattr(md, "distribution", lambda name: _FakeDist(payload)) +def _with_no_dist(monkeypatch, exc): + """Make the LOOKUP itself raise — the path `_with_dist` cannot reach. + + Caught at `7c0a3b6`: `_with_dist(PackageNotFoundError(...))` made `read_text` + raise, so the test named for an uninstalled package never exercised + `distribution("opendox")` failing, which is the call `installed_commit()` + actually guards. + """ + import importlib.metadata as md + + def _raise(name): + raise exc + monkeypatch.setattr(md, "distribution", _raise) + + def test_installed_commit_reads_a_real_vcs_record(monkeypatch) -> None: _with_dist(monkeypatch, json.dumps( {"url": "https://github.com/opensoft/openDox-code", @@ -813,21 +836,28 @@ def test_installed_commit_refuses_a_record_that_is_not_git(monkeypatch) -> None: def test_installed_commit_is_none_when_the_package_is_not_installed(monkeypatch) -> None: + """The LOOKUP fails, not the read — see `_with_no_dist`.""" from importlib.metadata import PackageNotFoundError - _with_dist(monkeypatch, PackageNotFoundError("opendox")) + _with_no_dist(monkeypatch, PackageNotFoundError("opendox")) assert _ob.installed_commit() is None -def test_a_parser_regression_would_now_be_caught_before_it_reaches_the_decision() -> None: - """The point of the six above, stated as an assertion rather than a comment. +def test_installed_commit_is_none_when_reading_the_record_raises(monkeypatch) -> None: + """...and the read failing is its own case, which is what `_with_dist` drives.""" + _with_dist(monkeypatch, OSError("metadata unreadable")) + assert _ob.installed_commit() is None - `_absent()` branches on `installed_commit()`'s RETURN VALUE, so every test of - the decision that monkeypatches that function proves nothing about the - reading. These six cover the reading: a real VCS record, an absent file, - malformed JSON, a non-VCS install, a too-short id, and no distribution at all. - """ - import inspect - source = inspect.getsource(_ob.installed_commit) - assert "direct_url.json" in source - assert "vcs_info" in source - assert "len(commit) == 40" in source +# WHY THE CASES ABOVE ARE THE CASES: `_absent()` branches on `installed_commit()`'s +# RETURN VALUE, so every test of the DECISION that monkeypatches that function +# proves nothing about the READING. Nine cases cover the reading — a real VCS +# record, an absent `direct_url.json`, malformed JSON, a non-VCS (`archive_info`) +# install, a commit id that is not 40 characters, forty characters that are not +# hex, a 40-hex id under a non-git VCS, the distribution LOOKUP raising, and the +# read raising. +# +# A tenth test stood here until `7c0a3b6` and is gone rather than repaired: it +# asserted strings against `inspect.getsource(installed_commit)`, and once the +# implementation stopped containing `len(commit) == 40` it passed only because an +# explanatory COMMENT still held that text. A test coupled to source text fails on +# a harmless rename and catches no behaviour — the nine above already assert the +# results it was gesturing at. diff --git a/tests/test_gate_loop_views.py b/tests/test_gate_loop_views.py index 020d119..40cbad9 100644 --- a/tests/test_gate_loop_views.py +++ b/tests/test_gate_loop_views.py @@ -615,13 +615,18 @@ def test_the_style_residue_is_recorded_rather_than_skipped() -> None: # --------------------------------------------------------------------------- def _view_extension_or_skip(): - """The assembled openDox's view registry, or — where it has none — a FAIL if - that openDox is the one this leg DECLARES (or its provenance is unreadable - under CI) and a SKIP only for a demonstrably different consumer. - - The summary line used to read "or SKIP where it has none", which contradicted - the table four paragraphs down; Copilot's review of `42741fd` on #21 caught - it. The summary is the line a reader trusts, so it carries the outcome now. + """The assembled openDox's view registry, or — where it has none — whichever + of FAIL and SKIP `tests/opendox_bundle.py::_absent` measures: FAIL for the + commit this leg DECLARES and for unrecorded provenance UNDER CI; SKIP for a + DIFFERENT commit and for unrecorded provenance OFF CI. + + This summary took two goes. It read "or SKIP where it has none", which + contradicted the table four paragraphs down; the review of `42741fd` on #21 + caught that, and the review of `7c0a3b6` caught the replacement too — it said + a skip was "only for a demonstrably different consumer" and dropped the + off-CI unrecorded branch. All four rows are on the line now, because the + summary is the line a reader trusts and a half-table is how it went wrong + twice. BOTH GUARDS ARE SATISFIED BY THIS LEG'S OWN PIN, since 2026-09-16. They were not when slice S5 wrote them: the pin was `a99eba03`, the first From 4652d551c2f9ef6ab9af0563e872879fb5a5bf52 Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 16:00:01 +0000 Subject: [PATCH 08/33] Cite RULED openxFactory#656 comment 5700475319 where each decision is stated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Brett Heap ruled both of this act's open questions on 2026-09-16 by interactive multi-choice, recorded on openxFactory#656 as comment 5700475319. Both answers are what #21 already does, so nothing about the tree's behaviour changes — what changes is that each decision now names the ruling that authorizes it, at the place the decision is made rather than only in a pull request description that will not travel with the file. Q1, "tests/test_doxbench_mutation_boundary.py leaves validate.yml's list" -> (a) DROP IT, "with the measurement and both grounds in the workflow comment; it returns with the BUILD arc beside test_doxbench_turns.py". Cited in the validate.yml block that drops it, which already carried the measurement (the collection error at gate_console.py:63's `from doc_health import corpus`) and both grounds (the BUILD arc's defect under RULED Q-L8 (b'), and the file being an arrived carve row whose edits are declared at openxFactory). Q2, "the three skip guards with stale reasons" -> (a) KEEP the guards and CORRECT their reasons, "they test the ASSEMBLED openDox; a consumer may pin behind the view contract". Cited at all three sites that hold that decision: tests/opendox_bundle.py's "A SKIP STAYS" paragraph, tests/test_gate_loop_views.py's _view_extension_or_skip, and tests/test_gate_loop_probes.py's bundle fixture. Measured after the edit: 332 passed / 6 skipped under validate.yml's own invocation, unchanged — these are comments. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- .github/workflows/validate.yml | 6 +++++- tests/opendox_bundle.py | 8 ++++++-- tests/test_gate_loop_probes.py | 3 ++- tests/test_gate_loop_views.py | 9 ++++++--- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 031149d..1952c8a 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -174,7 +174,11 @@ jobs: # # ONE FILE LEAVES THIS LIST WITH THE 2026-09-16 PIN BUMP # (`a99eba03` -> `0b4e8bbf`), and the reason is the BUILD arc's, not the - # bump's. `tests/test_doxbench_mutation_boundary.py` was named by S8 on + # bump's. RULED openxFactory#656 comment 5700475319 (Brett Heap, 2026-09-16, by interactive multi-choice): + # the question "drop it, keep it and accept a red required check, or edit + # the arrived file" was put to Brett Heap and answered (a) DROP IT, "with + # the measurement and both grounds in the workflow comment; it returns with + # the BUILD arc beside test_doxbench_turns.py" — which is what follows. `tests/test_doxbench_mutation_boundary.py` was named by S8 on # the measurement quoted above: it COLLECTS, then skips whole at # `tests/opendox_bundle.py`'s module-level skip, which is what happened # while the pinned `opendox` carried no `web/` bundle. At `0b4e8bbf` the diff --git a/tests/opendox_bundle.py b/tests/opendox_bundle.py index 68a4c80..301a6f7 100644 --- a/tests/opendox_bundle.py +++ b/tests/opendox_bundle.py @@ -43,8 +43,12 @@ installed `opendox` carries no bundle", which was true of `a99eba03` and is quoted here as provenance, not as a claim. -A SKIP STAYS FOR TWO CASES AND TWO ONLY, and this paragraph overstated it until -the review of `7c0a3b6` on openXdox-code#21. A missing bundle is honest to skip +A SKIP STAYS FOR TWO CASES AND TWO ONLY — and THAT IT STAYS AT ALL is ruled, not +chosen here. RULED openxFactory#656 comment 5700475319 (Brett Heap, 2026-09-16, by interactive multi-choice): asked whether to keep these guards with corrected reasons or +delete them on pin lockstep #2's precedent, Brett Heap answered (a) KEEP THEM and +correct the reasons, "they test the ASSEMBLED openDox; a consumer may pin behind +the view contract". This paragraph overstated the skip until the review of +`7c0a3b6` on openXdox-code#21. A missing bundle is honest to skip where the installed distribution records a commit that is NOT the one this leg declares — note the claim is "different", never "older": nothing here proves an ordering, only a disagreement — and where the installation records no provenance diff --git a/tests/test_gate_loop_probes.py b/tests/test_gate_loop_probes.py index 5465784..66d87ce 100644 --- a/tests/test_gate_loop_probes.py +++ b/tests/test_gate_loop_probes.py @@ -152,7 +152,8 @@ def bundle(tmp_path) -> Path: Skipped where the assembled `opendox` carries no bundle AND that openDox is demonstrably not the one this leg declares; FAILED where it IS the declared - one. That was a plain skip until the 2026-09-16 pin bump, when a missing + one. That this guard survives the pin bump at all is RULED openxFactory#656 comment 5700475319 (Brett Heap, 2026-09-16, by interactive multi-choice), answer (a): keep + the guards, correct their reasons. That was a plain skip until the 2026-09-16 pin bump, when a missing bundle stopped being the expected state and started being a regression — see `tests/opendox_bundle.py::_absent`, which reads both commits before it decides. A probe that quietly ran against a stand-in `helpers.js` would diff --git a/tests/test_gate_loop_views.py b/tests/test_gate_loop_views.py index 40cbad9..ec3151c 100644 --- a/tests/test_gate_loop_views.py +++ b/tests/test_gate_loop_views.py @@ -636,9 +636,12 @@ def _view_extension_or_skip(): three assertions below went 3 skipped -> 3 passed under `validate.yml`'s own invocation. The old wording is quoted here as provenance, not asserted. - THE GUARDS STAY, because what they test is the ASSEMBLED openDox, not this - leg's declared pin — the section header above says so — and an assembly is - free to install an openDox behind the view contract. That is the same + THE GUARDS STAY, and that is RULED rather than preferred: + RULED openxFactory#656 comment 5700475319 (Brett Heap, 2026-09-16, by interactive multi-choice) answered the question "keep the guards and correct their reasons, or + delete them on pin lockstep #2's precedent" with (a) KEEP — because what they + test is the ASSEMBLED openDox, not this leg's declared pin (the section header + above says so), and an assembly is free to install an openDox behind the view + contract. That is the same condition `view_extensions.ViewContractUnsupported` names at runtime, and these two guards are its test-time counterpart. From a256f683a5f8eba836a49e0e28153b878dcbbd81 Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 16:03:39 +0000 Subject: [PATCH 09/33] Re-wrap the ruling citations and drop the last unprovable "older" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Formatting and one word, no behaviour. The four citations added in the previous commit were pasted as single long lines into files wrapped at ~78 columns; they are re-wrapped, and the two paragraphs they interrupted are separated properly so neither reads as a run-on. The word: the bundle fixture still called a skipping consumer "a genuinely older consumer". This guard compares the declared commit with the installed one and can only prove DISAGREEMENT, never an ordering — the same correction the review of 7c0a3b6 made to the module docstring, missed here. It now says "demonstrably a DIFFERENT one" and says why in the same breath. 332 passed / 6 skipped, unchanged. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- .github/workflows/validate.yml | 13 ++++++++----- tests/opendox_bundle.py | 13 ++++++++----- tests/test_gate_loop_probes.py | 10 +++++++--- tests/test_gate_loop_views.py | 6 ++++-- 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 1952c8a..9aeadc2 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -174,11 +174,14 @@ jobs: # # ONE FILE LEAVES THIS LIST WITH THE 2026-09-16 PIN BUMP # (`a99eba03` -> `0b4e8bbf`), and the reason is the BUILD arc's, not the - # bump's. RULED openxFactory#656 comment 5700475319 (Brett Heap, 2026-09-16, by interactive multi-choice): - # the question "drop it, keep it and accept a red required check, or edit - # the arrived file" was put to Brett Heap and answered (a) DROP IT, "with - # the measurement and both grounds in the workflow comment; it returns with - # the BUILD arc beside test_doxbench_turns.py" — which is what follows. `tests/test_doxbench_mutation_boundary.py` was named by S8 on + # bump's. RULED openxFactory#656 comment 5700475319 (Brett Heap, + # 2026-09-16, by interactive multi-choice): the question "drop it, keep it + # and accept a red required check, or edit the arrived file" was put to + # Brett Heap and answered (a) DROP IT, "with the measurement and both + # grounds in the workflow comment; it returns with the BUILD arc beside + # test_doxbench_turns.py" — which is what follows. + # + # `tests/test_doxbench_mutation_boundary.py` was named by S8 on # the measurement quoted above: it COLLECTS, then skips whole at # `tests/opendox_bundle.py`'s module-level skip, which is what happened # while the pinned `opendox` carried no `web/` bundle. At `0b4e8bbf` the diff --git a/tests/opendox_bundle.py b/tests/opendox_bundle.py index 301a6f7..8ed7717 100644 --- a/tests/opendox_bundle.py +++ b/tests/opendox_bundle.py @@ -44,11 +44,14 @@ quoted here as provenance, not as a claim. A SKIP STAYS FOR TWO CASES AND TWO ONLY — and THAT IT STAYS AT ALL is ruled, not -chosen here. RULED openxFactory#656 comment 5700475319 (Brett Heap, 2026-09-16, by interactive multi-choice): asked whether to keep these guards with corrected reasons or -delete them on pin lockstep #2's precedent, Brett Heap answered (a) KEEP THEM and -correct the reasons, "they test the ASSEMBLED openDox; a consumer may pin behind -the view contract". This paragraph overstated the skip until the review of -`7c0a3b6` on openXdox-code#21. A missing bundle is honest to skip +chosen here. RULED openxFactory#656 comment 5700475319 (Brett Heap, 2026-09-16, +by interactive multi-choice): asked whether to keep these guards with corrected +reasons or delete them on pin lockstep #2's precedent, Brett Heap answered +(a) KEEP THEM and correct the reasons, "they test the ASSEMBLED openDox; a +consumer may pin behind the view contract". + +This paragraph overstated the skip until the review of `7c0a3b6` on +openXdox-code#21. A missing bundle is honest to skip where the installed distribution records a commit that is NOT the one this leg declares — note the claim is "different", never "older": nothing here proves an ordering, only a disagreement — and where the installation records no provenance diff --git a/tests/test_gate_loop_probes.py b/tests/test_gate_loop_probes.py index 66d87ce..625c03a 100644 --- a/tests/test_gate_loop_probes.py +++ b/tests/test_gate_loop_probes.py @@ -152,13 +152,17 @@ def bundle(tmp_path) -> Path: Skipped where the assembled `opendox` carries no bundle AND that openDox is demonstrably not the one this leg declares; FAILED where it IS the declared - one. That this guard survives the pin bump at all is RULED openxFactory#656 comment 5700475319 (Brett Heap, 2026-09-16, by interactive multi-choice), answer (a): keep - the guards, correct their reasons. That was a plain skip until the 2026-09-16 pin bump, when a missing + one. That this guard survives the pin bump at all is RULED + openxFactory#656 comment 5700475319 (Brett Heap, 2026-09-16, by interactive + multi-choice), answer (a): keep the guards, correct their reasons. + + That was a plain skip until the 2026-09-16 pin bump, when a missing bundle stopped being the expected state and started being a regression — see `tests/opendox_bundle.py::_absent`, which reads both commits before it decides. A probe that quietly ran against a stand-in `helpers.js` would measure the stand-in rather than the shipped file, so the skip is still the - right outcome for a genuinely older consumer. + right outcome for a consumer whose installed commit is demonstrably a + DIFFERENT one (this guard measures disagreement, never an ordering). """ source = _opendox_bundle() if source is None: diff --git a/tests/test_gate_loop_views.py b/tests/test_gate_loop_views.py index ec3151c..39c4a7e 100644 --- a/tests/test_gate_loop_views.py +++ b/tests/test_gate_loop_views.py @@ -637,8 +637,10 @@ def _view_extension_or_skip(): invocation. The old wording is quoted here as provenance, not asserted. THE GUARDS STAY, and that is RULED rather than preferred: - RULED openxFactory#656 comment 5700475319 (Brett Heap, 2026-09-16, by interactive multi-choice) answered the question "keep the guards and correct their reasons, or - delete them on pin lockstep #2's precedent" with (a) KEEP — because what they + RULED openxFactory#656 comment 5700475319 (Brett Heap, 2026-09-16, by + interactive multi-choice) answered the question "keep the guards and correct + their reasons, or delete them on pin lockstep #2's precedent" with + (a) KEEP — because what they test is the ASSEMBLED openDox, not this leg's declared pin (the section header above says so), and an assembly is free to install an openDox behind the view contract. That is the same From b177eefce362ed1a4f29fb4e9dd1dd04c9b4692c Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 16:05:06 +0000 Subject: [PATCH 10/33] Normalize a commit id's case before comparing it, the last open item from the review at 296bda7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit That review (5224807459) filed two suppressed comments and was never answered directly: the rate limiter cut the reading of it short, and both findings were then fixed under later rounds without being named. Recording that here rather than letting it look deliberate. (a) "installed_commit() only checks len(commit) == 40 … validate the characters (and normalize case)". The character validation landed at 7c0a3b6 with _SHA_RE and the vcs == git check, and the 40-character non-hex regression case with it. The NORMALIZATION is this commit: both readers now match case-insensitively and return lower case, so a lawful record that spells its commit in upper case is COMPARED rather than discarded. That can only turn an "unknown" into a real comparison — without it such a record reads as unreadable provenance and FAILS under CI over a formatting difference rather than a regression. One test pins it. (b) "this assertion inspects implementation source text rather than behavior". Deleted at 27a89fd, where the same finding arrived again. Measured: 333 passed / 6 skipped (332 + the new test), and the guard still fails closed — CI=true with opendox/web removed gives 13 errors. validate.yml's recorded figure follows to 333 / 16, and its series line becomes 317 -> 323 -> 330 -> 332 -> 333, one step per round that added tests. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- .github/workflows/validate.yml | 6 +++--- tests/opendox_bundle.py | 13 +++++++++---- tests/test_gate_loop_probes.py | 12 ++++++++++++ 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 9aeadc2..951b725 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -204,7 +204,7 @@ jobs: # alongside `test_doxbench_turns.py`. # # WITH IT GONE AND THE PIN MOVED, this invocation goes 301 passed / - # 23 skipped -> 332 passed / 6 skipped, and BOTH HALVES OF THAT DELTA HAVE + # 23 skipped -> 333 passed / 6 skipped, and BOTH HALVES OF THAT DELTA HAVE # TO BE SAID SEPARATELY, because Copilot's round-3 review of #21 caught this # block conflating them: # @@ -218,11 +218,11 @@ jobs: # file leaves this list, so that skip is no longer RUN rather than # cleared. Counting it as cleared would describe a transition that never # happened. - # * The remaining rise to 332 is NOT the bump: it is the 15 direct tests + # * The remaining rise to 333 is NOT the bump: it is the 16 direct tests # of the provenance guard that Copilot's review rounds asked for, which # live in `tests/test_gate_loop_probes.py` and are therefore on this # list. The bump alone measured 317. (This figure has been re-derived at - # every head rather than carried: 317 -> 323 -> 330 -> 332, once per + # every head rather than carried: 317 -> 323 -> 330 -> 332 -> 333, once per # round that added tests, which is the same discipline the block above # applies to the skip counts.) # diff --git a/tests/opendox_bundle.py b/tests/opendox_bundle.py index 8ed7717..1d7a777 100644 --- a/tests/opendox_bundle.py +++ b/tests/opendox_bundle.py @@ -135,9 +135,14 @@ def find() -> Path | None: # nothing measured means nothing claimed. # --------------------------------------------------------------------------- -_SHA_RE = re.compile(r"[0-9a-f]{40}") +#: A git object name, matched CASE-INSENSITIVELY and normalized to lowercase +#: below. Copilot asked for the normalization on openXdox-code#21, and it can +#: only ever turn an "unknown" into a real comparison: a lawful record that +#: happens to spell its commit in upper case would otherwise read as +#: unreadable provenance and FAIL under CI for a formatting difference. +_SHA_RE = re.compile(r"[0-9a-fA-F]{40}") -_PIN_RE = re.compile(r"opendox\s*@\s*git\+[^@\s\"']+@([0-9a-f]{40})") +_PIN_RE = re.compile(r"opendox\s*@\s*git\+[^@\s\"']+@([0-9a-fA-F]{40})") def declared_pin() -> str | None: @@ -147,7 +152,7 @@ def declared_pin() -> str | None: match = _PIN_RE.search(toml.read_text(encoding="utf-8")) except OSError: # pragma: no cover - no checkout return None - return match.group(1) if match else None + return match.group(1).lower() if match else None def installed_commit() -> str | None: @@ -183,7 +188,7 @@ def installed_commit() -> str | None: # say it is git, or this function does not know what is installed. if vcs != "git" or not isinstance(commit, str): return None - return commit if _SHA_RE.fullmatch(commit) else None + return commit.lower() if _SHA_RE.fullmatch(commit) else None def under_ci() -> bool: diff --git a/tests/test_gate_loop_probes.py b/tests/test_gate_loop_probes.py index 625c03a..4e084cb 100644 --- a/tests/test_gate_loop_probes.py +++ b/tests/test_gate_loop_probes.py @@ -833,6 +833,18 @@ def test_installed_commit_refuses_forty_characters_that_are_not_hex(monkeypatch) assert _ob.installed_commit() is None +def test_installed_commit_normalizes_an_upper_case_commit_id(monkeypatch) -> None: + """A lawful record spelled in upper case is compared, not discarded. + + Asked for on #21. It can only ever turn an "unknown" into a real comparison: + without it an upper-case id would read as unreadable provenance and FAIL under + CI over a formatting difference rather than a regression. + """ + _with_dist(monkeypatch, json.dumps( + {"vcs_info": {"vcs": "git", "commit_id": _PIN_B.upper()}})) + assert _ob.installed_commit() == _PIN_B + + def test_installed_commit_refuses_a_record_that_is_not_git(monkeypatch) -> None: """A 40-hex id under a non-git VCS is not an openDox-code commit.""" _with_dist(monkeypatch, json.dumps( From f6f1b991684ef600974a46f405df51d8023fde2e Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 16:07:42 +0000 Subject: [PATCH 11/33] =?UTF-8?q?Review=20at=2027a89fd:=20one=20table,=20o?= =?UTF-8?q?ne=20home=20=E2=80=94=20every=20paraphrase=20of=20the=20guard's?= =?UTF-8?q?=20outcomes=20is=20replaced=20by=20a=20pointer=20to=20it,=20plu?= =?UTF-8?q?s=20a=20real=20bug=20in=20declared=5Fpin()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Review 5225106776 filed THIRTEEN suppressed comments. All thirteen are accurate, and eleven of them are one defect repeated: the four-row decision table had been PARAPHRASED in eight different docstrings and comments, and every paraphrase lost a row or overstated one. Fixing the eight paraphrases one more time would have earned a ninth round, so the structure changes instead. THE TABLE NOW LIVES IN EXACTLY ONE PLACE — `_absent()` — and `require()`, `web()`, the probes fixture and its branch comment POINT AT IT rather than restate it. Each says so, and says why: a second copy of a table is how a row goes missing. THE ANCESTRY CLAIM, in four more places. `_absent()` compares two commit identities and never asks git which came first, so "a consumer assembling at its own OLDER pin" was never something this guard measured. The canonical table row, the module comment, `validate.yml`'s probe paragraph and the different-commit test's own docstring now all say DIFFERENT, and the table row says "(identity, never ancestry)" so the next reader cannot re-derive the wrong word. A REAL BUG, not documentation. `declared_pin()` caught `OSError`, but `Path.read_text(encoding="utf-8")` raises `UnicodeDecodeError` on a non-UTF-8 file, and that is a `ValueError`. A malformed `pyproject.toml` would therefore have escaped the function entirely and bypassed `_absent()`'s explicit unknown-provenance CI policy. Now caught with the filesystem error. THREE MESSAGES AND CONTRACTS THAT WERE WRONG ABOUT THEMSELVES: * the unreadable-side skip reported "this installation records no PEP 610 provenance" even when the INSTALL was fine and `pyproject.toml` was the unreadable side. It now names whichever side is actually missing, and a new test pins that (declared=None, installed valid). * `installed_commit()`'s docstring said `None` means "did not record one". It also means malformed JSON, an archive install, a non-git record, a bad hash, and a lookup or read that raised — every one of which has a test. It now says "no usable provenance was READ" and lists them. * `under_ci()`'s test docstring said "nothing else is treated as CI" while the body below it accepted `1`, `true` and `yes`. It now states the accepted spellings. * the module docstring ran the TWO skips together. They do not say the same thing: the different-commit skip names both commits and concludes "this is not the openDox we declare"; the unreadable-side skip concludes nothing at all and exists only because off CI an unreadable side is lawful. Measured: 334 passed / 6 skipped (the two new tests), fail-closed intact — CI=true with `opendox/web` removed gives 13 errors. validate.yml's figure follows to 334 / 17 and its series to 317 -> 323 -> 330 -> 332 -> 333 -> 334. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- .github/workflows/validate.yml | 13 ++++--- tests/opendox_bundle.py | 66 +++++++++++++++++++++++----------- tests/test_gate_loop_probes.py | 56 +++++++++++++++++++++-------- 3 files changed, 94 insertions(+), 41 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 951b725..b485b20 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -113,8 +113,10 @@ jobs: # state until the pin bump) every probe SKIPS". THE SAME BUMP CLEARED IT: # at `0b4e8bbf` the bundle is in the wheel and this file goes 0 passed / # 13 skipped -> 13 passed / 0 skipped. The skip survives for an assembly - # that installs an older openDox than this leg declares, and the `node` - # one for a runner without node. + # that installs a DIFFERENT openDox from the one this leg declares — the + # guard compares two commit identities and never asks git which came first, + # so "different" is all it can say — and the `node` one for a runner + # without node. # § 3.4 SLICE S8 UN-NARROWS THIS LIST AS FAR AS THE MEASUREMENT ALLOWS, # which is the half of RULED Q-L8 (b′) this slice was scoped to lift. # The note's § 5 S8 row says the narrowings "lift FOR THE WEB SUITES", and @@ -204,7 +206,7 @@ jobs: # alongside `test_doxbench_turns.py`. # # WITH IT GONE AND THE PIN MOVED, this invocation goes 301 passed / - # 23 skipped -> 333 passed / 6 skipped, and BOTH HALVES OF THAT DELTA HAVE + # 23 skipped -> 334 passed / 6 skipped, and BOTH HALVES OF THAT DELTA HAVE # TO BE SAID SEPARATELY, because Copilot's round-3 review of #21 caught this # block conflating them: # @@ -218,11 +220,12 @@ jobs: # file leaves this list, so that skip is no longer RUN rather than # cleared. Counting it as cleared would describe a transition that never # happened. - # * The remaining rise to 333 is NOT the bump: it is the 16 direct tests + # * The remaining rise to 334 is NOT the bump: it is the 17 direct tests # of the provenance guard that Copilot's review rounds asked for, which # live in `tests/test_gate_loop_probes.py` and are therefore on this # list. The bump alone measured 317. (This figure has been re-derived at - # every head rather than carried: 317 -> 323 -> 330 -> 332 -> 333, once per + # every head rather than carried: 317 -> 323 -> 330 -> 332 -> 333 -> 334, + # once per # round that added tests, which is the same discipline the block above # applies to the skip counts.) # diff --git a/tests/opendox_bundle.py b/tests/opendox_bundle.py index 1d7a777..8ba1d09 100644 --- a/tests/opendox_bundle.py +++ b/tests/opendox_bundle.py @@ -57,9 +57,13 @@ ordering, only a disagreement — and where the installation records no provenance at all AND the run is off CI. Everywhere else `_absent()` fails closed, the declared pin included, and under CI unrecorded provenance included. A skipped -suite says "this is not the openDox we declare"; a failing one says "the openDox -we declare is wrong", and the guard's whole job is to tell those apart instead of -answering "skip" to both. +THE TWO SKIPS DO NOT SAY THE SAME THING, and this paragraph ran them together +until the review of `27a89fd` on #21. The different-commit skip says "this is not +the openDox we declare", and names both commits to prove it. The unreadable-side +skip says only "the comparison could not be made", claims nothing about what is +installed, and exists because off CI an unreadable side is lawful. A FAILURE says +"the openDox we declare is wrong". The guard's whole job is to keep those three +apart instead of answering "skip" to all of them. """ from __future__ import annotations @@ -120,8 +124,11 @@ def find() -> Path | None: # distribution's `direct_url.json` (PEP 610), which a VCS install always # records. # Bundle missing AND the two agree -> FAIL: a regression at the declared pin. -# Bundle missing AND they differ -> SKIP: a consumer assembling at its own, -# older pin, named in the reason. +# Bundle missing AND they differ -> SKIP: a consumer assembling at a +# DIFFERENT commit, both named in the +# reason. DIFFERENT, never "older": this +# guard compares two identities and never +# asks git which came first. # Provenance unreadable, UNDER CI -> FAIL. Round 2 of the same review was right # that skipping here left the required job # able to go green with the bundle missing; @@ -150,7 +157,11 @@ def declared_pin() -> str | None: toml = Path(__file__).resolve().parents[1] / "pyproject.toml" try: match = _PIN_RE.search(toml.read_text(encoding="utf-8")) - except OSError: # pragma: no cover - no checkout + except (OSError, UnicodeDecodeError): # pragma: no cover - no checkout + # UnicodeDecodeError is a ValueError, NOT an OSError, so a non-UTF-8 + # `pyproject.toml` would have escaped this function and bypassed + # `_absent()`'s explicit unknown-provenance policy altogether. Caught at + # the review of `27a89fd` on openXdox-code#21. return None return match.group(1).lower() if match else None @@ -158,8 +169,12 @@ def declared_pin() -> str | None: def installed_commit() -> str | None: """The commit the INSTALLED `opendox` was built from (PEP 610), or None. - None is not "no provenance exists"; it is "this installation did not record - one" — an editable checkout, a wheel copied in by hand. + None means NO USABLE PROVENANCE WAS READ — which is broader than "none was + recorded", and saying only the narrow thing made this contract inaccurate + (caught at the review of `27a89fd` on #21). It covers: no `direct_url.json`, + malformed JSON, an `archive_info` (non-VCS) install, a record whose `vcs` is + not git, a `commit_id` that is not 40 hex, the distribution lookup raising, + and the read raising. Every one of those has its own test below. WHAT THE CALLER DOES WITH None IS NOT "always skip", and this docstring said so until Copilot's round-3 review of #21 caught it: `_absent()` FAILS on None @@ -202,7 +217,7 @@ def _absent(subject: str, *, module_level: bool) -> NoReturn: | installed vs declared | outcome | | --- | --- | | equal | FAIL — a regression at the pin this leg declares | - | different | SKIP — a consumer assembling at its own, older pin | + | different | SKIP — a consumer assembling at a DIFFERENT commit (identity, never ancestry) | | UNKNOWN, under CI | FAIL — see below | | UNKNOWN, off CI | SKIP — a developer box may install however it likes | @@ -235,13 +250,18 @@ def _absent(subject: str, *, module_level: bool) -> NoReturn: f"direct VCS reference, and pip records `direct_url.json` for that " f"every time. Failing rather than skipping, because a skip here is " f"exactly the silent green this guard exists to prevent.") + missing = ("this leg's declared pin could not be read from " + "`pyproject.toml`" if declared is None else + "no usable PEP 610 provenance could be read from the installed " + "distribution") pytest.skip( - f"{subject} is missing, and this installation records no PEP 610 " - f"provenance (declared={declared or 'unreadable'}, " - f"installed={installed or 'unrecorded'}), so nothing is claimed about " - f"which commit is installed. Off the CI path that is lawful — an " - f"editable checkout or a hand-placed wheel has none. Under CI this same " - f"condition FAILS.", + f"{subject} is missing and the comparison could not be made: {missing} " + f"(declared={declared or 'unreadable'}, " + f"installed={installed or 'unreadable'}). NOTHING is claimed here about " + f"which openDox is installed — this is not the different-commit skip, " + f"which names both. Off the CI path an unreadable side is lawful (an " + f"editable checkout or a hand-placed wheel records none). Under CI this " + f"same condition FAILS.", allow_module_level=module_level) pytest.skip( f"{subject} is missing, and this is NOT the declared pin's doing: the " @@ -258,10 +278,13 @@ def _absent(subject: str, *, module_level: bool) -> NoReturn: def require(*, module_level: bool = True) -> Path: """The pinned bundle, STAGED once per process as an ESM-marked tree — or, - where there is none, whatever `_absent()` decides: FAIL for the pin this leg - DECLARES (and for unknown provenance under CI), SKIP for a demonstrably - different consumer. It is not an unconditional skip, and this docstring said - it was until Copilot's review of `42741fd` on #21. + where there is none, whatever `_absent()` decides. + + THE OUTCOME IS `_absent()`'s FOUR-ROW TABLE AND THIS DOCSTRING DOES NOT + RESTATE IT. Two reviews on #21 caught a paraphrase here losing a row (first + "SKIP where the pin carries no bundle", then a summary that dropped the + off-CI unreadable case), which is what a second copy of a table is for. Read + `_absent()`. `module_level=True` skips the IMPORTING MODULE, which is what the thirty suites whose whole subject is the bundle want. `web()` below passes False, @@ -324,8 +347,9 @@ def require(*, module_level: bool = True) -> Path: def web() -> Path: """The pinned bundle; where there is none, `_absent()`'s outcome scoped to - the CALLING TEST rather than the module — a FAIL for the declared pin (or - unknown provenance under CI) and a SKIP for a different consumer. + the CALLING TEST rather than the module. Which outcome is `_absent()`'s + table's to say, and this docstring does not restate it — for the reason + `require()` above gives. FOR THE SUITE WHOSE SUBJECT IS NOT THE BUNDLE (Copilot review of `openXdox-code#19` is the class of finding this anticipates, and the diff --git a/tests/test_gate_loop_probes.py b/tests/test_gate_loop_probes.py index 4e084cb..8de085b 100644 --- a/tests/test_gate_loop_probes.py +++ b/tests/test_gate_loop_probes.py @@ -150,9 +150,11 @@ def bundle(tmp_path) -> Path: """A COMPOSED bundle: openDox's own `web/`, with this column's six modules placed into it by the assembly hook RULED Q5 names. - Skipped where the assembled `opendox` carries no bundle AND that openDox is - demonstrably not the one this leg declares; FAILED where it IS the declared - one. That this guard survives the pin bump at all is RULED + Where the assembled `opendox` carries no bundle, the outcome is + `tests/opendox_bundle.py::_absent`'s FOUR-ROW TABLE and this docstring does + not restate it — two reviews on #21 caught a two-row paraphrase here, which is + what a second copy of a table is for. That this guard survives the pin bump at + all is RULED openxFactory#656 comment 5700475319 (Brett Heap, 2026-09-16, by interactive multi-choice), answer (a): keep the guards, correct their reasons. @@ -160,19 +162,16 @@ def bundle(tmp_path) -> Path: bundle stopped being the expected state and started being a regression — see `tests/opendox_bundle.py::_absent`, which reads both commits before it decides. A probe that quietly ran against a stand-in `helpers.js` would - measure the stand-in rather than the shipped file, so the skip is still the - right outcome for a consumer whose installed commit is demonstrably a - DIFFERENT one (this guard measures disagreement, never an ordering). + measure the stand-in rather than the shipped file, so a skip is still the + right outcome wherever `_absent()` gives one. """ source = _opendox_bundle() if source is None: # The shared rule in `tests/opendox_bundle.py::_absent`, which READS the - # installed distribution's PEP 610 provenance instead of asserting it: - # FAIL for the DECLARED commit and for unrecorded provenance UNDER CI; - # SKIP for a DIFFERENT commit, and for unrecorded provenance OFF CI. - # Round 1 of the review on #21 found this file claiming "came from - # somewhere older than the declared pin" on a check that only tested for - # a marker; if `0b4e8bbf` itself ever stopped shipping `web/**`, all + # installed distribution's PEP 610 provenance instead of asserting it. + # Its four-row table is there, not restated here. Round 1 of the review on + # #21 found this file claiming the install "came from somewhere older than + # the declared pin" on a check that only tested for a marker; if `0b4e8bbf` itself ever stopped shipping `web/**`, all # thirteen probes below would have skipped and this required check would # have stayed green over the regression. import opendox_bundle @@ -699,7 +698,11 @@ def test_the_declared_pin_missing_its_bundle_FAILS(monkeypatch) -> None: def test_a_different_installed_commit_SKIPS_and_names_both(monkeypatch) -> None: - """The lawful case: a consumer assembling at its own, older pin.""" + """The lawful case: a consumer assembling at a DIFFERENT commit. + + Not "older": the values are synthetic and `_absent()` compares identities, so + nothing here establishes an ordering. Caught at the review of `27a89fd`. + """ call = _decide(monkeypatch, _PIN_A, _PIN_B, ci=True) with pytest.raises(pytest.skip.Exception) as raised: call() @@ -722,11 +725,34 @@ def test_unknown_provenance_SKIPS_off_ci(monkeypatch) -> None: call = _decide(monkeypatch, _PIN_A, None, ci=False) with pytest.raises(pytest.skip.Exception) as raised: call() - assert "no PEP 610 provenance" in str(raised.value) + message = str(raised.value) + assert "no usable PEP 610 provenance could be read" in message + assert "NOTHING is claimed here about" in message + + +def test_an_unreadable_declared_pin_says_so_rather_than_blaming_the_install( + monkeypatch) -> None: + """The INSTALLED side can be perfectly good and the comparison still fail. + + Caught at the review of `27a89fd` on #21: this branch used to report "this + installation records no PEP 610 provenance" even when the installation had + recorded a valid one and it was `pyproject.toml` that could not be read. The + message now names whichever side is actually missing. + """ + call = _decide(monkeypatch, None, _PIN_B, ci=False) + with pytest.raises(pytest.skip.Exception) as raised: + call() + message = str(raised.value) + assert "declared pin could not be read" in message + assert "no usable PEP 610 provenance" not in message def test_under_ci_reads_the_environment_the_runner_sets(monkeypatch) -> None: - """`CI=true` is what GitHub Actions sets; nothing else is treated as CI.""" + """`CI` is read, not guessed: `1`, `true` and `yes` (any case, trimmed) are + CI; every other value, and an unset variable, are not. GitHub Actions sets + `CI=true`. The docstring used to say "nothing else is treated as CI" while the + body below accepted three spellings — caught at the review of `27a89fd`. + """ for value, expected in (("true", True), ("TRUE", True), ("1", True), ("yes", True), ("false", False), ("", False)): monkeypatch.setenv("CI", value) From 399e2a9e6e3deff917c2063df00404e391c73f16 Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 16:45:02 +0000 Subject: [PATCH 12/33] Review at f6f1b991: the two FAILURES are two different claims, and declared_pin()'s own failure branch is driven at last MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copilot's review `5225285200` at `f6f1b991` filed five findings — four suppressed, one thread. All five are answered here by measurement, none is argued away. ONE FINDING WITH TEETH, and it is the only coverage gap left in the guard. The CI fail-closed policy turns on `declared_pin()` returning None when reading `pyproject.toml` raises, and every decision test monkeypatches `declared_pin()` itself — so `declared=None` had only ever been an INPUT and never once a value the function produced. `test_declared_pin_is_none_when_the_read_raises` and `test_declared_pin_is_none_when_pyproject_is_not_utf_8` now drive both raising types through a narrow `Path.read_text` patch scoped to `pyproject.toml`. The second is the one that matters: `UnicodeDecodeError` is a `ValueError`, NOT an `OSError`, and until the review of `27a89fd` it was uncaught — a non-UTF-8 `pyproject.toml` raised straight past `_absent()`'s unknown-provenance policy. The branch can no longer narrow back to `OSError` alone in silence. THREE FINDINGS OF ONE DEFECT, the same one this pull request exists to sweep for, and committed inside the sweep for the fourth round running: prose that collapses `_absent()`'s two FAILURES into one. They are not one claim. Equal commits FAIL saying "the openDox we declare is wrong"; an unreadable side under CI FAILS saying "this run cannot say which openDox is installed", which is a PROVENANCE ANOMALY — a metadata or install failure, never evidence that the bundle regressed. Calling the second a regression misdiagnoses it. Corrected at both sites Copilot named: `tests/opendox_bundle.py`'s module summary (now four outcomes as an explicit list, two skips and two failures, pointing at `_absent()`'s canonical table) and `tests/test_gate_loop_probes.py`'s module summary (the lumped bullet split in two). The same edit repairs a sentence the previous commit left truncated mid-clause ("… included. A skipped" / "THE TWO SKIPS DO NOT SAY…"). ONE FINDING OF ARITHMETIC. The parser-case inventory said NINE and the file holds TEN `installed_commit()` tests: the upper-case normalization case added at `b177eef` never reached the inventory, and the paragraph below it numbered the DELETED source-inspection test as "a tenth" as though it were one of them. Both corrected, and the count now carries the command that derives it (`grep -c '^def test_installed_commit' tests/test_gate_loop_probes.py` -> 10). THE OPEN THREAD (`PRRT_kwDOUPv7_s6jBAXA`, `.github/workflows/validate.yml:227`): the description's headline said 15 guard tests while the workflow attributed the rise to 17, and the workflow was right. Measured here: `git diff main -- tests/test_gate_loop_probes.py | grep -c '^+def test_'` -> **19** with this commit's two. The PR body's headline, the workflow's attribution and the series are all set to the measured figure rather than reconciled to each other. THREE STALE `# pragma: no cover` CLAIMS REMOVED, same defect class: the branches on `declared_pin()`'s read, `installed_commit()`'s lookup and its JSON parse are each driven by a named test now, so a pragma telling a reader nothing exercises them had become false. The one on `find()`'s `ModuleNotFoundError` STAYS — no test uninstalls `opendox`. MEASURED at this head with `validate.yml`'s exact invocation: **336 passed, 6 skipped** (334 before; the delta is exactly this commit's two tests). Diff against `main`: 7 files, +795 / -74. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- .github/workflows/validate.yml | 18 ++++--- tests/opendox_bundle.py | 49 +++++++++++++----- tests/test_gate_loop_probes.py | 92 ++++++++++++++++++++++++++++------ 3 files changed, 124 insertions(+), 35 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index b485b20..29a4fd9 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -206,7 +206,7 @@ jobs: # alongside `test_doxbench_turns.py`. # # WITH IT GONE AND THE PIN MOVED, this invocation goes 301 passed / - # 23 skipped -> 334 passed / 6 skipped, and BOTH HALVES OF THAT DELTA HAVE + # 23 skipped -> 336 passed / 6 skipped, and BOTH HALVES OF THAT DELTA HAVE # TO BE SAID SEPARATELY, because Copilot's round-3 review of #21 caught this # block conflating them: # @@ -220,14 +220,18 @@ jobs: # file leaves this list, so that skip is no longer RUN rather than # cleared. Counting it as cleared would describe a transition that never # happened. - # * The remaining rise to 334 is NOT the bump: it is the 17 direct tests + # * The remaining rise to 336 is NOT the bump: it is the 19 direct tests # of the provenance guard that Copilot's review rounds asked for, which # live in `tests/test_gate_loop_probes.py` and are therefore on this - # list. The bump alone measured 317. (This figure has been re-derived at - # every head rather than carried: 317 -> 323 -> 330 -> 332 -> 333 -> 334, - # once per - # round that added tests, which is the same discipline the block above - # applies to the skip counts.) + # list. The bump alone measured 317. Both counts are re-derived at every + # head rather than carried: + # git diff main -- tests/test_gate_loop_probes.py | grep -c '^+def test_' + # gives 19, and the passing figure has run 317 -> 323 -> 330 -> 332 -> + # 333 -> 334 -> 336, once per round that added tests — the same + # discipline the block above applies to the skip counts. The last step + # is the review of `f6f1b991`, which asked for the two cases that drive + # `declared_pin()`'s own unreadable-file branch instead of supplying its + # None as an input.) # # The 6 skips that remain are the three seam suites' `doc_health` pairs, # which no pin bump touches. diff --git a/tests/opendox_bundle.py b/tests/opendox_bundle.py index 8ba1d09..a897521 100644 --- a/tests/opendox_bundle.py +++ b/tests/opendox_bundle.py @@ -56,14 +56,31 @@ declares — note the claim is "different", never "older": nothing here proves an ordering, only a disagreement — and where the installation records no provenance at all AND the run is off CI. Everywhere else `_absent()` fails closed, the -declared pin included, and under CI unrecorded provenance included. A skipped -THE TWO SKIPS DO NOT SAY THE SAME THING, and this paragraph ran them together -until the review of `27a89fd` on #21. The different-commit skip says "this is not -the openDox we declare", and names both commits to prove it. The unreadable-side -skip says only "the comparison could not be made", claims nothing about what is -installed, and exists because off CI an unreadable side is lawful. A FAILURE says -"the openDox we declare is wrong". The guard's whole job is to keep those three -apart instead of answering "skip" to all of them. +declared pin included, and under CI unrecorded provenance included. + +FOUR OUTCOMES, NOT THREE. Two review rounds on #21 caught this paragraph running +them together: at `27a89fd` it had one sentence for both SKIPS, and at `f6f1b991` +the sentence below still said every FAILURE means "the openDox we declare is +wrong", which is true of one of the two failures and a misdiagnosis of the other. +`_absent()`'s docstring holds the canonical table; these are the four things it +says, and they are four different claims: + + * DIFFERENT commits -> SKIP, saying "this is not the openDox we declare" and + naming both commits to prove it; + * an unreadable side, OFF CI -> SKIP, saying only "the comparison could not be + made". It claims nothing about what is installed, and it exists because off + the required path an unreadable side is lawful; + * EQUAL commits -> FAIL, saying "the openDox we declare is wrong". This is the + only outcome that is an assertion about the package; + * an unreadable side, UNDER CI -> FAIL, saying "this run cannot say which + openDox is installed". That is a PROVENANCE ANOMALY, not proof of a bad + package: `validate.yml` installs `-e ".[test]"` against a PEP 508 direct VCS + reference and pip records `direct_url.json` for that every time, so a + required run that cannot read one has lost the ability to check, which is + itself worth stopping for. + +The guard's whole job is to keep those four apart instead of answering "skip" to +all of them. """ from __future__ import annotations @@ -157,11 +174,16 @@ def declared_pin() -> str | None: toml = Path(__file__).resolve().parents[1] / "pyproject.toml" try: match = _PIN_RE.search(toml.read_text(encoding="utf-8")) - except (OSError, UnicodeDecodeError): # pragma: no cover - no checkout + except (OSError, UnicodeDecodeError): # UnicodeDecodeError is a ValueError, NOT an OSError, so a non-UTF-8 # `pyproject.toml` would have escaped this function and bypassed # `_absent()`'s explicit unknown-provenance policy altogether. Caught at - # the review of `27a89fd` on openXdox-code#21. + # the review of `27a89fd` on openXdox-code#21. The `# pragma: no cover` + # that sat on this line is GONE rather than kept: the review of + # `f6f1b991` asked for a test that makes the read fail, and BOTH raising + # types are now driven by + # `tests/test_gate_loop_probes.py::test_declared_pin_is_none_when_*`, so + # the pragma had become a false claim about the branch it labelled. return None return match.group(1).lower() if match else None @@ -185,14 +207,17 @@ def installed_commit() -> str | None: try: from importlib.metadata import distribution raw = distribution("opendox").read_text("direct_url.json") - except Exception: # pragma: no cover - not installed + except Exception: + # Driven by `test_installed_commit_is_none_when_the_package_is_not_installed` + # (the LOOKUP raises) and `…_when_reading_the_record_raises` (the read does). return None if not raw: return None try: vcs_info = json.loads(raw).get("vcs_info") or {} vcs, commit = vcs_info.get("vcs"), vcs_info.get("commit_id") - except (ValueError, AttributeError): # pragma: no cover - malformed + except (ValueError, AttributeError): + # Driven by `test_installed_commit_is_none_on_malformed_json`. return None # BOTH CHECKS ARE LOAD-BEARING, and the second is Copilot's finding at the # head before this one: `len(commit) == 40` admitted any forty CHARACTERS, so diff --git a/tests/test_gate_loop_probes.py b/tests/test_gate_loop_probes.py index 8de085b..f65d940 100644 --- a/tests/test_gate_loop_probes.py +++ b/tests/test_gate_loop_probes.py @@ -41,11 +41,18 @@ * NO recorded provenance, off CI -> SKIP, naming the declared one and saying plainly that the installed one is unrecorded (it cannot name what it could not read, which is why this is a different sentence from the one above); - * the DECLARED commit, or no recorded provenance UNDER CI -> FAIL, because that - is a regression here and a skip would take these thirteen probes quietly - green in a required check. - -Neither outcome ever passes silently against a stand-in. + * the DECLARED commit -> FAIL, because THAT is a regression here, and a skip + would take these thirteen probes quietly green in a required check; + * no recorded provenance UNDER CI -> FAIL TOO, and the review of `f6f1b991` on + #21 was right that this line used to file it under the word "regression". It + is not one. It is a PROVENANCE ANOMALY: the required run cannot establish + which openDox it is testing at all. `validate.yml` installs `-e ".[test]"` + against a PEP 508 direct VCS reference and pip records `direct_url.json` for + that every time, so failing to read one on the required path is a metadata or + install failure — worth stopping for, but never evidence that the bundle + regressed. + +No outcome ever passes silently against a stand-in. A CREATED file: no row in openxFactory's `docs/opendox-carve-manifest.yaml` (RULED OQ-C), admitted by path in the S5 annotation. @@ -771,6 +778,49 @@ def test_the_declared_pin_is_read_from_this_legs_own_pyproject() -> None: assert f"openDox-code@{declared}" in toml +def _with_unreadable_pyproject(monkeypatch, exc) -> None: + """Make `Path.read_text` raise for `pyproject.toml`, and for nothing else. + + Narrow on purpose: `declared_pin()` is the only reader under test, and a + blanket patch would hide which file the branch actually reacted to. + """ + real_read_text = Path.read_text + + def _read_text(self, *args, **kwargs): + if self.name == "pyproject.toml": + raise exc + return real_read_text(self, *args, **kwargs) + + monkeypatch.setattr(_ob.Path, "read_text", _read_text) + + +def test_declared_pin_is_none_when_the_read_raises(monkeypatch) -> None: + """The unreadable DECLARED side, produced rather than assumed. + + Copilot's review of `f6f1b991` on #21: the CI fail-closed policy depends on + `declared_pin()` returning None when the read raises, and every test of the + decision monkeypatches `declared_pin()` itself — so `declared=None` had only + ever been supplied as an input, never once produced by the function. + """ + _with_unreadable_pyproject(monkeypatch, OSError("pyproject.toml unreadable")) + assert _ob.declared_pin() is None + + +def test_declared_pin_is_none_when_pyproject_is_not_utf_8(monkeypatch) -> None: + """The half of that branch that was a REAL BUG until the review of `27a89fd`. + + `UnicodeDecodeError` is a `ValueError`, NOT an `OSError`, so a non-UTF-8 + `pyproject.toml` raised straight out of `declared_pin()` and past + `_absent()`'s unknown-provenance policy — the required check's fail-closed + rule bypassed entirely. This case exists so the `except` clause cannot + silently narrow back to `OSError` alone. + """ + _with_unreadable_pyproject( + monkeypatch, + UnicodeDecodeError("utf-8", b"\xff", 0, 1, "invalid start byte")) + assert _ob.declared_pin() is None + + # --- THE PEP 610 PARSER ITSELF, not a monkeypatched stand-in ----------------- # Copilot round 3 on #21: "all six direct guard tests monkeypatch # `installed_commit()` and therefore bypass this code … a parser regression can @@ -892,15 +942,25 @@ def test_installed_commit_is_none_when_reading_the_record_raises(monkeypatch) -> # WHY THE CASES ABOVE ARE THE CASES: `_absent()` branches on `installed_commit()`'s # RETURN VALUE, so every test of the DECISION that monkeypatches that function -# proves nothing about the READING. Nine cases cover the reading — a real VCS -# record, an absent `direct_url.json`, malformed JSON, a non-VCS (`archive_info`) -# install, a commit id that is not 40 characters, forty characters that are not -# hex, a 40-hex id under a non-git VCS, the distribution LOOKUP raising, and the -# read raising. +# proves nothing about the READING. TEN cases cover the reading of the INSTALLED +# side — a real VCS record, an absent `direct_url.json`, malformed JSON, a non-VCS +# (`archive_info`) install, a commit id that is not 40 characters, forty +# characters that are not hex, an UPPER-CASE 40-hex id (normalized rather than +# discarded), a 40-hex id under a non-git VCS, the distribution LOOKUP raising, +# and the read raising. The DECLARED side's own reading is covered separately, +# above, by the two `test_declared_pin_is_none_when_…` cases. +# +# THE COUNT IS MEASURED, NOT CARRIED, and this line read "nine" until the review +# of `f6f1b991` on #21 caught that the upper-case case added at `b177eef` had +# never reached the inventory: +# +# grep -c '^def test_installed_commit' tests/test_gate_loop_probes.py -> 10 # -# A tenth test stood here until `7c0a3b6` and is gone rather than repaired: it -# asserted strings against `inspect.getsource(installed_commit)`, and once the -# implementation stopped containing `len(commit) == 40` it passed only because an -# explanatory COMMENT still held that text. A test coupled to source text fails on -# a harmless rename and catches no behaviour — the nine above already assert the -# results it was gesturing at. +# A DELETED case is not one of the ten, and this paragraph used to number it as +# though it were ("a tenth test"). One further test stood here until `7c0a3b6` +# and is gone rather than repaired: it asserted strings against +# `inspect.getsource(installed_commit)`, and once the implementation stopped +# containing `len(commit) == 40` it passed only because an explanatory COMMENT +# still held that text. A test coupled to source text fails on a harmless rename +# and catches no behaviour — the ten above already assert the results it was +# gesturing at. From 8b23f6fd60f5bbd4a05461cbc9abe52bb7f3ccd0 Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 16:59:13 +0000 Subject: [PATCH 13/33] Review at 399e2a9: the required check's scope stated where a reader starts, and "or None where the pin carries none" retired in both readers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copilot's review `5225684154` at `399e2a9` — 🔵 "Needs a closer look", 7/7 files, **0 comments generated, 4 suppressed**, threads 6/0. Three findings fixed, one answered by measurement and registered. THE REQUIRED CHECK'S SCOPE, SAID WHERE A READER STARTS. `validate.yml`'s preamble still opened with the 2026-09-10 narrowing — "validate runs only the scaffold's shape assertions; the carved tests … return when the BUILD arc lands" — while the list at the bottom of the same file has named carved suites since slice S8. The correction was already in the file, twenty lines further down (the "§ 3.4 SLICE S8 UN-NARROWS THIS LIST" block); nothing pointed at it from the top. A forward pointer now does, with the split MEASURED rather than asserted: of the FOURTEEN files on the list, THREE never import anything under test (`test_leg_shape.py`, `test_dependency_direction.py`, `test_no_hardcoded_status_words.py` parse with `ast`) and ELEVEN import a runtime module — `test_domain_profile.py` on its § 4.4 grounds, and TEN carved suites that RUN, FOUR of which read the pinned bundle through `tests/opendox_bundle.py`. "OR None WHERE THE PIN CARRIES NONE", IN BOTH READERS. `find()` and `_opendox_bundle()` are DISCOVERY functions: they test for the marker and know nothing about why it is missing. That line was accurate while a missing bundle had exactly one expected cause; after the bump it has four, and a caller who read it could reasonably have concluded "stale pin, skip" and walked past the identity check the required job depends on. Both now describe discovery only and leave the classification to `_absent()`'s table, which is the rule this PR has been applying to every other paraphrase of that table. THE 29 IMPORTER ANNOTATIONS: ACCURATE FINDING, ANSWERED BY MEASUREMENT, NOT FIXED HERE. 29 files carry `# noqa: E402 (skips where the pin carries no bundle)` and that parenthetical is now incomplete for the same reason. Measured: grep -rn 'skips where the pin carries no bundle' tests/ -> 29 sites, 29 files git diff --name-only main -- -> 0 touched all 29 appear in openxFactory docs/opendox-carve-manifest.yaml Every one is an ARRIVED carve row whose edits are declared at openxFactory, and none is otherwise touched by this act, so editing them here would be an undeclared edit to a declared surface — the SAME ground on which `tests/test_doxbench_mutation_boundary.py` is dropped from `validate.yml` rather than repaired, and the same answer this review round gave when the question first arrived. The finding is recorded at the `_absent()` call site those annotations reach, with the three commands above, and registered as residue in the description. Nothing is concealed by the wait: a `# noqa` justification is not the outcome, and the outcome those files get is composed from what it measured. MEASURED at this head, `validate.yml`'s exact invocation: **336 passed, 6 skipped** — unchanged, as it must be: this commit edits comments and docstrings only. Diff against `main`: 7 files, +861 / -76. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- .github/workflows/validate.yml | 25 +++++++++++++++++++++++++ tests/opendox_bundle.py | 33 ++++++++++++++++++++++++++++++++- tests/test_gate_loop_probes.py | 10 +++++++++- 3 files changed, 66 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 29a4fd9..857e330 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -47,6 +47,31 @@ jobs: # The same disclosed narrowing openDox-code carries under RULED Q-L5 # (b′). # + # THAT PARAGRAPH IS THE 2026-09-10 STATE AND IS NO LONGER THE WHOLE SCOPE + # OF THIS CHECK. Copilot's review of `399e2a9` on openXdox-code#21 was + # right that a reader who stopped there would take the required job to be + # narrower than the list at the bottom of this file actually is; the + # correction was already in the file, twenty lines further down + # ("§ 3.4 SLICE S8 UN-NARROWS THIS LIST AS FAR AS THE MEASUREMENT + # ALLOWS"), and had never been pointed at from up here. MEASURED against + # that list rather than asserted — it names FOURTEEN files: + # * THREE never import anything under test (`test_leg_shape.py`, + # `test_dependency_direction.py`, `test_no_hardcoded_status_words.py` + # parse trees with `ast`). Those are the scaffold shape assertions the + # paragraph above is about, and they are all that "only the scaffold's + # shape assertions" ever described. + # * ELEVEN import a runtime module. `test_domain_profile.py` imports + # `openxdox.domain_profile` alone, on the § 4.4 grounds set out below; + # the other TEN are carved suites that RUN here, and FOUR of those + # read the pinned openDox bundle through `tests/opendox_bundle.py` + # (`test_gate_loop_views.py`, `test_gate_loop_probes.py`, + # `test_doxbench_abstract_store.py`, `test_doxbench_telemetry.py`). + # What Q-L8 (b′) still keeps out is the REST of the carved corpus, which + # is BUILD-blocked on `doc_health` / `ideation_dashboard` — and + # `tests/test_doxbench_mutation_boundary.py` is the one file this act + # moves from the running group into that one, for the reason recorded in + # the drop block below. + # # `tests/test_dependency_direction.py` joins it under # `split-opendox-two-layer-product` § 4.1 (RULED 5626260214, # opensoft/openxFactory#656). It is a SHAPE assertion authored HERE, of diff --git a/tests/opendox_bundle.py b/tests/opendox_bundle.py index a897521..e9993fb 100644 --- a/tests/opendox_bundle.py +++ b/tests/opendox_bundle.py @@ -110,7 +110,17 @@ def find() -> Path | None: - """The installed openDox's `web/` bundle, or None where the pin carries none.""" + """The installed openDox's `web/` bundle, or None where no bundle was found. + + DISCOVERY ONLY: this function tests for the marker and says nothing about + WHY it is absent. `None` used to be documented as "the pin carries none", + which was the single expected cause before the bump and is now one of four + (a regression at the declared pin, a consumer at a different commit, or + either side unreadable). Classifying it is `_absent()`'s job and its table + is not restated here — a caller that read the old line could have concluded + "stale pin, skip" and walked straight past the identity check. Caught at the + review of `399e2a9` on openXdox-code#21. + """ try: import opendox except ModuleNotFoundError: # pragma: no cover - no consumer pinned @@ -341,6 +351,27 @@ def require(*, module_level: bool = True) -> Path: if _STAGED is None: web = find() if web is None: + # THE 29 IMPORTER ANNOTATIONS THAT REACH THIS LINE ARE STALE, AND + # THEY ARE NOT REPAIRED HERE. Copilot's review of `399e2a9` on + # openXdox-code#21 is right about the fact: 29 files carry + # `from opendox_bundle import OPENDOX_WEB # noqa: E402 (skips + # where the pin carries no bundle)`, and after the bump this path + # also FAILS — at the declared pin, and for an unreadable side under + # CI. Measured, not estimated: + # grep -rn 'skips where the pin carries no bundle' tests/ -> 29 + # sites in 29 files + # git diff --name-only main -- -> 0 + # all 29 appear in openxFactory `docs/opendox-carve-manifest.yaml` + # Every one of them is an ARRIVED carve row whose edits are declared + # at openxFactory, and none is otherwise touched by this act, so + # editing them here would be an undeclared edit to a declared + # surface — the same ground on which + # `tests/test_doxbench_mutation_boundary.py` is DROPPED from + # `validate.yml` rather than repaired. Registered as residue in #21's + # description for a later declared act. Nothing is hidden by the + # wait: the annotation is a `# noqa` justification, while the + # outcome those files actually get is composed below, from what it + # measured, and names itself in full. _absent("openDox's `web/` bundle", module_level=module_level) staging = Path(tempfile.mkdtemp(prefix="opendox-bundle-")) atexit.register(shutil.rmtree, staging, True) diff --git a/tests/test_gate_loop_probes.py b/tests/test_gate_loop_probes.py index f65d940..04339e7 100644 --- a/tests/test_gate_loop_probes.py +++ b/tests/test_gate_loop_probes.py @@ -143,7 +143,15 @@ def _run_node(body: str, bundle: Path) -> dict: def _opendox_bundle() -> Path | None: - """The INSTALLED openDox's web bundle, or None where the pin carries none.""" + """The INSTALLED openDox's web bundle, or None where no bundle was found. + + DISCOVERY ONLY, same contract as `tests/opendox_bundle.py::find` and stale + in the same way until the review of `399e2a9` on #21: "where the pin carries + none" was the one expected cause before the bump, and the `bundle` fixture + below now routes `None` into `_absent()` precisely BECAUSE it is no longer + the only one. What the absence means is `_absent()`'s four-row table; this + function only reports that the marker is not there. + """ try: import opendox except ModuleNotFoundError: # pragma: no cover - no consumer From 24cd5f219a0ba0550423a17a33657ae01db5ae8d Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 17:11:02 +0000 Subject: [PATCH 14/33] Review at 8b23f6f: the three CALL SITES that route a missing subject into the guard are tested, one level out from the decision and the parser MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copilot's review `5225817509` at `8b23f6f` — 🔵 "Needs a closer look", 7/7 files, **0 comments generated, 3 suppressed**, threads 6/0. All three are ONE finding, it is accurate, and it is the round-3 finding one level further out. WHAT IT SAW. Every guard test to date either calls `_absent()` directly or monkeypatches the function beneath it. They prove what the guard DECIDES and what `installed_commit()` READS — and nothing about whether the three CALLERS still ask it. In Copilot's words: "changing this new call back to an unconditional `pytest.skip` would leave the 19 guard tests green while the `OPENDOX_WEB` importers silently skip under CI". That is exactly the silent green this act exists to remove, reached one level out each round: first through the decision, then through the parser, now through the call site. SEVEN TESTS, AT THE THREE SITES IT NAMED, each driving the outcome rather than restating the branch: * `tests/opendox_bundle.py::require` (`:375`) — `find()` forced to None with `_STAGED` reset, because `require()` stages once per process and every other suite in this run has already filled it; without that reset the test would never reach the branch. FAILS at the declared pin, SKIPS for a different one. * `tests/test_gate_loop_probes.py::bundle` (`:185`) — driven through the REAL fixture with `request.getfixturevalue("bundle")`, so what is proven is the branch the thirteen probes actually take. Same two outcomes. * `tests/test_gate_loop_views.py::_view_extension_or_skip` (`:669`) — BOTH refusal branches, which nothing had reached: the module absent (`sys.modules` entry set to None plus the package attribute deleted — neither alone is enough), and `ViewBinding` without RULED Q2's `exports` field, which is the shape a PARTIAL packaging regression takes. The first branch at the declared pin and at a different one; the second at the declared pin. MEASURED at this head, `validate.yml`'s exact invocation: **343 passed, 6 skipped** (336 before; the delta is exactly these seven). The guard's own tests are now **26**, re-derived not carried: git diff main -- tests/test_gate_loop_probes.py \ tests/test_gate_loop_views.py | grep -c '^+def test_' -> 26 Whole tree: **153 failed, 612 passed, 10 skipped, 128 errors** — failures, skips and errors unchanged; 605 -> 612 is these seven. Diff vs main: 7 files, +1013/-76. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- .github/workflows/validate.yml | 26 +++++++----- tests/test_gate_loop_probes.py | 75 +++++++++++++++++++++++++++++++++ tests/test_gate_loop_views.py | 77 ++++++++++++++++++++++++++++++++++ 3 files changed, 167 insertions(+), 11 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 857e330..7636878 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -231,7 +231,7 @@ jobs: # alongside `test_doxbench_turns.py`. # # WITH IT GONE AND THE PIN MOVED, this invocation goes 301 passed / - # 23 skipped -> 336 passed / 6 skipped, and BOTH HALVES OF THAT DELTA HAVE + # 23 skipped -> 343 passed / 6 skipped, and BOTH HALVES OF THAT DELTA HAVE # TO BE SAID SEPARATELY, because Copilot's round-3 review of #21 caught this # block conflating them: # @@ -245,18 +245,22 @@ jobs: # file leaves this list, so that skip is no longer RUN rather than # cleared. Counting it as cleared would describe a transition that never # happened. - # * The remaining rise to 336 is NOT the bump: it is the 19 direct tests + # * The remaining rise to 343 is NOT the bump: it is the 26 direct tests # of the provenance guard that Copilot's review rounds asked for, which - # live in `tests/test_gate_loop_probes.py` and are therefore on this - # list. The bump alone measured 317. Both counts are re-derived at every - # head rather than carried: - # git diff main -- tests/test_gate_loop_probes.py | grep -c '^+def test_' - # gives 19, and the passing figure has run 317 -> 323 -> 330 -> 332 -> - # 333 -> 334 -> 336, once per round that added tests — the same + # live in `tests/test_gate_loop_probes.py` and + # `tests/test_gate_loop_views.py` and are therefore both on this list. + # The bump alone measured 317. Both counts are re-derived at every head + # rather than carried: + # git diff main -- tests/test_gate_loop_probes.py \ + # tests/test_gate_loop_views.py | grep -c '^+def test_' + # gives 26, and the passing figure has run 317 -> 323 -> 330 -> 332 -> + # 333 -> 334 -> 336 -> 343, once per round that added tests — the same # discipline the block above applies to the skip counts. The last step - # is the review of `f6f1b991`, which asked for the two cases that drive - # `declared_pin()`'s own unreadable-file branch instead of supplying its - # None as an input.) + # is the review of `8b23f6f`, which asked for the CALL SITES: the tests + # before it proved what the guard decides and what it reads, and none of + # them proved that the three callers still route a missing subject into + # it, so swapping any one call for a bare `pytest.skip` would have left + # every required test green.) # # The 6 skips that remain are the three seam suites' `doc_health` pairs, # which no pin bump touches. diff --git a/tests/test_gate_loop_probes.py b/tests/test_gate_loop_probes.py index 04339e7..52c0581 100644 --- a/tests/test_gate_loop_probes.py +++ b/tests/test_gate_loop_probes.py @@ -972,3 +972,78 @@ def test_installed_commit_is_none_when_reading_the_record_raises(monkeypatch) -> # still held that text. A test coupled to source text fails on a harmless rename # and catches no behaviour — the ten above already assert the results it was # gesturing at. + + +# --- THE CALL SITES, not the decision and not the parser --------------------- +# Copilot's review of `8b23f6f` on #21, and it is the round-3 finding one level +# out: the tests above prove what `_absent()` DECIDES and what +# `installed_commit()` READS, and every one of them either calls `_absent()` +# directly or monkeypatches the function under it. None of them proves that the +# three CALLERS still route a missing subject INTO `_absent()`. "Replacing this +# call with `pytest.skip` would leave the 19 guard tests green while the +# `OPENDOX_WEB` importers silently skip under CI" — exactly the silent green +# this whole guard exists to break, reached one level further out each round. +# Two call sites are covered here; the third +# (`test_gate_loop_views.py::_view_extension_or_skip`) is covered in that file, +# beside the assertions it gates. + + +def _pin(monkeypatch, declared, installed, *, ci=True): + """Fix what the guard will READ, so a call site's OUTCOME is the assertion.""" + monkeypatch.setattr(_ob, "declared_pin", lambda: declared) + monkeypatch.setattr(_ob, "installed_commit", lambda: installed) + monkeypatch.setenv("CI", "true" if ci else "") + + +def test_require_FAILS_at_the_declared_pin_when_the_bundle_is_missing( + monkeypatch) -> None: + """`opendox_bundle.require()`'s own call site, driven with no bundle. + + `_STAGED` is reset because `require()` stages once per process and every + other suite in this run has already filled it — without the reset this test + would never reach `find()` at all, and would prove nothing. + """ + _pin(monkeypatch, _PIN_A, _PIN_A) + monkeypatch.setattr(_ob, "_STAGED", None) + monkeypatch.setattr(_ob, "find", lambda: None) + with pytest.raises(pytest.fail.Exception) as raised: + _ob.require(module_level=False) + assert "REGRESSION at the declared pin" in str(raised.value) + + +def test_require_SKIPS_for_a_different_installed_commit(monkeypatch) -> None: + """...and the lawful consumer still gets a skip through the same call.""" + _pin(monkeypatch, _PIN_A, _PIN_B) + monkeypatch.setattr(_ob, "_STAGED", None) + monkeypatch.setattr(_ob, "find", lambda: None) + with pytest.raises(pytest.skip.Exception) as raised: + _ob.require(module_level=False) + assert "NOT the declared pin's doing" in str(raised.value) + + +def test_the_bundle_fixture_FAILS_at_the_declared_pin(request, monkeypatch) -> None: + """The `bundle` fixture's call site, driven through the real fixture. + + `request.getfixturevalue` runs the fixture that the thirteen probes below + receive, so what is proven is the branch they actually take — not a copy of + it written into the test. + """ + import sys + _pin(monkeypatch, _PIN_A, _PIN_A) + monkeypatch.setattr(sys.modules[__name__], "_opendox_bundle", lambda: None) + with pytest.raises(pytest.fail.Exception) as raised: + request.getfixturevalue("bundle") + assert "REGRESSION at the declared pin" in str(raised.value) + + +def test_the_bundle_fixture_SKIPS_for_a_different_installed_commit( + request, monkeypatch) -> None: + """...and skips, naming both commits, for an assembly at another pin.""" + import sys + _pin(monkeypatch, _PIN_A, _PIN_B) + monkeypatch.setattr(sys.modules[__name__], "_opendox_bundle", lambda: None) + with pytest.raises(pytest.skip.Exception) as raised: + request.getfixturevalue("bundle") + message = str(raised.value) + assert _PIN_A[:8] in message + assert _PIN_B[:8] in message diff --git a/tests/test_gate_loop_views.py b/tests/test_gate_loop_views.py index 39c4a7e..ab27d6e 100644 --- a/tests/test_gate_loop_views.py +++ b/tests/test_gate_loop_views.py @@ -760,3 +760,80 @@ def test_the_draft_views_one_action_is_the_create_forms_own_submit() -> None: assert create.count('method: "POST"') == 1, "still exactly one write" # the TILE path is untouched: there a new document really is being started assert 'o.submitLabel || "create document"' in create + + +# --------------------------------------------------------------------------- +# `_view_extension_or_skip`'s OWN CALL SITES — Copilot's review of `8b23f6f` on +# openXdox-code#21, and it was right: the three materialization assertions above +# exercise only the SUCCESSFUL import-and-`exports` path. The guard's two +# refusal branches — the module absent, and `ViewBinding` without RULED Q2's +# `exports` field — were reached by nothing, so replacing either +# `_absent()` call with a bare `pytest.skip` would have left every required test +# green while restoring the silent green this act exists to remove. The direct +# `_absent()` tests in `tests/test_gate_loop_probes.py` prove what the guard +# DECIDES; these prove that this caller still asks it. +# --------------------------------------------------------------------------- + +_PIN_DECLARED = "a" * 40 +_PIN_OTHER = "b" * 40 + + +def _guard_reads(monkeypatch, declared, installed, *, ci=True): + import opendox_bundle + monkeypatch.setattr(opendox_bundle, "declared_pin", lambda: declared) + monkeypatch.setattr(opendox_bundle, "installed_commit", lambda: installed) + monkeypatch.setenv("CI", "true" if ci else "") + + +def _without_view_extension(monkeypatch): + """Make `from opendox import view_extension` raise ImportError. + + BOTH steps are needed and neither is enough: the attribute is deleted + because the package object already carries it once anything has imported it, + and the `sys.modules` entry is set to `None` because otherwise the submodule + is simply re-imported from disk. A `None` entry is the documented way to + make an import fail without touching the filesystem. + """ + import sys + import opendox + monkeypatch.delattr(opendox, "view_extension", raising=False) + monkeypatch.setitem(sys.modules, "opendox.view_extension", None) + + +def test_a_missing_view_extension_FAILS_at_the_declared_pin(monkeypatch) -> None: + """The ImportError branch, at the pin this leg declares, under CI.""" + _guard_reads(monkeypatch, _PIN_DECLARED, _PIN_DECLARED) + _without_view_extension(monkeypatch) + with pytest.raises(pytest.fail.Exception) as raised: + _view_extension_or_skip() + message = str(raised.value) + assert "REGRESSION at the declared pin" in message + assert "view_extension" in message + + +def test_a_missing_view_extension_SKIPS_for_a_different_installed_commit( + monkeypatch) -> None: + """...and the older-assembly reading RULED 5700475319 keeps still holds.""" + _guard_reads(monkeypatch, _PIN_DECLARED, _PIN_OTHER) + _without_view_extension(monkeypatch) + with pytest.raises(pytest.skip.Exception) as raised: + _view_extension_or_skip() + message = str(raised.value) + assert _PIN_DECLARED[:8] in message + assert _PIN_OTHER[:8] in message + + +def test_a_ViewBinding_without_exports_FAILS_at_the_declared_pin( + monkeypatch) -> None: + """The SECOND branch: the module imports, and RULED Q2's field is gone. + + This is the branch a partial packaging regression would take — the registry + present, the contract behind it — and it was the less obvious of the two to + leave unproven. + """ + from opendox import view_extension + _guard_reads(monkeypatch, _PIN_DECLARED, _PIN_DECLARED) + monkeypatch.setattr(view_extension.ViewBinding, "__annotations__", {}) + with pytest.raises(pytest.fail.Exception) as raised: + _view_extension_or_skip() + assert "`exports` field" in str(raised.value) From cb84001692d728ebe1bf6ddea234198e78eba96f Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 17:55:06 +0000 Subject: [PATCH 15/33] Review at 24cd5f2: the CI failure names WHICH side it could not read, and the guard stops dereferencing a class it only has a getattr for MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copilot review 5225945364 on openXdox-code#21: seven suppressed comments and one thread. Two are defects, five are claims that outran the code, one is grammar. TWO DEFECTS. `tests/opendox_bundle.py::_absent` FAILED under CI saying "this run cannot say which `opendox` is installed" while printing the installed hash in the next field. When `pyproject.toml` is the unreadable side, provenance is KNOWN and it is the COMPARISON that cannot be made. `_unreadable_side()` now composes that sentence for BOTH branches (declared unreadable · provenance unrecorded · NEITHER readable), so the CI failure and the off-CI skip cannot drift apart again — the off-CI branch had already learned to name the side at 27a89fd and the CI branch had not. `tests/test_gate_loop_views.py::_view_extension_or_skip` read `view_extension.ViewBinding.__annotations__` through a getattr for the ANNOTATIONS and dereferenced the CLASS directly: an assembly shipping the module without `ViewBinding` raised AttributeError instead of the declared FAIL/SKIP, on a path `view_extensions.ViewContractUnsupported` names as an unsupported assembly in its own docstring (:110-112). The class is read with getattr, missing goes to `_absent()`, and a new test drives it. FIVE CLAIMS CORRECTED, each where a reader would trust it. `test_gate_loop_views.py:834` imported `from opendox import view_extension` inside the test that proves the skip — ImportError for exactly the consumer the helper exists to skip. It goes through the helper now, before any patching. The thread PRRT_kwDOUPv7_s6jCaFX (:816, repeated at :834) and the "keeps still holds" grammar are one edit: `_absent()` compares identities and never asks git which came first, so b*40 is a DIFFERENT commit, not an older assembly. `test_gate_loop_probes.py:180` said a missing bundle became a regression at the bump, full stop. True only at the commit this leg DECLARES; the other three rows still skip or report an anomaly. Qualified. `tests/opendox_bundle.py:77` and the views table carried the same over-broad "cannot say which openDox is installed" row. Comparison-neutral now. `.github/workflows/validate.yml:68` claimed FOUR suites read the pinned bundle through `tests/opendox_bundle.py`. Measured over the fourteen named files: `grep -ln 'import opendox_bundle'` -> TWO (views, probes); `grep -ln 'from opendox import'` -> telemetry:21 and abstract_store:43,45 plus views' own guarded import. The doxbench pair imports pinned PYTHON modules with no guard in the path — the distinction the line had erased. MEASURED at this head, validate.yml's own invocation: 346 passed, 6 skipped (343 before; the delta is exactly this round's three tests). The two guard suites alone: 77 passed. Guard tests 26 -> 29 (`git diff main -- tests/test_gate_loop_probes.py tests/test_gate_loop_views.py | grep -c '^+def test_'`). Every count in validate.yml's record block and in the PR body moved with the measurement. REGISTERED, NOT DONE: `src/openxdox/view_extensions.py:411` has the runtime twin of the second defect — it builds `ViewBinding(**spec)` and catches TypeError only, so a module without the class raises AttributeError rather than ViewContractUnsupported. That file is not among this PR's seven and a pin bump is not where a materialization path changes behaviour. It is in the PR body's "What this does NOT do". Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- .github/workflows/validate.yml | 48 ++++++++++++++++++-------- tests/opendox_bundle.py | 62 ++++++++++++++++++++++++---------- tests/test_gate_loop_probes.py | 56 +++++++++++++++++++++++++----- tests/test_gate_loop_views.py | 61 +++++++++++++++++++++++++++++---- 4 files changed, 180 insertions(+), 47 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 7636878..5714780 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -62,10 +62,25 @@ jobs: # shape assertions" ever described. # * ELEVEN import a runtime module. `test_domain_profile.py` imports # `openxdox.domain_profile` alone, on the § 4.4 grounds set out below; - # the other TEN are carved suites that RUN here, and FOUR of those - # read the pinned openDox bundle through `tests/opendox_bundle.py` - # (`test_gate_loop_views.py`, `test_gate_loop_probes.py`, - # `test_doxbench_abstract_store.py`, `test_doxbench_telemetry.py`). + # the other TEN are carved suites that RUN here, and FOUR of them reach + # the PINNED openDox — in TWO DIFFERENT WAYS, which this line ran + # together until the review of `24cd5f2` on #21 measured them apart: + # - TWO read the pinned WEB BUNDLE through `tests/opendox_bundle.py` + # (`test_gate_loop_views.py`, `test_gate_loop_probes.py`), so the + # provenance guard below decides what a missing bundle costs them; + # - TWO import pinned openDox PYTHON MODULES directly and never touch + # that helper: `test_doxbench_abstract_store.py:43,45` + # (`from opendox import doxbench_abstract_store`, `doxbench_turns`) + # and `test_doxbench_telemetry.py:21` (`from opendox import + # doxbench_telemetry`). A regression in the pin reaches those two as + # an ImportError or a failing assertion — loudly, and with no guard + # in the path to classify it. + # `test_gate_loop_views.py` does both (it imports + # `opendox.view_extension` through its own guarded helper). Measured + # over the fourteen files named below, not asserted: + # grep -ln 'import opendox_bundle' -> views, probes + # grep -ln 'from opendox import' -> views, telemetry, + # abstract_store # What Q-L8 (b′) still keeps out is the REST of the carved corpus, which # is BUILD-blocked on `doc_health` / `ideation_dashboard` — and # `tests/test_doxbench_mutation_boundary.py` is the one file this act @@ -231,7 +246,7 @@ jobs: # alongside `test_doxbench_turns.py`. # # WITH IT GONE AND THE PIN MOVED, this invocation goes 301 passed / - # 23 skipped -> 343 passed / 6 skipped, and BOTH HALVES OF THAT DELTA HAVE + # 23 skipped -> 346 passed / 6 skipped, and BOTH HALVES OF THAT DELTA HAVE # TO BE SAID SEPARATELY, because Copilot's round-3 review of #21 caught this # block conflating them: # @@ -245,7 +260,7 @@ jobs: # file leaves this list, so that skip is no longer RUN rather than # cleared. Counting it as cleared would describe a transition that never # happened. - # * The remaining rise to 343 is NOT the bump: it is the 26 direct tests + # * The remaining rise to 346 is NOT the bump: it is the 29 direct tests # of the provenance guard that Copilot's review rounds asked for, which # live in `tests/test_gate_loop_probes.py` and # `tests/test_gate_loop_views.py` and are therefore both on this list. @@ -253,14 +268,19 @@ jobs: # rather than carried: # git diff main -- tests/test_gate_loop_probes.py \ # tests/test_gate_loop_views.py | grep -c '^+def test_' - # gives 26, and the passing figure has run 317 -> 323 -> 330 -> 332 -> - # 333 -> 334 -> 336 -> 343, once per round that added tests — the same - # discipline the block above applies to the skip counts. The last step - # is the review of `8b23f6f`, which asked for the CALL SITES: the tests - # before it proved what the guard decides and what it reads, and none of - # them proved that the three callers still route a missing subject into - # it, so swapping any one call for a bare `pytest.skip` would have left - # every required test green.) + # gives 29, and the passing figure has run 317 -> 323 -> 330 -> 332 -> + # 333 -> 334 -> 336 -> 343 -> 346, once per round that added tests — the + # same discipline the block above applies to the skip counts. The review + # of `8b23f6f` asked for the CALL SITES: the tests before it proved what + # the guard decides and what it reads, and none of them proved that the + # three callers still route a missing subject into it, so swapping any + # one call for a bare `pytest.skip` would have left every required test + # green. The review of `24cd5f2` took the last three: the CI branch's + # message had to name WHICH side it could not read (two cases — an + # unreadable `pyproject.toml` beside a good `direct_url.json`, and + # neither side readable), and `_view_extension_or_skip()` had to survive + # a `view_extension` module that carries no `ViewBinding` class, which + # until then left this guard through an `AttributeError`.) # # The 6 skips that remain are the three seam suites' `doc_health` pairs, # which no pin bump touches. diff --git a/tests/opendox_bundle.py b/tests/opendox_bundle.py index e9993fb..10e9618 100644 --- a/tests/opendox_bundle.py +++ b/tests/opendox_bundle.py @@ -72,12 +72,16 @@ the required path an unreadable side is lawful; * EQUAL commits -> FAIL, saying "the openDox we declare is wrong". This is the only outcome that is an assertion about the package; - * an unreadable side, UNDER CI -> FAIL, saying "this run cannot say which - openDox is installed". That is a PROVENANCE ANOMALY, not proof of a bad + * an unreadable side, UNDER CI -> FAIL, naming WHICH side could not be read + and saying the two commits could not be COMPARED. It does NOT say "this run + cannot say which openDox is installed": where `pyproject.toml` is the + unreadable side the installed commit is in hand and gets printed, so that + claim was false for one of the two shapes this row covers — caught at the + review of `24cd5f2` on #21. It is a COMPARISON anomaly, not proof of a bad package: `validate.yml` installs `-e ".[test]"` against a PEP 508 direct VCS reference and pip records `direct_url.json` for that every time, so a - required run that cannot read one has lost the ability to check, which is - itself worth stopping for. + required run that cannot read one side has lost the ability to check, which + is itself worth stopping for. The guard's whole job is to keep those four apart instead of answering "skip" to all of them. @@ -246,6 +250,27 @@ def under_ci() -> bool: return os.environ.get("CI", "").strip().lower() in {"1", "true", "yes"} +def _unreadable_side(declared: str | None, installed: str | None) -> str: + """WHICH side of the comparison could not be read — never "which openDox is + installed", because two of these three shapes have a commit in hand. + + Copilot's review of `24cd5f2` on #21 caught the CI branch saying "this run + cannot say which `opendox` is installed" while the very next field printed the + installed hash: when `pyproject.toml` is the unreadable side, the provenance is + known and it is the COMPARISON that cannot be made. Both branches compose their + phrase here now, so the two can no longer drift apart — which is how the off-CI + branch came to name the side (review of `27a89fd`) while the CI branch did not. + """ + if declared is None and installed is None: + return ("NEITHER side could be read: this leg's declared pin is unreadable " + "in `pyproject.toml` and the installed distribution records no " + "usable PEP 610 provenance") + if declared is None: + return "this leg's declared pin could not be read from `pyproject.toml`" + return ("no usable PEP 610 provenance could be read from the installed " + "distribution") + + def _absent(subject: str, *, module_level: bool) -> NoReturn: """Raise the RIGHT outcome for a missing `subject`. @@ -276,25 +301,26 @@ def _absent(subject: str, *, module_level: bool) -> NoReturn: f"it fails here instead of skipping: a skip would take every suite " f"that depends on {subject} quietly green in a required check.") if declared is None or installed is None: + unreadable = _unreadable_side(declared, installed) if under_ci(): pytest.fail( - f"{subject} is missing AND this run cannot say which `opendox` is " - f"installed (declared={declared or 'unreadable'}, " - f"installed={installed or 'unrecorded'}). On CI that is itself the " - f"anomaly: `validate.yml` installs `-e \".[test]\"` against a PEP 508 " - f"direct VCS reference, and pip records `direct_url.json` for that " - f"every time. Failing rather than skipping, because a skip here is " - f"exactly the silent green this guard exists to prevent.") - missing = ("this leg's declared pin could not be read from " - "`pyproject.toml`" if declared is None else - "no usable PEP 610 provenance could be read from the installed " - "distribution") + f"{subject} is missing and the two commits could not be COMPARED: " + f"{unreadable} (declared={declared or 'unreadable'}, " + f"installed={installed or 'unrecorded'}). Where the field above " + f"prints a commit, THAT side was read fine; nothing here claims the " + f"installed openDox is unknown. On CI the unreadable side is itself " + f"the anomaly: `validate.yml` installs `-e \".[test]\"` against a " + f"PEP 508 direct VCS reference, and pip records `direct_url.json` " + f"for that every time. Failing rather than skipping, because a skip " + f"here is exactly the silent green this guard exists to prevent.") pytest.skip( - f"{subject} is missing and the comparison could not be made: {missing} " + f"{subject} is missing and the comparison could not be made: {unreadable} " f"(declared={declared or 'unreadable'}, " f"installed={installed or 'unreadable'}). NOTHING is claimed here about " - f"which openDox is installed — this is not the different-commit skip, " - f"which names both. Off the CI path an unreadable side is lawful (an " + f"whether the installed openDox IS the declared one — the comparison " + f"never happened. This is not the different-commit skip, which reads " + f"both sides and names them. Off the CI path an unreadable side is " + f"lawful (an " f"editable checkout or a hand-placed wheel records none). Under CI this " f"same condition FAILS.", allow_module_level=module_level) diff --git a/tests/test_gate_loop_probes.py b/tests/test_gate_loop_probes.py index 52c0581..b267336 100644 --- a/tests/test_gate_loop_probes.py +++ b/tests/test_gate_loop_probes.py @@ -173,12 +173,17 @@ def bundle(tmp_path) -> Path: openxFactory#656 comment 5700475319 (Brett Heap, 2026-09-16, by interactive multi-choice), answer (a): keep the guards, correct their reasons. - That was a plain skip until the 2026-09-16 pin bump, when a missing - bundle stopped being the expected state and started being a regression — - see `tests/opendox_bundle.py::_absent`, which reads both commits before it - decides. A probe that quietly ran against a stand-in `helpers.js` would - measure the stand-in rather than the shipped file, so a skip is still the - right outcome wherever `_absent()` gives one. + That was a plain skip until the 2026-09-16 pin bump, when a missing bundle + stopped being the expected state AT THE COMMIT THIS LEG DECLARES and started + being a regression THERE — see `tests/opendox_bundle.py::_absent`, which reads + both commits before it decides. Only the equal-commit row is a regression: a + DIFFERENT installed commit still skips, an unreadable side still skips off CI, + and the CI failure for an unreadable side is a comparison anomaly rather than + a verdict on the package. The review of `24cd5f2` caught this sentence + generalizing the one row to all four, two paragraphs below the table. + A probe that quietly ran against a stand-in `helpers.js` would measure the + stand-in rather than the shipped file, so a skip is still the right outcome + wherever `_absent()` gives one. """ source = _opendox_bundle() if source is None: @@ -728,11 +733,46 @@ def test_a_different_installed_commit_SKIPS_and_names_both(monkeypatch) -> None: def test_unknown_provenance_FAILS_under_ci(monkeypatch) -> None: - """The round-2 finding: on the REQUIRED path, unknown is not neutral.""" + """The round-2 finding: on the REQUIRED path, unknown is not neutral. + + The message says the two commits could not be COMPARED and names the side that + could not be read — it no longer says "this run cannot say which `opendox` is + installed", which was false whenever the unreadable side was `pyproject.toml` + (the review of `24cd5f2`, and the assertion below moved with it). + """ call = _decide(monkeypatch, _PIN_A, None, ci=True) with pytest.raises(pytest.fail.Exception) as raised: call() - assert "cannot say which `opendox` is installed" in str(raised.value) + message = str(raised.value) + assert "could not be COMPARED" in message + assert "no usable PEP 610 provenance could be read" in message + + +def test_an_unreadable_declared_pin_under_ci_does_not_blame_the_install( + monkeypatch) -> None: + """THE CI TWIN of the off-CI test below, and the review of `24cd5f2`'s finding. + + `declared_pin()` unreadable with a perfectly good `direct_url.json` used to FAIL + saying "this run cannot say which `opendox` is installed" while the very next + field printed the installed hash. What is unknown is the COMPARISON, and the + message has to say which side went missing — under CI exactly as off it. + """ + call = _decide(monkeypatch, None, _PIN_B, ci=True) + with pytest.raises(pytest.fail.Exception) as raised: + call() + message = str(raised.value) + assert "declared pin could not be read" in message + assert "no usable PEP 610 provenance" not in message + assert _PIN_B in message + + +def test_both_sides_unreadable_says_NEITHER_rather_than_picking_one( + monkeypatch) -> None: + """The third shape, which the either/or phrasing could only half-report.""" + call = _decide(monkeypatch, None, None, ci=True) + with pytest.raises(pytest.fail.Exception) as raised: + call() + assert "NEITHER side could be read" in str(raised.value) def test_unknown_provenance_SKIPS_off_ci(monkeypatch) -> None: diff --git a/tests/test_gate_loop_views.py b/tests/test_gate_loop_views.py index ab27d6e..5c40e3e 100644 --- a/tests/test_gate_loop_views.py +++ b/tests/test_gate_loop_views.py @@ -617,8 +617,8 @@ def test_the_style_residue_is_recorded_rather_than_skipped() -> None: def _view_extension_or_skip(): """The assembled openDox's view registry, or — where it has none — whichever of FAIL and SKIP `tests/opendox_bundle.py::_absent` measures: FAIL for the - commit this leg DECLARES and for unrecorded provenance UNDER CI; SKIP for a - DIFFERENT commit and for unrecorded provenance OFF CI. + commit this leg DECLARES and for an UNREADABLE SIDE (either commit) under CI; + SKIP for a DIFFERENT commit and for an unreadable side OFF CI. This summary took two goes. It read "or SKIP where it has none", which contradicted the table four paragraphs down; the review of `42741fd` on #21 @@ -656,10 +656,11 @@ def _view_extension_or_skip(): out of `pyproject.toml` and the installed commit out of the distribution's PEP 610 `direct_url.json`. This docstring said "different (or unrecorded) -> SKIP", and Copilot's round-3 review of #21 was right that the parenthesis is - false: UNRECORDED provenance FAILS under CI and skips only off it, because a + false: an UNREADABLE SIDE fails under CI and skips only off it, because a skip on the required path is the silent green the guard exists to prevent. The table `_absent()` actually carries: equal -> FAIL; different -> SKIP with - both commits named; unrecorded -> FAIL under CI, SKIP off it. + both commits named; either side unreadable -> FAIL under CI naming WHICH side + it was, SKIP off it. """ import opendox_bundle try: @@ -672,7 +673,20 @@ def _view_extension_or_skip(): opendox_bundle._absent( "`opendox.view_extension` (§ 3.4 slice S3's view registry)", module_level=False) - if "exports" not in getattr(view_extension.ViewBinding, "__annotations__", {}): + binding = getattr(view_extension, "ViewBinding", None) + if binding is None: + # THE MODULE WITHOUT ITS CLASS — a third unsupported shape, and until the + # review of `24cd5f2` on #21 the only one that escaped this guard: the + # class was dereferenced here directly, so an assembly shipping + # `view_extension` without `ViewBinding` raised AttributeError instead of + # taking the declared FAIL/SKIP. `view_extensions.ViewContractUnsupported` + # names exactly that assembly as unsupported (its docstring: "an assembly + # that pins an openDox without `view_extension.ViewBinding`"), so it is + # `_absent()`'s to classify, like the other two. + opendox_bundle._absent( + "`opendox.view_extension.ViewBinding` (§ 3.4 slice S3's view " + "registry class)", module_level=False) + if "exports" not in getattr(binding, "__annotations__", {}): opendox_bundle._absent( "RULED Q2's `exports` field on `opendox.view_extension.ViewBinding` " "(openxFactory#656 comment 5648049748)", module_level=False) @@ -813,7 +827,14 @@ def test_a_missing_view_extension_FAILS_at_the_declared_pin(monkeypatch) -> None def test_a_missing_view_extension_SKIPS_for_a_different_installed_commit( monkeypatch) -> None: - """...and the older-assembly reading RULED 5700475319 keeps still holds.""" + """...and the DIFFERENT-COMMIT reading RULED 5700475319 keeps still holds. + + Not "older", and the thread on `24cd5f2` was right to say so twice: `_absent()` + compares two identities and never asks git which came first, so `b`*40 against + `a`*40 is a different assembly and nothing more. The ruling's own ground — an + assembly is free to install an openDox behind the view contract — is what this + skip serves, and it needs no ordering to hold. + """ _guard_reads(monkeypatch, _PIN_DECLARED, _PIN_OTHER) _without_view_extension(monkeypatch) with pytest.raises(pytest.skip.Exception) as raised: @@ -830,10 +851,36 @@ def test_a_ViewBinding_without_exports_FAILS_at_the_declared_pin( This is the branch a partial packaging regression would take — the registry present, the contract behind it — and it was the less obvious of the two to leave unproven. + + THE MODULE COMES THROUGH THE HELPER, not `from opendox import view_extension`: + the review of `24cd5f2` caught that a bare import here raises ImportError for + exactly the consumer this helper exists to SKIP (a different openDox without + the module), turning a supported assembly into a hard failure inside the test + that proves the guard. This call is made BEFORE `_guard_reads()` patches + anything, so it is the real installed module or the real skip. """ - from opendox import view_extension + view_extension = _view_extension_or_skip() _guard_reads(monkeypatch, _PIN_DECLARED, _PIN_DECLARED) monkeypatch.setattr(view_extension.ViewBinding, "__annotations__", {}) with pytest.raises(pytest.fail.Exception) as raised: _view_extension_or_skip() assert "`exports` field" in str(raised.value) + + +def test_a_view_extension_without_ViewBinding_FAILS_at_the_declared_pin( + monkeypatch) -> None: + """THE THIRD unsupported shape: the module imports, the CLASS is not there. + + It raised `AttributeError` before the review of `24cd5f2` — the one path out + of this guard that never reached `_absent()` — and an AttributeError three + frames from a dataclass is precisely what + `view_extensions.ViewContractUnsupported` exists to replace with a sentence. + """ + view_extension = _view_extension_or_skip() + _guard_reads(monkeypatch, _PIN_DECLARED, _PIN_DECLARED) + monkeypatch.delattr(view_extension, "ViewBinding") + with pytest.raises(pytest.fail.Exception) as raised: + _view_extension_or_skip() + message = str(raised.value) + assert "ViewBinding" in message + assert "REGRESSION at the declared pin" in message From d8e8605456bb78c3f54f375e93e55ba5ab54c0c1 Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 18:10:30 +0000 Subject: [PATCH 16/33] Review at cb84001: both new caller branches take their ruled SKIP too, and the sweep's grep claim says which tree it was measured on MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copilot review 5226412781: five suppressed comments, no new thread. Two are coverage on the branches the last round added; three are claims in the PR description and in a quotation. BOTH NEW CALLER BRANCHES HAD ONLY THEIR FAIL HALF DRIVEN. The missing-ViewBinding branch and the missing-`exports` branch were each proved at the DECLARED pin only, so making either an unconditional failure would have passed every added test while breaking the consumer RULED 5700475319 protects — an assembly that pins an openDox behind the view contract. One test each, at `_PIN_OTHER`, asserting the skip names both commits. THE LAST "OLDER ASSEMBLY" IN THE FILE was inside a quotation of Copilot's own round-1 review, which is how it survived three rounds of this same correction. `_absent()` measures identity, never ordering; the summary says DIFFERENT now and records the borrowed word as the review's rather than the guard's. THE SWEEP'S GREP CLAIM WAS FALSE AT THIS HEAD, and the finding is exact: "`git grep -n a99eba03` returns exactly one line, the pin itself" was measured against `main` and then left unqualified while this act added thirteen provenance quotations of that commit. The description now carries both measurements — `main`: `pyproject.toml:106` and nothing else; this head: 13 lines in 6 files and NONE in `pyproject.toml`, every one a quotation the sweep added on purpose. And the description's headline test count was still 26. It is 31, from the command `validate.yml` carries. Round 10's own section keeps its 26, marked as the count at that head, because that section records that round. MEASURED at this head, validate.yml's own invocation: 348 passed, 6 skipped (346 before; the delta is exactly these two tests). The two guard suites alone: 79 passed. Whole tree (pytest tests/ -q --noconftest --continue-on-collection-errors): 153 failed, 617 passed, 10 skipped, 128 errors — failures, skips and errors unchanged, 615 -> 617 being precisely these two. Guard tests 29 -> 31. Diff vs main: 7 files, +1193 / -77. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- .github/workflows/validate.yml | 16 ++++++++---- tests/test_gate_loop_views.py | 46 ++++++++++++++++++++++++++++++++-- 2 files changed, 55 insertions(+), 7 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 5714780..2fb1c6b 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -246,7 +246,7 @@ jobs: # alongside `test_doxbench_turns.py`. # # WITH IT GONE AND THE PIN MOVED, this invocation goes 301 passed / - # 23 skipped -> 346 passed / 6 skipped, and BOTH HALVES OF THAT DELTA HAVE + # 23 skipped -> 348 passed / 6 skipped, and BOTH HALVES OF THAT DELTA HAVE # TO BE SAID SEPARATELY, because Copilot's round-3 review of #21 caught this # block conflating them: # @@ -260,7 +260,7 @@ jobs: # file leaves this list, so that skip is no longer RUN rather than # cleared. Counting it as cleared would describe a transition that never # happened. - # * The remaining rise to 346 is NOT the bump: it is the 29 direct tests + # * The remaining rise to 348 is NOT the bump: it is the 31 direct tests # of the provenance guard that Copilot's review rounds asked for, which # live in `tests/test_gate_loop_probes.py` and # `tests/test_gate_loop_views.py` and are therefore both on this list. @@ -268,8 +268,9 @@ jobs: # rather than carried: # git diff main -- tests/test_gate_loop_probes.py \ # tests/test_gate_loop_views.py | grep -c '^+def test_' - # gives 29, and the passing figure has run 317 -> 323 -> 330 -> 332 -> - # 333 -> 334 -> 336 -> 343 -> 346, once per round that added tests — the + # gives 31, and the passing figure has run 317 -> 323 -> 330 -> 332 -> + # 333 -> 334 -> 336 -> 343 -> 346 -> 348, once per round that added tests + # — the # same discipline the block above applies to the skip counts. The review # of `8b23f6f` asked for the CALL SITES: the tests before it proved what # the guard decides and what it reads, and none of them proved that the @@ -280,7 +281,12 @@ jobs: # unreadable `pyproject.toml` beside a good `direct_url.json`, and # neither side readable), and `_view_extension_or_skip()` had to survive # a `view_extension` module that carries no `ViewBinding` class, which - # until then left this guard through an `AttributeError`.) + # until then left this guard through an `AttributeError`. The review of + # `cb84001` took the two after that: BOTH new caller branches had only + # their declared-pin FAIL driven, so making either an unconditional + # failure would have passed every added test while breaking the consumer + # RULED 5700475319 protects — the assembly that pins an openDox behind + # the view contract. Each is now driven at a DIFFERENT commit too.) # # The 6 skips that remain are the three seam suites' `doc_health` pairs, # which no pin bump touches. diff --git a/tests/test_gate_loop_views.py b/tests/test_gate_loop_views.py index 5c40e3e..38b1c6c 100644 --- a/tests/test_gate_loop_views.py +++ b/tests/test_gate_loop_views.py @@ -648,9 +648,12 @@ def _view_extension_or_skip(): these two guards are its test-time counterpart. BUT THEY NO LONGER SKIP BLINDLY. Copilot's round-1 review of openXdox-code#21 - was right that `pytest.importorskip` cannot tell "an older assembly" from "a + was right that `pytest.importorskip` cannot tell a DIFFERENT assembly from "a regression in the openDox this leg DECLARES", and after the bump only the - first of those may skip: if `0b4e8bbf` lost `view_extension` or the `exports` + first of those may skip. (That review said "an older assembly"; the guard that + replaced `importorskip` cannot measure ordering, only identity, so this summary + stopped borrowing the word — the review of `cb84001` caught it here, the last + copy left in the file.) if `0b4e8bbf` lost `view_extension` or the `exports` field, all three assertions below would have gone quietly green in a required check. `tests/opendox_bundle.py::_absent` decides by READING the declared pin out of `pyproject.toml` and the installed commit out of the distribution's @@ -867,6 +870,25 @@ def test_a_ViewBinding_without_exports_FAILS_at_the_declared_pin( assert "`exports` field" in str(raised.value) +def test_a_ViewBinding_without_exports_SKIPS_for_a_different_installed_commit( + monkeypatch) -> None: + """The SKIP half of the `exports` branch, at the CALL SITE. + + The declared-pin FAIL above and the generic `_absent()` tests would both stay + green if this call became an unconditional failure, and the consumer RULED + 5700475319 protects — an assembly pinning an openDox behind the view contract — + would break with them green. Caught at the review of `cb84001`. + """ + view_extension = _view_extension_or_skip() + _guard_reads(monkeypatch, _PIN_DECLARED, _PIN_OTHER) + monkeypatch.setattr(view_extension.ViewBinding, "__annotations__", {}) + with pytest.raises(pytest.skip.Exception) as raised: + _view_extension_or_skip() + message = str(raised.value) + assert _PIN_DECLARED[:8] in message + assert _PIN_OTHER[:8] in message + + def test_a_view_extension_without_ViewBinding_FAILS_at_the_declared_pin( monkeypatch) -> None: """THE THIRD unsupported shape: the module imports, the CLASS is not there. @@ -884,3 +906,23 @@ def test_a_view_extension_without_ViewBinding_FAILS_at_the_declared_pin( message = str(raised.value) assert "ViewBinding" in message assert "REGRESSION at the declared pin" in message + + +def test_a_view_extension_without_ViewBinding_SKIPS_for_a_different_commit( + monkeypatch) -> None: + """...and the same branch at a DIFFERENT commit takes the ruled skip. + + The third unsupported shape has to be COMPATIBLE for a consumer behind the + view contract, exactly as the other two are; with only the FAIL case driven, + an unconditional failure here would pass every added test and break that + consumer. Caught at the review of `cb84001`. + """ + view_extension = _view_extension_or_skip() + _guard_reads(monkeypatch, _PIN_DECLARED, _PIN_OTHER) + monkeypatch.delattr(view_extension, "ViewBinding") + with pytest.raises(pytest.skip.Exception) as raised: + _view_extension_or_skip() + message = str(raised.value) + assert "ViewBinding" in message + assert _PIN_DECLARED[:8] in message + assert _PIN_OTHER[:8] in message From b22a6fdf0fb5ef7a0dcdc05005d1670fcc1cd32c Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 18:19:20 +0000 Subject: [PATCH 17/33] Review at d8e8605 (approval recommended): the two wording nits, and the diff size corrected to the tree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copilot review 5226574758: 🟢 "Approval recommended — The remaining comments are documentation wording corrections and do not block approval." 0 new comments, 2 suppressed, one thread repeating the first. Comments and docstrings only. tests/test_gate_loop_views.py:833 — "keeps still holds". Round 11 replaced the phrase's neighbour ("older-assembly" -> "DIFFERENT-COMMIT") and left the word itself standing; the line now reads "...and the DIFFERENT-COMMIT reading that RULED 5700475319 rests on still holds." tests/test_gate_loop_views.py:656 — round 12's new parenthesis landed mid sentence, leaving a lower-case `if` to start the clause after it. Capitalized. ALSO CORRECTED, IN THE PR BODY: the round-12 commit message says the diff is +1193 / -77. That shortstat was taken before the same commit's own validate.yml comment block; the tree is +1199 / -77. The message cannot be amended (this lane never force-pushes), so the correction lives in the description, which is what the landing squash carries. MEASURED at this head: tests/test_gate_loop_views.py 41 passed; the required invocation is 348 passed / 6 skipped, unchanged, as a docstring-only change must be. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- tests/test_gate_loop_views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_gate_loop_views.py b/tests/test_gate_loop_views.py index 38b1c6c..62f0169 100644 --- a/tests/test_gate_loop_views.py +++ b/tests/test_gate_loop_views.py @@ -653,7 +653,7 @@ def _view_extension_or_skip(): first of those may skip. (That review said "an older assembly"; the guard that replaced `importorskip` cannot measure ordering, only identity, so this summary stopped borrowing the word — the review of `cb84001` caught it here, the last - copy left in the file.) if `0b4e8bbf` lost `view_extension` or the `exports` + copy left in the file.) If `0b4e8bbf` lost `view_extension` or the `exports` field, all three assertions below would have gone quietly green in a required check. `tests/opendox_bundle.py::_absent` decides by READING the declared pin out of `pyproject.toml` and the installed commit out of the distribution's @@ -830,7 +830,7 @@ def test_a_missing_view_extension_FAILS_at_the_declared_pin(monkeypatch) -> None def test_a_missing_view_extension_SKIPS_for_a_different_installed_commit( monkeypatch) -> None: - """...and the DIFFERENT-COMMIT reading RULED 5700475319 keeps still holds. + """...and the DIFFERENT-COMMIT reading that RULED 5700475319 rests on still holds. Not "older", and the thread on `24cd5f2` was right to say so twice: `_absent()` compares two identities and never asks git which came first, so `b`*40 against From a0eed160c26b0f34bb58da18cc760ae3438825d9 Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 18:28:00 +0000 Subject: [PATCH 18/33] Review at b22a6fd: two section headers that counted, and both counts had gone stale MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copilot review 5226685677: 0 new comments, 0 open threads, two suppressed comments. Both are section headers whose numbers stopped matching the file under them, and both are accurate. tests/test_gate_loop_probes.py:1024 quoted Copilot's round-10 sentence with its "19 guard tests" — the count at ITS head, three rounds ago. The point never lived in the number, so the number is no longer carried: the header now names the quotation as that review's, and gives the two commands that are true at any head (25 added tests in this file and 6 in test_gate_loop_views.py as this was written; validate.yml's record block carries the total). tests/test_gate_loop_views.py:787 said the guard has TWO refusal branches. It has had THREE since cb84001 — the module absent, `ViewBinding` absent, and `ViewBinding` without RULED Q2's `exports`. All three are listed now, with the note that each is driven BOTH ways (FAIL at the declared pin, SKIP for a different commit), which is the coverage rule the last two rounds established: a branch proved only at the declared pin can be replaced by an unconditional failure with every added test still green, and that breaks the consumer RULED 5700475319 protects. MEASURED at this head: the two guard suites 79 passed; comments only, so the required invocation stays 348 passed / 6 skipped. Diff vs main: 7 files, +1216 / -77. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- tests/test_gate_loop_probes.py | 15 +++++++++++---- tests/test_gate_loop_views.py | 24 +++++++++++++++++------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/tests/test_gate_loop_probes.py b/tests/test_gate_loop_probes.py index b267336..e9cbd0a 100644 --- a/tests/test_gate_loop_probes.py +++ b/tests/test_gate_loop_probes.py @@ -1019,10 +1019,17 @@ def test_installed_commit_is_none_when_reading_the_record_raises(monkeypatch) -> # out: the tests above prove what `_absent()` DECIDES and what # `installed_commit()` READS, and every one of them either calls `_absent()` # directly or monkeypatches the function under it. None of them proves that the -# three CALLERS still route a missing subject INTO `_absent()`. "Replacing this -# call with `pytest.skip` would leave the 19 guard tests green while the -# `OPENDOX_WEB` importers silently skip under CI" — exactly the silent green -# this whole guard exists to break, reached one level further out each round. +# three CALLERS still route a missing subject INTO `_absent()`. That review's own +# sentence: "replacing this call with `pytest.skip` would leave the guard +# tests green while the `OPENDOX_WEB` importers silently skip under CI" — it said +# 19, the count at ITS head, and the point does not live in the number, so the +# number is not carried here. What is true at any head is the command: +# git diff main -- tests/test_gate_loop_probes.py | grep -c '^+def test_' +# git diff main -- tests/test_gate_loop_views.py | grep -c '^+def test_' +# (25 and 6 as this was written; `validate.yml`'s record block carries the total). +# It is exactly the silent green this whole guard exists to break, reached one +# level further out each round — and the review of `b22a6fd` caught the quoted +# count going stale three rounds after the quotation. # Two call sites are covered here; the third # (`test_gate_loop_views.py::_view_extension_or_skip`) is covered in that file, # beside the assertions it gates. diff --git a/tests/test_gate_loop_views.py b/tests/test_gate_loop_views.py index 62f0169..75e4d2c 100644 --- a/tests/test_gate_loop_views.py +++ b/tests/test_gate_loop_views.py @@ -782,13 +782,23 @@ def test_the_draft_views_one_action_is_the_create_forms_own_submit() -> None: # --------------------------------------------------------------------------- # `_view_extension_or_skip`'s OWN CALL SITES — Copilot's review of `8b23f6f` on # openXdox-code#21, and it was right: the three materialization assertions above -# exercise only the SUCCESSFUL import-and-`exports` path. The guard's two -# refusal branches — the module absent, and `ViewBinding` without RULED Q2's -# `exports` field — were reached by nothing, so replacing either -# `_absent()` call with a bare `pytest.skip` would have left every required test -# green while restoring the silent green this act exists to remove. The direct -# `_absent()` tests in `tests/test_gate_loop_probes.py` prove what the guard -# DECIDES; these prove that this caller still asks it. +# exercise only the SUCCESSFUL import-and-`exports` path. The guard's refusal +# branches were reached by nothing, so replacing any one `_absent()` call with a +# bare `pytest.skip` would have left every required test green while restoring the +# silent green this act exists to remove. There are THREE of them, and the third +# arrived with the review of `cb84001` (the review of `b22a6fd` caught this header +# still saying two): +# 1. `opendox.view_extension` absent — the module is not there at all; +# 2. `view_extension.ViewBinding` absent — the module without its class, +# which was an AttributeError out of this guard until `cb84001`; +# 3. `ViewBinding` without RULED Q2's `exports` — the partial packaging +# regression: the registry present, the contract behind it. +# Each is driven BOTH ways below — FAIL at the commit this leg declares, SKIP for a +# different one — because a branch proved only at the declared pin can be replaced +# by an unconditional failure with every added test still green, and that breaks the +# consumer RULED 5700475319 protects. The direct `_absent()` tests in +# `tests/test_gate_loop_probes.py` prove what the guard DECIDES; these prove that +# this caller still asks it. # --------------------------------------------------------------------------- _PIN_DECLARED = "a" * 40 From e6cd0e8050129f99dea6ccf4630834be8376e815 Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 18:38:21 +0000 Subject: [PATCH 19/33] Review at a0eed16: the parser now asserts WHICH distribution it asked about, and the required check's inventory stops crediting views with the bundle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copilot review 5226786313: 0 new comments, 0 open threads, three suppressed. One is a real coverage gap in the parser; two are documentation this act authored. THE PARSER NEVER CHECKED THE PACKAGE NAME. Both fakes for `importlib.metadata.distribution` answered to ANY name, so a regression to `distribution("openxdox")` — or to any other installed distribution — would have read a STRANGER's direct_url.json, compared that commit against this leg's declared pin and left all ten parser tests green. `_ASKED` is asserted in both fakes now, and test_installed_commit_asks_for_the_opendox_distribution_and_no_other records the lookup and asserts it is exactly ["opendox"]. THE INVENTORY ROUND 11 PRODUCED WAS ITSELF HALF WRONG, and the finding is exact: `tests/test_gate_loop_views.py` never calls find(), require() or the `bundle` fixture. It imports opendox_bundle for _absent() — the CLASSIFIER — and reaches the pin through `opendox.view_extension`. So ONE suite reads the pinned web bundle (probes) and THREE import pinned python modules (views through its guarded helper; the doxbench pair at module scope with no guard in the path), and _absent() decides for two of the four. Measured: `grep -n 'opendox_bundle\.' tests/test_gate_loop_views.py` -> three _absent() calls, no find/require. AND THE DESCRIPTION'S PRIMARY TABLE still said cb84001 / 346. It says this head / 349 now, with the series carrying every step. MEASURED at this head, validate.yml's own invocation: 349 passed, 6 skipped (348 before; the delta is the one new parser test). Whole tree: 153 failed, 618 passed, 10 skipped, 128 errors — failures, skips and errors unchanged, 617 -> 618 being precisely that test. Guard tests 31 -> 32. Diff vs main: 7 files, +1264 / -77. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- .github/workflows/validate.yml | 55 +++++++++++++++++++++------------- tests/test_gate_loop_probes.py | 45 ++++++++++++++++++++++++++-- 2 files changed, 77 insertions(+), 23 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 2fb1c6b..637b531 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -65,22 +65,31 @@ jobs: # the other TEN are carved suites that RUN here, and FOUR of them reach # the PINNED openDox — in TWO DIFFERENT WAYS, which this line ran # together until the review of `24cd5f2` on #21 measured them apart: - # - TWO read the pinned WEB BUNDLE through `tests/opendox_bundle.py` - # (`test_gate_loop_views.py`, `test_gate_loop_probes.py`), so the - # provenance guard below decides what a missing bundle costs them; - # - TWO import pinned openDox PYTHON MODULES directly and never touch - # that helper: `test_doxbench_abstract_store.py:43,45` + # - ONE reads the pinned WEB BUNDLE: `test_gate_loop_probes.py`, whose + # `_opendox_bundle()` finds the marker under the installed `opendox` + # and whose `bundle` fixture composes it. `tests/opendox_bundle.py`'s + # own `find()` / `require()` call site is driven from that file too; + # `test_gate_loop_views.py` never calls `find()`, `require()` or that + # fixture, which this bullet claimed until the review of `a0eed16`; + # - THREE import pinned openDox PYTHON MODULES: + # `test_gate_loop_views.py` takes `opendox.view_extension` through its + # own guarded helper (`_view_extension_or_skip`, which is why it + # imports `opendox_bundle` at all — for `_absent()`, the CLASSIFIER, + # not for the bundle), while `test_doxbench_abstract_store.py:43,45` # (`from opendox import doxbench_abstract_store`, `doxbench_turns`) # and `test_doxbench_telemetry.py:21` (`from opendox import - # doxbench_telemetry`). A regression in the pin reaches those two as - # an ImportError or a failing assertion — loudly, and with no guard - # in the path to classify it. - # `test_gate_loop_views.py` does both (it imports - # `opendox.view_extension` through its own guarded helper). Measured - # over the fourteen files named below, not asserted: - # grep -ln 'import opendox_bundle' -> views, probes - # grep -ln 'from opendox import' -> views, telemetry, - # abstract_store + # doxbench_telemetry`) import at module scope with NO guard in the + # path: a regression in the pin reaches those two as an ImportError + # or a failing assertion, loudly and unclassified. + # So `tests/opendox_bundle.py::_absent` decides for TWO of the four — + # the bundle for probes, the view contract for views — and for neither + # doxbench suite. Measured over the fourteen files named below: + # grep -ln 'import opendox_bundle' -> views, probes + # grep -ln 'from opendox import' -> views, telemetry, + # abstract_store + # grep -n 'opendox_bundle\.' tests/test_gate_loop_views.py + # -> three `_absent()` calls, + # no `find`/`require` # What Q-L8 (b′) still keeps out is the REST of the carved corpus, which # is BUILD-blocked on `doc_health` / `ideation_dashboard` — and # `tests/test_doxbench_mutation_boundary.py` is the one file this act @@ -246,7 +255,7 @@ jobs: # alongside `test_doxbench_turns.py`. # # WITH IT GONE AND THE PIN MOVED, this invocation goes 301 passed / - # 23 skipped -> 348 passed / 6 skipped, and BOTH HALVES OF THAT DELTA HAVE + # 23 skipped -> 349 passed / 6 skipped, and BOTH HALVES OF THAT DELTA HAVE # TO BE SAID SEPARATELY, because Copilot's round-3 review of #21 caught this # block conflating them: # @@ -260,7 +269,7 @@ jobs: # file leaves this list, so that skip is no longer RUN rather than # cleared. Counting it as cleared would describe a transition that never # happened. - # * The remaining rise to 348 is NOT the bump: it is the 31 direct tests + # * The remaining rise to 349 is NOT the bump: it is the 32 direct tests # of the provenance guard that Copilot's review rounds asked for, which # live in `tests/test_gate_loop_probes.py` and # `tests/test_gate_loop_views.py` and are therefore both on this list. @@ -268,9 +277,9 @@ jobs: # rather than carried: # git diff main -- tests/test_gate_loop_probes.py \ # tests/test_gate_loop_views.py | grep -c '^+def test_' - # gives 31, and the passing figure has run 317 -> 323 -> 330 -> 332 -> - # 333 -> 334 -> 336 -> 343 -> 346 -> 348, once per round that added tests - # — the + # gives 32, and the passing figure has run 317 -> 323 -> 330 -> 332 -> + # 333 -> 334 -> 336 -> 343 -> 346 -> 348 -> 349, once per round that added + # tests — the # same discipline the block above applies to the skip counts. The review # of `8b23f6f` asked for the CALL SITES: the tests before it proved what # the guard decides and what it reads, and none of them proved that the @@ -286,7 +295,13 @@ jobs: # their declared-pin FAIL driven, so making either an unconditional # failure would have passed every added test while breaking the consumer # RULED 5700475319 protects — the assembly that pins an openDox behind - # the view contract. Each is now driven at a DIFFERENT commit too.) + # the view contract. Each is now driven at a DIFFERENT commit too. The + # review of `a0eed16` took the last one, in the PARSER: both fakes for + # `importlib.metadata.distribution` answered to ANY name, so a regression + # to `distribution("openxdox")` would have read a stranger's PEP 610 + # record and compared ITS commit against this leg's declared pin with all + # ten parser tests green. Both fakes assert the name now, and one test + # asserts the lookup itself.) # # The 6 skips that remain are the three seam suites' `doc_health` pairs, # which no pin bump touches. diff --git a/tests/test_gate_loop_probes.py b/tests/test_gate_loop_probes.py index e9cbd0a..ad71b16 100644 --- a/tests/test_gate_loop_probes.py +++ b/tests/test_gate_loop_probes.py @@ -891,10 +891,26 @@ def read_text(self, name): return self._payload +#: The ONE distribution `installed_commit()` may ask about. Both fakes below assert +#: it, because neither did until the review of `a0eed16`: they answered to ANY name, +#: so a regression to `distribution("openxdox")` — or to any other installed package +#: — would have read a STRANGER's `direct_url.json`, compared that commit against +#: this leg's declared pin, and left all ten parser tests green while doing it. +_ASKED = "opendox" + + def _with_dist(monkeypatch, payload): - """Install a fake distribution whose `read_text` returns (or raises) `payload`.""" + """Install a fake distribution whose `read_text` returns (or raises) `payload`. + + The fake ASSERTS the name it is asked for (see `_ASKED`): the provenance this + guard reads is worthless if it is read off the wrong package. + """ import importlib.metadata as md - monkeypatch.setattr(md, "distribution", lambda name: _FakeDist(payload)) + + def _lookup(name): + assert name == _ASKED, f"installed_commit() asked for {name!r}, not {_ASKED!r}" + return _FakeDist(payload) + monkeypatch.setattr(md, "distribution", _lookup) def _with_no_dist(monkeypatch, exc): @@ -903,15 +919,38 @@ def _with_no_dist(monkeypatch, exc): Caught at `7c0a3b6`: `_with_dist(PackageNotFoundError(...))` made `read_text` raise, so the test named for an uninstalled package never exercised `distribution("opendox")` failing, which is the call `installed_commit()` - actually guards. + actually guards. It asserts the requested name too, for `_with_dist`'s reason. """ import importlib.metadata as md def _raise(name): + assert name == _ASKED, f"installed_commit() asked for {name!r}, not {_ASKED!r}" raise exc monkeypatch.setattr(md, "distribution", _raise) +def test_installed_commit_asks_for_the_opendox_distribution_and_no_other( + monkeypatch) -> None: + """The lookup NAME is the assertion, and nothing else asserted it. + + `_with_dist` answered to any name, so `distribution("openxdox")` would have read + a stranger's PEP 610 record and compared ITS commit against this leg's declared + pin — a provenance check on the wrong package, with every parser test green. + Caught at the review of `a0eed16` on #21. + """ + import importlib.metadata as md + asked = [] + + def _lookup(name): + asked.append(name) + return _FakeDist(json.dumps( + {"url": "https://github.com/opensoft/openDox-code", + "vcs_info": {"vcs": "git", "commit_id": _PIN_B}})) + monkeypatch.setattr(md, "distribution", _lookup) + assert _ob.installed_commit() == _PIN_B + assert asked == ["opendox"] + + def test_installed_commit_reads_a_real_vcs_record(monkeypatch) -> None: _with_dist(monkeypatch, json.dumps( {"url": "https://github.com/opensoft/openDox-code", From fd3af6aabd692a8c894160f6b1713ff8b2961e56 Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 18:47:28 +0000 Subject: [PATCH 20/33] Review at e6cd0e8: four sentences that promised a SKIP where the guard may FAIL, and one that promised a runtime catch the runtime does not make MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copilot review 5226898698: 0 new comments, 0 open threads, four suppressed, all documentation this act authored, all accurate. Three are the same defect in three places — prose written when a missing bundle could only skip — and one is a claim about the runtime. tests/opendox_bundle.py:348 (`require`) said "`module_level=True` skips the IMPORTING MODULE" as though the flag governed every outcome. It scopes the SKIP and nothing else: `pytest.fail` fails the test that reached the guard, whichever flag was passed. Said that way now. tests/opendox_bundle.py:434 (`web`) promised "skips whole" / "skips the three tests" in its closing rule, under an opening that had already delegated the outcome to `_absent()`. The rule now names the scope and lets the table say which outcome is scoped: where it FAILS, the failure lands on whatever test reached the guard. tests/opendox_bundle.py:113 said the replacement for `_REASON` "names the two commits it just compared". That is the DIFFERENT-COMMIT row only; where a side is unreadable there is no comparison to name, and the reason says which side could not be read. Qualified. src/openxdox/view_extensions.py:38 said `ViewContractUnsupported` names the consumer-behind-contract condition, full stop. `GateLoopViews.views()` catches TWO shapes — the module absent (ImportError) and a `ViewBinding` that does not take this column's fields (TypeError) — and a module carrying no `ViewBinding` at all still raises AttributeError at the constructor. The TEST-time guard classifies that shape since cb84001; the runtime catch is registered in the PR body's "What this does NOT do" rather than smuggled into a pin bump. The paragraph now says exactly which shapes the runtime names. MEASURED at this head: required invocation 349 passed / 6 skipped, unchanged — comments and docstrings only. Diff vs main: 7 files, +1298 / -83. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- src/openxdox/view_extensions.py | 14 ++++++++++++-- tests/opendox_bundle.py | 28 ++++++++++++++++++++-------- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/src/openxdox/view_extensions.py b/src/openxdox/view_extensions.py index 35b9ab3..55d63ac 100644 --- a/src/openxdox/view_extensions.py +++ b/src/openxdox/view_extensions.py @@ -34,8 +34,18 @@ that pins an openDox behind the view contract must still be able to IMPORT this module — an import-time reach would make it unimportable under THAT consumer's pin and would put its `validate` red for a reason that has nothing to do with -this column. `ViewContractUnsupported` below is what names that -condition when it arises. So `VIEW_BINDING_SPECS` below is +this column. `ViewContractUnsupported` below is what names that condition where +`GateLoopViews.views()` CATCHES it, and that is two shapes, not three: the +`view_extension` module absent (ImportError) and a `ViewBinding` that does not +take this column's fields (TypeError). A module that carries no `ViewBinding` at +all still raises `AttributeError` at the constructor below — the class docstring +names that assembly as unsupported, and the runtime does not yet classify it. +The TEST-time guard does (`tests/test_gate_loop_views.py::_view_extension_or_skip`, +which reads the class with `getattr` and hands the shape to +`tests/opendox_bundle.py::_absent`); the runtime catch is registered in this pull +request's "What this does NOT do" rather than smuggled into a pin bump. Caught at +the review of `e6cd0e8` on openXdox-code#21, which was right that these lines +promised more than the code below does. So `VIEW_BINDING_SPECS` below is plain data — the same JSON shape the manifest crosses the process boundary as — and `GateLoopViews.views()` materializes it through whatever `opendox` the ASSEMBLY installed, at the one moment an assembly exists to have installed one. diff --git a/tests/opendox_bundle.py b/tests/opendox_bundle.py index 10e9618..6ed5c9f 100644 --- a/tests/opendox_bundle.py +++ b/tests/opendox_bundle.py @@ -109,8 +109,11 @@ # reason from what it measured instead of stating it in advance. It read "this leg # pins a commit older than openDox's own packaging declaration … The pin bump makes # this suite run", which was true of `a99eba03` and became false at `0b4e8bbf`; the -# replacement's whole point is that it cannot go stale, because it names the two -# commits it just compared. +# replacement's whole point is that it cannot go stale, because every reason is +# composed from what the run just read. In the DIFFERENT-COMMIT outcome that is the +# two commits, named; where a side is unreadable there is no comparison to name, and +# the reason says WHICH side could not be read instead. (The review of `e6cd0e8` +# caught this comment claiming the two commits for all four rows.) def find() -> Path | None: @@ -347,10 +350,14 @@ def require(*, module_level: bool = True) -> Path: off-CI unreadable case), which is what a second copy of a table is for. Read `_absent()`. - `module_level=True` skips the IMPORTING MODULE, which is what the thirty - suites whose whole subject is the bundle want. `web()` below passes False, - which skips only the calling TEST — see its own docstring for when that is - the honest reading and when it is not. + `module_level` SCOPES THE SKIP OUTCOME AND NOTHING ELSE. With True a skip + takes the IMPORTING MODULE, which is what the thirty suites whose whole + subject is the bundle want; `web()` below passes False, so a skip takes only + the calling TEST (see its docstring for when that is the honest reading). The + FAIL outcomes — the declared pin, and an unreadable side under CI — are not + scoped by it at all: `pytest.fail` fails the test that reached the guard, + whichever flag was passed. The review of `e6cd0e8` caught this paragraph + reading as though the flag governed every outcome. WHY A STAGED COPY AND NOT THE INSTALLED DIRECTORY ITSELF (Copilot review of openXdox-code#19, the `test_round_trip.py` finding — accurate). Several of @@ -443,8 +450,13 @@ def web() -> Path: suite it no longer runs. So the rule is the subject, not the convenience: a module whose every test - reads the bundle imports `OPENDOX_WEB` and skips whole; a module where the - bundle is an aside calls this and skips the three tests that need it. + reads the bundle imports `OPENDOX_WEB` and takes the outcome module-wide; a + module where the bundle is an aside calls this and takes it per test. WHERE + THE OUTCOME IS A SKIP, that reads "skips whole" and "skips the three tests + that need it"; where `_absent()` FAILS — the declared pin, or an unreadable + side under CI — the failure lands on whatever test reached the guard, and no + scoping flag softens it. Caught at the review of `e6cd0e8`, which was right + that promising a skip here contradicts the table this docstring defers to. """ return require(module_level=False) From de7d96686dcc42a8cda16971e2db17247d1e34c3 Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 18:56:40 +0000 Subject: [PATCH 21/33] Review at fd3af6a: the three counts the round before it made stale, each re-derived from the file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copilot review 5227017752: 0 new comments, 0 open threads, three suppressed, all in tests/test_gate_loop_probes.py and all arithmetic this act's own last round broke when it added the lookup-name test. :1044 — `grep -c '^def test_installed_commit'` records 10; the file holds 11. Corrected, with the cause named: the eleventh is the test the review of a0eed16 asked for, one round earlier. The paragraph below it ("a DELETED case is not one of the ten", "the ten above already assert") moves with it. :898 — "would have left all ten parser tests green" is stale for the same reason. It now says every parser test THEN STANDING, all ten of them, and names the eleventh as the one this finding produced, with the command beside it. :1068 — "(25 and 6 as this was written)" was written one round before the round that added to it. It is 26 and 6 at this head, with the breakdown measured rather than asserted: 11 decision/read cases, 11 `installed_commit` parser tests and 4 call-site tests here, 6 in the views file, 32 in validate.yml's record block. The lesson this act keeps re-learning is in the comments now: a count printed without the command that produced it goes stale on the next round that adds a test, and this file has done it three times. MEASURED at this head: tests/test_gate_loop_probes.py 39 passed; comments only, so the required invocation stays 349 passed / 6 skipped. Diff vs main: 7 files, +1306 / -83. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- tests/test_gate_loop_probes.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/test_gate_loop_probes.py b/tests/test_gate_loop_probes.py index ad71b16..e97316f 100644 --- a/tests/test_gate_loop_probes.py +++ b/tests/test_gate_loop_probes.py @@ -895,7 +895,9 @@ def read_text(self, name): #: it, because neither did until the review of `a0eed16`: they answered to ANY name, #: so a regression to `distribution("openxdox")` — or to any other installed package #: — would have read a STRANGER's `direct_url.json`, compared that commit against -#: this leg's declared pin, and left all ten parser tests green while doing it. +#: this leg's declared pin, and left every parser test then standing green while +#: doing it — all TEN of them; the eleventh is the one below, which exists because +#: of this finding. (`grep -c '^def test_installed_commit' ` -> 11.) _ASKED = "opendox" @@ -1041,15 +1043,18 @@ def test_installed_commit_is_none_when_reading_the_record_raises(monkeypatch) -> # of `f6f1b991` on #21 caught that the upper-case case added at `b177eef` had # never reached the inventory: # -# grep -c '^def test_installed_commit' tests/test_gate_loop_probes.py -> 10 +# grep -c '^def test_installed_commit' tests/test_gate_loop_probes.py -> 11 # -# A DELETED case is not one of the ten, and this paragraph used to number it as +# It read 10 until the review of `fd3af6a` caught the lookup-name test the review +# of `a0eed16` had just asked for — the same staleness, one round later, which is +# why the command is printed beside the number every time. +# A DELETED case is not one of the eleven, and this paragraph used to number it as # though it were ("a tenth test"). One further test stood here until `7c0a3b6` # and is gone rather than repaired: it asserted strings against # `inspect.getsource(installed_commit)`, and once the implementation stopped # containing `len(commit) == 40` it passed only because an explanatory COMMENT # still held that text. A test coupled to source text fails on a harmless rename -# and catches no behaviour — the ten above already assert the results it was +# and catches no behaviour — the eleven above already assert the results it was # gesturing at. @@ -1065,7 +1070,10 @@ def test_installed_commit_is_none_when_reading_the_record_raises(monkeypatch) -> # number is not carried here. What is true at any head is the command: # git diff main -- tests/test_gate_loop_probes.py | grep -c '^+def test_' # git diff main -- tests/test_gate_loop_views.py | grep -c '^+def test_' -# (25 and 6 as this was written; `validate.yml`'s record block carries the total). +# (26 in this file and 6 in the views file at THIS head — 11 decision/read cases, +# 11 `installed_commit` parser tests and 4 call-site tests here; `validate.yml`'s +# record block carries the total, 32. The review of `fd3af6a` caught the pair +# reading 25 and 6: a count written one round before the round that added to it.) # It is exactly the silent green this whole guard exists to break, reached one # level further out each round — and the review of `b22a6fd` caught the quoted # count going stale three rounds after the quotation. From 8b9ece180f0aac10129d4330777ee376cd931ee5 Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 19:07:43 +0000 Subject: [PATCH 22/33] Review at de7d966: the regex MISS in declared_pin() is driven at last, and this repository stops carrying two numbers for the S8 census MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copilot review 5227126546: 0 new comments, 0 open threads, three suppressed. One is a real coverage gap, one is a contradiction between two files of this tree, one is a command that counts its own documentation. tests/opendox_bundle.py:205 — `declared_pin()`'s `if match else None` had no test. The two existing tests make the READ raise; nothing made the REGEX miss, so a dependency line rewritten to a branch ref, a version range or a path install would have returned None with nothing proving the fail-closed policy still catches it. TWO tests, on a new `_with_pyproject_text` helper that lets the file read CLEANLY: the function returns None for a pyproject declaring `openDox-code@main`, and `_absent()` then FAILS under CI naming the declared side while still printing the installed commit. tests/opendox_bundle.py:15 asserted "the real count is 31 files and 47 sites" while validate.yml's S8 block says 46 sites over 31 files. openXdox-code#19's LANDING settled this ("RE-DERIVED AT LANDING, AND ONLY THE COUNT MOVED", main 0a0265f): under a named, re-runnable instrument — a ROOT SPELLING is a line spelling REPO_ROOT / "src" / "openxdox" / "web" in any Path or slash form, counted over the REVISIONS with git grep — it is 46 spellings over 31 files, as 22 + 9. The "47 sites" of #19's review rounds is left ATTRIBUTED and not restated, for #19's own reason: a root spelled once carries several derived sites, so neither total corrects the other. This file asserted it as the real count; it no longer does, and the two files now agree. tests/opendox_bundle.py:395 recorded `grep -rn 'skips where the pin carries no bundle' tests/ -> 29`. That comment now contains the phrase, so the unfiltered command answers 30 and counts the helper reporting the count. The recorded command carries --include='test_*.py' (29), with the reason beside it. MEASURED at this head, validate.yml's own invocation: 351 passed, 6 skipped (349 before; the delta is exactly these two tests). The two guard suites: 82 passed. Whole tree: 153 failed, 620 passed, 10 skipped, 128 errors — failures, skips and errors unchanged, 618 -> 620 being precisely these two. Guard tests 32 -> 34 (28 here + 6 in the views file: 13 decision/read cases, 11 installed_commit parser tests, 4 call-site tests). Diff vs main: 7 files, +1379 / -86. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- .github/workflows/validate.yml | 18 ++++++---- tests/opendox_bundle.py | 25 +++++++++++--- tests/test_gate_loop_probes.py | 63 ++++++++++++++++++++++++++++++++-- 3 files changed, 92 insertions(+), 14 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 637b531..7c0d18e 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -255,7 +255,7 @@ jobs: # alongside `test_doxbench_turns.py`. # # WITH IT GONE AND THE PIN MOVED, this invocation goes 301 passed / - # 23 skipped -> 349 passed / 6 skipped, and BOTH HALVES OF THAT DELTA HAVE + # 23 skipped -> 351 passed / 6 skipped, and BOTH HALVES OF THAT DELTA HAVE # TO BE SAID SEPARATELY, because Copilot's round-3 review of #21 caught this # block conflating them: # @@ -269,7 +269,7 @@ jobs: # file leaves this list, so that skip is no longer RUN rather than # cleared. Counting it as cleared would describe a transition that never # happened. - # * The remaining rise to 349 is NOT the bump: it is the 32 direct tests + # * The remaining rise to 351 is NOT the bump: it is the 34 direct tests # of the provenance guard that Copilot's review rounds asked for, which # live in `tests/test_gate_loop_probes.py` and # `tests/test_gate_loop_views.py` and are therefore both on this list. @@ -277,9 +277,9 @@ jobs: # rather than carried: # git diff main -- tests/test_gate_loop_probes.py \ # tests/test_gate_loop_views.py | grep -c '^+def test_' - # gives 32, and the passing figure has run 317 -> 323 -> 330 -> 332 -> - # 333 -> 334 -> 336 -> 343 -> 346 -> 348 -> 349, once per round that added - # tests — the + # gives 34, and the passing figure has run 317 -> 323 -> 330 -> 332 -> + # 333 -> 334 -> 336 -> 343 -> 346 -> 348 -> 349 -> 351, once per round that + # added tests — the # same discipline the block above applies to the skip counts. The review # of `8b23f6f` asked for the CALL SITES: the tests before it proved what # the guard decides and what it reads, and none of them proved that the @@ -301,7 +301,13 @@ jobs: # to `distribution("openxdox")` would have read a stranger's PEP 610 # record and compared ITS commit against this leg's declared pin with all # ten parser tests green. Both fakes assert the name now, and one test - # asserts the lookup itself.) + # asserts the lookup itself. The review of `de7d966` took the branch under + # THAT one: `declared_pin()`'s regex MISS — a readable `pyproject.toml` + # that declares no `opendox @ git+…@<40-hex>` — had no test at all, so a + # dependency line rewritten to a branch ref or a version range would have + # returned None with nothing proving the fail-closed policy still catches + # it. Two tests: the function returns None, and `_absent()` FAILS under CI + # naming the declared side while still printing the installed commit.) # # The 6 skips that remain are the three seam suites' `doc_health` pairs, # which no pin bump touches. diff --git a/tests/opendox_bundle.py b/tests/opendox_bundle.py index 6ed5c9f..6def75d 100644 --- a/tests/opendox_bundle.py +++ b/tests/opendox_bundle.py @@ -10,9 +10,20 @@ openXdox-code [name a `views/.js` path], and every one of them resolves it under `REPO_ROOT / "src" / "openxdox" / "web"` — a directory openXdox-code does not have … the carve's `import rewrites` edit class rewrote the path constant and -pointed the tests at the wrong leg."* Eight further suites at this leg name the -same constant as a SERVE ROOT without naming a view module, so the real count is -31 files and 47 sites. +pointed the tests at the wrong leg."* Further suites at this leg name the same +constant as a SERVE ROOT without naming a view module, and the total is the one +**openXdox-code#19's LANDING re-derived** (`main 0a0265f`, "RE-DERIVED AT LANDING, +AND ONLY THE COUNT MOVED"): under a named, re-runnable instrument — a ROOT SPELLING +is a line spelling `REPO_ROOT / "src" / "openxdox" / "web"` in any Path or slash +form, counted over the REVISIONS with `git grep` and never a worktree — **46 root +spellings over 31 files**, as 22 resolving a concrete `views/.js` module plus +9 using the root as a serve root (the ninth being the tool at +`tests/tools/playwright-smoke.py`, outside `validate`'s list). `validate.yml`'s S8 +block carries that same 46. The review rounds on #19 said "31 files, 47 sites"; +that figure is left ATTRIBUTED and not restated, for #19's own reason — a root +spelled once carries several derived sites, so neither total corrects the other — +and this line asserted it as "the real count" until the review of `de7d966` on #21 +found the two numbers disagreeing across this repository. The note's § 5 S8 row then infers that those files *"go to the leg the census says owns each bundle file"*. **That inference does not hold, and the reason is @@ -391,8 +402,12 @@ def require(*, module_level: bool = True) -> Path: # where the pin carries no bundle)`, and after the bump this path # also FAILS — at the declared pin, and for an unreadable side under # CI. Measured, not estimated: - # grep -rn 'skips where the pin carries no bundle' tests/ -> 29 - # sites in 29 files + # grep -rn 'skips where the pin carries no bundle' tests/ \ + # --include='test_*.py' -> 29 + # sites in 29 files. The --include is load-bearing: this comment + # quotes the annotation, so the unfiltered command answers 30 and + # counts the helper that reports the count. Caught at the review + # of `de7d966` on #21. # git diff --name-only main -- -> 0 # all 29 appear in openxFactory `docs/opendox-carve-manifest.yaml` # Every one of them is an ARRIVED carve row whose edits are declared diff --git a/tests/test_gate_loop_probes.py b/tests/test_gate_loop_probes.py index e97316f..b47d07f 100644 --- a/tests/test_gate_loop_probes.py +++ b/tests/test_gate_loop_probes.py @@ -842,6 +842,61 @@ def _read_text(self, *args, **kwargs): monkeypatch.setattr(_ob.Path, "read_text", _read_text) +def _with_pyproject_text(monkeypatch, text) -> None: + """Make `pyproject.toml` READ CLEANLY as `text`, and nothing else change. + + `_with_unreadable_pyproject` above drives the two RAISING branches; this drives + the branch where the file is perfectly readable and simply does not declare the + pin — the `if match else None` the review of `de7d966` found untested. + """ + real_read_text = Path.read_text + + def _read_text(self, *args, **kwargs): + if self.name == "pyproject.toml": + return text + return real_read_text(self, *args, **kwargs) + + monkeypatch.setattr(_ob.Path, "read_text", _read_text) + + +def test_declared_pin_is_none_when_pyproject_declares_no_opendox_pin( + monkeypatch) -> None: + """A READABLE `pyproject.toml` with no `opendox @ git+…@<40-hex>` in it. + + The two tests above make the READ raise; nothing made the REGEX miss. A + dependency line that lost its pin — rewritten to a version range, to a branch + ref, to a path install, or simply deleted — returns None from the same function + and must reach the SAME fail-closed policy, or the required check could go green + over a leg that no longer declares which openDox it is built against. Caught at + the review of `de7d966` on #21. + """ + _with_pyproject_text(monkeypatch, ( + "[project]\nname = \"openxdox-code\"\n" + "dependencies = [\n" + " \"opendox @ git+https://github.com/opensoft/openDox-code@main\",\n" + " \"pyyaml>=6\",\n" + "]\n")) + assert _ob.declared_pin() is None + + +def test_an_undeclared_pin_FAILS_under_ci_like_any_other_unreadable_side( + monkeypatch) -> None: + """...and the outcome is the fail-closed one, driven end to end. + + The test above proves the function returns None; this proves what `_absent()` + then does with it — FAIL under CI, naming the declared side as the one it could + not read, with the installed commit still printed because that side was fine. + """ + _with_pyproject_text(monkeypatch, "[project]\nname = \"openxdox-code\"\n") + monkeypatch.setattr(_ob, "installed_commit", lambda: _PIN_B) + monkeypatch.setenv("CI", "true") + with pytest.raises(pytest.fail.Exception) as raised: + _ob._absent("the subject under test", module_level=False) + message = str(raised.value) + assert "declared pin could not be read" in message + assert _PIN_B in message + + def test_declared_pin_is_none_when_the_read_raises(monkeypatch) -> None: """The unreadable DECLARED side, produced rather than assumed. @@ -1070,10 +1125,12 @@ def test_installed_commit_is_none_when_reading_the_record_raises(monkeypatch) -> # number is not carried here. What is true at any head is the command: # git diff main -- tests/test_gate_loop_probes.py | grep -c '^+def test_' # git diff main -- tests/test_gate_loop_views.py | grep -c '^+def test_' -# (26 in this file and 6 in the views file at THIS head — 11 decision/read cases, +# (28 in this file and 6 in the views file at THIS head — 13 decision/read cases, # 11 `installed_commit` parser tests and 4 call-site tests here; `validate.yml`'s -# record block carries the total, 32. The review of `fd3af6a` caught the pair -# reading 25 and 6: a count written one round before the round that added to it.) +# record block carries the total, 34. The review of `fd3af6a` caught this pair +# reading 25 and 6, and the review of `de7d966` moved it again by asking for the +# two undeclared-pin tests: a count written in prose is stale one round later, +# which is why the commands are printed above it every time.) # It is exactly the silent green this whole guard exists to break, reached one # level further out each round — and the review of `b22a6fd` caught the quoted # count going stale three rounds after the quotation. From 2dfd66954f374ec6739fc22fda8acee9800fd990 Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 19:18:05 +0000 Subject: [PATCH 23/33] Review at 8b9ece1: a 40-hex PREFIX of a longer ref is not a pin, and the parser now says so MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copilot review 5227217096: one thread and one suppressed comment. The thread is the parser bug with the widest blast radius found on this PR, and it is right. `_PIN_RE` had no delimiter after `{40}`, so any ref that merely BEGAN with forty hex characters — `…@<40-hex>dead`, `…@<40-hex>x` — yielded that prefix as "the commit this leg declares". A leg pinned to a branch whose name starts with a sha would then have `declared_pin()` return a commit it does NOT declare, and the guard compares that against what is installed: equal by accident FAILS naming the wrong culprit; unequal SKIPS over a real regression. Both are the silent-green class this whole guard exists to remove, reached through the parser again. A trailing `(?![0-9a-zA-Z])` makes a continuing ref read as NO pin, which takes the fail-closed path under CI (`_absent()` names the declared side as unreadable). The class is 0-9a-zA-Z rather than hex: a branch ending in `x` is no more a pin than one ending in `dead`. TWO TESTS, BOTH SIDES. test_declared_pin_refuses_a_40_hex_PREFIX_of_a_longer_ref drives three continuing refs; test_declared_pin_still_reads_the_real_pin_beside _that_guard drives four legitimate endings — closing quote, comma, `#` comment, bare end of line — because a lookahead that is too strict fails closed on a correct file, which is the opposite defect and just as silent. AND the views summary said "BOTH GUARDS ARE SATISFIED BY THIS LEG'S OWN PIN" while the enumeration under it lists THREE refusal branches since cb84001. It says all three now, with the date the sentence was written noted. MEASURED at this head: required invocation 353 passed, 6 skipped (351 before; the delta is exactly these two tests). The two guard suites: 84 passed. Whole tree: 153 failed, 622 passed, 10 skipped, 128 errors — failures, skips and errors unchanged. Guard tests 34 -> 36 (30 here = 15 decision/read + 11 parser + 4 call-site; 6 in the views file). Diff vs main: 7 files, +1438 / -86. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- .github/workflows/validate.yml | 21 ++++++++++++----- tests/opendox_bundle.py | 13 ++++++++++- tests/test_gate_loop_probes.py | 41 ++++++++++++++++++++++++++++++++-- tests/test_gate_loop_views.py | 5 ++++- 4 files changed, 70 insertions(+), 10 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 7c0d18e..7857568 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -255,7 +255,7 @@ jobs: # alongside `test_doxbench_turns.py`. # # WITH IT GONE AND THE PIN MOVED, this invocation goes 301 passed / - # 23 skipped -> 351 passed / 6 skipped, and BOTH HALVES OF THAT DELTA HAVE + # 23 skipped -> 353 passed / 6 skipped, and BOTH HALVES OF THAT DELTA HAVE # TO BE SAID SEPARATELY, because Copilot's round-3 review of #21 caught this # block conflating them: # @@ -269,7 +269,7 @@ jobs: # file leaves this list, so that skip is no longer RUN rather than # cleared. Counting it as cleared would describe a transition that never # happened. - # * The remaining rise to 351 is NOT the bump: it is the 34 direct tests + # * The remaining rise to 353 is NOT the bump: it is the 36 direct tests # of the provenance guard that Copilot's review rounds asked for, which # live in `tests/test_gate_loop_probes.py` and # `tests/test_gate_loop_views.py` and are therefore both on this list. @@ -277,9 +277,9 @@ jobs: # rather than carried: # git diff main -- tests/test_gate_loop_probes.py \ # tests/test_gate_loop_views.py | grep -c '^+def test_' - # gives 34, and the passing figure has run 317 -> 323 -> 330 -> 332 -> - # 333 -> 334 -> 336 -> 343 -> 346 -> 348 -> 349 -> 351, once per round that - # added tests — the + # gives 36, and the passing figure has run 317 -> 323 -> 330 -> 332 -> + # 333 -> 334 -> 336 -> 343 -> 346 -> 348 -> 349 -> 351 -> 353, once per + # round that added tests — the # same discipline the block above applies to the skip counts. The review # of `8b23f6f` asked for the CALL SITES: the tests before it proved what # the guard decides and what it reads, and none of them proved that the @@ -307,7 +307,16 @@ jobs: # dependency line rewritten to a branch ref or a version range would have # returned None with nothing proving the fail-closed policy still catches # it. Two tests: the function returns None, and `_absent()` FAILS under CI - # naming the declared side while still printing the installed commit.) + # naming the declared side while still printing the installed commit. The + # review of `8b9ece1` then found the PARSER bug with the widest blast + # radius on this PR: `_PIN_RE` had no delimiter after `{40}`, so a ref that + # merely BEGAN with forty hex characters (`…@<40-hex>dead`) yielded that + # prefix as the declared commit — and the guard would compare a commit this + # leg does NOT declare against what is installed, failing on the wrong + # culprit or skipping over a real regression. A trailing `(?![0-9a-zA-Z])` + # makes a continuing ref read as NO pin, which is the fail-closed path, and + # two tests hold both sides of it: three continuing refs refused, four + # legitimate line endings still read.) # # The 6 skips that remain are the three seam suites' `doc_health` pairs, # which no pin bump touches. diff --git a/tests/opendox_bundle.py b/tests/opendox_bundle.py index 6def75d..57614be 100644 --- a/tests/opendox_bundle.py +++ b/tests/opendox_bundle.py @@ -194,7 +194,18 @@ def find() -> Path | None: #: unreadable provenance and FAIL under CI for a formatting difference. _SHA_RE = re.compile(r"[0-9a-fA-F]{40}") -_PIN_RE = re.compile(r"opendox\s*@\s*git\+[^@\s\"']+@([0-9a-fA-F]{40})") +#: THE TRAILING GUARD IS LOAD-BEARING, and it is Copilot's finding at `8b9ece1`. +#: Without `(?![0-9a-zA-Z])` this pattern matched a 40-hex PREFIX of a longer ref: +#: `…@<40-hex>dead` is not pinned to that commit at all, yet `declared_pin()` +#: returned the prefix, and the guard would then compare a commit this leg does +#: NOT declare against what is installed — equal by accident is a FAIL that names +#: the wrong culprit, and unequal is a SKIP that hides a real regression. A ref +#: that merely CONTINUES is not a 40-hex pin, so it reads as no pin at all and +#: takes the fail-closed path under CI. The class is `0-9a-zA-Z` rather than hex: +#: a branch name like `0b4e8bbf68fabfcd65d4f0d80e619c20a013e888x` is no more a pin +#: than one ending in `dead`, and both must miss. +_PIN_RE = re.compile( + r"opendox\s*@\s*git\+[^@\s\"']+@([0-9a-fA-F]{40})(?![0-9a-zA-Z])") def declared_pin() -> str | None: diff --git a/tests/test_gate_loop_probes.py b/tests/test_gate_loop_probes.py index b47d07f..4e6b363 100644 --- a/tests/test_gate_loop_probes.py +++ b/tests/test_gate_loop_probes.py @@ -879,6 +879,43 @@ def test_declared_pin_is_none_when_pyproject_declares_no_opendox_pin( assert _ob.declared_pin() is None +def test_declared_pin_refuses_a_40_hex_PREFIX_of_a_longer_ref(monkeypatch) -> None: + """`…@<40-hex>dead` is NOT a pin, and the regex used to read one out of it. + + Copilot's finding at `8b9ece1` (thread on `tests/opendox_bundle.py:197`), and it + is the parser bug with the widest blast radius found on this PR: `_PIN_RE` had no + delimiter after `{40}`, so any ref that merely BEGAN with forty hex characters + yielded that prefix as "the commit this leg declares". The guard would then + compare a commit this leg does NOT declare against what is installed — equal by + accident FAILS naming the wrong culprit, unequal SKIPS over a real regression. + A continuing ref must read as NO pin, which takes the fail-closed path under CI. + """ + for tail in ("dead", "x", "0"): + _with_pyproject_text(monkeypatch, ( + "dependencies = [\n" + f" \"opendox @ git+https://github.com/opensoft/openDox-code@{_PIN_A}{tail}\",\n" + "]\n")) + assert _ob.declared_pin() is None, tail + + +def test_declared_pin_still_reads_the_real_pin_beside_that_guard( + monkeypatch) -> None: + """...and the delimiter guard does not cost the pin it is there to protect. + + The live `pyproject.toml` is read by + `test_the_declared_pin_is_read_from_this_legs_own_pyproject`; this drives the + same line's ENDINGS — the closing quote, a comma, a newline, a `#` comment — + because a lookahead that is too strict fails closed on a correct file, which is + the opposite defect and just as silent. + """ + for line in (f' "opendox @ git+https://x/openDox-code@{_PIN_A}",', + f' "opendox @ git+https://x/openDox-code@{_PIN_A}"', + f'opendox @ git+https://x/openDox-code@{_PIN_A} # the pin', + f'opendox @ git+https://x/openDox-code@{_PIN_A}'): + _with_pyproject_text(monkeypatch, f"dependencies = [\n{line}\n]\n") + assert _ob.declared_pin() == _PIN_A, line + + def test_an_undeclared_pin_FAILS_under_ci_like_any_other_unreadable_side( monkeypatch) -> None: """...and the outcome is the fail-closed one, driven end to end. @@ -1125,9 +1162,9 @@ def test_installed_commit_is_none_when_reading_the_record_raises(monkeypatch) -> # number is not carried here. What is true at any head is the command: # git diff main -- tests/test_gate_loop_probes.py | grep -c '^+def test_' # git diff main -- tests/test_gate_loop_views.py | grep -c '^+def test_' -# (28 in this file and 6 in the views file at THIS head — 13 decision/read cases, +# (30 in this file and 6 in the views file at THIS head — 15 decision/read cases, # 11 `installed_commit` parser tests and 4 call-site tests here; `validate.yml`'s -# record block carries the total, 34. The review of `fd3af6a` caught this pair +# record block carries the total, 36. The review of `fd3af6a` caught this pair # reading 25 and 6, and the review of `de7d966` moved it again by asking for the # two undeclared-pin tests: a count written in prose is stale one round later, # which is why the commands are printed above it every time.) diff --git a/tests/test_gate_loop_views.py b/tests/test_gate_loop_views.py index 75e4d2c..78f2acf 100644 --- a/tests/test_gate_loop_views.py +++ b/tests/test_gate_loop_views.py @@ -628,7 +628,10 @@ def _view_extension_or_skip(): summary is the line a reader trusts and a half-table is how it went wrong twice. - BOTH GUARDS ARE SATISFIED BY THIS LEG'S OWN PIN, since 2026-09-16. + ALL THREE REFUSAL BRANCHES ARE SATISFIED BY THIS LEG'S OWN PIN, since + 2026-09-16 (the module, the `ViewBinding` class, and RULED Q2's `exports` + field — the enumeration is below; this line said "BOTH GUARDS" until the + review of `8b9ece1`, having been written when there were two). They were not when slice S5 wrote them: the pin was `a99eba03`, the first reason read "this leg pins an `opendox` older than the § 3.4 slice S3 view registry" and the second said the bump "is owed at landing". The bump landed From a9264b8c6855535560bde3fafb9178c6a4948dc6 Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 19:28:25 +0000 Subject: [PATCH 24/33] Review at 2dfd669: a positive terminator for the pin, because refusing ref characters one class at a time is a losing game MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copilot review 5227336506: one thread and three suppressed comments. The thread sharpens the previous round's own fix and is right. `(?![0-9a-zA-Z])` still admitted `…@-feature`, `…@/branch`, `…@_suffix` and `…@.1` — all legal git refs, all of them a leg pinned to something that is NOT that commit, and all of them would have had declared_pin() return the 40-hex prefix for the guard to compare against the install. Git allows nearly everything a URL does, so the pattern now requires a POSITIVE terminator instead: the characters that can legitimately follow the sha in pyproject.toml — a closing quote, whitespace (newline included), a comma, a closing bracket, a `#` comment — or end of file. Every separator the thread named is in the refusal loop of test_declared_pin_refuses_a_40_hex_PREFIX_of_a_longer_ref (now seven), and the four legitimate endings are still driven beside it. TWO COUNTS IN tests/opendox_bundle.py WERE WRONG, both measured apart now: :413 said 29 files carry `from opendox_bundle import OPENDOX_WEB`. The ANNOTATION is on 29 files; the import form is not. Measured: `grep -rln '^from opendox_bundle import OPENDOX_WEB' tests/ --include='test_*.py'` -> 26, and the other three (test_doxbench_transport.py, test_session_confinement.py, test_staging_workbench.py) `import opendox_bundle` and call composed() at module scope. Both forms named. :378 said thirty suites take the module-level skip. It is TWENTY-NINE — the same 26 + 3 — and test_doxbench_turns.py is not among them: it calls web() per test, which is the very distinction that docstring exists to draw. MEASURED at this head: required invocation 353 passed, 6 skipped — unchanged, as it must be: this round adds separators to an existing loop and fixes prose, not test functions. The two guard suites: 84 passed. Guard tests 36. Diff vs main: 7 files, +1469 / -86. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- tests/opendox_bundle.py | 41 +++++++++++++++++++++++----------- tests/test_gate_loop_probes.py | 9 +++++++- 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/tests/opendox_bundle.py b/tests/opendox_bundle.py index 57614be..799e623 100644 --- a/tests/opendox_bundle.py +++ b/tests/opendox_bundle.py @@ -194,18 +194,26 @@ def find() -> Path | None: #: unreadable provenance and FAIL under CI for a formatting difference. _SHA_RE = re.compile(r"[0-9a-fA-F]{40}") -#: THE TRAILING GUARD IS LOAD-BEARING, and it is Copilot's finding at `8b9ece1`. -#: Without `(?![0-9a-zA-Z])` this pattern matched a 40-hex PREFIX of a longer ref: +#: THE TRAILING GUARD IS LOAD-BEARING, and it is Copilot's finding at `8b9ece1`, +#: sharpened by its finding at `2dfd669`. +#: Without a terminator this pattern matched a 40-hex PREFIX of a longer ref: #: `…@<40-hex>dead` is not pinned to that commit at all, yet `declared_pin()` #: returned the prefix, and the guard would then compare a commit this leg does #: NOT declare against what is installed — equal by accident is a FAIL that names #: the wrong culprit, and unequal is a SKIP that hides a real regression. A ref #: that merely CONTINUES is not a 40-hex pin, so it reads as no pin at all and -#: takes the fail-closed path under CI. The class is `0-9a-zA-Z` rather than hex: -#: a branch name like `0b4e8bbf68fabfcd65d4f0d80e619c20a013e888x` is no more a pin -#: than one ending in `dead`, and both must miss. +#: takes the fail-closed path under CI. +#: IT IS A POSITIVE TERMINATOR, not a list of refused characters — the first try +#: was `(?![0-9a-zA-Z])`, and the review of `2dfd669` was right that it lets +#: `…@-feature`, `…@/branch`, `…@_suffix` and `…@.1` through, +#: all of them legal git refs. Refusing ref characters one class at a time is a +#: losing game (git allows nearly everything a URL does); requiring the pin to END +#: where a TOML string or line ends is not. The terminator set is exactly the +#: characters that can legitimately follow the sha in `pyproject.toml`: a closing +#: quote, whitespace (the newline included), a comma, a closing bracket, or a `#` +#: comment — or the end of the file. _PIN_RE = re.compile( - r"opendox\s*@\s*git\+[^@\s\"']+@([0-9a-fA-F]{40})(?![0-9a-zA-Z])") + r"opendox\s*@\s*git\+[^@\s\"']+@([0-9a-fA-F]{40})(?=[\"'\s,\]#]|$)") def declared_pin() -> str | None: @@ -373,8 +381,11 @@ def require(*, module_level: bool = True) -> Path: `_absent()`. `module_level` SCOPES THE SKIP OUTCOME AND NOTHING ELSE. With True a skip - takes the IMPORTING MODULE, which is what the thirty suites whose whole - subject is the bundle want; `web()` below passes False, so a skip takes only + takes the IMPORTING MODULE, which is what the TWENTY-NINE suites whose whole + subject is the bundle want (26 importing `OPENDOX_WEB`, 3 calling `composed()` + at module scope; `test_doxbench_turns.py` is NOT among them — it calls `web()` + per test, which is that docstring's own subject. The count read "thirty" until + the review of `2dfd669`); `web()` below passes False, so a skip takes only the calling TEST (see its docstring for when that is the honest reading). The FAIL outcomes — the declared pin, and an unreadable side under CI — are not scoped by it at all: `pytest.fail` fails the test that reached the guard, @@ -408,11 +419,15 @@ def require(*, module_level: bool = True) -> Path: if web is None: # THE 29 IMPORTER ANNOTATIONS THAT REACH THIS LINE ARE STALE, AND # THEY ARE NOT REPAIRED HERE. Copilot's review of `399e2a9` on - # openXdox-code#21 is right about the fact: 29 files carry - # `from opendox_bundle import OPENDOX_WEB # noqa: E402 (skips - # where the pin carries no bundle)`, and after the bump this path - # also FAILS — at the declared pin, and for an unreadable side under - # CI. Measured, not estimated: + # openXdox-code#21 is right about the fact: 29 files carry the + # annotation `# noqa: E402 (skips where the pin carries no bundle)`, + # and after the bump this path also FAILS — at the declared pin, and + # for an unreadable side under CI. The annotation sits on TWO import + # forms, which the review of `2dfd669` caught this sentence collapsing + # into one: 26 files import `OPENDOX_WEB` from here, and 3 — + # `test_doxbench_transport.py`, `test_session_confinement.py`, + # `test_staging_workbench.py` — `import opendox_bundle` and call + # `composed()` at module scope. Measured, not estimated: # grep -rn 'skips where the pin carries no bundle' tests/ \ # --include='test_*.py' -> 29 # sites in 29 files. The --include is load-bearing: this comment diff --git a/tests/test_gate_loop_probes.py b/tests/test_gate_loop_probes.py index 4e6b363..f544f67 100644 --- a/tests/test_gate_loop_probes.py +++ b/tests/test_gate_loop_probes.py @@ -889,8 +889,15 @@ def test_declared_pin_refuses_a_40_hex_PREFIX_of_a_longer_ref(monkeypatch) -> No compare a commit this leg does NOT declare against what is installed — equal by accident FAILS naming the wrong culprit, unequal SKIPS over a real regression. A continuing ref must read as NO pin, which takes the fail-closed path under CI. + + THE FIRST FIX WAS TOO NARROW AND THE THREAD ON `2dfd669` SAID SO: a negative + lookahead over `[0-9a-zA-Z]` still admitted `-feature`, `/branch`, `_suffix` and + `.1`, all legal git refs. Refusing ref characters one class at a time is a losing + game; the pattern requires a POSITIVE terminator now — the characters that can + legitimately follow the sha in `pyproject.toml` — and every separator named in + that thread is in the loop below. """ - for tail in ("dead", "x", "0"): + for tail in ("dead", "x", "0", "-feature", "/branch", "_suffix", ".1"): _with_pyproject_text(monkeypatch, ( "dependencies = [\n" f" \"opendox @ git+https://github.com/opensoft/openDox-code@{_PIN_A}{tail}\",\n" From 52453af7261ab2046ff305422a3c6767f7de8133 Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 19:40:48 +0000 Subject: [PATCH 25/33] Review at a9264b8: declared_pin() PARSES pyproject.toml, because four rounds proved a text search cannot hold this contract MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copilot review 5227455153: one thread and five suppressed comments. Two of the suppressed are the end of the pin-parsing arc and they are right. STOP SEARCHING TEXT. Four rounds walked ONE class of bug out of the regex, each fix admitting the next continuation: 8b9ece1 no terminator at all `…@dead` 2dfd669 a negative lookahead over alphanumerics `-feature` `/branch` `_suffix` a9264b8 a positive terminator set `,feature` `'feature`, both legal INSIDE the quoted URL and, independently of any terminator, a search over the raw file could read a sha out of a COMMENTED-OUT old dependency and compare against a pin this file no longer declares. `declared_pin()` now parses with `tomllib`, walks `project.dependencies`, and `fullmatch`es each requirement (minus any PEP 508 environment marker): a pin is read only when the WHOLE declared requirement is `opendox @ git+@<40-hex>`, and a comment is not in the dependency list at all. `TOMLDecodeError` joins OSError and UnicodeDecodeError in the same refusal — a file that does not parse declares nothing and must fail closed, which is the `27a89fd` finding one parser later. TESTS RE-CUT FOR THE NEW SHAPE, both sides: eleven continuations refused in one test — dead x 0 -feature /branch _suffix .1 ,feature 'feature " feature" #feature — every one named by a review round; a commented-out dependency ignored; three legitimate declarations still read (plain, with extras, with an environment marker, and not first in the list); a pyproject that is not TOML -> None. The fixture helper emits VALID TOML per case (quote chosen per requirement), because a helper writing broken TOML would make declared_pin() return None for the wrong reason and pass the test while proving nothing. THE DOCSTRING said "None if unreadable"; there are FOUR such states (unreadable, unparseable, no opendox requirement, a requirement that is not a 40-hex direct pin) and the caller cannot tell them apart from that word. All four named. TWO PER-FILE MEASUREMENTS IN validate.yml were pin-bump-only figures read as current: test_gate_loop_views.py 35 passed and test_gate_loop_probes.py 13 passed are `708591b`'s. Labelled, with the head's own figures beside them (41 and 45) and the command that produces each. AND THE REJECTED EXPRESSION IS NO LONGER WRITTEN OUT in the workflow (the thread: a rejected pattern reproduced in a workflow is a pattern somebody copies back). It survives only in tests/opendox_bundle.py's list of rejected attempts, beside the working one and labelled with why it failed. MEASURED at this head: required invocation 355 passed, 6 skipped (353 before; the delta is exactly the two new tests). Whole tree: 153 failed, 624 passed, 10 skipped, 128 errors — failures, skips and errors unchanged. Guard tests 36 -> 38 (32 here = 17 decision/read + 11 parser + 4 call-site; 6 in the views file). Diff vs main: 7 files, +1533 / -86. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- .github/workflows/validate.yml | 43 +++++++++---- tests/opendox_bundle.py | 71 ++++++++++++++------- tests/test_gate_loop_probes.py | 113 ++++++++++++++++++++++----------- 3 files changed, 156 insertions(+), 71 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 7857568..1c7ef81 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -146,7 +146,12 @@ jobs: # until the pin bump that lands with the openDox half". THAT BUMP HAS # LANDED: `pyproject.toml` names `0b4e8bbf` (openDox-code#23, § 3.4 slice # S8 leg B) since 2026-09-16, and this file goes 32 passed / 3 skipped -> - # 35 passed / 0 skipped under the invocation below. + # 35 passed / 0 skipped under the invocation below. THAT PAIR IS THE + # PIN-BUMP-ONLY MEASUREMENT, at `708591b`, and it is labelled because the + # review of `a9264b8` read it as the current one: the review rounds then + # added six guard tests to this file, so under the same invocation at the + # head it is 41 passed / 0 skipped + # (`python -m pytest -q tests/test_gate_loop_views.py --noconftest`). # # `tests/test_gate_loop_probes.py` joins it on the same footing and for # the reason the slice exists: slice S4 proved its two new modules by @@ -161,7 +166,11 @@ jobs: # end "where the installed `opendox` carries no bundle (this leg's pinned # state until the pin bump) every probe SKIPS". THE SAME BUMP CLEARED IT: # at `0b4e8bbf` the bundle is in the wheel and this file goes 0 passed / - # 13 skipped -> 13 passed / 0 skipped. The skip survives for an assembly + # 13 skipped -> 13 passed / 0 skipped — again the PIN-BUMP-ONLY pair, at + # `708591b`; the rounds added thirty-two guard tests here, so at the head the + # same invocation reads 45 passed / 0 skipped + # (`python -m pytest -q tests/test_gate_loop_probes.py --noconftest`). + # The skip survives for an assembly # that installs a DIFFERENT openDox from the one this leg declares — the # guard compares two commit identities and never asks git which came first, # so "different" is all it can say — and the `node` one for a runner @@ -255,7 +264,7 @@ jobs: # alongside `test_doxbench_turns.py`. # # WITH IT GONE AND THE PIN MOVED, this invocation goes 301 passed / - # 23 skipped -> 353 passed / 6 skipped, and BOTH HALVES OF THAT DELTA HAVE + # 23 skipped -> 355 passed / 6 skipped, and BOTH HALVES OF THAT DELTA HAVE # TO BE SAID SEPARATELY, because Copilot's round-3 review of #21 caught this # block conflating them: # @@ -269,7 +278,7 @@ jobs: # file leaves this list, so that skip is no longer RUN rather than # cleared. Counting it as cleared would describe a transition that never # happened. - # * The remaining rise to 353 is NOT the bump: it is the 36 direct tests + # * The remaining rise to 355 is NOT the bump: it is the 38 direct tests # of the provenance guard that Copilot's review rounds asked for, which # live in `tests/test_gate_loop_probes.py` and # `tests/test_gate_loop_views.py` and are therefore both on this list. @@ -277,9 +286,9 @@ jobs: # rather than carried: # git diff main -- tests/test_gate_loop_probes.py \ # tests/test_gate_loop_views.py | grep -c '^+def test_' - # gives 36, and the passing figure has run 317 -> 323 -> 330 -> 332 -> - # 333 -> 334 -> 336 -> 343 -> 346 -> 348 -> 349 -> 351 -> 353, once per - # round that added tests — the + # gives 38, and the passing figure has run 317 -> 323 -> 330 -> 332 -> + # 333 -> 334 -> 336 -> 343 -> 346 -> 348 -> 349 -> 351 -> 353 -> 355, once + # per round that added tests — the # same discipline the block above applies to the skip counts. The review # of `8b23f6f` asked for the CALL SITES: the tests before it proved what # the guard decides and what it reads, and none of them proved that the @@ -313,10 +322,22 @@ jobs: # merely BEGAN with forty hex characters (`…@<40-hex>dead`) yielded that # prefix as the declared commit — and the guard would compare a commit this # leg does NOT declare against what is installed, failing on the wrong - # culprit or skipping over a real regression. A trailing `(?![0-9a-zA-Z])` - # makes a continuing ref read as NO pin, which is the fail-closed path, and - # two tests hold both sides of it: three continuing refs refused, four - # legitimate line endings still read.) + # culprit or skipping over a real regression. A trailing negative + # lookahead over alphanumerics made a continuing ref read as NO pin — + # THE EXPRESSION IS NOT REPRODUCED HERE, at the request of the review of + # `a9264b8`, because a rejected pattern written out in a workflow is a + # pattern somebody copies back; it was still a TEXT SEARCH, + # and the next two rounds walked the same class of hole out of it: a + # positive terminator set still admitted `,` and `'` INSIDE the quoted PEP + # 508 URL, and a search over raw text could read a sha out of a + # COMMENTED-OUT dependency line. `declared_pin()` PARSES the file with + # `tomllib` now and `fullmatch`es the dependency VALUE, so a pin is read + # only when the entire declared requirement is + # `opendox @ git+@<40-hex>` — and a comment is not in + # `project.dependencies` at all. Eleven continuations are refused in one + # test, and three legitimate declarations (plain, with extras, with an + # environment marker) are still read in another, because a guard too + # strict to read a correct file fails closed just as silently.) # # The 6 skips that remain are the three seam suites' `doc_health` pairs, # which no pin bump touches. diff --git a/tests/opendox_bundle.py b/tests/opendox_bundle.py index 799e623..d073c30 100644 --- a/tests/opendox_bundle.py +++ b/tests/opendox_bundle.py @@ -106,6 +106,7 @@ import re import shutil import tempfile +import tomllib from pathlib import Path from typing import NoReturn @@ -194,34 +195,43 @@ def find() -> Path | None: #: unreadable provenance and FAIL under CI for a formatting difference. _SHA_RE = re.compile(r"[0-9a-fA-F]{40}") -#: THE TRAILING GUARD IS LOAD-BEARING, and it is Copilot's finding at `8b9ece1`, -#: sharpened by its finding at `2dfd669`. -#: Without a terminator this pattern matched a 40-hex PREFIX of a longer ref: -#: `…@<40-hex>dead` is not pinned to that commit at all, yet `declared_pin()` -#: returned the prefix, and the guard would then compare a commit this leg does -#: NOT declare against what is installed — equal by accident is a FAIL that names -#: the wrong culprit, and unequal is a SKIP that hides a real regression. A ref -#: that merely CONTINUES is not a 40-hex pin, so it reads as no pin at all and -#: takes the fail-closed path under CI. -#: IT IS A POSITIVE TERMINATOR, not a list of refused characters — the first try -#: was `(?![0-9a-zA-Z])`, and the review of `2dfd669` was right that it lets -#: `…@-feature`, `…@/branch`, `…@_suffix` and `…@.1` through, -#: all of them legal git refs. Refusing ref characters one class at a time is a -#: losing game (git allows nearly everything a URL does); requiring the pin to END -#: where a TOML string or line ends is not. The terminator set is exactly the -#: characters that can legitimately follow the sha in `pyproject.toml`: a closing -#: quote, whitespace (the newline included), a comma, a closing bracket, or a `#` -#: comment — or the end of the file. +#: THE PIN IS READ OUT OF THE PARSED DEPENDENCY LIST, NOT OUT OF THE FILE TEXT, +#: and that is where four review rounds drove it. The text-search version had a +#: new hole every round, each one the same class — a 40-hex PREFIX read as a pin: +#: `8b9ece1` no terminator at all (`…@dead`); +#: `2dfd669` `(?![0-9a-zA-Z])`, which still let `-feature`, `/branch`, +#: `_suffix` and `.1` through, all legal git refs; +#: `a9264b8` a positive terminator set, which still let `,` and `'` through +#: INSIDE the quoted PEP 508 URL, where both are ref continuations; +#: and, independently of any terminator, a search over the raw text could read +#: the sha out of a COMMENTED-OUT old dependency line and compare against a pin +#: this file no longer declares. +#: Refusing ref characters one class at a time is a losing game — git allows +#: nearly everything a URL does. `tomllib` ends it: the dependency VALUE is a +#: string the parser hands over whole, so `fullmatch` against it admits a pin only +#: when the ENTIRE declared requirement is `opendox @ git+@<40-hex>`, and a +#: comment is not in `project.dependencies` at all. Copilot's finding at `a9264b8`. +#: The optional-dependency tables are NOT searched: a test extra is not what this +#: leg is built against, and `validate.yml` installs `.[test]` against this list. _PIN_RE = re.compile( - r"opendox\s*@\s*git\+[^@\s\"']+@([0-9a-fA-F]{40})(?=[\"'\s,\]#]|$)") + r"opendox(?:\[[^\]]*\])?\s*@\s*git\+[^@\s]+@([0-9a-fA-F]{40})") def declared_pin() -> str | None: - """The openDox-code commit `pyproject.toml` declares, or None if unreadable.""" + """The openDox-code commit this leg's `project.dependencies` pins `opendox` to. + + None where there is NO SUCH PIN TO READ, which is four states and not one — + the docstring said "if unreadable" until the review of `a9264b8` pointed out + that the caller cannot tell them apart from that word: the file is unreadable, + it is not valid TOML, it declares no `opendox` requirement, or the requirement + it declares is not a 40-hex direct VCS pin (a branch ref, a version range, a + path install). `_absent()` treats all four the same — fail-closed under CI — + and that is the point: NONE of them tells this run which openDox it declares. + """ toml = Path(__file__).resolve().parents[1] / "pyproject.toml" try: - match = _PIN_RE.search(toml.read_text(encoding="utf-8")) - except (OSError, UnicodeDecodeError): + parsed = tomllib.loads(toml.read_text(encoding="utf-8")) + except (OSError, UnicodeDecodeError, tomllib.TOMLDecodeError): # UnicodeDecodeError is a ValueError, NOT an OSError, so a non-UTF-8 # `pyproject.toml` would have escaped this function and bypassed # `_absent()`'s explicit unknown-provenance policy altogether. Caught at @@ -231,8 +241,23 @@ def declared_pin() -> str | None: # types are now driven by # `tests/test_gate_loop_probes.py::test_declared_pin_is_none_when_*`, so # the pragma had become a false claim about the branch it labelled. + # `TOMLDecodeError` joined them at `a9264b8`'s review, when the read became + # a PARSE: a `pyproject.toml` that does not parse declares nothing, and the + # guard must fail closed on it exactly as it does on an unreadable one. + return None + project = parsed.get("project") + dependencies = project.get("dependencies") if isinstance(project, dict) else None + if not isinstance(dependencies, list): return None - return match.group(1).lower() if match else None + for requirement in dependencies: + if not isinstance(requirement, str): + continue + # PEP 508 allows an environment marker after `;`; the pin is in the part + # before it, and `fullmatch` on the rest is what refuses a continuing ref. + match = _PIN_RE.fullmatch(requirement.split(";", 1)[0].strip()) + if match: + return match.group(1).lower() + return None def installed_commit() -> str | None: diff --git a/tests/test_gate_loop_probes.py b/tests/test_gate_loop_probes.py index f544f67..ca4ab61 100644 --- a/tests/test_gate_loop_probes.py +++ b/tests/test_gate_loop_probes.py @@ -879,48 +879,87 @@ def test_declared_pin_is_none_when_pyproject_declares_no_opendox_pin( assert _ob.declared_pin() is None -def test_declared_pin_refuses_a_40_hex_PREFIX_of_a_longer_ref(monkeypatch) -> None: - """`…@<40-hex>dead` is NOT a pin, and the regex used to read one out of it. - - Copilot's finding at `8b9ece1` (thread on `tests/opendox_bundle.py:197`), and it - is the parser bug with the widest blast radius found on this PR: `_PIN_RE` had no - delimiter after `{40}`, so any ref that merely BEGAN with forty hex characters - yielded that prefix as "the commit this leg declares". The guard would then - compare a commit this leg does NOT declare against what is installed — equal by - accident FAILS naming the wrong culprit, unequal SKIPS over a real regression. - A continuing ref must read as NO pin, which takes the fail-closed path under CI. - - THE FIRST FIX WAS TOO NARROW AND THE THREAD ON `2dfd669` SAID SO: a negative - lookahead over `[0-9a-zA-Z]` still admitted `-feature`, `/branch`, `_suffix` and - `.1`, all legal git refs. Refusing ref characters one class at a time is a losing - game; the pattern requires a POSITIVE terminator now — the characters that can - legitimately follow the sha in `pyproject.toml` — and every separator named in - that thread is in the loop below. +def _pyproject(*requirements, extra="") -> str: + """A minimal, VALID `pyproject.toml` declaring exactly these requirements. + + The quote is chosen per requirement — a TOML literal string for the usual + case, a basic string where the value itself carries a `'` — because two cases + below put a quote character INSIDE the requirement on purpose, and a helper + that emitted invalid TOML would make `declared_pin()` return None for the + wrong reason, passing the test while proving nothing. """ - for tail in ("dead", "x", "0", "-feature", "/branch", "_suffix", ".1"): - _with_pyproject_text(monkeypatch, ( - "dependencies = [\n" - f" \"opendox @ git+https://github.com/opensoft/openDox-code@{_PIN_A}{tail}\",\n" - "]\n")) + body = "" + for requirement in requirements: + quote = '"' if "'" in requirement else "'" + assert quote not in requirement, requirement + body += f" {quote}{requirement}{quote},\n" + return ('[project]\nname = "openxdox-code"\n' + f"{extra}dependencies = [\n{body}]\n") + + +def test_declared_pin_refuses_anything_but_a_whole_40_hex_direct_pin( + monkeypatch) -> None: + """A ref that CONTINUES past the sha is not a pin, and every escape is closed. + + Four review rounds walked this one class of bug out of a text search — no + terminator at all (`8b9ece1`), a negative lookahead that let `-feature`, + `/branch`, `_suffix` and `.1` through (`2dfd669`), a positive terminator set + that still let `,` and `'` through INSIDE the quoted URL (`a9264b8`) — and the + answer was to stop searching text: `tomllib` hands over the dependency VALUE, + and `fullmatch` admits it only if the WHOLE requirement is the pin. Every + continuation those rounds named is driven here, on one `assert`. + """ + for tail in ("dead", "x", "0", "-feature", "/branch", "_suffix", ".1", + ",feature", "'feature", " feature", "#feature"): + _with_pyproject_text(monkeypatch, _pyproject( + f"opendox @ git+https://github.com/opensoft/openDox-code@{_PIN_A}{tail}")) assert _ob.declared_pin() is None, tail -def test_declared_pin_still_reads_the_real_pin_beside_that_guard( +def test_declared_pin_ignores_a_commented_out_dependency(monkeypatch) -> None: + """The stale sha in a COMMENT is not what this leg declares. + + Copilot's finding at `a9264b8`: a search over the raw file text reads a sha out + of a commented-out old line, so a leg whose real dependency had been changed or + removed would still report the commented commit — and `_absent()` would compare + against a pin this file no longer declares. `tomllib` never sees comments. + """ + _with_pyproject_text(monkeypatch, _pyproject( + "PyYAML>=6.0", + extra=(f'# opendox @ git+https://github.com/opensoft/openDox-code@{_PIN_A}\n' + "# (kept as provenance, and not a declaration)\n"))) + assert _ob.declared_pin() is None + + +def test_declared_pin_reads_the_pin_through_extras_markers_and_position( monkeypatch) -> None: - """...and the delimiter guard does not cost the pin it is there to protect. + """...and the parse does not cost the pin it protects. - The live `pyproject.toml` is read by - `test_the_declared_pin_is_read_from_this_legs_own_pyproject`; this drives the - same line's ENDINGS — the closing quote, a comma, a newline, a `#` comment — - because a lookahead that is too strict fails closed on a correct file, which is - the opposite defect and just as silent. + PEP 508 lets the requirement carry extras and an environment marker, and the + list has no required order. A guard too strict to read a legitimate declaration + fails closed on a CORRECT file, which is the opposite defect and just as silent. """ - for line in (f' "opendox @ git+https://x/openDox-code@{_PIN_A}",', - f' "opendox @ git+https://x/openDox-code@{_PIN_A}"', - f'opendox @ git+https://x/openDox-code@{_PIN_A} # the pin', - f'opendox @ git+https://x/openDox-code@{_PIN_A}'): - _with_pyproject_text(monkeypatch, f"dependencies = [\n{line}\n]\n") - assert _ob.declared_pin() == _PIN_A, line + for requirement in ( + f"opendox @ git+https://github.com/opensoft/openDox-code@{_PIN_A}", + f"opendox[test] @ git+https://github.com/opensoft/openDox-code@{_PIN_A}", + f'opendox @ git+https://github.com/opensoft/openDox-code@{_PIN_A} ; python_version >= "3.11"', + ): + _with_pyproject_text(monkeypatch, _pyproject( + "PyYAML>=6.0", requirement, "jsonschema>=4.18")) + assert _ob.declared_pin() == _PIN_A, requirement + + +def test_declared_pin_is_none_when_pyproject_does_not_parse(monkeypatch) -> None: + """A `pyproject.toml` that is not TOML declares nothing, and fails closed. + + The read became a PARSE at `a9264b8`'s review, so `TOMLDecodeError` joined + `OSError` and `UnicodeDecodeError` in the same refusal. Without it the guard + would raise out of `declared_pin()` and bypass `_absent()`'s policy entirely — + the defect the review of `27a89fd` found for `UnicodeDecodeError`, one parser + later. + """ + _with_pyproject_text(monkeypatch, "[project\nname = broken") + assert _ob.declared_pin() is None def test_an_undeclared_pin_FAILS_under_ci_like_any_other_unreadable_side( @@ -1169,9 +1208,9 @@ def test_installed_commit_is_none_when_reading_the_record_raises(monkeypatch) -> # number is not carried here. What is true at any head is the command: # git diff main -- tests/test_gate_loop_probes.py | grep -c '^+def test_' # git diff main -- tests/test_gate_loop_views.py | grep -c '^+def test_' -# (30 in this file and 6 in the views file at THIS head — 15 decision/read cases, +# (32 in this file and 6 in the views file at THIS head — 17 decision/read cases, # 11 `installed_commit` parser tests and 4 call-site tests here; `validate.yml`'s -# record block carries the total, 36. The review of `fd3af6a` caught this pair +# record block carries the total, 38. The review of `fd3af6a` caught this pair # reading 25 and 6, and the review of `de7d966` moved it again by asking for the # two undeclared-pin tests: a count written in prose is stale one round later, # which is why the commands are printed above it every time.) From 18e8c12f34178596eb8f9bb202465634f660a038 Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 19:50:42 +0000 Subject: [PATCH 26/33] Review at 52453af: an SSH declaration has an `@` in the authority, and the pin pattern stopped at it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copilot review 5227561395: three suppressed comments, no threads. One is a real parser defect in the round that was supposed to end the parser defects. `[^@\s]+` for the URL stopped at the FIRST `@`, so `opendox @ git+ssh://git@github.com/opensoft/openDox-code@<40-hex>` — a PEP 508 declaration pip installs happily — read as NO pin, and the guard would have failed closed under CI on a CORRECT file. That is the opposite defect to the last four rounds' and just as silent. The URL part is `\S+` now: greedy under `fullmatch`, it backtracks to the LAST `@` that leaves forty hex and nothing after them, which is the pin by construction. The https and ssh forms are both driven — in the acceptance test, and in the refusal loop, which now runs its eleven continuations against BOTH url shapes (22 assertions). TWO CLAIMS SCOPED TO WHAT IS TRUE: tests/opendox_bundle.py:52 said the bundle's arrival means "the suites that import OPENDOX_WEB run instead of skipping". `test_doxbench_mutation_boundary.py` imports it too, and with that skip gone it runs on to `from openxdox import gate_console` -> `doc_health` and COLLECTION-ERRORS — which is exactly why RULED openxFactory#656 comment 5700475319 drops it from validate.yml's list. The sentence now says the old missing-bundle skip no longer fires, and names that file as the one where something else takes its place. tests/test_gate_loop_views.py:651 still said "these two guards are its test-time counterpart"; there are THREE refusal branches since cb84001, all enumerated below it. MEASURED at this head: required invocation 355 passed, 6 skipped — unchanged, as a round that adds loop cases and prose must be. The two guard suites: 86 passed (probes 45, views 41). Guard tests 38. Diff vs main: 7 files, +1575 / -86. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- tests/opendox_bundle.py | 17 +++++++++++++++-- tests/test_gate_loop_probes.py | 12 +++++++++--- tests/test_gate_loop_views.py | 4 +++- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/tests/opendox_bundle.py b/tests/opendox_bundle.py index d073c30..e9aa377 100644 --- a/tests/opendox_bundle.py +++ b/tests/opendox_bundle.py @@ -49,7 +49,13 @@ `opendox/web/**` into a wheel at all. THIS LEG'S PIN HAS NOW ADVANCED PAST IT — 2026-09-16, `a99eba03` -> `0b4e8bbf` (openDox-code#23, § 3.4 slice S8 leg B) — and the bundle is there: `find()` returns a real directory under the installed -`opendox`, and the suites that import `OPENDOX_WEB` run instead of skipping. +`opendox`, so the OLD missing-bundle skip no longer fires for the suites that +import `OPENDOX_WEB`. It does not follow that all of them now RUN, and the review +of `52453af` was right to catch the blanket claim: `test_doxbench_mutation_ +boundary.py` imports `OPENDOX_WEB` too, and with that skip gone it runs on to +`from openxdox import gate_console` -> `doc_health`, a COLLECTION ERROR. That is +the BUILD arc's defect, not this bump's, and it is precisely why RULED +openxFactory#656 comment 5700475319 drops that file from `validate.yml`'s list. This paragraph used to end "Until this leg's pin advances past that commit, an installed `opendox` carries no bundle", which was true of `a99eba03` and is quoted here as provenance, not as a claim. @@ -213,8 +219,15 @@ def find() -> Path | None: #: comment is not in `project.dependencies` at all. Copilot's finding at `a9264b8`. #: The optional-dependency tables are NOT searched: a test extra is not what this #: leg is built against, and `validate.yml` installs `.[test]` against this list. +#: THE URL PART IS `\S+`, NOT `[^@\s]+`, and that is the review of `52453af`: +#: a PEP 508 SSH declaration carries an `@` in the AUTHORITY — +#: `opendox @ git+ssh://git@github.com/opensoft/openDox-code@<40-hex>` — so +#: stopping at the first `@` read no pin out of a declaration pip installs +#: happily, and the guard would have failed closed under CI on a correct file. +#: Greedy `\S+` under `fullmatch` backtracks to the LAST `@` that leaves forty hex +#: and nothing after them, which is the pin by construction. _PIN_RE = re.compile( - r"opendox(?:\[[^\]]*\])?\s*@\s*git\+[^@\s]+@([0-9a-fA-F]{40})") + r"opendox(?:\[[^\]]*\])?\s*@\s*git\+\S+@([0-9a-fA-F]{40})") def declared_pin() -> str | None: diff --git a/tests/test_gate_loop_probes.py b/tests/test_gate_loop_probes.py index ca4ab61..6df005d 100644 --- a/tests/test_gate_loop_probes.py +++ b/tests/test_gate_loop_probes.py @@ -911,9 +911,10 @@ def test_declared_pin_refuses_anything_but_a_whole_40_hex_direct_pin( """ for tail in ("dead", "x", "0", "-feature", "/branch", "_suffix", ".1", ",feature", "'feature", " feature", "#feature"): - _with_pyproject_text(monkeypatch, _pyproject( - f"opendox @ git+https://github.com/opensoft/openDox-code@{_PIN_A}{tail}")) - assert _ob.declared_pin() is None, tail + for url in (f"git+https://github.com/opensoft/openDox-code@{_PIN_A}", + f"git+ssh://git@github.com/opensoft/openDox-code@{_PIN_A}"): + _with_pyproject_text(monkeypatch, _pyproject(f"opendox @ {url}{tail}")) + assert _ob.declared_pin() is None, (url, tail) def test_declared_pin_ignores_a_commented_out_dependency(monkeypatch) -> None: @@ -942,6 +943,11 @@ def test_declared_pin_reads_the_pin_through_extras_markers_and_position( for requirement in ( f"opendox @ git+https://github.com/opensoft/openDox-code@{_PIN_A}", f"opendox[test] @ git+https://github.com/opensoft/openDox-code@{_PIN_A}", + # An SSH declaration carries an `@` in the AUTHORITY, and a pattern that + # stopped at the first one read NO pin out of a requirement pip installs + # happily — the guard would then fail closed under CI on a correct file. + # Copilot's review of `52453af`. + f"opendox @ git+ssh://git@github.com/opensoft/openDox-code@{_PIN_A}", f'opendox @ git+https://github.com/opensoft/openDox-code@{_PIN_A} ; python_version >= "3.11"', ): _with_pyproject_text(monkeypatch, _pyproject( diff --git a/tests/test_gate_loop_views.py b/tests/test_gate_loop_views.py index 78f2acf..6e44b49 100644 --- a/tests/test_gate_loop_views.py +++ b/tests/test_gate_loop_views.py @@ -648,7 +648,9 @@ def _view_extension_or_skip(): above says so), and an assembly is free to install an openDox behind the view contract. That is the same condition `view_extensions.ViewContractUnsupported` names at runtime, and - these two guards are its test-time counterpart. + the three refusal branches below are its test-time counterpart (the paragraph + said "these two guards" until the review of `52453af`, having been written when + there were two). BUT THEY NO LONGER SKIP BLINDLY. Copilot's round-1 review of openXdox-code#21 was right that `pytest.importorskip` cannot tell a DIFFERENT assembly from "a From 0e3922d56bd129ba9cd4b4c53d740680e7f082f2 Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 20:00:40 +0000 Subject: [PATCH 27/33] Review at 18e8c12: a marker that is FALSE is not a declaration, and a name that is spelled OpenDox still is MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copilot review 5227642836: three suppressed comments, no threads. Two are real parser defects and they pull in opposite directions — one reads a pin that is not active, one refuses a pin that is. A FALSE ENVIRONMENT MARKER WAS TREATED AS A PIN. `requirement.split(";")[0]` took the spec and dropped the condition, so `opendox @ git+…@ ; python_version < "3.0"` — a line pip installs NOTHING from — read as "the commit this leg declares". Whatever `opendox` happened to be installed would then disagree with it and take the different-commit SKIP, over a real regression. `_marker_holds()` evaluates the marker with `packaging.markers` now, and an unevaluable marker reads as FALSE: a condition this environment cannot judge is not a declaration this run can rely on, and every None here lands on the fail-closed path rather than a skip. THE NAME MATCHED ONLY LOWERCASE. Distribution names are case-insensitive (PEP 503; this leg's own dependency census normalizes with `.lower()` at tests/test_dependency_direction.py), and this estate spells it `openDox` half the time. `OpenDox @ git+…@` read as NO pin, which fails the guard CLOSED under CI on a file pip installs happily — the `52453af` defect's twin, found one round later. `(?i:opendox)`. AND validate.yml's coverage inventory said THREE legitimate declarations where the test drives FIVE. It names all five now (plain HTTPS, extras, an SSH url whose authority carries an `@`, a true marker, mixed-case name), plus the false and unevaluable markers that must NOT read as a pin. MEASURED at this head: required invocation 356 passed, 6 skipped (355 before; the delta is the one new test). Whole tree: 153 failed, 625 passed, 10 skipped, 128 errors — failures, skips and errors unchanged. Guard tests 38 -> 39 (33 here = 18 decision/read + 11 parser + 4 call-site; 6 in the views file). Diff vs main: 7 files, +1629 / -86. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- .github/workflows/validate.yml | 22 +++++++++++------ tests/opendox_bundle.py | 45 +++++++++++++++++++++++++++++----- tests/test_gate_loop_probes.py | 25 +++++++++++++++++-- 3 files changed, 76 insertions(+), 16 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 1c7ef81..a39cea8 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -264,7 +264,7 @@ jobs: # alongside `test_doxbench_turns.py`. # # WITH IT GONE AND THE PIN MOVED, this invocation goes 301 passed / - # 23 skipped -> 355 passed / 6 skipped, and BOTH HALVES OF THAT DELTA HAVE + # 23 skipped -> 356 passed / 6 skipped, and BOTH HALVES OF THAT DELTA HAVE # TO BE SAID SEPARATELY, because Copilot's round-3 review of #21 caught this # block conflating them: # @@ -278,7 +278,7 @@ jobs: # file leaves this list, so that skip is no longer RUN rather than # cleared. Counting it as cleared would describe a transition that never # happened. - # * The remaining rise to 355 is NOT the bump: it is the 38 direct tests + # * The remaining rise to 356 is NOT the bump: it is the 39 direct tests # of the provenance guard that Copilot's review rounds asked for, which # live in `tests/test_gate_loop_probes.py` and # `tests/test_gate_loop_views.py` and are therefore both on this list. @@ -286,9 +286,9 @@ jobs: # rather than carried: # git diff main -- tests/test_gate_loop_probes.py \ # tests/test_gate_loop_views.py | grep -c '^+def test_' - # gives 38, and the passing figure has run 317 -> 323 -> 330 -> 332 -> - # 333 -> 334 -> 336 -> 343 -> 346 -> 348 -> 349 -> 351 -> 353 -> 355, once - # per round that added tests — the + # gives 39, and the passing figure has run 317 -> 323 -> 330 -> 332 -> + # 333 -> 334 -> 336 -> 343 -> 346 -> 348 -> 349 -> 351 -> 353 -> 355 -> + # 356, once per round that added tests — the # same discipline the block above applies to the skip counts. The review # of `8b23f6f` asked for the CALL SITES: the tests before it proved what # the guard decides and what it reads, and none of them proved that the @@ -335,9 +335,15 @@ jobs: # only when the entire declared requirement is # `opendox @ git+@<40-hex>` — and a comment is not in # `project.dependencies` at all. Eleven continuations are refused in one - # test, and three legitimate declarations (plain, with extras, with an - # environment marker) are still read in another, because a guard too - # strict to read a correct file fails closed just as silently.) + # test — eleven continuations against BOTH url shapes — and FIVE + # legitimate declarations are still read in another (plain HTTPS, with + # extras, an SSH url whose AUTHORITY carries an `@`, a true environment + # marker, and `OpenDox` spelled in mixed case, names being + # case-insensitive), because a guard too strict to read a correct file + # fails closed just as silently. A FALSE marker is the one conditional + # that must NOT read as a pin — pip installs nothing from that line — and + # it is driven beside a true one and an unevaluable one. The reviews of + # `52453af` and `18e8c12` found each of those in turn.) # # The 6 skips that remain are the three seam suites' `doc_health` pairs, # which no pin bump touches. diff --git a/tests/opendox_bundle.py b/tests/opendox_bundle.py index e9aa377..e96bc8b 100644 --- a/tests/opendox_bundle.py +++ b/tests/opendox_bundle.py @@ -226,8 +226,36 @@ def find() -> Path | None: #: happily, and the guard would have failed closed under CI on a correct file. #: Greedy `\S+` under `fullmatch` backtracks to the LAST `@` that leaves forty hex #: and nothing after them, which is the pin by construction. +#: THE NAME MATCHES CASE-INSENSITIVELY, because distribution names are +#: (PEP 503, and `tests/test_dependency_direction.py` normalizes with `.lower()` +#: for the same reason): `OpenDox @ git+…@` is the same declaration pip +#: installs, and reading no pin out of it would fail this guard CLOSED under CI on +#: a correct file. Copilot's review of `18e8c12`. _PIN_RE = re.compile( - r"opendox(?:\[[^\]]*\])?\s*@\s*git\+\S+@([0-9a-fA-F]{40})") + r"(?i:opendox)(?:\[[^\]]*\])?\s*@\s*git\+\S+@([0-9a-fA-F]{40})") + + +def _marker_holds(text: str) -> bool: + """Whether a PEP 508 environment marker is TRUE for this interpreter. + + A conditional requirement is only a declaration where its marker holds: with + `; python_version < "3.0"` pip installs nothing, so treating the sha as "the + commit this leg declares" would compare an unrelated installed `opendox` + against a pin that is not active and take the different-commit SKIP — over a + real regression. Copilot's review of `18e8c12`. + + UNEVALUABLE IS FALSE, deliberately: a marker this environment cannot judge is + not a declaration this run can rely on, and everything that returns None here + lands on `_absent()`'s fail-closed path under CI rather than on a skip. + """ + try: + from packaging.markers import Marker + except ModuleNotFoundError: # pragma: no cover - ships with pytest + return False + try: + return bool(Marker(text).evaluate()) + except Exception: + return False def declared_pin() -> str | None: @@ -265,11 +293,16 @@ def declared_pin() -> str | None: for requirement in dependencies: if not isinstance(requirement, str): continue - # PEP 508 allows an environment marker after `;`; the pin is in the part - # before it, and `fullmatch` on the rest is what refuses a continuing ref. - match = _PIN_RE.fullmatch(requirement.split(";", 1)[0].strip()) - if match: - return match.group(1).lower() + # PEP 508 allows an environment marker after `;`. The pin is in the part + # before it — `fullmatch` on that is what refuses a continuing ref — and the + # marker decides whether this requirement is INSTALLED AT ALL. + spec, _, marker = requirement.partition(";") + match = _PIN_RE.fullmatch(spec.strip()) + if not match: + continue + if marker.strip() and not _marker_holds(marker.strip()): + continue + return match.group(1).lower() return None diff --git a/tests/test_gate_loop_probes.py b/tests/test_gate_loop_probes.py index 6df005d..73f2979 100644 --- a/tests/test_gate_loop_probes.py +++ b/tests/test_gate_loop_probes.py @@ -949,12 +949,33 @@ def test_declared_pin_reads_the_pin_through_extras_markers_and_position( # Copilot's review of `52453af`. f"opendox @ git+ssh://git@github.com/opensoft/openDox-code@{_PIN_A}", f'opendox @ git+https://github.com/opensoft/openDox-code@{_PIN_A} ; python_version >= "3.11"', + # Distribution names are case-insensitive (PEP 503), and this one is + # spelled `openDox` half the time in this estate. Copilot, `18e8c12`. + f"OpenDox @ git+https://github.com/opensoft/openDox-code@{_PIN_A}", ): _with_pyproject_text(monkeypatch, _pyproject( "PyYAML>=6.0", requirement, "jsonschema>=4.18")) assert _ob.declared_pin() == _PIN_A, requirement +def test_declared_pin_is_none_for_a_pin_whose_marker_is_FALSE(monkeypatch) -> None: + """A conditional requirement is a declaration only where its marker holds. + + With `; python_version < "3.0"` pip installs nothing from that line, so reading + the sha as "the commit this leg declares" would compare whatever `opendox` + happens to be installed against a pin that is NOT ACTIVE — and the mismatch + takes the different-commit SKIP, over a real regression. Copilot's review of + `18e8c12`; the marker is evaluated now, and an unevaluable one reads as false. + """ + for marker, expected in (('python_version >= "3.0"', _PIN_A), + ('python_version < "3.0"', None), + ('this is not a marker', None)): + _with_pyproject_text(monkeypatch, _pyproject( + f"opendox @ git+https://github.com/opensoft/openDox-code@{_PIN_A}" + f" ; {marker}")) + assert _ob.declared_pin() == expected, marker + + def test_declared_pin_is_none_when_pyproject_does_not_parse(monkeypatch) -> None: """A `pyproject.toml` that is not TOML declares nothing, and fails closed. @@ -1214,9 +1235,9 @@ def test_installed_commit_is_none_when_reading_the_record_raises(monkeypatch) -> # number is not carried here. What is true at any head is the command: # git diff main -- tests/test_gate_loop_probes.py | grep -c '^+def test_' # git diff main -- tests/test_gate_loop_views.py | grep -c '^+def test_' -# (32 in this file and 6 in the views file at THIS head — 17 decision/read cases, +# (33 in this file and 6 in the views file at THIS head — 18 decision/read cases, # 11 `installed_commit` parser tests and 4 call-site tests here; `validate.yml`'s -# record block carries the total, 38. The review of `fd3af6a` caught this pair +# record block carries the total, 39. The review of `fd3af6a` caught this pair # reading 25 and 6, and the review of `de7d966` moved it again by asking for the # two undeclared-pin tests: a count written in prose is stale one round later, # which is why the commands are printed above it every time.) From 9ff630d9afe4b2be0bd13540e099ae16c331c61a Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 20:12:29 +0000 Subject: [PATCH 28/33] Review at 0e3922d: the requirement is PARSED by packaging, and the pin's SOURCE is checked, not just its sha MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copilot review 5227760657: one thread and two suppressed comments. The thread is a provenance hole; the first suppressed comment is the last hand-rolled split. THE SOURCE WAS NEVER CHECKED (thread). `installed_commit()` compares SHAS ONLY, so a dependency re-pointed at a DIFFERENT repository at some other 40-hex commit would have made a missing bundle read as the lawful "different commit" case and SKIP under CI — while this leg was no longer testing openDox-code at all. `_names_opendox_code()` now requires the declared url's repository to be openDox-code (case-insensitively, `.git` and RFC 3986 `;params` tolerated); anything else reads as NO pin, which is the fail-closed path. A FORK or MIRROR under another account still reads — what is refused is a different PROJECT, not a different host — and five urls drive exactly that line. `partition(";")` TRUNCATED A LEGAL URL. A semicolon is a legal URI path character, so `git+https://host/repo;component@` lost its pin and the guard failed closed on a declaration pip installs. `packaging.requirements.Requirement` parses the entry now — name (case-insensitively, PEP 503), extras, url, marker — and this code no longer guesses where any of them start. Every hand-rolled version of that split lost a legal shape or admitted an illegal one, once per round, for five rounds. AND THE TEST THAT CLAIMED THE PIN IS READ FROM THE FILE proved nothing: a hard-coded return of today's sha satisfies a substring assertion against the file that contains it. It now also replaces `pyproject.toml` with a synthetic one declaring a DIFFERENT commit and asserts that commit comes back, which only a real read can do. MEASURED at this head: required invocation 357 passed, 6 skipped (356 before; the delta is the one new test). Whole tree: 153 failed, 626 passed, 10 skipped, 128 errors — failures, skips and errors unchanged. Guard tests 39 -> 40 (34 here = 19 decision/read + 11 parser + 4 call-site; 6 in the views file). Diff vs main: 7 files, +1722 / -86. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- .github/workflows/validate.yml | 17 ++++-- tests/opendox_bundle.py | 94 +++++++++++++++++++++++++--------- tests/test_gate_loop_probes.py | 49 ++++++++++++++++-- 3 files changed, 127 insertions(+), 33 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index a39cea8..0a3fc06 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -264,7 +264,7 @@ jobs: # alongside `test_doxbench_turns.py`. # # WITH IT GONE AND THE PIN MOVED, this invocation goes 301 passed / - # 23 skipped -> 356 passed / 6 skipped, and BOTH HALVES OF THAT DELTA HAVE + # 23 skipped -> 357 passed / 6 skipped, and BOTH HALVES OF THAT DELTA HAVE # TO BE SAID SEPARATELY, because Copilot's round-3 review of #21 caught this # block conflating them: # @@ -278,7 +278,7 @@ jobs: # file leaves this list, so that skip is no longer RUN rather than # cleared. Counting it as cleared would describe a transition that never # happened. - # * The remaining rise to 356 is NOT the bump: it is the 39 direct tests + # * The remaining rise to 357 is NOT the bump: it is the 40 direct tests # of the provenance guard that Copilot's review rounds asked for, which # live in `tests/test_gate_loop_probes.py` and # `tests/test_gate_loop_views.py` and are therefore both on this list. @@ -286,9 +286,9 @@ jobs: # rather than carried: # git diff main -- tests/test_gate_loop_probes.py \ # tests/test_gate_loop_views.py | grep -c '^+def test_' - # gives 39, and the passing figure has run 317 -> 323 -> 330 -> 332 -> + # gives 40, and the passing figure has run 317 -> 323 -> 330 -> 332 -> # 333 -> 334 -> 336 -> 343 -> 346 -> 348 -> 349 -> 351 -> 353 -> 355 -> - # 356, once per round that added tests — the + # 356 -> 357, once per round that added tests — the # same discipline the block above applies to the skip counts. The review # of `8b23f6f` asked for the CALL SITES: the tests before it proved what # the guard decides and what it reads, and none of them proved that the @@ -343,7 +343,14 @@ jobs: # fails closed just as silently. A FALSE marker is the one conditional # that must NOT read as a pin — pip installs nothing from that line — and # it is driven beside a true one and an unevaluable one. The reviews of - # `52453af` and `18e8c12` found each of those in turn.) + # `52453af` and `18e8c12` found each of those in turn. The review of + # `0e3922d` ended the arc by taking the splitting away from this code + # altogether: `packaging.requirements` settles the name, the extras, the + # url and where the marker starts — a `;` is legal in a url path, and + # hand-splitting on it truncated a declaration pip installs — and the + # SOURCE is checked, because comparing shas alone let a dependency + # re-pointed at a different PROJECT read as the lawful "different commit" + # skip while this leg was no longer testing openDox-code at all.) # # The 6 skips that remain are the three seam suites' `doc_health` pairs, # which no pin bump touches. diff --git a/tests/opendox_bundle.py b/tests/opendox_bundle.py index e96bc8b..0bcd416 100644 --- a/tests/opendox_bundle.py +++ b/tests/opendox_bundle.py @@ -226,13 +226,39 @@ def find() -> Path | None: #: happily, and the guard would have failed closed under CI on a correct file. #: Greedy `\S+` under `fullmatch` backtracks to the LAST `@` that leaves forty hex #: and nothing after them, which is the pin by construction. -#: THE NAME MATCHES CASE-INSENSITIVELY, because distribution names are -#: (PEP 503, and `tests/test_dependency_direction.py` normalizes with `.lower()` -#: for the same reason): `OpenDox @ git+…@` is the same declaration pip -#: installs, and reading no pin out of it would fail this guard CLOSED under CI on -#: a correct file. Copilot's review of `18e8c12`. -_PIN_RE = re.compile( - r"(?i:opendox)(?:\[[^\]]*\])?\s*@\s*git\+\S+@([0-9a-fA-F]{40})") +#: The pin inside a direct-reference URL. The NAME, the extras and the marker are +#: the PEP 508 parser's business now (review of `0e3922d`); what is left here is +#: "this URL ends in `@<40-hex>` and nothing else", which is what refuses a ref +#: that merely BEGINS with forty hex characters. `\S+` rather than `[^@\s]+` +#: because an SSH url carries an `@` in its authority (review of `18e8c12`), and +#: greedy backtracking under `fullmatch` lands on the LAST such `@`. +_URL_PIN_RE = re.compile(r"git\+\S+@([0-9a-fA-F]{40})") + +#: The repository this leg is entitled to reason about. `installed_commit()` +#: compares SHAS ONLY, so a declaration re-pointed at another repository at some +#: other 40-hex commit would have made a missing bundle look like the lawful +#: "different commit" case and SKIP under CI — while this leg was no longer +#: testing openDox-code at all. Copilot's thread on `0e3922d`. A pin at another +#: repository is not a declaration this guard can interpret, so it reads as NO +#: pin, which is the fail-closed path under CI rather than a silent skip. +#: The `;…` tail is RFC 3986 path parameters, legal in a VCS url and the very +#: shape the review of `0e3922d` named (`…/repo;component@`); it belongs to +#: the path, not to the repository's name, so it is allowed and ignored here. +_OPENDOX_CODE_RE = re.compile(r".*/opendox-code(?:\.git)?(?:;[^/]*)?$") + + +def _names_opendox_code(url: str) -> bool: + """Whether a direct-reference URL names `opensoft/openDox-code`. + + Compared on the repository PATH and case-insensitively (the estate spells it + `openDox-code`, `opendox-code` and `OpenDox-code` in different places), with + the `git+` scheme prefix, any `@` suffix and a trailing `.git` stripped + first. A fork or mirror under another account still passes — what this refuses + is a DIFFERENT PROJECT, which is the case the thread on `0e3922d` names. + """ + without_scheme = url[len("git+"):] if url.startswith("git+") else url + repository = without_scheme.rsplit("@", 1)[0] if "@" in without_scheme else without_scheme + return bool(_OPENDOX_CODE_RE.fullmatch(repository.rstrip("/").lower())) def _marker_holds(text: str) -> bool: @@ -261,13 +287,21 @@ def _marker_holds(text: str) -> bool: def declared_pin() -> str | None: """The openDox-code commit this leg's `project.dependencies` pins `opendox` to. - None where there is NO SUCH PIN TO READ, which is four states and not one — - the docstring said "if unreadable" until the review of `a9264b8` pointed out - that the caller cannot tell them apart from that word: the file is unreadable, - it is not valid TOML, it declares no `opendox` requirement, or the requirement - it declares is not a 40-hex direct VCS pin (a branch ref, a version range, a - path install). `_absent()` treats all four the same — fail-closed under CI — - and that is the point: NONE of them tells this run which openDox it declares. + None where there is NO SUCH PIN TO READ, which is SIX states and not one — the + docstring said "if unreadable" until the review of `a9264b8` pointed out that + the caller cannot tell them apart from that word: the file is unreadable, it is + not valid TOML, it declares no `opendox` requirement, the requirement it + declares is not a 40-hex direct VCS pin (a branch ref, a version range, a path + install), its environment marker does not hold on this interpreter (review of + `18e8c12`), or it points at a DIFFERENT PROJECT than openDox-code (the thread + on `0e3922d`). `_absent()` treats all six the same — fail-closed under CI — and + that is the point: NONE of them tells this run which openDox it declares. + + THE REQUIREMENT IS PARSED, never split by hand: `packaging.requirements` + settles the name (case-insensitively, PEP 503), the extras, the url and where + the marker starts, because every hand-rolled version of that split lost a legal + declaration shape — an `@` in an SSH authority, a `;` in a url path — or + admitted an illegal one. Five review rounds, one per shape. """ toml = Path(__file__).resolve().parents[1] / "pyproject.toml" try: @@ -290,19 +324,31 @@ def declared_pin() -> str | None: dependencies = project.get("dependencies") if isinstance(project, dict) else None if not isinstance(dependencies, list): return None - for requirement in dependencies: - if not isinstance(requirement, str): + try: + from packaging.requirements import InvalidRequirement, Requirement + except ModuleNotFoundError: # pragma: no cover - ships with pytest + return None + for entry in dependencies: + if not isinstance(entry, str): + continue + # THE PEP 508 PARSER SPLITS THIS, not `partition(";")`. A semicolon is a + # legal URI character, so `git+https://host/repo;component@` was + # truncated at it and read as NO pin — the guard failing closed on a + # declaration pip installs. Copilot's review of `0e3922d`; the parser knows + # where the marker starts and this function no longer guesses. + try: + requirement = Requirement(entry) + except InvalidRequirement: continue - # PEP 508 allows an environment marker after `;`. The pin is in the part - # before it — `fullmatch` on that is what refuses a continuing ref — and the - # marker decides whether this requirement is INSTALLED AT ALL. - spec, _, marker = requirement.partition(";") - match = _PIN_RE.fullmatch(spec.strip()) - if not match: + if requirement.name.lower() != "opendox" or not requirement.url: continue - if marker.strip() and not _marker_holds(marker.strip()): + # A marker that does not hold means pip installs nothing from this line, so + # the sha on it is not "the commit this leg declares" (review of `18e8c12`). + if requirement.marker is not None and not _marker_holds(str(requirement.marker)): continue - return match.group(1).lower() + match = _URL_PIN_RE.fullmatch(requirement.url) + if match and _names_opendox_code(requirement.url): + return match.group(1).lower() return None diff --git a/tests/test_gate_loop_probes.py b/tests/test_gate_loop_probes.py index 73f2979..6db70d4 100644 --- a/tests/test_gate_loop_probes.py +++ b/tests/test_gate_loop_probes.py @@ -816,14 +816,26 @@ def test_under_ci_reads_the_environment_the_runner_sets(monkeypatch) -> None: assert _ob.under_ci() is False -def test_the_declared_pin_is_read_from_this_legs_own_pyproject() -> None: - """Not a constant: the guard re-reads the file the bump edits.""" +def test_the_declared_pin_is_read_from_this_legs_own_pyproject(monkeypatch) -> None: + """Not a constant: the guard re-reads the file the bump edits. + + The first half checks the LIVE file, and on its own it proved nothing — a + hard-coded return of today's sha would satisfy a substring assertion against + the file that contains it (Copilot, review of `0e3922d`). The second half is + the proof: with `pyproject.toml` replaced by a synthetic one declaring a + DIFFERENT commit, the function must return THAT commit, which only a real read + can do. + """ declared = _ob.declared_pin() assert declared is not None assert len(declared) == 40 toml = (Path(__file__).resolve().parents[1] / "pyproject.toml").read_text( encoding="utf-8") assert f"openDox-code@{declared}" in toml + assert _PIN_A != declared + _with_pyproject_text(monkeypatch, _pyproject( + f"opendox @ git+https://github.com/opensoft/openDox-code@{_PIN_A}")) + assert _ob.declared_pin() == _PIN_A def _with_unreadable_pyproject(monkeypatch, exc) -> None: @@ -917,6 +929,28 @@ def test_declared_pin_refuses_anything_but_a_whole_40_hex_direct_pin( assert _ob.declared_pin() is None, (url, tail) +def test_declared_pin_refuses_a_pin_at_a_DIFFERENT_REPOSITORY(monkeypatch) -> None: + """A 40-hex pin at another project is not a declaration this guard can read. + + `installed_commit()` compares SHAS ONLY, so a dependency re-pointed at another + repository at some other 40-hex commit would have made a missing bundle look + like the lawful "different commit" case and SKIP under CI — while this leg was + no longer testing openDox-code at all. Copilot's thread on `0e3922d`. Such a + pin reads as NO pin, which is the fail-closed path, and a fork or mirror of + openDox-code under another account still reads (what is refused is a different + PROJECT, not a different host). + """ + for url, expected in ( + (f"git+https://github.com/opensoft/openDox-code@{_PIN_A}", _PIN_A), + (f"git+https://github.com/someone/openDox-code@{_PIN_A}", _PIN_A), + (f"git+https://example.invalid/mirrors/opendox-code.git@{_PIN_A}", _PIN_A), + (f"git+https://github.com/opensoft/openXdox-code@{_PIN_A}", None), + (f"git+https://github.com/opensoft/some-other-project@{_PIN_A}", None), + ): + _with_pyproject_text(monkeypatch, _pyproject(f"opendox @ {url}")) + assert _ob.declared_pin() == expected, url + + def test_declared_pin_ignores_a_commented_out_dependency(monkeypatch) -> None: """The stale sha in a COMMENT is not what this leg declares. @@ -952,6 +986,13 @@ def test_declared_pin_reads_the_pin_through_extras_markers_and_position( # Distribution names are case-insensitive (PEP 503), and this one is # spelled `openDox` half the time in this estate. Copilot, `18e8c12`. f"OpenDox @ git+https://github.com/opensoft/openDox-code@{_PIN_A}", + # A SEMICOLON is a legal URI character, and `partition(";")` truncated + # the url at it — the guard failing closed on a declaration pip + # installs. The PEP 508 parser knows where a marker starts. + # Copilot, review of `0e3922d`. + f"opendox @ git+https://github.com/opensoft/openDox-code;branch@{_PIN_A}", + # ...and a `.git` suffix, which the source check must not refuse. + f"opendox @ git+ssh://git@github.com/opensoft/openDox-code.git@{_PIN_A}", ): _with_pyproject_text(monkeypatch, _pyproject( "PyYAML>=6.0", requirement, "jsonschema>=4.18")) @@ -1235,9 +1276,9 @@ def test_installed_commit_is_none_when_reading_the_record_raises(monkeypatch) -> # number is not carried here. What is true at any head is the command: # git diff main -- tests/test_gate_loop_probes.py | grep -c '^+def test_' # git diff main -- tests/test_gate_loop_views.py | grep -c '^+def test_' -# (33 in this file and 6 in the views file at THIS head — 18 decision/read cases, +# (34 in this file and 6 in the views file at THIS head — 19 decision/read cases, # 11 `installed_commit` parser tests and 4 call-site tests here; `validate.yml`'s -# record block carries the total, 39. The review of `fd3af6a` caught this pair +# record block carries the total, 40. The review of `fd3af6a` caught this pair # reading 25 and 6, and the review of `de7d966` moved it again by asking for the # two undeclared-pin tests: a count written in prose is stale one round later, # which is why the commands are printed above it every time.) From e92fb06b987663bc4c075e5537718043d9c482cc Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 20:23:16 +0000 Subject: [PATCH 29/33] Review at 9ff630d: the CI failure stops blaming the file for four states in which the file is fine MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copilot review 5227875090: six suppressed comments, no threads. One is a message that misdiagnoses, one is a test that proved the wrong branch, four are counts this round's own predecessors moved. tests/opendox_bundle.py:458 — `_unreadable_side()` said "this leg's declared pin could not be read from pyproject.toml" for every None from `declared_pin()`. Only TWO of its six states are a failed read; the other four — no `opendox` requirement, a requirement that is not a 40-hex direct VCS pin, an environment marker that does not hold here, a pin at another project — happen with a perfectly readable file, and under CI that message told a reader to go looking for a corrupt `pyproject.toml`. It now says what is true of all six and points at `declared_pin()`, which enumerates them. tests/test_gate_loop_probes.py:1013 — the "unevaluable marker" case was `this is not a marker`, which `Requirement()` rejects outright: the test proved the InvalidRequirement branch and never reached `_marker_holds()`. It uses a SYNTACTICALLY VALID marker naming a variable this environment cannot resolve (`extra == "…"`), and the function's own three outcomes are asserted directly beside it. FOUR STALE MEASUREMENTS, all this act's own: validate.yml's per-file figure for test_gate_loop_probes.py (45 -> 47 passed, and "thirty-two" -> thirty-four guard tests in the same sentence), its parser inventory (FIVE legitimate declarations -> SEVEN: plain HTTPS, extras, an SSH authority `@`, a `;` path parameter, a `.git` suffix, a true marker, a mixed-case name), and opendox_bundle.py's "five review rounds, one per shape", which stopped being a fixed number two rounds ago. The sixth suppressed comment says the PR description still opens with 39 guard tests and 356 passes. It does not: the description was updated to 40 / 357 at 9ff630d's push (20:13Z) and the review read the snapshot before it. Measured, not asserted — `gh pr view 21 --json body` at this head carries "with 40 tests holding it there" and "current head `9ff630d` | 357 passed, 6 skipped". No edit owed. MEASURED at this head: required invocation 357 passed, 6 skipped — unchanged, as a round of messages and comments must be. Per file: test_gate_loop_probes.py 47 passed, test_gate_loop_views.py 41 passed. Guard tests 40. Diff vs main: 7 files, +1752 / -86. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- .github/workflows/validate.yml | 17 +++++++++-------- tests/opendox_bundle.py | 21 ++++++++++++++++----- tests/test_gate_loop_probes.py | 15 +++++++++++++-- 3 files changed, 38 insertions(+), 15 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 0a3fc06..b2685fb 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -167,8 +167,8 @@ jobs: # state until the pin bump) every probe SKIPS". THE SAME BUMP CLEARED IT: # at `0b4e8bbf` the bundle is in the wheel and this file goes 0 passed / # 13 skipped -> 13 passed / 0 skipped — again the PIN-BUMP-ONLY pair, at - # `708591b`; the rounds added thirty-two guard tests here, so at the head the - # same invocation reads 45 passed / 0 skipped + # `708591b`; the rounds added thirty-four guard tests here, so at the head + # the same invocation reads 47 passed / 0 skipped # (`python -m pytest -q tests/test_gate_loop_probes.py --noconftest`). # The skip survives for an assembly # that installs a DIFFERENT openDox from the one this leg declares — the @@ -335,12 +335,13 @@ jobs: # only when the entire declared requirement is # `opendox @ git+@<40-hex>` — and a comment is not in # `project.dependencies` at all. Eleven continuations are refused in one - # test — eleven continuations against BOTH url shapes — and FIVE - # legitimate declarations are still read in another (plain HTTPS, with - # extras, an SSH url whose AUTHORITY carries an `@`, a true environment - # marker, and `OpenDox` spelled in mixed case, names being - # case-insensitive), because a guard too strict to read a correct file - # fails closed just as silently. A FALSE marker is the one conditional + # test — eleven continuations against BOTH url shapes — and SEVEN + # legitimate declarations are still read in another (plain HTTPS · with + # extras · an SSH url whose AUTHORITY carries an `@` · a `;` path + # parameter · a `.git` suffix · a true environment marker · `OpenDox` + # spelled in mixed case, names being case-insensitive per PEP 503), + # because a guard too strict to read a correct file fails closed just as + # silently. A FALSE marker is the one conditional # that must NOT read as a pin — pip installs nothing from that line — and # it is driven beside a true one and an unevaluable one. The reviews of # `52453af` and `18e8c12` found each of those in turn. The review of diff --git a/tests/opendox_bundle.py b/tests/opendox_bundle.py index 0bcd416..071dbd3 100644 --- a/tests/opendox_bundle.py +++ b/tests/opendox_bundle.py @@ -301,7 +301,7 @@ def declared_pin() -> str | None: settles the name (case-insensitively, PEP 503), the extras, the url and where the marker starts, because every hand-rolled version of that split lost a legal declaration shape — an `@` in an SSH authority, a `;` in a url path — or - admitted an illegal one. Five review rounds, one per shape. + admitted an illegal one, once per review round. """ toml = Path(__file__).resolve().parents[1] / "pyproject.toml" try: @@ -412,11 +412,22 @@ def _unreadable_side(declared: str | None, installed: str | None) -> str: branch came to name the side (review of `27a89fd`) while the CI branch did not. """ if declared is None and installed is None: - return ("NEITHER side could be read: this leg's declared pin is unreadable " - "in `pyproject.toml` and the installed distribution records no " - "usable PEP 610 provenance") + return ("NEITHER side is usable: this leg's declared pin could not be read " + "from `pyproject.toml` (see `declared_pin()` for the six states " + "that reach this) and the installed distribution records no usable " + "PEP 610 provenance") if declared is None: - return "this leg's declared pin could not be read from `pyproject.toml`" + # NOT "the file could not be read": `declared_pin()` returns None for six + # states and only two of them are a failed READ (the review of `9ff630d` + # caught this phrase blaming the file for the other four — an inactive + # marker, no `opendox` requirement, a requirement that is not a 40-hex VCS + # pin, or a pin at another project, every one of them a perfectly readable + # `pyproject.toml`). The sentence says what IS true of all six. + return ("this leg's declared pin could not be read from `pyproject.toml` " + "— the file is unreadable or unparseable, declares no `opendox` " + "requirement, declares one that is not a 40-hex direct VCS pin at " + "openDox-code, or carries an environment marker that does not hold " + "here (`declared_pin()` lists the six)") return ("no usable PEP 610 provenance could be read from the installed " "distribution") diff --git a/tests/test_gate_loop_probes.py b/tests/test_gate_loop_probes.py index 6db70d4..6bfb699 100644 --- a/tests/test_gate_loop_probes.py +++ b/tests/test_gate_loop_probes.py @@ -772,7 +772,7 @@ def test_both_sides_unreadable_says_NEITHER_rather_than_picking_one( call = _decide(monkeypatch, None, None, ci=True) with pytest.raises(pytest.fail.Exception) as raised: call() - assert "NEITHER side could be read" in str(raised.value) + assert "NEITHER side is usable" in str(raised.value) def test_unknown_provenance_SKIPS_off_ci(monkeypatch) -> None: @@ -1010,11 +1010,22 @@ def test_declared_pin_is_none_for_a_pin_whose_marker_is_FALSE(monkeypatch) -> No """ for marker, expected in (('python_version >= "3.0"', _PIN_A), ('python_version < "3.0"', None), - ('this is not a marker', None)): + # A SYNTACTICALLY VALID marker naming a variable this + # environment has no value for. The case here used to + # be `this is not a marker`, which `Requirement()` + # rejects outright — so it proved the InvalidRequirement + # branch and never reached `_marker_holds()` at all. + # Copilot's review of `9ff630d`. + ('extra == "nothing-declares-this"', None)): _with_pyproject_text(monkeypatch, _pyproject( f"opendox @ git+https://github.com/opensoft/openDox-code@{_PIN_A}" f" ; {marker}")) assert _ob.declared_pin() == expected, marker + # ...and the unevaluable path is driven at the function, where a marker that + # PARSES but cannot be evaluated here must read as false rather than raise. + assert _ob._marker_holds('extra == "x"') is False + assert _ob._marker_holds("this is not a marker") is False + assert _ob._marker_holds('python_version >= "3.0"') is True def test_declared_pin_is_none_when_pyproject_does_not_parse(monkeypatch) -> None: From 9ab852103d5b8aaf1477a8fc3841d69425f5e637 Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 20:41:37 +0000 Subject: [PATCH 30/33] Review at e92fb06: pip's direct-reference FRAGMENT is legal after the pin, and only two of the ten suites are actually carved MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copilot review 5228049032: two suppressed comments, no threads, both accurate. tests/opendox_bundle.py:235 — `#subdirectory=src` read as NO pin. `Requirement.url` legally carries pip's direct-reference fragment (`…@#subdirectory=src`, `#egg=opendox&subdirectory=src`), which says nothing about which commit is declared, and `fullmatch` required the forty hex to be the last characters of the url — so the guard failed CLOSED under CI on a declaration pip installs. `_without_fragment()` strips it before matching, and ONLY a `key=value` fragment: a bare `#feature` is a ref continuation, not a fragment, and stays in the refusal loop. Two acceptance cases added, the refusal case annotated with the distinction. .github/workflows/validate.yml:67 — "the other TEN are carved suites" is false, and the measurement is worse than the finding: of the ten runtime importers on this list, only TWO are ARRIVED carve rows (test_doxbench_abstract_store.py and test_doxbench_telemetry.py, each with a row in openxFactory `docs/opendox-carve-manifest.yaml`); the other EIGHT are CREATED files admitted by name in `docs/opendox-carve-admissions.yaml` — the two gate-loop suites of § 3.4 slice S5 and the three evidence / workbench / authority pairs. The distinction is load-bearing in this very act: an ARRIVED row's edits are declared at openxFactory, which is exactly why test_doxbench_mutation_boundary.py is dropped rather than repaired and why the 29 importer annotations are left alone. Both registers are named with the command that re-derives each. MEASURED at this head: required invocation 357 passed, 6 skipped — unchanged, as a round of parser tolerance and prose must be (the two new cases are loop entries in an existing test). tests/test_gate_loop_probes.py 47 passed. Guard tests 40. Diff vs main: 7 files, +1791 / -86. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- .github/workflows/validate.yml | 19 ++++++++++++++++--- tests/opendox_bundle.py | 21 +++++++++++++++++++-- tests/test_gate_loop_probes.py | 9 +++++++++ 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index b2685fb..c5ac8fe 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -62,9 +62,22 @@ jobs: # shape assertions" ever described. # * ELEVEN import a runtime module. `test_domain_profile.py` imports # `openxdox.domain_profile` alone, on the § 4.4 grounds set out below; - # the other TEN are carved suites that RUN here, and FOUR of them reach - # the PINNED openDox — in TWO DIFFERENT WAYS, which this line ran - # together until the review of `24cd5f2` on #21 measured them apart: + # the other TEN RUN here — and calling all ten "carved" was wrong, as + # the review of `e92fb06` said: measured against openxFactory's own two + # registers, only TWO are ARRIVED carve rows + # (`test_doxbench_abstract_store.py`, `test_doxbench_telemetry.py`, each + # with a row in `docs/opendox-carve-manifest.yaml`) and EIGHT are CREATED + # files admitted by name in `docs/opendox-carve-admissions.yaml` — the two + # gate-loop suites of § 3.4 slice S5 and the three evidence/workbench/ + # authority pairs. The distinction is not cosmetic: an ARRIVED row's edits + # are declared at openxFactory (which is why + # `test_doxbench_mutation_boundary.py` is dropped rather than repaired, + # and why the 29 importer annotations are left alone), while a CREATED + # file is this leg's to edit. Re-derive with + # `grep -c '' /docs/opendox-carve-{manifest,admissions}.yaml`. + # FOUR of the ten reach the PINNED openDox — in TWO DIFFERENT WAYS, which + # this line ran together until the review of `24cd5f2` on #21 measured + # them apart: # - ONE reads the pinned WEB BUNDLE: `test_gate_loop_probes.py`, whose # `_opendox_bundle()` finds the marker under the installed `opendox` # and whose `bundle` fixture composes it. `tests/opendox_bundle.py`'s diff --git a/tests/opendox_bundle.py b/tests/opendox_bundle.py index 071dbd3..999de11 100644 --- a/tests/opendox_bundle.py +++ b/tests/opendox_bundle.py @@ -234,6 +234,22 @@ def find() -> Path | None: #: greedy backtracking under `fullmatch` lands on the LAST such `@`. _URL_PIN_RE = re.compile(r"git\+\S+@([0-9a-fA-F]{40})") +#: pip's direct-reference FRAGMENT: `#subdirectory=src`, `#egg=opendox`, joined by +#: `&`. It is legal after the pin and says nothing about which commit is declared, +#: so it is stripped before matching — the review of `e92fb06` caught +#: `…@#subdirectory=src` reading as NO pin and failing the guard closed on a +#: declaration pip installs. Only a `key=value` fragment is stripped: a bare +#: `#feature` is a ref continuation, not a fragment, and must still refuse. +_FRAGMENT_RE = re.compile(r"[A-Za-z_][A-Za-z0-9_.-]*=[^&]*(?:&[A-Za-z_][A-Za-z0-9_.-]*=[^&]*)*") + + +def _without_fragment(url: str) -> str: + """`url` with a pip direct-reference fragment removed, if it has one.""" + head, sep, fragment = url.partition("#") + if sep and _FRAGMENT_RE.fullmatch(fragment): + return head + return url + #: The repository this leg is entitled to reason about. `installed_commit()` #: compares SHAS ONLY, so a declaration re-pointed at another repository at some #: other 40-hex commit would have made a missing bundle look like the lawful @@ -346,8 +362,9 @@ def declared_pin() -> str | None: # the sha on it is not "the commit this leg declares" (review of `18e8c12`). if requirement.marker is not None and not _marker_holds(str(requirement.marker)): continue - match = _URL_PIN_RE.fullmatch(requirement.url) - if match and _names_opendox_code(requirement.url): + url = _without_fragment(requirement.url) + match = _URL_PIN_RE.fullmatch(url) + if match and _names_opendox_code(url): return match.group(1).lower() return None diff --git a/tests/test_gate_loop_probes.py b/tests/test_gate_loop_probes.py index 6bfb699..37b6e1b 100644 --- a/tests/test_gate_loop_probes.py +++ b/tests/test_gate_loop_probes.py @@ -921,6 +921,9 @@ def test_declared_pin_refuses_anything_but_a_whole_40_hex_direct_pin( and `fullmatch` admits it only if the WHOLE requirement is the pin. Every continuation those rounds named is driven here, on one `assert`. """ + # `#feature` stays a REFUSAL: a bare `#…` is a ref continuation, not pip's + # `key=value` direct-reference fragment, and only the latter is stripped + # (review of `e92fb06`). for tail in ("dead", "x", "0", "-feature", "/branch", "_suffix", ".1", ",feature", "'feature", " feature", "#feature"): for url in (f"git+https://github.com/opensoft/openDox-code@{_PIN_A}", @@ -993,6 +996,12 @@ def test_declared_pin_reads_the_pin_through_extras_markers_and_position( f"opendox @ git+https://github.com/opensoft/openDox-code;branch@{_PIN_A}", # ...and a `.git` suffix, which the source check must not refuse. f"opendox @ git+ssh://git@github.com/opensoft/openDox-code.git@{_PIN_A}", + # pip's direct-reference FRAGMENT is legal after the pin and says + # nothing about which commit is declared. `#subdirectory=…` read as NO + # pin until the review of `e92fb06`, failing the guard closed on a + # declaration pip installs. + f"opendox @ git+https://github.com/opensoft/openDox-code@{_PIN_A}#subdirectory=src", + f"opendox @ git+https://github.com/opensoft/openDox-code@{_PIN_A}#egg=opendox&subdirectory=src", ): _with_pyproject_text(monkeypatch, _pyproject( "PyYAML>=6.0", requirement, "jsonschema>=4.18")) From 5285cf22ed3f8f3027bb47316b83d7c3bfddd506 Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 21:41:15 +0000 Subject: [PATCH 31/33] Review at 9ab8521: the provenance check covers the INSTALLED side too, and the workflow's parser inventory is measured again MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copilot review 5228136700: one thread + two suppressed comments, all three accurate. tests/opendox_bundle.py:400 (thread PRRT_kwDOUPv7_s6jHESs) — THE PROVENANCE CHECK WAS HALF A CHECK. The review of `0e3922d` made `declared_pin()` refuse a pin at another project, because comparing shas alone let a dependency re-pointed elsewhere read as the lawful "different commit" SKIP while this leg was no longer testing openDox-code at all. `installed_commit()` kept doing exactly that on the side that is actually IMPORTED: it returned `vcs_info.commit_id` and dropped `direct_url.json`'s `url`, so an `opendox` built from an unrelated repository at its own 40-hex commit still reached that skip. It reads the `url` now, through the same `_names_opendox_code()` the declared side uses, and a record naming another project is NO provenance — the fail-closed path under CI, not a silent green. ...and the too-strict half of it, which this arc has produced once per round: an INSTALLED record carries no `@` (PEP 610 keeps it in `requested_revision`), so stripping at the LAST `@` cut `ssh://git@github.com/opensoft/openDox-code` down to `ssh://git` and would have read a correct install as a different project. The ref is stripped positionally now — only an `@` after the final `/` can be one. A fork or a mirror still reads, RULED openxFactory#656 comment 5700475319; what is refused is a different PROJECT. Two tests: four refused sources (openXdox-code, openDox-spec, an `openDox-code-mirror` that is its own project, a file:// wheel) and six that must still read (HTTPS, `git+…​.git`, SSH with a `git@` authority, a fork under another account, a third-party mirror, a `#subdirectory=` fragment). .github/workflows/validate.yml:355 — the inventory said SEVEN legitimate declarations where the test drives NINE: the `#subdirectory=src` and `#egg=opendox&subdirectory=src` cases the review of `e92fb06` added one round earlier never reached it. Corrected and both named. tests/test_gate_loop_probes.py:196 — the fixture's counterfactual read as a claim about the CURRENT guard. It is about the marker-only check #21 replaced, and it now says so and says what the table does instead: at the declared pin those thirteen probes FAIL, which is the table's first row. MEASURED at this head with the workflow's own invocation: required 357 -> 359 passed, 6 skipped (the two new source tests); tests/test_gate_loop_probes.py 47 -> 49 passed; tests/test_gate_loop_views.py 41 passed, unchanged; `git diff main -- tests/test_gate_loop_probes.py tests/test_gate_loop_views.py | grep -c '^+def test_'` 40 -> 42; `grep -c '^def test_installed_commit' tests/test_gate_loop_probes.py` 11 -> 13. Every count this act states in the workflow and in the two inventory blocks was re-derived at this head. Diff vs main: 7 files, +1880 / -86. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- .github/workflows/validate.yml | 27 ++++++++---- tests/opendox_bundle.py | 43 +++++++++++++++---- tests/test_gate_loop_probes.py | 75 ++++++++++++++++++++++++++++------ 3 files changed, 117 insertions(+), 28 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index c5ac8fe..b08ac97 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -180,8 +180,8 @@ jobs: # state until the pin bump) every probe SKIPS". THE SAME BUMP CLEARED IT: # at `0b4e8bbf` the bundle is in the wheel and this file goes 0 passed / # 13 skipped -> 13 passed / 0 skipped — again the PIN-BUMP-ONLY pair, at - # `708591b`; the rounds added thirty-four guard tests here, so at the head - # the same invocation reads 47 passed / 0 skipped + # `708591b`; the rounds added thirty-six guard tests here, so at the head + # the same invocation reads 49 passed / 0 skipped # (`python -m pytest -q tests/test_gate_loop_probes.py --noconftest`). # The skip survives for an assembly # that installs a DIFFERENT openDox from the one this leg declares — the @@ -277,7 +277,7 @@ jobs: # alongside `test_doxbench_turns.py`. # # WITH IT GONE AND THE PIN MOVED, this invocation goes 301 passed / - # 23 skipped -> 357 passed / 6 skipped, and BOTH HALVES OF THAT DELTA HAVE + # 23 skipped -> 359 passed / 6 skipped, and BOTH HALVES OF THAT DELTA HAVE # TO BE SAID SEPARATELY, because Copilot's round-3 review of #21 caught this # block conflating them: # @@ -291,7 +291,7 @@ jobs: # file leaves this list, so that skip is no longer RUN rather than # cleared. Counting it as cleared would describe a transition that never # happened. - # * The remaining rise to 357 is NOT the bump: it is the 40 direct tests + # * The remaining rise to 359 is NOT the bump: it is the 42 direct tests # of the provenance guard that Copilot's review rounds asked for, which # live in `tests/test_gate_loop_probes.py` and # `tests/test_gate_loop_views.py` and are therefore both on this list. @@ -299,9 +299,9 @@ jobs: # rather than carried: # git diff main -- tests/test_gate_loop_probes.py \ # tests/test_gate_loop_views.py | grep -c '^+def test_' - # gives 40, and the passing figure has run 317 -> 323 -> 330 -> 332 -> + # gives 42, and the passing figure has run 317 -> 323 -> 330 -> 332 -> # 333 -> 334 -> 336 -> 343 -> 346 -> 348 -> 349 -> 351 -> 353 -> 355 -> - # 356 -> 357, once per round that added tests — the + # 356 -> 357 -> 359, once per round that added tests — the # same discipline the block above applies to the skip counts. The review # of `8b23f6f` asked for the CALL SITES: the tests before it proved what # the guard decides and what it reads, and none of them proved that the @@ -348,11 +348,14 @@ jobs: # only when the entire declared requirement is # `opendox @ git+@<40-hex>` — and a comment is not in # `project.dependencies` at all. Eleven continuations are refused in one - # test — eleven continuations against BOTH url shapes — and SEVEN + # test — eleven continuations against BOTH url shapes — and NINE # legitimate declarations are still read in another (plain HTTPS · with # extras · an SSH url whose AUTHORITY carries an `@` · a `;` path # parameter · a `.git` suffix · a true environment marker · `OpenDox` - # spelled in mixed case, names being case-insensitive per PEP 503), + # spelled in mixed case, names being case-insensitive per PEP 503 · + # a `#subdirectory=src` fragment · an `#egg=…&subdirectory=…` one — + # the two the review of `e92fb06` added, which this inventory still + # counted as seven until the review of `9ab8521` measured it), # because a guard too strict to read a correct file fails closed just as # silently. A FALSE marker is the one conditional # that must NOT read as a pin — pip installs nothing from that line — and @@ -364,7 +367,13 @@ jobs: # hand-splitting on it truncated a declaration pip installs — and the # SOURCE is checked, because comparing shas alone let a dependency # re-pointed at a different PROJECT read as the lawful "different commit" - # skip while this leg was no longer testing openDox-code at all.) + # skip while this leg was no longer testing openDox-code at all. The + # review of `9ab8521` closed the OTHER HALF of that: the check sat on the + # DECLARED url only, so an `opendox` INSTALLED from an unrelated + # repository still reached that skip — `installed_commit()` reads + # `direct_url.json`'s `url` as well as its `commit_id` now, a fork or a + # mirror of openDox-code passing (RULED 5700475319) and a different + # project failing closed.) # # The 6 skips that remain are the three seam suites' `doc_health` pairs, # which no pin bump touches. diff --git a/tests/opendox_bundle.py b/tests/opendox_bundle.py index 999de11..a47e025 100644 --- a/tests/opendox_bundle.py +++ b/tests/opendox_bundle.py @@ -271,9 +271,19 @@ def _names_opendox_code(url: str) -> bool: the `git+` scheme prefix, any `@` suffix and a trailing `.git` stripped first. A fork or mirror under another account still passes — what this refuses is a DIFFERENT PROJECT, which is the case the thread on `0e3922d` names. + + IT READS BOTH SIDES' URLS, and that is why the `@` suffix is stripped + POSITIONALLY rather than at the last `@`: a DECLARED url carries the ref + (`…/openDox-code@<40-hex>`) and an INSTALLED one never does — PEP 610 keeps it + in `vcs_info.requested_revision` — so `rsplit("@", 1)` cut a perfectly ordinary + `ssh://git@github.com/opensoft/openDox-code` down to `ssh://git` and read a + correct install as a different project. A ref can only follow the final `/`; + an authority's `@` cannot. Copilot's thread on `9ab8521`. """ without_scheme = url[len("git+"):] if url.startswith("git+") else url - repository = without_scheme.rsplit("@", 1)[0] if "@" in without_scheme else without_scheme + last_segment = without_scheme.rsplit("/", 1)[-1] + repository = (without_scheme.rsplit("@", 1)[0] + if "@" in last_segment else without_scheme) return bool(_OPENDOX_CODE_RE.fullmatch(repository.rstrip("/").lower())) @@ -376,8 +386,10 @@ def installed_commit() -> str | None: recorded", and saying only the narrow thing made this contract inaccurate (caught at the review of `27a89fd` on #21). It covers: no `direct_url.json`, malformed JSON, an `archive_info` (non-VCS) install, a record whose `vcs` is - not git, a `commit_id` that is not 40 hex, the distribution lookup raising, - and the read raising. Every one of those has its own test below. + not git, a `commit_id` that is not 40 hex, a record whose `url` names a + PROJECT other than openDox-code (Copilot's thread on `9ab8521`), the + distribution lookup raising, and the read raising. Every one of those has its + own test below. WHAT THE CALLER DOES WITH None IS NOT "always skip", and this docstring said so until Copilot's round-3 review of #21 caught it: `_absent()` FAILS on None @@ -395,7 +407,9 @@ def installed_commit() -> str | None: if not raw: return None try: - vcs_info = json.loads(raw).get("vcs_info") or {} + record = json.loads(raw) + vcs_info = record.get("vcs_info") or {} + source = record.get("url") vcs, commit = vcs_info.get("vcs"), vcs_info.get("commit_id") except (ValueError, AttributeError): # Driven by `test_installed_commit_is_none_on_malformed_json`. @@ -409,6 +423,19 @@ def installed_commit() -> str | None: # say it is git, or this function does not know what is installed. if vcs != "git" or not isinstance(commit, str): return None + # THE SOURCE IS THE OTHER HALF OF THE PROVENANCE, and this function read only + # the commit until Copilot's thread on `9ab8521`: a distribution NAMED + # `opendox` but built from an unrelated repository at its own 40-hex commit + # was handed to `_absent()` as the lawful DIFFERENT-COMMIT case and SKIPPED + # the required suite — while nothing installed here came from openDox-code at + # all. `declared_pin()` got exactly this check at `9ff630d`, on the side that + # is DECLARED; this is the same check on the side that is IMPORTED, and + # half a provenance check is the silent green the other half exists to stop. + # A FORK or a MIRROR still reads (RULED openxFactory#656 comment 5700475319 — + # a consumer may pin an openDox of its own choosing); what is refused is a + # different PROJECT, and it lands on the fail-closed path under CI. + if not isinstance(source, str) or not _names_opendox_code(_without_fragment(source)): + return None return commit.lower() if _SHA_RE.fullmatch(commit) else None @@ -431,8 +458,8 @@ def _unreadable_side(declared: str | None, installed: str | None) -> str: if declared is None and installed is None: return ("NEITHER side is usable: this leg's declared pin could not be read " "from `pyproject.toml` (see `declared_pin()` for the six states " - "that reach this) and the installed distribution records no usable " - "PEP 610 provenance") + "that reach this) and the installed distribution records no PEP 610 " + "provenance this guard can use") if declared is None: # NOT "the file could not be read": `declared_pin()` returns None for six # states and only two of them are a failed READ (the review of `9ff630d` @@ -446,7 +473,9 @@ def _unreadable_side(declared: str | None, installed: str | None) -> str: "openDox-code, or carries an environment marker that does not hold " "here (`declared_pin()` lists the six)") return ("no usable PEP 610 provenance could be read from the installed " - "distribution") + "distribution — it records none, it records one this guard cannot " + "read, or it records one built from a PROJECT other than openDox-code " + "(`installed_commit()` lists the states)") def _absent(subject: str, *, module_level: bool) -> NoReturn: diff --git a/tests/test_gate_loop_probes.py b/tests/test_gate_loop_probes.py index 37b6e1b..39a9732 100644 --- a/tests/test_gate_loop_probes.py +++ b/tests/test_gate_loop_probes.py @@ -191,9 +191,13 @@ def bundle(tmp_path) -> Path: # installed distribution's PEP 610 provenance instead of asserting it. # Its four-row table is there, not restated here. Round 1 of the review on # #21 found this file claiming the install "came from somewhere older than - # the declared pin" on a check that only tested for a marker; if `0b4e8bbf` itself ever stopped shipping `web/**`, all - # thirteen probes below would have skipped and this required check would - # have stayed green over the regression. + # the declared pin" on a check that only tested for a marker. UNDER THAT + # CHECK, had `0b4e8bbf` itself ever stopped shipping `web/**`, all thirteen + # probes below would have skipped and this required check would have stayed + # green over the regression. UNDER THE TABLE THEY OBEY NOW THEY FAIL: the + # installed commit equals the declared pin, which is the table's first row + # — said here because the review of `9ab8521` read the sentence above as a + # claim about the guard that replaced it. import opendox_bundle opendox_bundle._absent("openDox's `web/` bundle", module_level=False) target = tmp_path / "web" @@ -1122,8 +1126,9 @@ def read_text(self, name): #: so a regression to `distribution("openxdox")` — or to any other installed package #: — would have read a STRANGER's `direct_url.json`, compared that commit against #: this leg's declared pin, and left every parser test then standing green while -#: doing it — all TEN of them; the eleventh is the one below, which exists because -#: of this finding. (`grep -c '^def test_installed_commit' ` -> 11.) +#: doing it — all TEN of them then; the eleventh is the one below, which exists +#: because of this finding. (`grep -c '^def test_installed_commit' ` +#: -> 13 at this head: the review of `9ab8521` added the two SOURCE cases.) _ASKED = "opendox" @@ -1232,7 +1237,8 @@ def test_installed_commit_normalizes_an_upper_case_commit_id(monkeypatch) -> Non CI over a formatting difference rather than a regression. """ _with_dist(monkeypatch, json.dumps( - {"vcs_info": {"vcs": "git", "commit_id": _PIN_B.upper()}})) + {"url": "https://github.com/opensoft/openDox-code", + "vcs_info": {"vcs": "git", "commit_id": _PIN_B.upper()}})) assert _ob.installed_commit() == _PIN_B @@ -1243,6 +1249,49 @@ def test_installed_commit_refuses_a_record_that_is_not_git(monkeypatch) -> None: assert _ob.installed_commit() is None +def test_installed_commit_refuses_a_record_from_a_DIFFERENT_PROJECT(monkeypatch) -> None: + """A 40-hex git commit OF SOMETHING ELSE is not provenance this leg may compare. + + `installed_commit()` returned `vcs_info.commit_id` and dropped the record's + `url`, so an `opendox` built from an unrelated repository at its own commit + reached `_absent()` as the lawful DIFFERENT-COMMIT case and SKIPPED the required + suite — with nothing installed here coming from openDox-code at all. The + DECLARED side got this check at `9ff630d` + (`test_declared_pin_refuses_a_pin_at_a_DIFFERENT_REPOSITORY`); Copilot's thread + on `9ab8521` asked for it on the side that is actually imported. + """ + for url in ("https://github.com/opensoft/openXdox-code", + "https://github.com/opensoft/openDox-spec", + "https://github.com/opensoft/openDox-code-mirror", + "file:///srv/wheels/opendox"): + _with_dist(monkeypatch, json.dumps( + {"url": url, "vcs_info": {"vcs": "git", "commit_id": _PIN_B}})) + assert _ob.installed_commit() is None, url + + +def test_installed_commit_reads_a_fork_a_mirror_and_an_ssh_record(monkeypatch) -> None: + """...and the source check must not fail CLOSED on a lawful install. + + An installed record carries no `@` — PEP 610 keeps the ref in + `requested_revision` — so stripping at the LAST `@` cut + `ssh://git@github.com/opensoft/openDox-code` down to `ssh://git` and read a + correct install as a different project: the "too strict" half of this defect, + which every round of this arc has found paired with the too-loose half. A fork + or a mirror under another account reads too, RULED openxFactory#656 comment + 5700475319: a consumer may pin an openDox of its own choosing; what is refused + is a different PROJECT. + """ + for url in ("https://github.com/opensoft/openDox-code", + "git+https://github.com/opensoft/openDox-code.git", + "ssh://git@github.com/opensoft/openDox-code", + "https://github.com/a-fork/openDox-code", + "https://git.example.test/mirrors/opendox-code.git", + "https://github.com/opensoft/openDox-code#subdirectory=src"): + _with_dist(monkeypatch, json.dumps( + {"url": url, "vcs_info": {"vcs": "git", "commit_id": _PIN_B}})) + assert _ob.installed_commit() == _PIN_B, url + + def test_installed_commit_is_none_when_the_package_is_not_installed(monkeypatch) -> None: """The LOOKUP fails, not the read — see `_with_no_dist`.""" from importlib.metadata import PackageNotFoundError @@ -1257,11 +1306,13 @@ def test_installed_commit_is_none_when_reading_the_record_raises(monkeypatch) -> # WHY THE CASES ABOVE ARE THE CASES: `_absent()` branches on `installed_commit()`'s # RETURN VALUE, so every test of the DECISION that monkeypatches that function -# proves nothing about the READING. TEN cases cover the reading of the INSTALLED +# proves nothing about the READING. TWELVE cases cover the reading of the INSTALLED # side — a real VCS record, an absent `direct_url.json`, malformed JSON, a non-VCS # (`archive_info`) install, a commit id that is not 40 characters, forty # characters that are not hex, an UPPER-CASE 40-hex id (normalized rather than -# discarded), a 40-hex id under a non-git VCS, the distribution LOOKUP raising, +# discarded), a 40-hex id under a non-git VCS, a record whose `url` names a +# DIFFERENT PROJECT, the fork / mirror / SSH / fragment shapes that must still +# read (the same defect's too-strict half), the distribution LOOKUP raising, # and the read raising. The DECLARED side's own reading is covered separately, # above, by the two `test_declared_pin_is_none_when_…` cases. # @@ -1269,7 +1320,7 @@ def test_installed_commit_is_none_when_reading_the_record_raises(monkeypatch) -> # of `f6f1b991` on #21 caught that the upper-case case added at `b177eef` had # never reached the inventory: # -# grep -c '^def test_installed_commit' tests/test_gate_loop_probes.py -> 11 +# grep -c '^def test_installed_commit' tests/test_gate_loop_probes.py -> 13 # # It read 10 until the review of `fd3af6a` caught the lookup-name test the review # of `a0eed16` had just asked for — the same staleness, one round later, which is @@ -1296,9 +1347,9 @@ def test_installed_commit_is_none_when_reading_the_record_raises(monkeypatch) -> # number is not carried here. What is true at any head is the command: # git diff main -- tests/test_gate_loop_probes.py | grep -c '^+def test_' # git diff main -- tests/test_gate_loop_views.py | grep -c '^+def test_' -# (34 in this file and 6 in the views file at THIS head — 19 decision/read cases, -# 11 `installed_commit` parser tests and 4 call-site tests here; `validate.yml`'s -# record block carries the total, 40. The review of `fd3af6a` caught this pair +# (36 in this file and 6 in the views file at THIS head — 19 decision/read cases, +# 13 `installed_commit` parser tests and 4 call-site tests here; `validate.yml`'s +# record block carries the total, 42. The review of `fd3af6a` caught this pair # reading 25 and 6, and the review of `de7d966` moved it again by asking for the # two undeclared-pin tests: a count written in prose is stale one round later, # which is why the commands are printed above it every time.) From ca327c211c9741e7b4a98871a1d2801d47844ea3 Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 21:57:23 +0000 Subject: [PATCH 32/33] Review at 5285cf2: the DEFAULT require() path is driven, and two inventories stop carrying a number MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copilot review 5228713458: two threads + two suppressed comments. Three accurate, one already false when it was filed. tests/test_gate_loop_probes.py:1393 (suppressed) — THE DEFAULT IS THE PATH THE IMPORTERS TAKE, and nothing drove it. Both call-site tests pass `module_level=False`, because that is what a test function needs; the 29 `OPENDOX_WEB` importers call `require()` with no argument at MODULE scope, where the skip must carry `allow_module_level=True` or pytest raises instead of skipping. A regression that stopped forwarding the default would have left every call-site test green while breaking exactly the callers this guard exists for. One test drives `require()` with no override and asserts the raised `Skipped` carries `allow_module_level is True`. tests/test_gate_loop_probes.py:1317 (suppressed) — the DECLARED-side inventory said "the two test_declared_pin_is_none_… cases" and there are five (the readable miss, a false marker, a file that does not parse, the read raising, a non-UTF-8 file). It no longer says a number at all: the paragraph prints `grep -c '^def test_declared_pin_is_none'` and lets the command be the count. Four rounds of this review have moved a number that was written in prose; this is the second inventory in the file to stop carrying one. tests/test_gate_loop_probes.py:1335 (thread) — the continuation under the installed-side inventory still said "the eleven above" one commit after that inventory became thirteen. It says "the cases above" now, for the same reason. .github/workflows/validate.yml:298 (thread) — ALREADY FALSE WHEN FILED. The description's current-head row reads `0b4e8bbf, current head 5285cf2 | 359 passed, 6 skipped` and its guard-test figure reads 42; the 40 / 357 pairs that remain in it are inside sections headed "Measured at 9ff630d", "at e92fb06" and "at 9ab8521" — each scoped to the head it was measured at, which is what the comment asks for. Answered on the thread by quotation; no edit owed. Round 25 filed the same shape of finding against a description that had already been updated. MEASURED at this head with the workflow's own invocation: required 359 -> 360 passed, 6 skipped; tests/test_gate_loop_probes.py 49 -> 50 passed; tests/test_gate_loop_views.py 41 passed, unchanged; `git diff main -- | grep -c '^+def test_'` 42 -> 43; `grep -c '^def test_installed_commit'` 13, unchanged; `grep -c '^def test_declared_pin_is_none'` 5. Diff vs main: 7 files, +1904 / -86. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- .github/workflows/validate.yml | 12 +++++------ tests/test_gate_loop_probes.py | 38 +++++++++++++++++++++++++++------- 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index b08ac97..354c040 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -180,8 +180,8 @@ jobs: # state until the pin bump) every probe SKIPS". THE SAME BUMP CLEARED IT: # at `0b4e8bbf` the bundle is in the wheel and this file goes 0 passed / # 13 skipped -> 13 passed / 0 skipped — again the PIN-BUMP-ONLY pair, at - # `708591b`; the rounds added thirty-six guard tests here, so at the head - # the same invocation reads 49 passed / 0 skipped + # `708591b`; the rounds added thirty-seven guard tests here, so at the head + # the same invocation reads 50 passed / 0 skipped # (`python -m pytest -q tests/test_gate_loop_probes.py --noconftest`). # The skip survives for an assembly # that installs a DIFFERENT openDox from the one this leg declares — the @@ -277,7 +277,7 @@ jobs: # alongside `test_doxbench_turns.py`. # # WITH IT GONE AND THE PIN MOVED, this invocation goes 301 passed / - # 23 skipped -> 359 passed / 6 skipped, and BOTH HALVES OF THAT DELTA HAVE + # 23 skipped -> 360 passed / 6 skipped, and BOTH HALVES OF THAT DELTA HAVE # TO BE SAID SEPARATELY, because Copilot's round-3 review of #21 caught this # block conflating them: # @@ -291,7 +291,7 @@ jobs: # file leaves this list, so that skip is no longer RUN rather than # cleared. Counting it as cleared would describe a transition that never # happened. - # * The remaining rise to 359 is NOT the bump: it is the 42 direct tests + # * The remaining rise to 360 is NOT the bump: it is the 43 direct tests # of the provenance guard that Copilot's review rounds asked for, which # live in `tests/test_gate_loop_probes.py` and # `tests/test_gate_loop_views.py` and are therefore both on this list. @@ -299,9 +299,9 @@ jobs: # rather than carried: # git diff main -- tests/test_gate_loop_probes.py \ # tests/test_gate_loop_views.py | grep -c '^+def test_' - # gives 42, and the passing figure has run 317 -> 323 -> 330 -> 332 -> + # gives 43, and the passing figure has run 317 -> 323 -> 330 -> 332 -> # 333 -> 334 -> 336 -> 343 -> 346 -> 348 -> 349 -> 351 -> 353 -> 355 -> - # 356 -> 357 -> 359, once per round that added tests — the + # 356 -> 357 -> 359 -> 360, once per round that added tests — the # same discipline the block above applies to the skip counts. The review # of `8b23f6f` asked for the CALL SITES: the tests before it proved what # the guard decides and what it reads, and none of them proved that the diff --git a/tests/test_gate_loop_probes.py b/tests/test_gate_loop_probes.py index 39a9732..d2a8aec 100644 --- a/tests/test_gate_loop_probes.py +++ b/tests/test_gate_loop_probes.py @@ -1314,7 +1314,12 @@ def test_installed_commit_is_none_when_reading_the_record_raises(monkeypatch) -> # DIFFERENT PROJECT, the fork / mirror / SSH / fragment shapes that must still # read (the same defect's too-strict half), the distribution LOOKUP raising, # and the read raising. The DECLARED side's own reading is covered separately, -# above, by the two `test_declared_pin_is_none_when_…` cases. +# above, by the `test_declared_pin_is_none_when_…` cases — and THAT count is not +# written here at all, because it was written as "two" and was five by the time +# the review of `5285cf2` read it (the readable miss, a false marker, a file that +# does not parse, the read raising, a non-UTF-8 file). The command is the count: +# +# grep -c '^def test_declared_pin_is_none' tests/test_gate_loop_probes.py # # THE COUNT IS MEASURED, NOT CARRIED, and this line read "nine" until the review # of `f6f1b991` on #21 caught that the upper-case case added at `b177eef` had @@ -1325,13 +1330,13 @@ def test_installed_commit_is_none_when_reading_the_record_raises(monkeypatch) -> # It read 10 until the review of `fd3af6a` caught the lookup-name test the review # of `a0eed16` had just asked for — the same staleness, one round later, which is # why the command is printed beside the number every time. -# A DELETED case is not one of the eleven, and this paragraph used to number it as -# though it were ("a tenth test"). One further test stood here until `7c0a3b6` +# A DELETED case is not one of the cases above, and this paragraph used to number +# it as though it were ("a tenth test"). One further test stood here until `7c0a3b6` # and is gone rather than repaired: it asserted strings against # `inspect.getsource(installed_commit)`, and once the implementation stopped # containing `len(commit) == 40` it passed only because an explanatory COMMENT # still held that text. A test coupled to source text fails on a harmless rename -# and catches no behaviour — the eleven above already assert the results it was +# and catches no behaviour — the cases above already assert the results it was # gesturing at. @@ -1347,9 +1352,9 @@ def test_installed_commit_is_none_when_reading_the_record_raises(monkeypatch) -> # number is not carried here. What is true at any head is the command: # git diff main -- tests/test_gate_loop_probes.py | grep -c '^+def test_' # git diff main -- tests/test_gate_loop_views.py | grep -c '^+def test_' -# (36 in this file and 6 in the views file at THIS head — 19 decision/read cases, -# 13 `installed_commit` parser tests and 4 call-site tests here; `validate.yml`'s -# record block carries the total, 42. The review of `fd3af6a` caught this pair +# (37 in this file and 6 in the views file at THIS head — 19 decision/read cases, +# 13 `installed_commit` parser tests and 5 call-site tests here; `validate.yml`'s +# record block carries the total, 43. The review of `fd3af6a` caught this pair # reading 25 and 6, and the review of `de7d966` moved it again by asking for the # two undeclared-pin tests: a count written in prose is stale one round later, # which is why the commands are printed above it every time.) @@ -1394,6 +1399,25 @@ def test_require_SKIPS_for_a_different_installed_commit(monkeypatch) -> None: assert "NOT the declared pin's doing" in str(raised.value) +def test_require_forwards_its_DEFAULT_module_level_to_the_skip(monkeypatch) -> None: + """THE DEFAULT IS THE PATH THE IMPORTERS TAKE, and no test drove it. + + Both call-site tests above pass `module_level=False`, because that is what a + test function needs; the 29 `OPENDOX_WEB` importers call `require()` with no + argument at MODULE scope, where a skip must carry `allow_module_level=True` or + pytest raises instead of skipping. A regression that stopped forwarding the + default would have left every test above green and broken exactly the callers + this guard exists for. Copilot's review of `5285cf2`. + """ + _pin(monkeypatch, _PIN_A, _PIN_B) + monkeypatch.setattr(_ob, "_STAGED", None) + monkeypatch.setattr(_ob, "find", lambda: None) + with pytest.raises(pytest.skip.Exception) as raised: + _ob.require() + assert raised.value.allow_module_level is True + assert "NOT the declared pin's doing" in str(raised.value) + + def test_the_bundle_fixture_FAILS_at_the_declared_pin(request, monkeypatch) -> None: """The `bundle` fixture's call site, driven through the real fixture. From 894781e47ac0aa0bd79e795db4d48a9a7c8e0ec7 Mon Sep 17 00:00:00 2001 From: Brett Heap <1513478+brettheap@users.noreply.github.com> Date: Wed, 16 Sep 2026 22:06:22 +0000 Subject: [PATCH 33/33] Review at ca327c2: a FAIL reached during an import is a collection error, not a failed test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copilot review 5228827546: 0 new threads, three suppressed comments. ONE accurate and fixed here; two answered by measurement on the PR, because both describe a contradiction the text does not contain. tests/opendox_bundle.py:566 — ACCURATE, and the sharpest reading of this guard anyone has offered. `require()`'s docstring said `pytest.fail` "fails the test that reached the guard, whichever flag was passed". It cannot, in the case the same paragraph is about: reached while a module is being IMPORTED — the `OPENDOX_WEB` line through PEP 562's `__getattr__`, or a module-scope `composed()` — the raise happens during COLLECTION and pytest reports that module as a collection ERROR, not a failed test. The paragraph now says where a failure lands is decided by where the guard was REACHED and never by `module_level`, and names both outcomes. Red either way, which is the point. ...and the same review's finding turned on this act's own prose: the new default-path test said "the 29 `OPENDOX_WEB` importers", collapsing the TWO annotated forms into one — the exact collapse the review of `2dfd669` caught in `opendox_bundle.py`'s annotation note. Measured: `grep -rn 'skips where the pin carries no bundle' tests/ --include='test_*.py'` -> 29 sites in 29 files, of which 26 import `OPENDOX_WEB` (`__getattr__` -> bare `require()`) and 3 call `composed()` (which calls a bare `require()` of its own). The docstring says both now. ANSWERED, NOT EDITED (both on the PR, with the measurement): * probes:1310 "TWELVE cases ... but the file defines 13" — there is no contradiction: TWELVE cases cover the READING and the thirteenth (`test_installed_commit_asks_for_the_opendox_distribution_and_no_other`) covers WHICH DISTRIBUTION IS ASKED FOR, which is why `_ASKED`'s own note exists. The twelve are enumerated in that paragraph and the `grep -c` beside it reports 13 by design. * validate.yml:280 "the comparison mixes two lists" — it does, deliberately and in terms: the block immediately below it says the delta has TWO HALVES and that the seventeenth skip did not clear but LEFT THE LIST, which is precisely the accounting the comment asks for. Re-scoping the before-measurement to the new list would delete the record of what the drop did. MEASURED at this head: required 360 passed / 6 skipped, UNCHANGED (prose only); tests/test_gate_loop_probes.py 50 passed; guard tests 43; diff vs main 7 files. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 --- tests/opendox_bundle.py | 12 +++++++++--- tests/test_gate_loop_probes.py | 16 ++++++++++------ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/tests/opendox_bundle.py b/tests/opendox_bundle.py index a47e025..e170d42 100644 --- a/tests/opendox_bundle.py +++ b/tests/opendox_bundle.py @@ -562,9 +562,15 @@ def require(*, module_level: bool = True) -> Path: the review of `2dfd669`); `web()` below passes False, so a skip takes only the calling TEST (see its docstring for when that is the honest reading). The FAIL outcomes — the declared pin, and an unreadable side under CI — are not - scoped by it at all: `pytest.fail` fails the test that reached the guard, - whichever flag was passed. The review of `e6cd0e8` caught this paragraph - reading as though the flag governed every outcome. + scoped by it at all, and no flag softens one. WHERE a failure lands is decided + by where the guard was REACHED, never by `module_level`: reached from a test, + `pytest.fail` fails that test; reached while a module is being imported — the + `OPENDOX_WEB` line, through PEP 562's `__getattr__`, or a module-scope + `composed()` — it raises during COLLECTION, and pytest reports that module as a + collection ERROR rather than a failed test. Red either way, which is the point. + The review of `e6cd0e8` caught this paragraph reading as though the flag + governed every outcome; the review of `ca327c2` caught the sentence that + replaced it promising a failed TEST in the one case that cannot produce one. WHY A STAGED COPY AND NOT THE INSTALLED DIRECTORY ITSELF (Copilot review of openXdox-code#19, the `test_round_trip.py` finding — accurate). Several of diff --git a/tests/test_gate_loop_probes.py b/tests/test_gate_loop_probes.py index d2a8aec..0a9c9f5 100644 --- a/tests/test_gate_loop_probes.py +++ b/tests/test_gate_loop_probes.py @@ -1400,14 +1400,18 @@ def test_require_SKIPS_for_a_different_installed_commit(monkeypatch) -> None: def test_require_forwards_its_DEFAULT_module_level_to_the_skip(monkeypatch) -> None: - """THE DEFAULT IS THE PATH THE IMPORTERS TAKE, and no test drove it. + """THE DEFAULT IS THE PATH THE MODULE-SCOPE CALLERS TAKE, and no test drove it. Both call-site tests above pass `module_level=False`, because that is what a - test function needs; the 29 `OPENDOX_WEB` importers call `require()` with no - argument at MODULE scope, where a skip must carry `allow_module_level=True` or - pytest raises instead of skipping. A regression that stopped forwarding the - default would have left every test above green and broken exactly the callers - this guard exists for. Copilot's review of `5285cf2`. + test function needs. The TWENTY-NINE annotated module-scope sites take the + default instead — 26 importing `OPENDOX_WEB`, which PEP 562's `__getattr__` + resolves with a bare `require()`, and 3 calling `composed()`, which calls a + bare `require()` of its own (the two forms `opendox_bundle.py`'s own annotation + note keeps apart, and which the review of `2dfd669` caught being collapsed into + one). At module scope a skip must carry `allow_module_level=True` or pytest + raises instead of skipping, so a regression that stopped forwarding the default + would have left every test above green and broken exactly those callers. + Copilot's review of `5285cf2`. """ _pin(monkeypatch, _PIN_A, _PIN_B) monkeypatch.setattr(_ob, "_STAGED", None)