Repository navigation
§ 4.5 slice 3: add the model/scenario workbench at openXdox-code (design § D4 machinery 5) - #12
Conversation
…nery 5) design § D4's extraction names machinery (5) in full — "a `model` member and an optional `scenario` member, a declared scope and isolation boundary, a truth store the model may never write, output confined to `hypothesis_proposed | no_signal | discarded`, and a named human promoting authority" — and calls it openXdox's centre of gravity, absent from all 80,000 lines. This renders exactly those five elements over an already-parsed `xfactory_derived_model_conformance` document and stops: no new data model, no invented field names, no conformance verdict (the schema's deep template checks live in `scripts/validate-derived-models.py`, "never copied"), and no second rendering of the `provenance` block that machinery (4)'s evidence surface already owns. One `GET /projections/workbench` RouteBinding through the § 2.4 seam, mirroring `RoleAuthorityProjectionExtension` (#10) and `EvidenceProvenanceSurfaceExtension` (#11) exactly. New file only. On Brett Heap's ruling ASK-3 (opensoft/openXfactory#656 comment 5628886636); claimed at comment 5633537301. Refs opensoft/openXfactory#656 Lane: openxfactory-4-opendox-extraction Co-Authored-By: Claude Fable 5.1 <[email protected]>
Reviewer's GuideThe PR adds the third § 4.5 feature: a read-only model/scenario workbench that projects the existing derived-model conformance declaration into typed bench stations and exposes it at GET /projections/workbench, while leaving validation and core composition wiring to their existing seams. Sequence diagram for the model/scenario workbench projectionsequenceDiagram
participant Client
participant Routes as ModelScenarioWorkbenchRoutes
participant Projector as project
participant Declaration as derived_model_conformance
Client->>Routes: GET /projections/workbench
Routes->>Declaration: getattr(self, derived_model_conformance, None)
Routes->>Projector: project(declaration)
Projector-->>Routes: WorkbenchView
Routes->>Routes: WorkbenchView.as_json()
Routes-->>Client: JSON response
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
23 tests over the PURE rendering logic and the HTTP door, against
declaration shapes transcribed verbatim from the two ratified fixtures
(examples/derived-models/{medx-governed,ledgerx-calibrated}/
declaration.example.yaml, opensoft/openxFactory). The two are not
interchangeable and both are exercised throughout: medx is governed /
scope: domain / gate-form truth-store protection / no isolation boundary,
ledgerx is calibrated / scope: subject / field-lock form / per_client — so
between them they cover every branch D4 machinery (5) names.
Also proves the deliberate omissions: the dials machinery (5) does not name
(identity, person_modeling, calibration_*) are absent from a station, a
member carries no provenance (machinery (4)'s, not re-rendered), a
model-only family renders an empty scenario tuple rather than a finding, a
role outside the schema's two-value enum lands in neither tuple, and an
illegible sub-shape renders as "nothing legible declared" instead of
raising — this module does not own the judgment that a declaration is
malformed.
New file only.
Refs opensoft/openXfactory#656
Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Fable 5.1 <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Required unit, seam, and HTTP route coverage is missing.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a read-only model/scenario workbench projection and exposes it at /projections/workbench.
Changes:
- Renders model/scenario members, scope, isolation, truth-store access, output statuses, and promoting authority.
- Adds the route extension for the workbench.
File summaries
| File | Summary | Findings |
|---|---|---|
src/openxdox/model_scenario_workbench.py |
Implements the workbench projection, handler mixin, and route extension. | Moderate: missing projection and seam tests (3 votes); missing HTTP handler and route-dispatch coverage (1 vote). |
Review details
Suppressed comments (1)
src/openxdox/model_scenario_workbench.py:403
- The new HTTP route is also untested: unlike the existing projection surfaces, there is no handler/fake-server coverage for JSON output and
head_only, nor a seam test for structural conformance, handler resolution, GET/HEAD matching, and assembly beside the other bindings. Please add those tests so this route cannot regress silently.
def routes(self) -> tuple[route_extension.RouteBinding, ...]:
return (
route_extension.RouteBinding("GET", WORKBENCH_ROUTE, False,
"_handle_model_scenario_workbench"),
- Files reviewed: 2/2 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.
12 tests proving the bench contributes its one GET through § 2.4's seam the way both landed slices do: structural conformance to route_extension.RouteExtension without inheriting from it, a handler name resolve_handlers accepts, exact-not-prefix dispatch through match() for both GET and HEAD, and clean assembly beside every existing contribution column. Two assemblies are asserted. The unconditional one is § 4.5's whole build content — role-authority + evidence + workbench, 3 bindings, 3 distinct exact routes — which none of the three could assert before this slice existed. The fuller one adds the gate and projection columns for 7 bindings, order-insensitive by SET of binding keys rather than by count alone, and skips ONLY on the cited doc_health ModuleNotFoundError those two columns still carry (§ 3.5/3.6 BUILD-arc work): any other ModuleNotFoundError re-raises, so a genuine breakage here cannot hide behind the skip. New file only. Refs opensoft/openXfactory#656 Lane: openxfactory-4-opendox-extraction Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
There was a problem hiding this comment.
🔵 Needs a closer look
Address malformed-input handling and correct the model-only fixture coverage.
Review details
Suppressed comments (3)
src/openxdox/model_scenario_workbench.py:360
project()is documented and tested as a non-validating renderer that should keep rendering malformed declarations, but this comprehension raisesTypeErrorfor a mapping such as{"families": 1}(and the same pattern can fail for scalarmembersoraction_authority). Guard or normalize non-iterable sequence fields before iterating so a bad declaration cannot take the workbench route down; add a scalar-malformed regression case.
_station(raw) for raw in (doc.get("families") or [])
tests/test_model_scenario_workbench.py:247
- This test name is grammatically broken and makes the assertion difficult to discover. Rename it to state clearly that dials outside this workbench are omitted.
def test_dials_this_machinery_does_not_name_are_not_rendered() -> None:
tests/test_model_scenario_workbench.py:272
- This test calls the fixture a valid model-only family, but it omits schema-required top-level fields,
dials.identity/truth_store_class/person_modeling, and the member's requiredtruth_store_access. It therefore only proves permissive partial-input rendering, not the claimed schema-valid optional-scenario case; make the fixture complete or relabel the test as malformed-input coverage.
declaration = {
"domain": {"id": "adx"},
"families": [
{
"id": "persona_campaign",
- Files reviewed: 3/3 changed files
- Comments generated: 0 new
- Review effort level: Lite
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 4 days and 14 hours by commenting @sourcery-ai review. Upgrade to get a review now.



Lane: openxfactory-4-opendox-extraction (formerly openxfactory-opendox)
split-opendox-two-layer-product§ 4.5's third and last named BUILD feature: the model/scenario workbench (design § D4 machinery (5)), on Brett Heap's ruling ASK-3 (opensoft/openXfactory#656 comment 5628886636), which fixed the order projection → evidence surface → workbench. Claimed at comment 5633537301, after a sibling search found no workbench branch, PR or claim anywhere. Slice 1 (role-and-authority projection, machinery (6)) landed as #104f98e77c; slice 2 (evidence-and-provenance surface, machinery (4)) landed as #11427230c3.What this renders
Design § D4's extraction of the seven machineries common to all three worked domain mappings names this one in full:
Five named elements; this renders exactly those five, one bench station per declared family:
role: modelmembers and its optionalrole: scenariomembers, in two separate tuples —governed-derived-model's "Conformance declaration" requirement makes the optionality a contract property ("Scenario members are optional; model members are not"), and a model-only family must not render identically to a model+scenario one;scope, with theisolation_boundarythe "Declared scope and cross-scope review" requirement pairs withscope: subject;truth_store+truth_store_classjoined to each member's owntruth_store_accessbinding. This join is the one neither sibling surface makes: § 4.5 slice 2: add the evidence-and-provenance surface (design § D4 machinery 4) #11's ownEvidenceFamilydocstring explicitly deferred "the family's other four dials (identity, scope, truth store, promoting authority)" to "a different surface's concern — the model/scenario workbench, design § D4 machinery (5)";output_status_fieldbesideHYPOTHESIS_OUTPUT_STATUSES, transcribed from the "Human-gated promotion" requirement ("A conforming scenario member SHALL express outputs only as hypotheses (hypothesis_proposed | no_signal | discarded)"), plus each member'saction_authoritybindings, which are how "Read-only truth store and zero action authority" makes an external act unrepresentable rather than merely disallowed;promoting_authoritydial, the only route by which "any hypothesis becomes action or truth".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) — exactly as #11's does and asrole_authority_projection.layers(domain_labels=...)established in #10. Both test fixtures transcribe the ratifiedmedx-governedandledgerx-calibratedexample declarations verbatim (examples/derived-models/*/declaration.example.yaml), so the bench is proved against the two shapes that already exist rather than against one invented for the test.No conformance verdict. The schema's own header comment states its deep template checks — including, verbatim, "scenario members' output status enum is exactly hypothesis_proposed|no_signal|discarded" and "access bindings resolve as single-value field locks or present gates" — live in "the canonical validator (
scripts/validate-derived-models.py), never copied." Those are precisely the two a workbench is most tempted to re-derive. It does not: it transcribes the declaration and renders the contract's enum beside it, never opening a template file. A renderednullis an honest "nothing declared yet".No second rendering of
provenance. That block is machinery (4)'s and stays withevidence_provenance_surface;identity/person_modeling/calibration_*are the dials D4 machinery (5) does not name.tieris carried as an identifying field only, the same role it plays inEvidenceFamily.Seam
One
GET /projections/workbenchRouteBindingthroughroute_extension's § 2.4 seam, mirroring both landed slices' shape exactly — a structurally-conformantModelScenarioWorkbenchExtensionimporting nothing from the core it contributes to, aModelScenarioWorkbenchRoutesmixin whose handler name resolves, and clean assembly beside the role-authority, evidence, gate and projection columns (7 bindings, order-insensitive, zeroRouteBindingError). The route is exact, sits under neither declared prefix (/actions/gate/,/source/), and is distinct from both sibling projection routes.The handler reads the same
self.derived_model_conformanceattribute #11's does — one document, one attribute for task 4.3's composition point to set — defaulting to an empty document while that box stays open.Scope discipline
New files only. Nothing under
pyproject.toml,gate_console.py,tests/test_leg_shape.pyortests/test_dependency_direction.pyis touched, and no back-import is added.Tick judgment
§ 4.5 names three features. This is 3 of 3 — with #10 and #11 landed, this PR is what makes § 4.5's build content complete. § 4.5 does not tick on this merge: the box also owes a requirement row in
openXdox-spec, which is not authored here. That row must state that openXdox renders, over a domain's declaredxfactory_derived_model_conformancedocument, a model/scenario workbench that shows each family's model member and optional scenario member against its declared scope and isolation boundary, the truth store the model may never write, thehypothesis_proposed | no_signal | discardedconfinement of scenario output, and the named human promoting authority — rendering the declaration without re-deriving any conformance judgment reserved to the canonical validator.Register note
The openXdox root
codepin owes one bump past #10, #11 and this — batched with slice 2b rather than taken per-PR.Tests
tests/test_model_scenario_workbench.py— 23 unit tests overproject()/as_json()and the handler mixin. Both ratified fixture shapes (they are not interchangeable:medx-governedis governed /scope: domain/ gate-form truth-store binding / no isolation boundary;ledgerx-calibratedis calibrated /scope: subject/ field-lock form /per_client, so between them they cover both arms of every either/or the schema describes), plus a model-only family, a role outside the schema's two-value enum, empty /None/ familyless / dials-less input, non-mapping sub-shapes, declaration-order preservation, and the deliberate omissions asserted as omissions.tests/test_model_scenario_workbench_seam.py— 12 seam-conformance tests, including the first assembly anywhere of all three § 4.5 features together (3 bindings, unconditional) and the full five-column assembly (7 bindings), order-insensitive by binding-key SET rather than by count.doc_healthModuleNotFoundErrorthe gate/projection columns still carry — the same documented § 4.1 gap both sibling slices skip on, and the guard re-raises any otherModuleNotFoundErrorso nothing in this slice can hide behind it.python -m pytest -q tests/test_leg_shape.py tests/test_dependency_direction.py --noconftest→ 24 passed, identical tomain. Whole-tree collection is identical tomaintoo (the same 57 pre-existing collection errors with or without these three files — thedoc_health/conftest chain, untouched here).Arrival
Phase B,
scripts/verify-carve-arrival.py --destination openxdox_code --phase B, with the two declared replicas this leg owes:The same command against
origin/main(427230c3), minus this slice's three--allow-createdpaths, reports 105 file(s) … (1 scaffold, 2 replica, 8 created), exit=0 — identical in every other figure. The three new files (src/openxdox/model_scenario_workbench.py,tests/test_model_scenario_workbench.py,tests/test_model_scenario_workbench_seam.py) are each named with--allow-created: new modules only, nothing inside any existing row's declared lines touched.Threads
One Copilot thread, raised against the first commit (module only, before the suites landed) and answered with the two suites at
f91d576/5c8e9a6— resolved.Refs opensoft/openXfactory#656
🤖 Generated with Claude Code