Skip to content

§ 4.5 slice 3: add the model/scenario workbench at openXdox-code (design § D4 machinery 5) - #12

Merged
brettheap merged 3 commits into
mainfrom
build/section-4-5-workbench
Sep 11, 2026
Merged

brettheap merged 3 commits into
mainfrom
build/section-4-5-workbench

Conversation

@brettheap

@brettheap brettheap commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

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 #10 4f98e77c; slice 2 (evidence-and-provenance surface, machinery (4)) landed as #11 427230c3.

What this renders

Design § D4's extraction of the seven machineries common to all three worked domain mappings names this one in full:

(5) The MODEL/SCENARIO WORKBENCH — 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. It exists nowhere in the 80,000 lines and it is openXdox's centre of gravity — which changes the character of the work from "carve" to "carve and build".

Five named elements; this renders exactly those five, one bench station per declared family:

  1. the family's role: model members and its optional role: scenario members, 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;
  2. the declared scope, with the isolation_boundary the "Declared scope and cross-scope review" requirement pairs with scope: subject;
  3. the truth store the model may never write — the family's truth_store + truth_store_class joined to each member's own truth_store_access binding. 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 own EvidenceFamily docstring 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)";
  4. the confinement of scenario output — the member's declared output_status_field beside HYPOTHESIS_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's action_authority bindings, which are how "Read-only truth store and zero action authority" makes an external act unrepresentable rather than merely disallowed;
  5. the named human promoting authority — the family's promoting_authority dial, 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-parsed xfactory_derived_model_conformance document — the schema at contracts/schemas/xfactory-derived-model-conformance.schema.yaml (opensoft/openxFactory) — exactly as #11's does and as role_authority_projection.layers(domain_labels=...) established in #10. Both test fixtures transcribe the ratified medx-governed and ledgerx-calibrated example 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 rendered null is an honest "nothing declared yet".

No second rendering of provenance. That block is machinery (4)'s and stays with evidence_provenance_surface; identity / person_modeling / calibration_* are the dials D4 machinery (5) does not name. tier is carried as an identifying field only, the same role it plays in EvidenceFamily.

Seam

One GET /projections/workbench RouteBinding through route_extension's § 2.4 seam, mirroring both landed slices' shape exactly — a structurally-conformant ModelScenarioWorkbenchExtension importing nothing from the core it contributes to, a ModelScenarioWorkbenchRoutes mixin whose handler name resolves, and clean assembly beside the role-authority, evidence, gate and projection columns (7 bindings, order-insensitive, zero RouteBindingError). 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_conformance attribute #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.py or tests/test_dependency_direction.py is 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 declared xfactory_derived_model_conformance document, 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, the hypothesis_proposed | no_signal | discarded confinement 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 code pin 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 over project()/as_json() and the handler mixin. Both ratified fixture shapes (they are not interchangeable: medx-governed is governed / scope: domain / gate-form truth-store binding / no isolation boundary; ledgerx-calibrated is 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.
  • 35 tests total: 33 pass unconditionally, 2 skip on the cited doc_health ModuleNotFoundError the gate/projection columns still carry — the same documented § 4.1 gap both sibling slices skip on, and the guard re-raises any other ModuleNotFoundError so nothing in this slice can hide behind it.
  • Required suite unaffected: python -m pytest -q tests/test_leg_shape.py tests/test_dependency_direction.py --noconftest → 24 passed, identical to main. Whole-tree collection is identical to main too (the same 57 pre-existing collection errors with or without these three files — the doc_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:

OK …/xdox: openxdox_code (opensoft/openXdox-code) at opensoft/openxFactory@b075fd91dc8f
(opendox-carve-0), phase B — 92 row(s) arrived, 9 digest(s) verified, 81 declared-edit
row(s) within their lines, 4 unapplied; 2 of 2 declared replica(s) verified; 108 file(s)
under scripts, src/openxdox, tests with none undeclared (1 scaffold, 2 replica, 11
created); scaffold admissions checked against 427230c340cd
exit=0

The same command against origin/main (427230c3), minus this slice's three --allow-created paths, 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

…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]>
Copilot AI lite review requested due to automatic review settings September 11, 2026 11:13
@sourcery-ai

sourcery-ai Bot commented Sep 11, 2026

Copy link
Copy Markdown

Reviewer's Guide

The 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 projection

sequenceDiagram
    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
Loading

File-Level Changes

Change Details Files
Add a pure model/scenario workbench projection model that renders the declared conformance document without performing validation.
  • Represent model and optional scenario members as separate tuples with their access, output, and authority bindings.
  • Render family scope, isolation boundary, truth-store declarations, tier, and promoting authority.
  • Expose the contract-level hypothesis output status enum while preserving absent or malformed declaration values without inventing conformance verdicts.
src/openxdox/model_scenario_workbench.py
Add the workbench HTTP route as an isolated route-extension contribution.
  • Provide GET /projections/workbench through a structurally conformant extension and route mixin.
  • Read the shared derived-model-conformance handler attribute, default to an empty document, serialize the projected view as JSON, and serve it through the existing wire helpers.
src/openxdox/model_scenario_workbench.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

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]>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

Copilot AI review requested due to automatic review settings September 11, 2026 11:16
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]>
@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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 raises TypeError for a mapping such as {"families": 1} (and the same pattern can fail for scalar members or action_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 required truth_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

@brettheap
brettheap marked this pull request as ready for review September 11, 2026 11:21

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@brettheap
brettheap merged commit 5333b12 into main Sep 11, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants