Repository navigation
§ 4.5 slice 2: add the evidence-and-provenance surface (design § D4 machinery 4) - #11
Conversation
…de (design § D4 machinery 4) split-opendox-two-layer-product § 4.5's second named BUILD feature (RULED ASK-3, opensoft/openXfactory#656 comment 5628886636; claimed at comment 5632730583 immediately after slice 1, the role-and-authority projection, landed as #10). Renders governed-derived-model's "Full provenance" requirement (the Purpose section's second invariant: "every fact carrying provenance or a declared assumption") over a caller-supplied xfactory_derived_model_conformance-shaped structure — the same schema and the ratified medx-governed/ledgerx-calibrated fixtures already declare. No new data model, no invented field names, no conformance verdict computed (the schema's own canonical validator, scripts/validate-derived-models.py, is never copied here). Adds: - src/openxdox/evidence_provenance_surface.py — project()/as_json() pure rendering over role:model members' provenance bindings (form/evidence_field/assumption_register_field/invented_facts_field), one GET /projections/evidence RouteBinding through the § 2.4 seam. - tests/test_evidence_provenance_surface.py — unit tests against both ratified fixture shapes plus absent/malformed-input handling. - tests/test_evidence_provenance_surface_seam.py — seam-conformance, proving assembly beside the gate/projection/role-authority columns with no collision. New files only; stays off pyproject.toml, tests/test_dependency_direction.py and gate_console.py (BUILD slice 2b's declared territory). Required `validate` suite (test_leg_shape.py + test_dependency_direction.py) unchanged at 24. Refs opensoft/openXfactory#656 Lane: openxfactory-4-opendox-extraction Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Reviewer's GuideImplements the second § 4.5 feature as a schema-faithful evidence-and-provenance projection: pure rendering of declared model-member provenance fields, a single route-extension contribution, and focused unit/seam tests without adding validation or live composition wiring. Sequence diagram for the evidence provenance projection requestsequenceDiagram
participant Client
participant Handler as DashboardHandler
participant Routes as EvidenceProvenanceRoutes
participant Projector as project()
Client->>Handler: GET /projections/evidence
Handler->>Routes: _handle_evidence_provenance_surface(head_only)
Routes->>Projector: project(derived_model_conformance)
Projector-->>Routes: EvidenceProvenanceView
Routes->>Routes: as_json()
Routes-->>Client: JSON response
Flow diagram for schema-faithful provenance renderingflowchart LR
Declaration["Parsed conformance declaration"] --> Families["Declared families"]
Families --> Models["role: model members"]
Models --> Binding["EvidenceBinding"]
Binding --> Output["EvidenceProvenanceView JSON"]
Families --> Scenarios["scenario members"]
Scenarios --> Excluded["Excluded from provenance surface"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.
You can request another review in 3 days and 7 hours by commenting @sourcery-ai review. Upgrade to get a review now.
There was a problem hiding this comment.
🟡 Changes recommended
Narrow the seam test’s ModuleNotFoundError handling so unrelated failures cannot be skipped.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds an evidence-and-provenance projection for derived-model declarations, exposed through GET /projections/evidence.
Changes:
- Renders provenance bindings for model members while excluding scenarios.
- Adds route-extension integration and JSON/HEAD handling.
- Adds projection and seam-conformance tests.
File summaries
| File | Summary |
|---|---|
tests/test_evidence_provenance_surface.py |
Tests projection rendering, serialization, and input handling. |
tests/test_evidence_provenance_surface_seam.py |
Tests route registration and assembly; its broad ModuleNotFoundError skip handling should be narrowed. |
src/openxdox/evidence_provenance_surface.py |
Implements projection models, rendering logic, handler, and route extension. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
… ModuleNotFoundError Both _existing_gate_and_projection_extensions() (evidence-provenance seam) and _existing_contribution_extensions() (role-authority seam, § 4.5 slice 1, already on main) caught every ModuleNotFoundError when importing serve_gate/serve_projection and skipped, so an unrelated missing dependency or an import bug in those modules would silently skip the advertised six-binding (resp. five-binding) assembly while the suite stayed green. Narrow the catch to the one known, cited gap: skip only when exc.name is doc_health or starts with doc_health; any other ModuleNotFoundError now re-raises. refs opensoft/openXfactory#656 Lane: openxfactory-4-opendox-extraction Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
…ign § D4 machinery 5) (#12) § 4.5 slice 3 of split-opendox-two-layer-product, on Brett Heap's ruling ASK-3 "projection → evidence surface → workbench" (opensoft/openXfactory#656 comment 5628886636; CLAIM 5633537301): the MODEL/SCENARIO WORKBENCH at openXdox-code — design § D4 machinery (5), the "centre of gravity". Adds `src/openxdox/model_scenario_workbench.py` (+404): `project()` takes an already-parsed `xfactory_derived_model_conformance` document and renders one bench station per family — the model member and the optional scenario member, `scope` + `isolation_boundary`, the truth store joined to each member's `truth_store_access` binding, `output_status_field` beside `HYPOTHESIS_OUTPUT_STATUSES`, and the `promoting_authority` — rendering the declaration without re-deriving any conformance judgment (the schema's deep checks live only in `scripts/validate-derived-models.py`, "never copied" — honoured) and without re-rendering provenance (machinery (4)'s, slice 2). One `GET /projections/workbench` `RouteBinding` through the § 2.4 seam via `ModelScenarioWorkbenchExtension.routes()`, reading the same `derived_model_conformance` attribute slice 2 established; the seam suite proves structural conformance and assembly beside `RoleAuthorityProjectionExtension` + `EvidenceProvenanceSurfaceExtension` and beside the full column set (order-insensitive, zero `RouteBindingError`). New files only (+1082/−0): the module, a unit suite (23), a seam suite (12) — 35 tests (33 pass, 2 skip only on the cited `doc_health` gap, § 4.1, re-raising any other `ModuleNotFoundError`); required `test_leg_shape` + `test_dependency_direction` unchanged at 24 — no back-imports. Arrival phase B exit 0, every figure identical to main except created files 8 → 11 (all declared). `validate` run 34593278586 success; SonarCloud success; 1 Copilot thread (suites landed after the module's first commit) answered and resolved. **4.5 = 3 of 3 at openXdox-code; the openXdox-spec requirement row is owed before the tick.** Register: openXdox root `code` pin owes one bump past #10/#11/#12 (batched with slice 2b's openXdox-code landing). Refs opensoft/openXfactory#656. Lane: openxfactory-4-opendox-extraction Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
) Lane: openxfactory-4-opendox-extraction Refs opensoft/openXfactory#656 pyproject.toml pins opendox at openDox-code main a99eba03 (openDox-code #11, § 4.3: profile_openxfactory is a lazy proxy the host registers once at process start; build_parser() and build_server() refuse without a host), following the pin past 0f1f2e59 (2b). The back-import ratchet, measured through the pin, reads unchanged — 0 import-time / 19 deferred over the same five openDox modules — so the table needed no edit; CI's four-file validate invocation passed 122 at 5bbc062. Copilot's one thread (this leg's conftest registers only openxdox.domain_profile) was verified and answered: opendox.cli/serve are unreachable in this leg regardless (serve.py imports ideation_dashboard, absent here, identical at the old pin), the old pin had no proxy at all so those readers already raised, and the host registration is the openxFactory half's act, in flight. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… fails instead of skipping, and the ratchet note's range is corrected 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 <noreply@anthropic.com>
…d), and sweep the claims the old pin left true (#21) Lane: openxfactory-4 (openXfactory-4-openDox_extraction) Refs opensoft/openXfactory#656 (stays OPEN). CLAIM: 5699629088. pyproject.toml:106 pins `opendox` at openDox-code main 0b4e8bbf68fabfcd65d4f0d80e619c20a013e888 (#23, S 3.4 slice S8 leg B, LANDED note 5690615323), following the pin past a99eba03 (#11, S 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 #1054, that a pip install of the pinned openXdox code resolves an older opendox than the lockstep contract names. BOTH OF THIS ACT'S OPEN QUESTIONS ARE RULED. RULED openxFactory#656 comment 5700475319 (Brett Heap, 2026-09-16, by interactive multi-choice): (a) DROP tests/test_doxbench_mutation_boundary.py from validate.yml's list, with the measurement and both grounds in the workflow comment, returning with the BUILD arc beside test_doxbench_turns.py; and (a) KEEP the three skip guards and CORRECT their reasons, because they test the ASSEMBLED openDox and a consumer may pin behind the view contract. Both were already what this act does; the ruling is now cited at each of the four places the decision is stated, so it travels with the file rather than with this message. MEASURED in fresh venvs at each pin, under validate.yml's exact invocation (python 3.12.3 / pytest 8.4.2, direct_url.json asserted): a99eba03 301 passed, 23 skipped 0b4e8bbf, the bump alone 317 passed, 6 skipped 0b4e8bbf, the landed head 360 passed, 6 skipped (the third is the second plus the FORTY-THREE provenance-guard tests the review rounds asked for; no other count moved between them, and both figures are re-derived at every head rather than carried — the pass count 317 -> 323 -> 330 -> 332 -> 333 -> 334 -> 336 -> 343 -> 346 -> 348 -> 349 -> 351 -> 353 -> 355 -> 356 -> 357 -> 359 -> 360, one step per round that added tests, and the test count from `git diff main -- tests/test_gate_loop_probes.py tests/test_gate_loop_views.py | grep -c '^+def test_'`.) THE SKIP DELTA IS TWO HALVES, not seventeen cleared skips — Copilot's round-3 review caught that conflation. SIXTEEN became passes: the three S5 materialization assertions RUN and PASS (test_gate_loop_views.py 32/3 -> 35/0) and the thirteen node probes run (test_gate_loop_probes.py 0/13 -> 13/0). The SEVENTEENTH did not clear: it was test_doxbench_mutation_boundary.py's module-level skip, and that file leaves the list (below), so the skip is no longer RUN rather than cleared. The six that remain are the three seam suites' doc_health pairs, which no pin bump touches. THE REVIEW TOOK TWENTY-EIGHT ROUNDS AND CHANGED WHAT THIS ACT IS, which the description records round by round rather than presenting as one clean diff. The bump is one line; the sweep is prose in six files; everything after that is the guard behind those skips learning to tell the DECLARED pin from somebody else's, because after the bump a skip could hide a regression instead of reporting one. It fails closed for the declared commit and for unreadable provenance under CI, skips for a different commit and for an unreadable side off CI, and 43 tests hold it there — including the PEP 610 parser itself, which one round showed was the way to reach the silent green without going through the decision at all. The last round found the four-row table paraphrased in eight places, each paraphrase missing a row; the table now lives in one place and the rest point at it. The last round split the two FAILURES apart everywhere they had been run together — an equal-commit regression says the declared openDox is wrong, an unreadable side under CI says only that the run cannot tell which openDox it is testing — and drove declared_pin()'s own unreadable-file branch, the last part of the fail-closed rule that had never been produced by the function rather than supplied to it. The round after it retired the line "or None where the pin carries none" from both discovery functions and pointed validate.yml's 2026-09-10 preamble at the S8 un-narrowing block twenty lines below it, so the required check's scope is stated where a reader starts rather than only where the list is. The last round went one level out again, to the three CALL SITES: every test before it either called the guard or monkeypatched the function under it, so swapping any one call for a bare pytest.skip would have left every required test green. THE LAST NINE ROUNDS WERE ONE CLASS, the reading itself: each found the guard admitting or refusing one more real declaration shape — a 40-hex PREFIX of a longer ref, an `@` in an SSH authority, a FALSE environment marker, a name spelled `OpenDox` (PEP 503 says names are case-insensitive), a `;` in a url path, pip's direct-reference fragment — until the reading stopped guessing: tomllib parses the file, packaging.requirements parses the entry, and fullmatch reads the pin. The last two closed the SOURCE on both sides. A pin at another PROJECT is not a declaration this guard can interpret (the declared url), and a distribution built from another project is not provenance it may compare (direct_url.json's url, which installed_commit() had been dropping while comparing shas alone) — a fork or a mirror of openDox-code passing on both sides, RULED 5700475319, and a different project failing closed under CI rather than taking the different-commit skip. The last round closed the other recurring class rather than its latest instance: a count written in prose goes stale one round after it is written, so the two inventories that kept doing it now print the `grep -c` that derives them instead of carrying a number. It also drove the one path the call-site tests could not: the 29 module-scope `OPENDOX_WEB` importers call require() with no argument, where a skip must carry allow_module_level=True, and nothing had ever asserted that the default is forwarded. 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` -> gate_console.py:63 `from doc_health import corpus`, and collection ERRORS. It is dropped rather than repaired for the reason test_doxbench_turns.py is not named at all - naming it would put the required check red for split-opendox S 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. `git grep -n a99eba03 main` — the tree this act starts from — returns exactly one line, the pin itself at pyproject.toml:106; at the landed head the same grep returns 13 lines in 6 files and NONE in pyproject.toml, every one a provenance quotation this sweep added on purpose (the claim is about the dependency SPEC, not the string — Copilot's review of cb84001 was right that the unqualified sentence is false at the head it is read at). There is no lockfile, requirements or constraints file and no test asserting the pin string. Eleven sites in six files carried sentences stating what IS pinned and are corrected, each quoting its old wording as provenance: 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, which 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, and the 29 `# noqa: E402 (skips where the pin carries no bundle)` comments across 29 files. NONE of the seven files this PR touches is an arrived carve row - checked against openxFactory's manifest, where 92 rows carry destination openxdox_code and none of the seven is among them, while all 29 noqa files ARE - so no edit here is an undeclared edit. 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, 626 passed, 10 skipped, 128 errors (at 9ff630d; 586 plus the 40 provenance-guard tests present at that head; 43 at the landed one) No new failure anywhere in the tree; the one new error is the file named above. SONARCLOUD'S ONE NEW FINDING, ANSWERED BY MEASUREMENT (advisory check): a VULNERABILITY/MAJOR at .github/workflows/validate.yml line 40, "Omitting --only-binary :all: can lead to the execution of setup scripts". That line is `run: python -m pip install -e ".[test]"`, is BYTE-IDENTICAL to main, and lies in no changed hunk of this PR (the first is at +95). Sonar's new-code window for a pull request covers a FILE this PR edits, so a pre-existing line is re-reported; #15 passed because it never touched validate.yml. The rule is also unsatisfiable here: --only-binary :all: forbids source builds, and this step is an editable install plus a PEP 508 direct VCS reference, both source installs by definition. validate, this leg's only required check, is SUCCESS at this head. NOT DONE HERE, by name: no assembly or aggregation pin moves (that is pin lockstep #3, claimed with this act); no arrived carve row is touched; and README.md:40-43's "validate runs only the scaffold's shape assertions" is left as it stands - it went stale at slice S8, not at this pin, and is registered for a later declared act. GATE EVIDENCE, MEASURED AT THE LANDED HEAD 894781e: validate SUCCESS, run 35155979036, the job's own line `360 passed, 6 skipped`; the same invocation in a fresh venv reads the same. Copilot's review 5228891702 at that head — "Needs a closer look - the broad dependency, CI, provenance, and test changes warrant final human review" — with every finding of every round fixed or answered by measurement, and 15 review threads / 0 unresolved. SonarCloud is advisory here and its one issue is answered above. Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>



Lane: openxfactory-4-opendox-extraction (formerly openxfactory-opendox)
split-opendox-two-layer-product§ 4.5's second named BUILD feature: the evidence-and-provenance surface (design § D4 machinery (4)), on Brett Heap's ruling ASK-3 (opensoft/openXfactory#656 comment 5628886636 — "evidence surface first... the most direct 'render what's already specified' work"). Claimed at comment 5632730583, continuing this lane's own work immediately after slice 1 (the role-and-authority projection, #10, landed at4f98e77c) named this as ASK-3's next successor. This PR is not re-posting that claim.What this renders
governed-derived-model's Purpose section (opensoft/openxFactoryopenspec/specs/governed-derived-model/spec.md) states its invariants "structural rather than advisory"; the second is "every fact carrying provenance or a declared assumption" — the "Full provenance" requirement:Design § D4 machinery (4) names the gap this closes: "a chart citation, a ledger tie-out and an attribution chain are ONE machinery over different nouns;
governed-derived-modelinvariant 2 is the contract and nothing renders it."Where the data comes from
No new data model, no invented field names.
project()takes an already-parsedxfactory_derived_model_conformancedocument (the schema atcontracts/schemas/xfactory-derived-model-conformance.schema.yaml,opensoft/openxFactory) and renders, per declared family and perrole: modelmember, exactly the threeprovenancesub-fields the schema names:evidence_field,assumption_register_field,invented_facts_field, under whicheverformthe domain declared (assumption_registerorassumptions_forbidden).scenario-role members carry noprovenanceblock in the schema and are excluded. The two test fixtures transcribe the ratifiedmedx-governedandledgerx-calibratedexample declarations verbatim (examples/derived-models/*/declaration.example.yaml).This module computes no conformance verdict — the schema's own header comment states its deep template checks live in "the canonical validator (
scripts/validate-derived-models.py), never copied," soEvidenceBindingtranscribes declared fields as-is, includingform: nullwhere a model member declares noprovenanceblock at all.Seam
One
GET /projections/evidenceRouteBindingthroughroute_extension's § 2.4 seam, mirroring slice 1'sRoleAuthorityProjectionExtensionshape exactly. Seam-conformance tests prove structural conformance toRouteExtension, handler-name resolution viaresolve_handlers, and clean assembly beside the gate/projection/role-authority columns (6 bindings total, order-insensitive, no collision).Scope discipline
New files only — stays off
pyproject.toml,tests/test_dependency_direction.pyandgate_console.py(BUILD slice 2b's declared territory per this lane's own claim at comment 5629040695). The requiredvalidatesuite (test_leg_shape.py+test_dependency_direction.py,--noconftest) is unchanged at 24 passing.Tick judgment
split-opendox-two-layer-product§ 4.5 names three features. This PR is 2 of 3 (role-and-authority projection landed as #10; the model/scenario workbench, design § D4 machinery (5), remains). § 4.5 stays OPEN after this lands.Tests
tests/test_evidence_provenance_surface.py— unit tests overproject()/as_json()against both ratified fixture shapes plus absent/malformed-input handling (empty declaration, missingprovenanceblock, partially-declared form).tests/test_evidence_provenance_surface_seam.py— seam-conformance againstroute_extension, including assembly beside all three existing § 2.4 contribution columns.doc_healthreachability — the same documented § 4.1 gap slice 1's own seam tests skip on, not this slice's to fix).Refs opensoft/openXfactory#656
🤖 Generated with Claude Code
Summary by Sourcery
Add the evidence-and-provenance surface for rendering derived-model provenance declarations through the route-extension seam.
New Features:
Enhancements:
Tests: