Skip to content

§ 3.4 S6: /source becomes openDox's own fixed core arm (RULED Q4) - #16

Merged
brettheap merged 15 commits into
mainfrom
build/s6-source-core-arm
Sep 12, 2026
Merged

brettheap merged 15 commits into
mainfrom
build/s6-source-core-arm

Conversation

@brettheap

@brettheap brettheap commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Lane: openxfactory-4-opendox-extraction

§ 3.4 slice S6, the openDox half. Refs opensoft/openXfactory#656.

STACKED ON #14 (slice S3, build/s3-view-registry, unlanded) — this
branch is cut from it and merges it again at e176947. The diff below reads
against that base, not against main.

PARALLEL SLICE WARNING: S4 also edits
tests/fixtures/web_boundary_census.yaml and tests/test_web_boundary.py.
This PR's edits there are confined to the /source family — the two census
note fields for views/viewer.js / views/wheel.js, and assertion 2's
owner pattern plus its reason — so the later merge is small.

The ruling

RULED Q4 — Brett Heap, 2026-09-12, opensoft/openXfactory#656 comment
5642758731:

/source/ is openDox's, and openXdox's projection binding keeps only
/snapshot-index.json and the three /projections/* routes.

Under RULING OQ-2 a student runs openDox alone, so views/viewer.js — class A,
the read-only Markdown viewer — could not render a document without the consumer
layer serving the route. The boundary note (openDox-spec
docs/front-end-package-boundary.md @ 61866d29) measured that as the census's
ONE § 2.2 rule 1 breach, and § 5 row S6 is the slice that discharges it by
moving the route, not the file
.

serve.py declares the route

declared what it is
SOURCE_PREFIX = "/source/", BARE_SOURCE_ROUTE = "/source" the pre-carve strings, unchanged
_keyed_source, _serve_source, _refuse_bare_source moved from openxdox/serve_projection.py:295-361, byte for byte
resolve_source_path a real def here now — the single-root containment entry point notebook_action.py:52 has always imported from .serve
two arms in _route exact /source above prefix /source/, both above the § 2.4 contributed consult

The order is the one the bindings had, and it is load-bearing.
collect_bindings grouped every EXACT binding ahead of every PREFIX one, so
/source answered send_error(404, "no source path") and /source/ (empty
tail) answered 404 with divergence headers and a zero-length body. A fixed arm
has to be written in that order; the other way round the bare route is
unreachable and its answer silently becomes an HTML error page. Placing both
arms above route_extension.match is what makes them FIXED rather than
shadowable — a contributed /source/ binding can no longer take the route back
by arriving first.

What did not move

  • snapshot_registry.resolve_within — the containment RULE, still the
    projection column's, still applied per registry entry, reached through the
    late consumer_reach seam serve_workbench.py already uses at five sites.
    resolve_source_path stays a one-line delegation to it: a second copy of the
    rule here would be the fork route_extension.py:89 names, and it is also what
    would silently drop the dot-directory refusals (T092 defect 10), which are
    resolve_within's and are inherited only by calling it.
  • FR-048 — hosted_ref_refused keeps its late stand-in and
    _hosted_entry_refused stays on LateProjectionRoutes (_serve_snapshot
    calls it too). The route moved; the hosted-plane rule did not.

consumer_reach.LateProjectionRoutes therefore drops three of its eight
forwarders and keeps five, and the resolve_source_path stand-in goes
altogether — one fewer wrong-direction reach, removed at the site rather
than renamed at the census.

Census — assertion 2 re-derived

Assertion 2's owner table drops /source and /source/ from openXdox's
projection pattern, because a class-A or class-C file addressing them is no
longer naming another column's route. 20 sites → 16, and the four that clear
do so without an edit to any of the four files that carry them:

cleared file:line
/source/ app.js:195, app.js:196, views/viewer.js:314, views/wheel.js:97

Measured residue on this branch, stated precisely:

count sites closed by
12 lens-model.js:1036/1037 · repo-selector.js:33/39/43/46 · staging-workbench-model.js:543/817/818/821/822/826 S4 (the SPLIT files)
2 app.js:586/598 — S3's gate.bar CORE_VIEWS entry and its routes: ["/actions/gate/ratify"] S5
2 lens.js:41/45 a future ruling — assertion 2's own standing declared exception (§ 4.5 point 2): none of Q1–Q5 rules on lens.js's two openxFactory-lane routes

xfail(strict=True) stays. § 5's row for S6 promises assertion 2 green for
views/viewer.js
, which it is — not the assertion green outright, which is
S5's row and, on this tree's own measurement, not even S5's while lens.js
stands. strict=True is what keeps that honest: the moment the residue reaches
zero this goes XPASS and red until the marker comes off.

Census rows: views/viewer.js is now a clean class A (its note records the
discharge; its CLASS never changed), and views/wheel.js's note says
SOURCE_ROUTE:97 is clean for the same reason.

Tests

tests/test_source_core_arm.py — CREATED, and on validate's explicit
list.
25 assertions: the route is declared here (not forwarded), the column no
longer carries it (asserted as an ABSENCE on the live seam), exact-before-prefix
dispatch, unshadowability, one containment authority and no re-implementation,
the two content types, the three distinct refusals each on its own text,
read-only posture, FR-048 still asked, and the four bundle literals still
standing unedited. No xfail — nothing it measures is a defect awaiting a
later slice.

It is a SHAPE assertion, deliberately: opendox.serve cannot be imported at
either leg (from ideation_dashboard import serve_openxfactory_lanes, a
stays_openxfactory_adapter row present at neither destination — exactly what
tests/test_consumer_reach.py's STILL_REACHING records), so the suites that
drive a whole server over a socket cannot run until S8 lifts § 1.2(d). A slice
that moved a route and left its only proof in the non-running half would be a
slice whose claim rests on a commit message.

tests/test_source_dot_directories.py did NOT arrive, and 7dd0ba5 is
why.
The first commit received it from openXdox-code with the route. That
file has a carve-manifest row with destination: openxdox_code
(docs/opendox-carve-manifest.yaml:3439-3450), so the move is a
RE-DESTINATION of the row, not a declared edit to an arrived file, and
Q-L1's annotation form cannot express it — verify-carve-arrival.py would
refuse here for a file no row places and at openXdox for a missing arrival.
"Fix the DESTINATION, never the manifest." It is back at openXdox-code
(657c821 there), with thirteen more /source functions across five other
carved suites; all six files are uncollectable at either leg, all six already
read opendox.serve, and S8 re-homes them with the manifest re-destination
act
that pass will need and no slice has yet been given. Recorded as a
REGISTER item rather than worked round.

Nothing is lost by that: every refusal those suites measure belongs to
snapshot_registry.resolve_within, which S6 did not move, and
test_the_containment_rule_is_the_one_authority_and_is_not_re_implemented
above is the assertion that the arm inherits all of them by calling that one
authority and nothing else.

tests/test_consumer_reach.py follows the seam: the LATE_COLUMN check now
asserts the three departed names are ABSENT as well as which five remain (a
forwarder left behind would be invisible — the route would keep working wherever
openXdox happens to be installed), and CONVERTED_SITES["serve.py"] drops
resolve_source_path because it stopped being a stand-in.

validate

Green locally on the narrowed command, with the new file added in the same
commit: 174 passed, 3 xfailed.

Pairs with

  • § 3.4 S6: the /source pair leaves the projection column (RULED Q4) openXdox-code#17 — the projection column's half.
  • An openxFactory carve-manifest row annotation (Q-L1, the ASK-7 pattern):
    serve.py is an ARRIVED file (opendox_code, already
    moved_with_declared_edit from the ASK-7 window), so these edits are declared
    lines on its row; tests/test_source_core_arm.py is a CREATED file needing one created:
    admission in docs/opendox-carve-admissions.yaml (RULED OQ-C / #656
    comment 5639058687).

🤖 Generated with Claude Code

Summary by Sourcery

Move the read-only /source pass-through into openDox's fixed core routing and verify that its ownership and safety boundaries remain intact.

New Features:

  • Make the read-only /source and /source/ endpoints fixed core routes owned by openDox, including their existing keyed and unkeyed serving behavior.

Bug Fixes:

  • Prevent contributed projection bindings from shadowing the /source routes and preserve exact-before-prefix dispatch and existing refusal responses.
  • Resolve source-path containment through the single registry authority while retaining hosted-plane safety checks.

Enhancements:

  • Remove /source handlers and the source-path stand-in from the late projection seam while retaining projection-owned snapshot and hosted-entry rules.
  • Update web-boundary ownership accounting so source-route references are no longer reported as cross-column violations.

CI:

  • Add the new source-core shape suite to the explicit validation workflow.

Tests:

  • Add structural coverage for route ownership, dispatch order, unshadowability, containment delegation, refusal responses, content types, read-only behavior, hosted restrictions, and unchanged front-end route literals.
  • Update consumer-reach tests to verify the source handlers are absent from the projection column.

brettheap and others added 13 commits September 11, 2026 23:01
… halves of one seam

openDox-spec `docs/front-end-package-boundary.md` § 4.1 asks for the front-end
analogue of `route_extension.collect_bindings`, and this is it — the AUTHORITY
in Python, its MIRROR in the language the shell is written in, and one
vocabulary held across both.

THE PROBLEM, in the note's own measurement: `src/opendox/web/` is "42 blobs,
30,585 lines, and NO package boundary at all", while the Python side has
answered the same question three times — a contributed ROUTE
(`route_extension`), a late REACH into the consumer (`consumer_reach`), and a
registered PROFILE (`domain_profile` + `profile_proxy`). § 4.1's instruction is
to reuse those shapes rather than invent a fourth, so:

    route_extension.RouteBinding      ->  ViewBinding
    route_extension.collect_bindings  ->  collect_view_bindings
    consumer_reach.route_column       ->  resolveView / requireView
    profile_proxy.profile_openxfactory -> host_view_extensions

`src/opendox/view_extension.py` is the authority. `ViewBinding` is frozen and
validated where it is CONSTRUCTED, `RouteBinding.__post_init__`'s discipline;
`ViewExtension` is a `runtime_checkable` Protocol and NOT an ABC, for
`RouteExtension`'s reason — an extension authored in the repository that PINS
this one must conform WITHOUT inheriting from anything here, since nominal
conformance would make the seam the dependency it was drawn to remove.
`collect_view_bindings()` flattens contributed bindings into ONE mount order and
refuses four things: a non-conforming extension, a `views()` that yields
anything else, two bindings claiming one (region, id) slot, and a non-class-B
binding declaring a route another column contributed.

THE FOURTH REFUSAL IS RULED Q3 MADE EXECUTABLE (#656 comment 5642758731): "a
route constant travels with the binding that calls it, never with the model that
declares it". It is derived from the assembly rather than asserted about it — the
caller passes the `RouteBinding`s another column actually CONTRIBUTED, because a
literal ownership table here would be a second copy of the routing that drifts
the moment a column adds a route. Class B is exempt BY CONSTRUCTION: a gate-loop
binding naming a gate route is the boundary working (§ 4.5 assertion 2).

ORDER IS DECLARATION ORDER, FLAT, and the difference from `collect_bindings` is
argued rather than inherited: that function re-orders exact before prefix
because an HTTP dispatcher consults its table until something matches. Nothing
here is consulted that way — a panel mounts into the ONE region it names, and
two panels in one region are a refused collision rather than a race — so
re-ordering would only take away the one thing declaration order is good for.

THE HOST FACET, AND TWO ABSENCES WITH TWO ANSWERS. `host_view_extensions()`
reads `VIEW_EXTENSIONS` off the ONE registered profile through the SAME lazy
proxy `build_server()` reads `ROUTE_EXTENSIONS` through (RULED ASK-2 option (2)).
NO HOST AT ALL REFUSES: `ProfileNotRegistered` is a `RuntimeError` and passes
through untouched, which is ASK-2's "refusal, not a default". A HOST WITHOUT THE
FACET gets an EMPTY CONSUMER COLUMN: `ProfileFacetMissing` subclasses
`AttributeError` precisely so `getattr(..., default)` answers, and the empty
answer is correct where an empty `ROUTE_EXTENSIONS` would be a defect — a server
missing its contributed ROUTES looks fine until a path 404s, whereas a shell
with no contributed PANELS is the shell this leg ships today. Refusing there
would impose a flag day on every host that has not yet grown the facet, which is
every host, today. AND THE ABSENCE IS NAMED, NEVER SILENT: `view_manifest()`
carries `host_facet` = "declared" | "absent" with the facet and profile names,
which is § 4.3 point 5's "renders its region empty WITH A NAMED REASON" applied
to a facet.

`src/opendox/web/views/view_extension.js` is the mirror, named by the note's own
S3 row (every other module in that folder is kebab-case; this one is spelled
like the two Python files it mirrors, because three files and one seam should
have one spelling). It reads the manifest back out of `/capabilities` and
applies the SAME four refusals to it, so both halves check the same thing
against the same facts. `lookupView` is the OPTIONAL reach (null, and the caller
decides what absence means); `requireView` is the REQUIRED one (a refusal that
names the layering, `consumer_reach`'s posture); `resolveView` loads the
binding's module at first use and refuses a binding whose named export is
missing, because a binding that cannot be mounted must not look registered.
A malformed manifest REFUSES while an absent one is an empty column: failing
closed is the only safe answer for a payload that decides which code the shell
imports, and § 4.4's vendor policy is why the module specifier is held to a
bundle-relative './…js' — a contributed binding is exactly the hole "no CDN, no
remote script" would otherwise leak through.

BOTH FILES ARE CREATED, NOT ARRIVED: neither has a row in openxFactory's
`docs/opendox-carve-manifest.yaml`, which is what Q-L1 means by "new files are
created, not arrived". The census row in `tests/test_consumer_reach.py` lands in
this same commit because it is a claim about this module — `opendox.view_extension`
imports NOTHING from `openxdox` and reads the host's facet through the proxy, so
it belongs in `NEUTRAL_MODULES` and not in `STILL_REACHING`, and the lawful
direction is that the column CONTRIBUTING a view imports this module rather than
the other way round.

Lane: openxfactory-4-opendox-extraction
Refs opensoft/openXfactory#656

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
… a registry lookup

§ 4.1 names this edit by line number: "app.js stops importing class-B modules
directly. Its line 43 becomes a lookup in the collected bindings, and a shell
built with no gate binding registered renders the tab strip WITHOUT the gate bar
rather than failing to load." That is what this commit does, and nothing else.

THE HARDCODED `TABS` TABLE BECOMES THE CORE ARM OF THE REGISTRY. `CORE_VIEWS`
holds the same seven views as `ViewBinding`s and is collected through
`collectViewBindings()` alongside whatever the consumer column contributed —
the same order and the same SINGLE collection `serve.build_server()` uses for
routes, and for the same reason: a collision between a contributed panel and one
of the shell's own must be refused before anything mounts, rather than
discovered as a panel that silently never rendered. A core binding declares its
`module` and `entry` truthfully even though it also carries a `mount` closure,
because a CONTRIBUTED binding carries only those two and is loaded through
`resolveView()` — the core arm always holds its own view modules statically,
since they are the product.

THE TAB STRIP IS DERIVED FROM THE REGISTRY, not declared beside it. A tab is
simply a binding that declared a `control`; a binding with no control — the gate
bar, and every overlay binding after it — is in the collected order and is not a
tab, which is why the filter is one expression in `initTabs` and not a second
list to keep in step.

THE GATE BAR IS A BINDING NOW: class B, `optional: true`, declaring
`/actions/gate/ratify` as RULED Q3's "a route constant travels with the binding
that calls it". Three things are true that were not true before. A shell
assembled without it renders the viewer with NO GATE BAR instead of failing to
load — `views/viewer.js` already tolerates a null `mountGate`
(`const mountGate = o.mountGate || null`), so the absence was always
representable downstream and was simply unreachable from here, and no second
file is touched. `gate.js`:120's route says in one checkable place whose it is.
And the entry sits in the CORE arm TRANSITIONALLY: slice S5 moves the four
class-B files behind a binding openXdox supplies, at which point this entry is
deleted and the identical binding arrives through `contributedViewBindings()`
with nothing else in this file changing — which is the test of whether the seam
was drawn in the right place.

`routes` IS DELIBERATELY UNDECLARED ON EVERY CORE TAB BINDING and that is not an
omission. Q3 makes `routes` a declaration of OWNERSHIP, not a transitive
inventory of every path a module's import graph happens to touch. Exactly one
core binding owns a route that way today: `gate.bar`. The census's eighteen
remaining route-ownership breaches are FILE-level facts (§ 4.5 assertion 2),
measured by slice S1's `tests/test_web_boundary.py` and cleared by S4 and S6;
declaring them here would encode S4's answers before S4 has done its work, and
would refuse this very assembly, since `/source/` is a contributed prefix today.

THE COLLECTED REGISTRY IS HANDED TO EVERY VIEW as the context key `views`, so an
OPTIONAL contributed panel is asked for by id — `lookupView(ctx.views, "…")`,
null when the column that supplies it is not installed. Slice S2's intent chips
are the first such reader: `wheel-intent` and `dispose-intent` are declared
regions already, so S2 adds an optional binding and two `lookupView` calls and
touches nothing here.

The consumer column is read out of the `/capabilities` payload this render
already fetched (§ 4.3's "no new route and no second fetch"). It is EMPTY at
this slice and on every static image, so the shell renders exactly as it did
before — the note's S3 row in its own words: "nothing is contributed yet, so the
shell renders exactly as today with an empty extension tuple". The server-side
line that publishes a manifest (`capabilities["views"] = view_manifest(...)`) is
slice S5's, inside `serve.py`'s own declared-edit window, which the in-flight
ASK-7 act owns this hour.

`index.html` IS NOT TOUCHED. A `data-region` attribute would be a second
spelling of an id the shell already carries, and an added attribute is in none
of the RULED `edit_classes` (`import rewrites | path constants | adapter calls`),
so declaring it would mean inventing an edit class rather than using one. The id
is the declaration; the registry's `REGIONS` table plus a drift test against the
shell's existing ids is what makes it a contract.

Q-L1: `src/opendox/web/app.js` is an ARRIVED file. Its 37 edited lines are
declared on its row of openxFactory's `docs/opendox-carve-manifest.yaml` by
openxFactory PR #1001, which lands FIRST — one `import rewrites` line (43) and
36 `adapter calls` lines. `verify-carve-arrival.py`'s `_check_declared_lines`
over all 123 `opendox_code` rows against this branch: app.js DECLARED, 60
verbatim rows byte-identical, 0 refusals.

Lane: openxfactory-4-opendox-extraction
Refs opensoft/openXfactory#656

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ommit

50 assertions over the seam, and the file is added to `validate`'s explicit
`--noconftest` list in THIS commit rather than a later one — the discipline
§ 4.5 states for slice S1 ("added to that list in the SAME commit") and the one
its three neighbours already keep: `test_leg_shape.py`, `test_consumer_reach.py`
and `test_profile_registration.py` each arrived that way. A test that is not in
the list is not run, and a seam nobody runs is a description.

WHAT IS ASSERTED, in six groups.

1. A malformed binding refuses WHERE IT IS DECLARED and the message says why —
   parametrized over every field: the id grammar, an undeclared region, a module
   specifier that is root-relative / absolute / climbs out of the bundle with
   `..`, an entry that is a callable rather than the NAME of an export, an
   unknown class, non-tuple routes, a route not rooted at '/'.
2. Collection: a non-conforming extension names the member it lacks; two
   bindings in one (region, id) slot refuse and the message names BOTH modules;
   one id in two different regions is NOT a collision; the core arm comes
   through an EMPTY consumer column unchanged; and collecting nothing at all is
   an empty tuple rather than a refusal, which is this slice's own case and
   every static image's.
3. RULED Q3, executable: a class-A binding declaring a gate route another column
   contributed is REFUSED, and the refusal quotes the rule. Class C and the
   transitional `?` are in scope too (§ 4.5 assertion 2's "class A, class C AND
   the transitional `?`, which is where most of the breaches actually sit"); a
   class-B binding declaring the SAME route is allowed, because a gate-loop
   binding naming a gate route is the boundary working. With no contributed
   routes nothing can breach — there is nothing to breach.
4. The host facet through the ONE registered profile: the facet comes off it; a
   host WITHOUT the facet contributes an empty column; NO host at all REFUSES
   rather than answering empty (ASK-2's "refusal, not a default"); and importing
   the registry resolves no profile at all, which is the whole value of the lazy
   proxy. The manifest declares its `schema_version` and `kind` and NAMES the
   absence rather than being silent about it.
5. Drift, so the two halves cannot diverge: both declare the same regions in the
   same order and the same classes; every "dom" region is an element
   `index.html` actually carries (the id IS the declaration — this is what makes
   the unedited shell a contract rather than an assumption); no "shell" region
   pretends to have one; every core tab binding names a dom region, or it would
   be a blank tab; `app.js` no longer imports the gate module, declares the gate
   bar as an OPTIONAL class-B binding, and wires the doc list through the
   registry.
6. The JavaScript half driven by the REAL file under `node`, skipped and never
   failed where node is absent: the core arm collects with an empty consumer
   column; a slot collision and a contributed gate route both refuse; a
   malformed `/capabilities` manifest refuses while an absent one is an empty
   column; ONE VIEW WIRED END TO END — `resolveView` loads the real
   `views/docs.js` from its binding and hands back the `renderDocs` export; a
   contributed panel mounts into its region under a minimal DOM; an absent
   OPTIONAL binding is null and an absent REQUIRED one refuses; and a "shell"
   region asked for a standing element refuses rather than returning a null the
   caller would read as "the column is not installed".

One of the drift assertions is a REAL DEFECT kept as a test rather than a
memory: the client's slot key joins a binding's region and id with a separator
neither can contain, and that separator was first written as a LITERAL NUL BYTE
in the source instead of as the six-character escape sequence a JavaScript
string literal spells it with. Everything parsed and every
other assertion passed — but `git`, `grep`, `file(1)` and every diff viewer
classify a file containing a NUL as BINARY, so the module would have reached
review as an unreadable blob. A separator that cannot occur in a region or an id
is right; spelling it as a raw byte is not. The check reads BYTES, because
reading the file as text is exactly what hides it.

Lane: openxfactory-4-opendox-extraction
Refs opensoft/openXfactory#656

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…at could inject a tab, an entry that could not be called

Copilot's review of PR #14, all three accepted and each kept as a test.

1. A DECLARATION DEFECT MUST NOT DEPEND ON THE TYPE OF WHAT IT REFUSES.
   `REGIONS` is a dict, so `<unhashable> not in REGIONS` raised `TypeError` out
   of the hash BEFORE `ViewBinding.__post_init__` could raise the
   `ViewBindingError` this module promises for every declaration defect — a
   caller written to catch the one refusal class would have met an exception it
   never agreed to handle. The type is now checked before the membership, on
   `region` and on `view_class` both; the second cannot raise today (a tuple
   membership test does not hash) and is guarded anyway, because relying on
   `VIEW_CLASSES` staying a tuple is exactly the quiet dependency this work
   exists to end.

2. A CONTRIBUTED ENTRY MAY NOT CARRY THE CORE ARM'S OWN TWO FIELDS.
   `contributedViewBindings` passed manifest entries straight to `viewBinding`,
   which accepts and preserves `mount` and `control`. `control` is what makes a
   binding a TAB, and a contributed entry arrives as JSON and cannot carry the
   `mount` FUNCTION the tab router calls — so a manifest declaring a `control`
   would have put an entry in the tab strip whose `mount` is `undefined`: the
   tab renders, and the click that selects it throws. Refused where the payload
   is READ rather than ignored, because ignoring it is a crash with a delay on
   it, and `view_manifest()` emits neither field, so no honest payload is
   refused by this. Malformed REFUSES while absent is an empty column — the
   rule that already governs the rest of the manifest.

3. PRESENT IS NOT MOUNTABLE. `resolveView` checked only that the entry NAME
   existed on the module's namespace, so a module exporting it as a string, an
   object or a `null` handed back a binding that looked resolved and threw a raw
   `TypeError` from inside whatever tried to mount it — the "dangling import a
   thousand lines from the call" this seam exists to replace. The entry must now
   be a function, and the refusal distinguishes "not exported" from "exported as
   something that cannot be called", because those are different defects in the
   contributing column.

Five new assertions, in the groups they belong to: an unhashable `region` (as a
list and as a dict) and an unhashable `view_class` refuse as `ViewBindingError`;
a contributed entry carrying `control` or `mount` refuses while the same entry
without them is collected; and an entry exported as a non-function refuses at
resolution. `tests/test_view_registry.py` is 55 assertions; `validate`'s four
files are 127.

Lane: openxfactory-4-opendox-extraction
Refs opensoft/openXfactory#656

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…uter's field names

`tests/test_bullseye_widget.py` asserts `app.js`'s shape by QUOTING ITS LINES
BACK, so the view registry's `view` -> `region` rename invalidates three of its
quotations the moment it lands. They are migrated in the SAME act that
invalidated them, which is the only time anyone can be sure the migration is a
rename and not a behaviour change:

  :900   classList.toggle("lensfull", target.view === "view-lens")
  :1781  storeTab(target.view);
  :1785  const remembered = TABS.find((t) => t.view === storedTab());

`.view` -> `.region` in all three, and nothing else on any line. The assertions'
MEANING is unchanged: the lens still takes the whole page, the tab is still
remembered on every activation, and it is still restored only to a view this
plane actually has. The tab router simply calls the field `region` now, because
a binding's mount point is what that string always was.

THE SUITE IS RED TODAY FOR AN UNRELATED REASON — it imports through
`src/opendox/serve.py`, which still reaches `ideation_dashboard`, a module the
§ 3 carve removed — and it is not in `validate`'s narrowed list. Neither fact
makes a stale assertion acceptable: slice S8 re-homes these 48 test files and
un-narrows `validate`, and an assertion describing a shape that no longer exists
is precisely the rot that slice would then have to discover and date. Copilot
found two of the three on PR #14; a sweep of every assertion in the leg that
quotes `app.js` found the third, and found no others anywhere in the suite.

Q-L1: `tests/test_bullseye_widget.py` is an ARRIVED file, already
`moved_with_declared_edit` for its `path constants` line 40. The three lines are
declared as `adapter calls` on the same row by openxFactory PR #1001 — the same
act that declares `app.js`'s 37 — and each is a single-line REPLACE at the carve
numbering, so exactly three lines are declared and no neighbour is.
`verify-carve-arrival.py`'s `_check_declared_lines` over all 123 `opendox_code`
rows: both rows DECLARED, 60 verbatim rows byte-identical, 0 refusals.

Lane: openxfactory-4-opendox-extraction
Refs opensoft/openXfactory#656

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
S1 landed tests/test_web_boundary.py, tests/fixtures/web_boundary_census.yaml
and an explicit-test-list addition to .github/workflows/validate.yml on main
while this leg was in flight. The only textual conflict is validate.yml's
pytest invocation; resolved as the UNION of both slices' comment blocks and
both new test files (tests/test_web_boundary.py then tests/test_view_registry.py),
in landing order S1 then S3. S1's census fixture and test module arrive
unmodified from main in this commit; the semantic follow-up they need (a
census row for S3's new file) is the next commit, not this one.

Lane: openxfactory-4-opendox-extraction
Refs opensoft/openXfactory#656
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
S1's census could carry no row for views/view_extension.js because the note
measured the tree before S3's file existed; the merge alone left
test_every_web_file_is_classified_exactly_once failing. Classified A: no
import (so it cannot trip assertion 3), no governance literal (out of
assertion 4's class-C/tail scope regardless), and its one route-shaped
string -- 'gate.bar' in a doc comment -- is an id, not a /actions/... path,
so assertion 2's patterns do not match it. app.js's own row `loc` moves
1155 -> 1282 with the registry wiring; the header totals move with both
rows (43 files, 31,134 lines).

Assertions 2 and 3's xfail `reason=` strings are corrected to the counts
this tree actually measures post-merge, on the module's own stated
"fidelity over tidiness" convention rather than left to cite a shape that
no longer exists:
  * assertion 3 (relative import / class boundary): 7 sites -> 6. S3 closes
    app.js:43 -> views/gate.js, the shell's one direct class-B import and
    exactly the edge slice S3 exists to close. The other 4 class-boundary
    sites and the 2 unresolved intent-feed sites are untouched, so the
    assertion stays red and the marker stays valid.
  * assertion 2 (route ownership): 18 sites -> 20. S3's CORE_VIEWS
    `gate.bar` entry declares `routes: ["/actions/gate/ratify"]` (RULED Q3:
    a route constant travels with the binding that calls it) -- a real
    breach by this assertion's own rule while that entry sits in app.js
    (class A) rather than views/gate.js (class B, exempt by construction).
    Transitional by the same design the CORE arm itself is: slice S5
    deletes this entry from app.js when the binding moves behind a
    host-supplied contribution. app.js's other two projection-route sites
    shift line number (183/184 -> 195/196) with the file's growth; same two
    `/source/` literals, untouched otherwise.

Neither assertion XPASSes -- both stay xfail(strict=True), which is the
thing this commit exists to keep true. Full leg validate invocation
(tests/test_leg_shape.py, tests/test_consumer_reach.py,
tests/test_profile_registration.py, tests/test_web_boundary.py,
tests/test_view_registry.py --noconftest): 129 passed, 3 xfailed, 0 failed.

Lane: openxfactory-4-opendox-extraction
Refs opensoft/openXfactory#656
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
view_extension.js
  * manifestRoutes(): a PRESENT manifest whose contributed_routes is not an
    array (or missing) now refuses instead of silently reading back [] --
    view_manifest() always emits this field as an array, so anything else
    there cannot be trusted for the ownership check it exists to carry.
    Absence of the WHOLE manifest is still an empty column, unchanged.
  * resolveView(): a rejected `await import(...)` (missing file, syntax
    error) is now caught and refused as a ViewBindingError naming the
    binding id and module path, instead of leaking a native error with
    neither.

view_extension.py
  * ViewBinding.entry is now held to the same ASCII identifier grammar
    views/view_extension.js's viewBinding() checks (_ENTRY), not Python's
    own str.isidentifier() -- the two disagreed in both directions
    ("$mount" valid JS, invalid Python identifier; "café" valid Python
    identifier, invalid per the client's ASCII-only regex), so a binding
    could be constructed on one side and refused on the other.
  * collect_view_bindings() now checks views is callable and views() a
    list/tuple before entering the loop. isinstance(extension,
    ViewExtension) is a runtime_checkable Protocol check and verifies only
    that the name exists; `views = 1` or `views()` returning None both
    passed it and then raised a raw TypeError, never the ViewBindingError
    every other declaration defect in this module promises.

Ten new tests (2 Python parametrized + 2 single + 2 JS, tests/test_view_-
registry.py), the census loc for views/view_extension.js corrected for its
growth (422 -> 455) with the header totals moving the same amount. Full
leg validate invocation: 139 passed, 3 xfailed, 0 failed -- the three S1
xfails unaffected (app.js untouched this round; both created files this
commit touches carry no manifest row, RULED OQ-C).

Lane: openxfactory-4-opendox-extraction
Refs opensoft/openXfactory#656
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…e scope

The one remaining PR #14 thread (tests/test_view_registry.py:132): this
repository ships no `package.json`, so `_run_node`'s harness and the real
`view_extension.js`/`docs.js` (native `export`/`import`, no bundler) have no
declared module format. Node decides ambiguous `.js` files via
`--experimental-detect-module` (default ON since Node ~20.10, unflagged by
Node 22+): it reparses a file as ESM the moment it sees module syntax, and
warns `To eliminate this warning, add "type": "module" to .../package.json`.

Verified by hand and does not reproduce today: neither locally (Node
v22.22.2) nor in the actual `validate` run for this head (34702880356, Node
24 per the runner's own deprecation notice) does any node-based test fail --
both pass because the heuristic is on by default there. It is still a real
gap, not a false positive: importing the unmodified `view_extension.js` with
`--no-experimental-detect-module` (simulating an older Node, or the flag
disabled) fails outright, proven both by hand and by the new regression test
below (confirmed red on the pre-fix tree, green after).

Fix: an explicit `package.json` (`"type": "module"`) at the repository root
-- an ancestor of `src/opendox/web/**/*.js` for Node's module-scope lookup,
but deliberately NOT inside `src/opendox/web/`, which
`tests/fixtures/web_boundary_census.yaml` classifies file-by-file (verified
`test_every_web_file_is_classified_exactly_once` still passes unchanged) --
plus one written into every `_temp_bundle()` copy, since `tmp_path` sits
outside the repository tree and the root file is not its ancestor.

New test `test_js_module_scope_holds_without_node_s_detection_heuristic`
imports both the real registry and a `_temp_bundle` copy under
`--no-experimental-detect-module` and asserts a clean import -- the positive
assertion that the module format is now a stated fact rather than a Node
default that a future version, downgrade or flag could change again.

Verified: full `validate` invocation (5 files, --noconftest) 140 passed, 3
xfailed -- same xfail set as before (S1's three strict xfails, untouched by
this change).

Lane: openxfactory-4-opendox-extraction
Refs opensoft/openXfactory#656

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
S2 (#15, "the intent chips become an optional
contributed binding") landed on main while this leg was in flight and
flipped PR #14's mergeStateStatus to DIRTY/CONFLICTING. Two textual
conflicts, both resolved as the UNION of both slices' content rather than
by picking a side:

- `.github/workflows/validate.yml`: both the comment block (S2's paragraph
  then S3's, plus a one-line note that S3's registry test now carries its
  own package.json fix) and the pytest file list (`test_intent_binding_shape.py`
  then `test_view_registry.py`) keep both slices' additions.
- `tests/fixtures/web_boundary_census.yaml`: both slices' own "a 43rd file"
  paragraphs are kept verbatim (each counts its own addition against the
  shared a99eba0 base, independently, and neither claim was wrong on its
  own branch), plus a new RECONCILED paragraph giving the combined total now
  that both land in one tree -- A 22 files/12,398 lines, B 4/1,597, C
  14/11,854, ? 4/5,432, total 44/31,281 -- verified against the merged
  file's own rows (`sum(row["loc"] ...)` by class), not hand-arithmetic left
  unchecked. `views/dispose.js` and `views/wheel.js` (S2's two other touched
  files) are unchanged in `loc` on both branches, so B/C totals carry over
  unmodified.

All other files (src/opendox/cli.py, src/opendox/serve.py,
src/opendox/web/views/dispose.js, src/opendox/web/views/wheel.js, the new
views/intent-binding.js, tests/test_intent_binding_dom.py,
tests/test_intent_binding_shape.py) arrive unmodified from main.

Verified: full `validate` invocation (6 files, --noconftest) 148 passed, 3
xfailed -- the same three S1 strict xfails, same reasons, confirmed still
XFAIL rather than flipped XPASS by S2's edits.

Lane: openxfactory-4-opendox-extraction
Refs opensoft/openXfactory#656

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… mount, view-registry isolation

tests/test_doc_surfaces.py
  * test_the_doc_tab_is_wired_to_the_one_cross_view_jump located the docs
    tab's block by the pre-S3 `{ tab: "tab-docs"` shape, which no longer
    exists in app.js now that the binding is `{ id, control, region }`
    (§ 3.4 S3). `app.split(...)[1]` on the absent literal raised IndexError
    before the renderDocs assertion ever ran. Migrated to split on the
    registry shape (`{ id: "docs.list", control: "tab-docs",
    region: "view-docs",`) -- the same one-token-class migration the three
    test_bullseye_widget.py `.view` -> `.region` quotations already took in
    this PR (09b42f5).

src/opendox/web/app.js
  * The viewer's `mountGate` adapter called a hard-coded
    `gateView.exports.mountGateBar` instead of the RESOLVED binding's own
    declared `entry` export. `resolveView()` already validates that
    `binding.entry` names a callable export of `binding.module`; a
    contributed `gate.bar` binding declaring a different entry name would
    pass that validation and then either mount the wrong function or throw
    on `undefined` here, because validation and mounting consulted two
    different names. Now
    `gateView.exports[gateView.binding.entry](host, gctx, { caps })` --
    one token changed. New
    test_app_js_mounts_the_gate_bar_through_its_declared_entry
    (tests/test_view_registry.py, S3-created) pins the new expression and
    asserts the old hard-coded call is absent, as a regression guard.

tests/test_view_registry.py
  * Normal (non-`--noconftest`) pytest loads the root conftest.py, which
    registers an empty `_SuiteProfile` at collection time -- a test process
    is a host like any other. This module never cleared that ambient
    registration before asserting against a clean slate:
    `registered()`'s `domain_profile.register()` raised AlreadyRegistered
    against the suite's own profile (reproduced in isolation running
    test_the_facet_comes_off_the_one_registered_profile alone), and
    test_no_host_at_all_refuses_rather_than_answering_empty's
    `assert not domain_profile.is_registered()` saw it registered and
    failed (also reproduced in isolation; the full-file run happened to
    pass it only as a side effect of the PRECEDING test's fixture teardown
    unregistering the conftest profile after its own registration attempt
    raised). New autouse `_empty_registry`, mirroring
    test_profile_registration.py's fixture of the same name: save whatever
    profile is registered (or None), unregister, yield, restore in
    teardown. Both tests now pass standalone and in any order.

Verified: narrowed validate (5 files, --noconftest) 82 passed, 3 xfailed,
unchanged. `node --check src/opendox/web/app.js` clean.

Normal invocation of both touched files still cannot reach any of these
three assertions: `ideation_dashboard` is genuinely absent from this leg by
design (pyproject.toml's own dependency note -- it is a cross-column reach
the BUILD arc removes), and the root conftest's autouse
`declared_human_console` fixture imports `opendox.cli` -> `opendox.serve`,
which imports it at module level. Every test in both files errors at
fixture setup on that ModuleNotFoundError before reaching either file's
body, unchanged by this commit (78 errors before and after -- the
pre-existing 77 plus one new test, same reason). Verified instead with a
scratch-only, uncommitted `ideation_dashboard` stub that satisfies the
import chain with no behavioural stand-in beyond existing, plus isolated
per-test and per-line checks against the real files; the PR thread replies
give the exact commands and tallies.

Also found, NOT fixed here (out of this round's scope and reported to the
orchestrator separately): tests/conftest.py's
`REPO_ROOT = HERE.parent.parent` is off by one directory now that the carve
flattened `tests/ideation-dashboard/` to `tests/` -- it resolves one level
above this repository's own root. That is a second, independent reason
most of test_doc_surfaces.py (and, by the same `REPO_ROOT` import, roughly
three dozen other test files) cannot reach a green normal invocation right
now; it masks nothing this commit fixes, and none of this commit's new or
changed assertions depend on it.

Lane: openxfactory-4-opendox-extraction
Refs opensoft/openXfactory#656
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
RULED Q4 (Brett Heap, 2026-09-12, opensoft/openXfactory#656 comment
5642758731): "`/source/` is openDox's, and openXdox's projection binding keeps
only `/snapshot-index.json` and the three `/projections/*` routes." Reading a
file out of the pinned checkout is the neutral product's own read-only
pass-through; it predates the gate loop and nothing about it is a gate act, and
under RULING OQ-2 a student runs openDox alone — so `views/viewer.js`, the
read-only Markdown viewer and the most obviously student-usable surface in the
bundle, could not render a document without the consumer layer serving the
route. The boundary note (openDox-spec `docs/front-end-package-boundary.md`
§ 2.2 rule 1, § 3.2, § 4.5 assertion 2, § 5 row S6, § 6 Q4) measured that as
the census's ONE class-A breach.

STACKED ON #14 (slice S3, `build/s3-view-registry`, unlanded).

`serve.py` declares the route. `SOURCE_PREFIX` and `BARE_SOURCE_ROUTE` with the
pre-carve strings, `_keyed_source` / `_serve_source` / `_refuse_bare_source`
moved from `openxdox/serve_projection.py`:295-361 byte for byte, and the
single-root containment entry point `resolve_source_path` — a real definition
here now, which is what `notebook_action.py`:52 has always imported `from
.serve` and :139 re-checks every resolved document with.

THE ORDER IS THE ONE THE BINDINGS HAD, and it is load-bearing.
`collect_bindings` grouped every EXACT binding ahead of every PREFIX one, so
`/source` answered `send_error(404, "no source path")` and `/source/` (empty
tail) answered 404 with divergence headers and a zero-length body. `_route`
reproduces that by putting the exact arm above the prefix arm; the other way
round the bare route is unreachable and its answer silently becomes an HTML
error page. Both arms sit ABOVE the § 2.4 contributed consult, which is what
makes them fixed rather than shadowable.

WHAT DID NOT MOVE. `snapshot_registry.resolve_within` is the containment RULE
and is still the projection column's — the same rule applied per registry entry
(task 2.2) — reached through the late `consumer_reach` seam `serve_workbench.py`
already uses at five sites. `hosted_ref_refused` and `_hosted_entry_refused` are
FR-048's hosted-plane confinement, also the column's: the route moved, the rules
it consults did not. `consumer_reach.LateProjectionRoutes` therefore drops three
of its eight forwarders and keeps five, and `resolve_source_path`'s stand-in
goes — one fewer wrong-direction reach, at the site rather than at the census.

Census (§ 4.5 assertion 2), re-derived rather than asserted: 20 sites -> 16.
The four `/source` sites clear — `app.js`:195/196, `views/viewer.js`:314,
`views/wheel.js`:97 — WITHOUT AN EDIT to any of those files, because the route
they name is this product's own now. What remains: TWELVE SPLIT-file sites S4
closes (`lens-model.js`:1036/1037, `repo-selector.js`:33/39/43/46,
`staging-workbench-model.js`:543/817/818/821/822/826), TWO at `app.js`:586/598
(S3's `gate.bar` CORE_VIEWS entry, closed at S5), and TWO at `lens.js`:41/45,
this assertion's own standing declared exception that only a future ruling on
`lens.js` can close. `xfail(strict=True)` stays: § 5's row for S6 promises
assertion 2 green for `views/viewer.js`, which it is, not the assertion green
outright.

Tests. `tests/test_source_core_arm.py` is CREATED and joins `validate`'s
explicit list: 25 assertions over the route's ownership, its dispatch order and
unshadowability, its single containment authority, its two content types, its
three distinct refusals, its read-only posture, FR-048 still being asked, and
the four bundle literals still standing unedited. It carries no `xfail` —
nothing it measures is a defect awaiting a later slice. It is a SHAPE assertion
because `opendox.serve` cannot be imported at either leg
(`from ideation_dashboard import …`, recorded in `STILL_REACHING`), which is
§ 1.2(d)'s finding and S8's to lift.

`tests/test_source_dot_directories.py` ARRIVES from openXdox-code with the
route — the one file of the 48 whose whole subject IS this route (T092 defect
10: `/source/.git/config` served a remote's embedded PAT). Unchanged but for an
arrival note and its `WEB` constant, which the carve's `import rewrites` class
had pointed at `src/openxdox/web`. Inert at both legs, like its 25 siblings,
until S8.

`tests/test_consumer_reach.py` follows the seam: the LATE_COLUMN check now
asserts the three departed names are ABSENT as well as which five remain, and
`CONVERTED_SITES["serve.py"]` drops `resolve_source_path` because it stopped
being a stand-in.

Pairs with opensoft/openXdox-code `build/s6-source-route-to-opendox` and with
an openxFactory carve-manifest row annotation (Q-L1, the ASK-7 pattern).

Refs opensoft/openXfactory#656

Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 12, 2026 17:24
WITHDRAWN, one commit later, on the carve floor's own rule. The previous commit
received `tests/test_source_dot_directories.py` from openXdox-code with the
route it is about. `docs/opendox-carve-manifest.yaml`:3439-3450 gives that file
a row with `destination: openxdox_code`, so the move is not a declared EDIT to
an arrived file — it is a RE-DESTINATION of the row itself, which Q-L1's
annotation form (`edits: [{class, lines[], note}]`, classes closed at
`import rewrites | path constants | adapter calls`) cannot express. Left
standing it would have made `verify-carve-arrival.py --destination opendox_code`
refuse for a file no row places, and the openXdox side refuse for a missing
arrival. "Fix the DESTINATION, never the manifest" is the verifier's own
remediation line.

Nothing is lost. The file is inert at both legs (§ 1.2(d)), it already reads
`from opendox import serve as serve_mod` — the carve's `import rewrites` class
had pointed it at the leg that now owns the route — and every refusal it
measures belongs to `snapshot_registry.resolve_within`, which S6 did NOT move.
`tests/test_source_core_arm.py` asserts exactly that single-authority property
(point 5, `test_the_containment_rule_is_the_one_authority_and_is_not_re_implemented`),
so the dot-directory refusals (T092 defect 10) are carried without being
re-stated at a leg that cannot run them.

Its docstring is corrected to say so, and to record the full shape of what stays
behind: six suites at openXdox-code, thirteen functions plus that whole file,
every one of them already pointed at `opendox.serve`. Re-homing them is § 5 row
S8's, with the other 47 — and S8 needs a manifest re-destination act that no
slice has yet been given. Recorded here so S8 finds it already written down.

Refs opensoft/openXfactory#656

Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

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

The deferred source-directory suite currently fails collection, and server/client validation gaps remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

This stacked S3/S6 change adds view-registry support and moves /source routing into openDox’s fixed core arm.

Changes:

  • Adds Python and JavaScript view registries.
  • Moves /source handling and updates consumer-boundary tracking.
  • Updates tests, census fixtures, package configuration, and CI validation.
File summaries
File Description
tests/test_web_boundary.py Updates ownership census assertions.
tests/test_view_registry.py Tests registry and manifest behavior.
tests/test_source_dot_directories.py Covers source refusal cases.
tests/test_source_core_arm.py Verifies fixed source-route ownership.
tests/test_doc_surfaces.py Updates document-tab wiring checks.
tests/test_consumer_reach.py Updates late-reach expectations.
tests/test_bullseye_widget.py Updates registry field assertions.
tests/fixtures/web_boundary_census.yaml Records revised ownership data.
src/opendox/web/views/view_extension.js Implements the browser registry mirror.
src/opendox/web/app.js Integrates registry-driven views and gates.
src/opendox/view_extension.py Defines the Python registry authority.
src/opendox/serve.py Owns the fixed /source routes.
src/opendox/consumer_reach.py Removes obsolete source forwarders.
package.json Declares Node ESM behavior.
.github/workflows/validate.yml Runs the validation suites.
Review details

Suppressed comments (6)

src/opendox/serve.py:181

  • Q4 says the projection binding retains /snapshot-index.json plus the three /projections/* routes, so saying its contribution is /snapshot-index.json alone is inaccurate and could mislead the next route carve into deleting or duplicating those routes. Update this comment to list all four retained projection routes; only /source moved to this fixed arm.
# `/snapshot-index.json` alone now. It is a route-ownership correction, not a

src/opendox/view_extension.py:259

  • Pattern.match() with this $-anchored regex does not require the entire string in Python: a trailing newline is accepted before $. An id such as docs.list\n therefore passes server-side but is rejected by the JavaScript mirror, allowing the shared binding vocabulary to diverge; use a full-string check here and consistently for the module and entry checks as well.
        if not isinstance(self.id, str) or not _ID.match(self.id):

src/opendox/view_extension.py:276

  • The module validator has the same Python $/match() end-of-string gap: ./views/docs.js\n is accepted by the authority but rejected by the client-side MODULE regex. Use fullmatch() here so a manifest cannot be published with a module specifier the browser will refuse.
        if not isinstance(self.module, str) or not _MODULE.match(self.module):

src/opendox/view_extension.py:287

  • The entry validator also accepts a final newline because it uses match() with $, while the JavaScript entry grammar rejects it. That lets the server emit a binding whose export name cannot be resolved by the browser; use fullmatch() for this check too.
        if not isinstance(self.entry, str) or not _ENTRY.match(self.entry):

src/opendox/web/app.js:940

  • The gate binding's declared entry is validated as callable, but this callback also assumes every resolved gate.bar module exports isGateBearing. A host can supply a callable custom mount under the declared entry without that auxiliary export; opening a proposal then calls undefined(entry.path) and crashes the viewer instead of treating the optional binding as absent or refusing it. Make this gate-specific export part of the binding contract and validate it before mounting, or provide a named guard/refusal path.
    const gateContext = (tile, entry, key) =>
      tile?.kind === "proposal" && gateView
        && gateView.exports.isGateBearing(entry.path) && key
        ? { changeId: tile.id, repository: key.repository }

src/opendox/web/views/view_extension.js:128

  • This membership check coerces non-string property keys. For example, a binding with region: ["view-docs"] is accepted because the array becomes the string view-docs, whereas the Python authority rejects that malformed value before membership; the returned binding then carries a non-string region. Check the region type before testing membership so malformed JSON cannot bypass the binding schema.
  if (!Object.prototype.hasOwnProperty.call(REGIONS, b.region)) {
  • Files reviewed: 14/14 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.

Comment thread src/opendox/web/views/view_extension.js Resolved
Copilot AI review requested due to automatic review settings September 12, 2026 17:34

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

Correct stale and incomplete route-ownership documentation before approval.

Review details

Suppressed comments (3)

src/opendox/consumer_reach.py:421

  • This updated reason still says the snapshot and index routes are both dispatched through the route-extension point, but _route keeps /snapshot.json as a fixed path == self.snapshot_route arm (lines 967-969) and only the index reaches route_extension.match (lines 1042-1050). Please distinguish the openXdox-owned snapshot handler from the contributed index route so this boundary description does not imply that the snapshot arm can be moved into a binding.
    reason="the snapshot and index routes are openXdox's column "
           "(design.md § D3); this core dispatches them through the § 2.4 "
           "route extension point instead of inheriting them")

src/opendox/serve.py:180

  • This relocation leaves two contradictory ownership statements in this module: the earlier module documentation at serve.py:153-155 still says serve_projection.py owns /source, and the build_server contract at serve.py:1547-1550 still says route_extensions=() loses /source/. Both are now false after this fixed-arm move, so update those statements so maintainers do not infer that /source is still a contributed projection route.
# AND ONE ROUTE HAS SINCE GONE THE OTHER WAY. § 3.4 slice S6 (RULED Q4, Brett
# Heap, 2026-09-12, openxFactory#656 comment 5642758731) returns the `/source`
# pair from CONTRIBUTED to FIXED: the read-only pass-through over the pinned
# checkout is the NEUTRAL product's own, so `SOURCE_PREFIX`,
# `BARE_SOURCE_ROUTE` and the three methods that answer them are declared below
# and `_route` branches on them again, above the contributed consult so no
# binding can take the route back. The projection column's contribution is

src/opendox/serve.py:181

  • This ownership summary is incomplete: Q4 leaves /snapshot-index.json plus the three /projections/* routes in the projection column, not /snapshot-index.json alone. As written, the new comment contradicts the routing contract and can mislead a later carve; please name all four retained routes.
# binding can take the route back. The projection column's contribution is
# `/snapshot-index.json` alone now. It is a route-ownership correction, not a
  • Files reviewed: 14/14 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

…e-core-arm

Lane: openxfactory-4-opendox-extraction

Refs opensoft/openXfactory#656

Two conflicts, both resolved keeping this branch's own content over main's
pre-S6 snapshot of the same text (main's side contributed nothing this
branch did not already carry further forward):

- `.github/workflows/validate.yml`: main has no S6 addition at all (its
  comment block + the `tests/test_source_core_arm.py` pytest-list line);
  kept this branch's version whole.
- `tests/test_web_boundary.py` (assertion 2's xfail reason on
  `test_no_ownership_violation_outside_class_b`): main's text is the
  post-S3/pre-S6 snapshot (20 sites); this branch's text is the RE-DERIVED
  post-S6 count (16, the four /source sites cleared) and already accounts
  for S3's own contribution (the CORE_VIEWS `gate.bar` entry, +2, cited by
  name) inside its own narrative. Kept this branch's version; verified
  `app.js` (the file both texts cite line numbers into) is byte-identical
  between this branch and origin/main, so the citations still hold.

`tests/conftest.py` auto-merged to main's #19 depth fix (this branch had
inherited the pre-fix `HERE.parent.parent`, touched by neither slice).
Everything else (view_extension.py/.js, app.js, test_view_registry.py,
test_doc_surfaces.py, test_bullseye_widget.py) merged clean — this branch
never edited those lines.

Narrowed validate (branch's own list, 7 files): 174 passed, 3 xfailed, 0
failed. `git diff origin/main --stat`: only this slice's own files (S6's
serve.py/consumer_reach.py/test_source_core_arm.py + the shared
web_boundary_census.yaml/test_consumer_reach.py/test_web_boundary.py/
validate.yml edits already on this branch before the merge) — no S3
residue.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings September 12, 2026 18:42
@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.

🟡 Changes recommended

Release coordination, fixed-prefix overlap validation, and test coverage gaps remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review details

Suppressed comments (3)

src/opendox/serve.py:183

  • This ownership summary now says the projection contribution is only /snapshot-index.json, but the module-level by-function split above still says serve_projection.py owns the /source routes. After this move those statements contradict each other, which can mislead the next extraction slice back toward the old column; update the earlier split narrative to remove /source from the projection column.
# binding can take the route back. The projection column's contribution is
# `/snapshot-index.json` alone now. It is a route-ownership correction, not a
# reversal of PR 3: what a COLUMN owns is contributed, and `/source` turned out
# not to be a column's.

src/opendox/serve.py:1031

  • Once SOURCE_PREFIX becomes a fixed read arm here, route_extension.collect_bindings() no longer sees that prefix, so a public build_server(route_extensions=...) caller can declare a GET/HEAD exact or nested /source/... binding and have it accepted but permanently bypassed by this branch. Before S6, the contributed /source/ binding made collect_bindings reject such overlap under its no-overlap rule (src/route_extension.py:84-97); reserve/validate overlaps with fixed prefixes during assembly so a dead contributed route fails at build time instead of silently disappearing.
        if path.startswith(SOURCE_PREFIX):
            self._serve_source(path[len(SOURCE_PREFIX):], head_only)

tests/test_source_core_arm.py:385

  • app.js contains two /source/ literals (the unkeyed fallback and the keyed return at lines 195-196), but this parameter only matches return "/source/";. The keyed form can be changed or removed while this suite still passes, so it does not prove the stated four front-end literals remain; assert two app.js matches or give the two sites separate patterns.
@pytest.mark.parametrize("relative,pattern", [
    ("views/viewer.js", r'o\.sourceBase \|\| "/source/"'),
    ("views/wheel.js", r'const SOURCE_ROUTE = "/source/";'),
    ("app.js", r'return "/source/";'),
])
  • Files reviewed: 7/7 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread src/opendox/serve.py Resolved
@brettheap
brettheap marked this pull request as ready for review September 12, 2026 19:01

@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 3 days and 6 hours by commenting @sourcery-ai review. Upgrade to get a review now.

brettheap added a commit that referenced this pull request Sep 12, 2026
…egistry-fail-closed

Reconciles the one conflict, in tests/fixtures/web_boundary_census.yaml's
views/view_extension.js row: #17's branch had just gained the missing
"455 -> 463 on S4" narrative sentence (a duplicate-row cleanup fix) while
this branch had already appended its own "463 -> 499 on this fix
(Copilot, PR #16)" continuation from the pre-cleanup 463 note. Spliced
both narrative additions into one chained note (422->455->463->499) and
kept loc: 499, which matches the file's actual line count. Re-verified:
totals re-derive exactly (A 25/16329, B 7/2174, C 14/11854, ?/1435).

Lane: openxfactory-4-opendox-extraction

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
brettheap added a commit to opensoft/openXdox-code that referenced this pull request Sep 12, 2026
Lane: openxfactory-4-opendox-extraction

Refs opensoft/openXfactory#656 (stays OPEN). CLAIM: 5647354329.

**RULED Q4** (Brett Heap, 2026-09-12, opensoft/openXfactory#656 comment `5642758731`):
"`/source/` is openDox's, and openXdox's projection binding keeps only
`/snapshot-index.json` and the three `/projections/*` routes." This leg is the
openXdox half of § 3.4 slice S6: `src/openxdox/serve_projection.py` drops
`SOURCE_PREFIX`, `BARE_SOURCE_ROUTE`, both `RouteBinding`s, `_keyed_source` /
`_serve_source` / `_refuse_bare_source`, and `resolve_source_path`.
`ProjectionRoutesExtension.routes()` is now the one binding,
`/snapshot-index.json`; the three `/projections/*` routes were never declared
here and are untouched. Pairs with opensoft/openDox-code#16 (the arm's new
home) and an openxFactory carve-manifest row annotation (Q-L1, ASK-7 pattern)
declaring these lines on `serve_projection.py`'s row.

Gate evidence: destination gate; `validate` SUCCESS at `00b69de7` (run
34708597396); 2 review threads, 0 unresolved (the seam-count finding fixed in
this branch's own history; the pin/release-ordering finding on this file's
stale `pyproject.toml` dependency — replied and registered on #656 rather than
fixed here, since the actual remediation is a later, deliberate pin-bump hop on
this repo's own side, not a change available inside this PR).
@brettheap
brettheap merged commit 3661345 into main Sep 12, 2026
4 checks passed
brettheap added a commit that referenced this pull request Sep 12, 2026
… the bindings that call them (#17)

Lane: openxfactory-4-opendox-extraction

Refs opensoft/openXfactory#656 (stays OPEN). CLAIM: 5647338637.

**RULED Q3** (Brett Heap, 2026-09-12, opensoft/openXfactory#656 comment
`5642758731`): "a route constant travels with the binding that calls it, never
with the model that happens to declare it." This is § 3.4 slice S4: the
thirteen gate-route constants declared in `lens-model.js`,
`repo-selector.js`, and `staging-workbench-model.js` split to the class-B
bindings that call them (`gate-lens.js`, `gate-projects.js`,
`projection-index.js`, `swb-create.js`, `swb-session.js` — four of them new),
with `/actions/refresh` measured and asserted to stay class A per § 3.2's Q3
row. Two dead parameters (`mountCreateProject`'s `projects`,
`commissionEdit`'s `control`) were dropped rather than carried across the
package boundary unread. The census SPLIT rows move to class B with real
line counts; `requireRouteShape()`-adjacent boundary assertions were
tightened (assertion 1 cutoff, assertion 2 residue) and re-verified against
the merged tree after S4 re-merged main twice (once after S6/#16 landed) —
see the #656 note for the residue arithmetic. Merges after `main` already
carries § 3.4 S3 (#14) and S6 (#16).

Gate evidence: destination gate; `validate` SUCCESS at `f3474843` (run
34722412518); 2 review threads, 0 unresolved (S3's own pre-existing
`isGateBearing` finding on `app.js`, not S4's to fix, replied + registered on
#656; a real test-coverage gap on `route_ownership_exceptions`, fixed in
this branch's own history by adding a mutation-tested assertion). Three
Copilot "suppressed" comments on the post-merge head are not review threads
(GraphQL: 0 unresolved) and are registered on #656 alongside the app.js
finding as the same "resolveView()/postPlan() validates shape, not
behaviour" follow-up class, out of scope here.
brettheap added a commit that referenced this pull request Sep 12, 2026
…f coercing it (S3 follow-up; fails closed per § 4.1) (#18)

Lane: openxfactory-4-opendox-extraction

Refs opensoft/openXfactory#656 (stays OPEN). CLAIM: 5647338637.

Stacked on § 3.4 S4 (#17, landed at `69d27602`) — an S3
follow-up fixing a Copilot finding on #16: `manifestRoutes()` validated only
that `contributed_routes` was an array, and `ownershipBreach()` read a
contributed entry's `is_prefix` with a truthy check, so neither refused a
single malformed entry (missing string `pattern`, or `is_prefix` anything
other than a real boolean, including simply absent). A new shared
`requireRouteShape(claimed)` in `view_extension.js` validates one contributed
route entry and is now called from both `manifestRoutes()` (at manifest-read
time, before any binding's route reaches `ownershipBreach()`) and
`ownershipBreach()` itself — `app.js` is untouched. The Python mirror
(`view_extension.py`) stays safe by construction: `RouteBinding.__post_init__`
already refuses a non-bool `is_prefix` before `_route_ownership_breach` runs,
so this JS-only fix is deliberately stricter than its Python line, matching
what construction-time validation already guarantees server-side.
`tests/test_view_registry.py` extends the existing malformed-manifest test
with two entry-level cases and adds a new ownership-check case, node-driven
per the file's existing `_run_node` pattern.

Gate evidence: destination gate; `validate` SUCCESS at `c57bd1f6` (run
34725295226, after re-merging `origin/main` post-#17-landing so the diff
collapses to this PR's own 3 files: `view_extension.js`,
`web_boundary_census.yaml`, `tests/test_view_registry.py`); narrowed pytest
207 passed / 3 xfailed locally against the merged tree; 0 review threads (0
unresolved). CLEAN/MERGEABLE, not draft.
brettheap added a commit that referenced this pull request Sep 12, 2026
…ed follow-up) into leg B

openDox-code#17 (S4) landed to main as a SQUASH and #18 (the fail-closed
follow-up) merged into `build/s4-split-route-tails` after it, so this leg takes
`origin/fix/view-registry-fail-closed` — which has already merged
`origin/main` into itself — rather than `origin/main` directly. That is a
superset of main and it carries the base branch's OWN resolution of the squash,
instead of re-resolving eight add/add conflicts against a history with no
shared ancestor.

THREE CONFLICTS, all where this slice and the merge-mains touched the same
bookkeeping, and both sides are kept in each:

* `.github/workflows/validate.yml` — S6's `tests/test_source_core_arm.py` and
  S5's `tests/test_gate_loop_contributed.py` are both on the narrowed list now,
  with both narration blocks.
* `tests/fixtures/web_boundary_census.yaml` — the `views/view_extension.js` and
  `views/wheel.js` rows carry the full loc chain from both lineages. The wheel's
  note is rewritten rather than merged: it said "imports dispose.js (class B)",
  and as of this slice it does not.
* `tests/test_web_boundary.py` — assertion 2.

AND ASSERTION 2 IS GREEN. The `xfail(strict=True)` that has stood on
`test_no_ownership_violation_outside_class_b` since slice S1 comes off here,
and it comes off because the count is ZERO, measured — 18 at S1 -> 20 at S3 ->
10 in scope after S4 -> 6 in scope with S6 also applied -> 0. The last six were
one family in one place: `app.js`'s CORE arm, the `gate.bar` / `gate.lens` /
`gate.projects` entries, each a class-B binding's `routes:` declaration sitting
in a class-A file. They closed the way the census row predicted they would —
the modules left, and their bindings arrive through `contributedViewBindings()`.
`views/lens.js`'s two openxFactory-lane sites stay out of scope by declaration,
as they always were.

Narrowed validate: 246 passed, 1 xfailed.

Lane: openxfactory-4-opendox-extraction
Refs opensoft/openXfactory#656

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
brettheap added a commit to opensoft/openXdox that referenced this pull request Sep 13, 2026
…n column) and openDox pin to 7cf6c143 (S3/S4/S6 landings) (#9)

Lane: openxfactory-4-opendox-extraction

Refs opensoft/openXfactory#656 (stays OPEN). CLAIM: 5647338637.

Second leg of the pin lockstep: `code` advances `af15f712` → `d6e7bbe3` (S6),
`contracts/opendox-pin.yaml` advances `8ec3036c` → `7cf6c143` (matching
opensoft/openDox#7). `spec` unchanged.

Gate evidence: destination gate; `validate` SUCCESS (base confirmed `main`);
`scripts/validate-pins.py --pin-source openDox=<sibling clone>` recomputes
every digest (`pins ok`); `validate-manifest.py` and
`validate-repository-naming.py` also pass. 1 review thread, 0 unresolved —
Copilot's pin-ordering finding (`openXdox-code`'s own `pyproject.toml` still
depends on `openDox-code@a99eba03`), the same shape as two already-
registered findings on opensoft/openDox-code#16 and opensoft/openXdox-code#17
— replied (out of scope for an assembly-root pin bump; the remediation is
`openXdox-code`'s own separate pin-bump ceremony per
`docs/opendox-cutover-runbook.md` § 5.1, design D12, "two pin moves per
hop") and registered on #656, resolved. CLEAN/MERGEABLE, not draft.
brettheap added a commit that referenced this pull request Sep 29, 2026
…erator (plan 034) (#54)

**Authored ahead, as a phase-2 draft.** Brett's RULING on openxFactory#656, comment `5857365170` ("Start phase 2's independent tasks"), names T052 among the phase-2 tasks authored as drafts. **T049 has landed** (openxFactory#1204 → `9d2e5bc3`), so phase 2 is open. T052 is `After: T049, T009, T053`, and **T053 has landed**: openDox-spec#16 → `f7ee3c76`. This PR stays a draft until the holder un-drafts it.

Plan 034, **T052 (5.4: declare the generator seam)**, phase-2 slice **P2-G**. The plan was read at openxFactory `main` `133e37d9` (`specs/034-opendox-standalone-operation/tasks.md`), and re-read at `9d2e5bc3`, where T052's entry is unchanged. The slice is claimed on openxFactory#656, comment `5857453864`. The branch was cut from openDox-code `main` `80acead1`, and `main` `2d116415` (T036 #52, T037 #55) is merged in.

## What it declares

Box 5.4 of #1144 reads *"DECLARE THE GENERATOR SEAM — it does not exist and `CorpusAdapter` is not it"*, and asks for three things. The new module is `src/opendox/generator_seam.py`, beside `domain_profile.py`.

- **The operation handed over**: `generate(repo_root, repository, *, source_revision=None, generated_at=None, **inputs)`, which answers the snapshot, a `dict`.
  - These are the four arguments openDox's generate verbs already hand a generator.
  - A governed generator's own extras, such as `project_register_source` and `possibles_source`, travel as **declared inputs**. So the seam neither drops them nor names them.
- **The registration point, beside `domain_profile.register()`**. A host calls `opendox.generator_seam.register(<SnapshotGenerator>)` once, at process start. Entry points call `register_default(...)`, which registers only where nothing is registered. `current()`, `is_registered()` and `unregister()` complete the registry, in `domain_profile`'s shape.
- **The conformance a contributed generator must meet**. `SnapshotGenerator(contract, generate, inputs=())` declares it, and `generate()` enforces it:
  1. It declares the contract it writes, which is the `kind` of every snapshot it answers.
  2. Its operation takes the seam's call, and **each declared input is optional**, because the seam passes an input only when the caller has a value for it. The seam checks this against the signature when the declaration is made. It binds the call once with every declared input given and once with none given, and every call the seam can make lies between the two.
  3. It declares every further input it reads. An undeclared input is refused before the generator is called (`GeneratorInputRefused`), and an input given as `None` is simply not passed.
  4. It answers a `dict` whose `kind` is its declared contract and whose `schema_version` is an integer. Anything else is refused (`GeneratorNotConformant`) and not handed on. So two generators that write two contracts can never both claim to be the one conformant implementation, which is the failure 5.4 was raised against.
  5. It is deterministic over its inputs. That is declared, and each generator's own suite proves it.
- **The conformance clause names T053's neutral kind for openDox's own generator**. `NEUTRAL_SNAPSHOT_KIND = "opendox-snapshot"` equals the `kind` const of openDox-spec#16's `contracts/schemas/opendox-snapshot.schema.yaml`. It was read at `bcff47d4`, and it is unchanged at #16's last head `cd49eb25` and in the landed `f7ee3c76` (`"kind": {"x-rule": "kind-is-opendox-snapshot", "const": "opendox-snapshot"}`). `register_default()` refuses a declaration that writes any other contract. A contributor declares its own contract, as openXdox's governed generator will.
- **The entry points register openDox's own generator where no host has** (R1Q10 (a), `5850003126`, in R1Q3 (a)'s pattern). `cli.build_parser()`, `cli.main()`, `serve.build_server()` and `serve.main()` each gain one line, `generator_seam.register_default(default_generator.GENERATOR)`, beside their registrations of the default profile and the default home corpus. As for the profile:
  - a bare process that builds nothing still meets `GeneratorNotRegistered`, which names the seam and the call;
  - a host registration made before anything has been generated from the default replaces it;
  - one made after a snapshot has been generated from it is refused (`GeneratorAlreadyRegistered`), for the reason RN-1 (a) gives for the profile;
  - one made **while** a snapshot is being generated from it is refused too, because that snapshot would come back after the swap;
  - a generation that fails, or whose answer the seam refuses, wrote nothing. So it records nothing, and a host still replaces the default after it.
- **Each registration keeps its own records.** Every change of registration goes through one helper that moves a registration serial on and starts the records afresh: `register()`, `register_default()` where it registers, and `unregister()`. A generation carries the serial it began under. So one that outlives its registration records nothing against the next one, even a later registration of the same declaration, and its caller still gets its snapshot.
- **One lock.** The registry's bookkeeping is kept under one `threading.Lock`, because `serve.py`'s `ThreadingHTTPServer` answers each request on a thread of its own. `generate()` holds it only to resolve and mark, and to record the end, and never across the generator's own call. So a generator may register, unregister or generate from inside its own call.
- **`CorpusAdapter` stays closed at six members.** A test pins `OPERATIONS` to the six and the protocol to `OPERATIONS`.

## Why openDox's own generator refuses until T054

`src/opendox/default_generator.py` declares openDox's own generator: contract `opendox-snapshot`, and no inputs. Its `generate()` raises `NeutralProjectionNotBuilt`, which names itself and T054, and it generates nothing. It never answers an empty snapshot. Because that refusal writes nothing, it shuts no host out.

That follows from the plan's order:
- T054, the neutral projection, is `After: T050, T052, T053`.
- T054 edits neither `cli.py` nor `serve.py`, whose single-writer chains run T052, then T055 (plan.md; W2-14 put T052 in both chains).
- So the registration calls are this task's, and the projection behind them is T054's.

No verb reaches the seam yet. The generate verbs still call the consumer's generator through `consumer_reach` (`cli.py:90`) until T055 routes them, and T055 is after T054. The refusal is therefore reachable only by a library caller that uses the seam directly.

## Files

| file | change |
|---|---|
| `src/opendox/generator_seam.py` | new: the seam, its declaration type and its refusals |
| `src/opendox/default_generator.py` | new: openDox's own generator's declaration |
| `tests/test_generator_seam.py` | new: the seam tests (71 cases) |
| `src/opendox/cli.py` | +9: one import, and one registration line in each of `build_parser()` and `main()` |
| `src/opendox/serve.py` | +9: one import, and one registration line in each of `build_server()` and `main()` |

The PR stays out of `conftest.py`, `pyproject.toml`, `validate.yml`, `README.md` and every pin.

## Review round 1: Copilot at `834f8ead`, two findings, both taken

Commit `4ca45d27` addresses both findings.

- **r4116122374, a declared input the operation cannot do without.** The declaration bound the call with every declared input given. But `generate()` drops a `None` input, so an operation that *requires* a declared input was accepted, and then failed with a raw `TypeError` whenever the option was unset. The declaration now binds the call a second time with none of the declared inputs given, and refuses such an operation when it is declared. The regression case is `test_a_declared_input_the_operation_cannot_do_without_is_refused`, which covers the input required by keyword and by position. openXdox's `generate_snapshot` takes both of its extras with a default of `None`, so T059's declaration passes both binds. `test_a_governed_generators_shape_is_declarable` now also generates through that shape with its inputs unset, and with one of them set.
- **r4116122388, the default's window closed before its operation ran.** The generation from the default was recorded before the call. So a failed generation, openDox's own pre-T054 refusal included, shut every host out although it wrote nothing. That contradicted the documented rule. The record is now made only once a conformant snapshot comes back. The property the early record gave, that no registration slips in during a first generation, is kept by a count of the generations from the default that are under way. That count and the record are updated under one lock, never held across the call.
  - The regression cases:
    - `test_openDoxs_own_generator_refuses_until_its_projection_lands` is Copilot's exact scenario: the real default refuses, then a host registers.
    - `test_a_generation_from_the_default_that_wrote_nothing_is_not_a_generation` runs twice: once for an operation that raises, and once for an answer the seam refuses.
    - `test_a_host_is_refused_while_a_generation_from_the_default_is_under_way` runs three times: the generation answers, raises, or answers another kind. It runs on a thread, and the host is refused during the generation every time. Afterwards the host is refused only after the conformant answer.
    - `test_a_generator_may_register_or_generate_from_inside_its_own_call` covers nesting, registering from inside the call, and a default swapped out from inside its own call.
  - The concurrency and re-entrancy cases run in a process of their own with a time limit. So a lock held across a call fails them, rather than hanging the suite.

**The new cases pin the findings.** The new test file was run against `834f8ead`'s seam logic. A one-line shim adds the counter attribute, so that the fixture can save it, and the old logic never reads it. 8 of the 66 go red: the declared-input case, the pre-T054 default case, the two wrote-nothing cases, the three under-way cases and the re-entrant case.

## Review round 2: the seam finding in Copilot's overview of openDox-code#57

T054's branch (#57) stacks on this one. Copilot's overview of #57 at `c0747e96` said that *"replacement-generator tracking can reject valid registrations"*. It opened no thread, so there was no scenario to answer. The claim is **real**. There are two cases, and both were reproduced at `4ca45d27`:

1. **The count of generations under way was global**, not tied to the registration it counted. `unregister()` drops a default while a generation from it still runs. Then a fresh default is registered, and a host over it is refused with *"a snapshot is being generated from it now"*, although nothing is.
2. **A generation that outlived its registration recorded its late answer against a fresh registration of the same declaration.** That shut the fresh window, against `unregister()`'s own promise that the record goes with the registration.

Commit `bce09c50` addresses both, in the form described under **Each registration keeps its own records** above. Commit `97b5b01f` moves one new docstring sentence so that #57 takes this head without a conflict. A trial merge of this head into #57's head `5a6fe637` is clean, and 94 seam and projection cases pass in the merged tree.

- **The regression case** is `test_a_generation_that_outlives_its_registration_touches_no_later_one`. It runs in four variants, in a process of its own. The follower is another default or the same declaration, and the host registers either while the generation runs or after it answers.
  - Against `4ca45d27`'s seam logic, with a one-line shim for the new serial, **3 of the 4 go red**.
  - The fourth (a host after the answer, over another default) was already right there, and it guards the new scoping. M12 turns all four red.
- `test_unregister_clears_the_default_and_its_generation` now registers the same default afresh before the host tries. So it also catches a helper that forgets to reset the record (M15).

## Review round 3: Copilot at `bce09c50`, one finding, taken

- **r4117421102: `current()` read `_registered` twice**, once for its `None` check and once for its answer. A thread that unregistered between the two reads made it answer `None` after passing the check.
  - `generate()` calls it while holding the seam's lock, so that path was safe, but a bare caller was not.
  - Commit `8d507c5b` makes it read the registration into a local once and answer that local. It takes no lock of its own, because `generate()` holds the seam's lock, which is not re-entrant, when it calls it.
- **The regression case** is `test_current_answers_the_registration_it_checked`. A line tracer forces the interleaving deterministically: it drops the registration before every line of `current()` after its first. Against `97b5b01f`'s seam logic it is red, with *"current() answered None after passing its check"*. Mutation M16 is caught by it.
- #57 still takes this head with no conflict. In a trial merge into #57's head `5a6fe637`, 95 seam and projection cases pass.

## The falsifier: the seam tests

T052's falsifier is "seam tests; F5.2 through T059 and T061", so F5.2 is quoted in T059's and T061's PRs, not here. These runs used Python 3.12.3 and pytest 8.4.2, in a venv installed exactly as `validate` installs: `--only-binary :all: -c constraints-cpython312-linux.txt -e ".[runtime,test]"`.

```
$ python -m pytest -q tests/test_generator_seam.py                 # root conftest
71 passed in 1.09s
$ python -m pytest -q tests/test_generator_seam.py --noconftest    # the file stands alone too
71 passed in 0.86s
```

**Red at `main`.** This test file dropped into a `git archive` of `main` `2d116415` fails to collect. The seam does not exist there, which is 5.4's own first line.

```
E   ImportError: cannot import name 'default_generator' from 'opendox' (…/src/opendox/__init__.py)
1 error in 0.24s
```

**The tests bite.** Each of sixteen mutations of the seam or an entry point, run in a throwaway copy of this branch, turns at least one case red:

| mutation | red |
|---|---|
| M1 `serve.build_server()` loses its registration | 2 |
| M2 `cli.build_parser()` loses its registration | 2 |
| M3 `current()` falls back to openDox's own generator | 3 |
| M4 `generate()` drops the kind check | 4 |
| M5 `generate()` passes an undeclared input through | 2 |
| M6 `register()` always overwrites, as `register_home` does | 7 |
| M7 `register_default()` drops the neutral-contract clause | 1 |
| M8 a generation from the default is not recorded | 3 |
| M9 the default's generation is recorded before its call (r4116122388) | 5 |
| M10 a generation from the default is never marked under way | 7 |
| M11 declared inputs are bound only as given (r4116122374) | 1 |
| M12 a generation's end ignores which registration it began under (#57's overview) | 5 |
| M13 a generation under way does not refuse a host | 4 |
| M14 a change of registration keeps the count of generations under way | 5 |
| M15 a change of registration keeps the record of a generation | 2 |
| M16 `current()` reads the registration again to answer (r4117421102) | 1 |

## The repository's own checks

**`validate`, as it now runs.** Since T036 (#52), `validate` runs the whole suite in one `python -m pytest -q --junitxml=…`, then pins the triple. It was run that way here, at `main` `2d116415` and at this head, in venvs installed by its own install line, and the JUnit reports were diffed test by test. This machine has no Postgres, so the database-backed cases skip here where CI runs them. The local skip count is therefore 177 at both, where CI pins 11.

```
main 2d11641:  2302 passed, 177 skipped   (selected 2479, failures 0, errors 0)
this head:      2373 passed, 177 skipped   (selected 2550, failures 0, errors 0)
added: 71 (tests.test_generator_seam, all passed) · removed: 0 · changed outcome: 0
```

The skip count does not move, so CI's exact pin of 11 holds. The number selected rises by the 71 cases, above the floor of 2476.

**F4.1's scan** (`scan_deferred_reaches.py`, sha256 `fe116203…`, byte-identical to research.md's appendix). It prints `19 deferred reaches` at `main` `2d116415` and at this head. The two listings are identical apart from the line numbers the added lines shift. The two new modules make no reach, late or not, and a test asserts that too. `threading` is the standard library's.

## What the later tasks need from the seam

- **T054 (the neutral projection)** replaces `default_generator.generate()`'s refusal with the projection, and keeps its signature `(repo_root, repository, *, source_revision=None, generated_at=None)`. It returns `{"schema_version": 1, "kind": "opendox-snapshot", …}`, and its inputs stay `()` unless it declares one, which must then be optional. It also retires `NeutralProjectionNotBuilt` and `test_openDoxs_own_generator_refuses_until_its_projection_lands`. The stand-in cases keep the "a generation that wrote nothing shuts no host out" rule covered. Its in-process test can generate through `generator_seam.generate(...)` with `default_generator.GENERATOR` registered. #57 takes this head (`8d507c5b`) with no conflict, and it needs no change for review rounds 2 and 3. A suite that generates from the default should `unregister()` between cases, as #57's `tests/test_neutral_projection.py` does, because each registration keeps its own window.
- **T055 (serve and generate standalone)**:
  - It routes `cli.py`'s two `generate_snapshot` calls (`_generate_and_write`, `_gate_snapshot`) through `generator_seam.generate(repo_root, repository, source_revision=…, generated_at=…, project_register_source=…, possibles_source=…)`, and resolves per call rather than holding `current()`.
  - A `None` option is not passed. A given option the registered generator does not declare is refused, as `GeneratorInputRefused`, a `GeneratorSeamError` that `main()` can report.
  - Its openDox-default snapshot registry's regenerate goes through the same call. The seam's own bookkeeping is safe to call from the server's request threads.
  - Its validator lookup picks the schema by the snapshot's `kind`, which is the registered generator's `contract`.
  - Two reaches are not the generator's operation, and the seam deliberately does not carry them:
    - `branch_session.py:1568` reads `iter_changes` and `declared_origin_state`, governed change-enumeration helpers;
    - `cli.py`'s `is_rfc3339_datetime` is a date-time shape check.
    T055 routes both elsewhere.
  - Once a verb generates through the seam, a suite that runs the verb gets openDox's own generator, unless a host registers one first.
- **T059 (openXdox contributes)** registers openXdox's governed generator:

  ```
  generator_seam.register(SnapshotGenerator(contract="ideation-dashboard-snapshot",
                          generate=generate_snapshot,
                          inputs=("project_register_source", "possibles_source")))
  ```

  - `generate_snapshot`'s signature takes the seam's call as it stands. Both declared inputs default to `None`, so the declaration passes both binds, and a test declares and generates through that shape.
  - Its test-only keywords (`git`, `generator_version`, `excluded_documents`) stay undeclared, so the seam never passes them.
  - The registration must come before the first generation in any process that uses openDox's entry points, and not during one, or it is refused.
  - T059's own seam test is `current() is` that declaration.
- **T064 (host wiring)**. The seam needs one explicit registration. openxFactory's `register_openxfactory()` makes only the profile registration today, and the seam does not read the profile. So openxFactory gets openXdox's generator only if something calls `register(...)` in its process: either a one-line host registration in T064, or a hook T059 gives openXdox that openxFactory already calls. T064's line *"It composes openXdox's profile, so none is expected"* should be re-read against this. **The holder decided it (2026-09-27):** T059 registers openXdox's generator from openXdox's own profile-registration path, the hook openxFactory already calls. So T064's line stays true, and T064 needs no host line. The next phase-2 bookkeeping round records it in T059's and T064's text.
- **T057**, once it packages `opendox-snapshot.schema.yaml`, can hold `NEUTRAL_SNAPSHOT_KIND` to the packaged copy's `kind` const.

Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)

🤖 Generated with [Claude Code](https://claude.com/claude-code)


Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
brettheap added a commit that referenced this pull request Sep 29, 2026
…s, f7ee3c76

T053 has landed: openDox-spec#16 squashed as f7ee3c76. The openDox root
now pins it (opensoft/openDox#14, dox-v1.1): its spec gitlink and
contracts/spec-pin.yaml name f7ee3c76, and its contracts/manifest.yaml
records the four files at that commit. T057's falsifier holds each copy
to "the spec-leg commit the openDox root pins", so the record's commit
and the test's SPEC_COMMIT move from #16's head, cd49eb25, to f7ee3c76
together, on the holder's word.

No digest moves.
- f7ee3c76 has cd49eb25's tree (7b00d19e).
- The four copies are byte for byte the files at f7ee3c76.
- The four digests are the ones the root's manifest records there.

The comments in copies.yaml and test_validator_input_set.py now say
what the root pins, and test_validator.py's corpus note names the
landed commit.

Checked:
- Moving SPEC_COMMIT back alone fails 2 of the falsifier's 28 cases, so
  the two still move together or not at all.
- The whole suite: selected=2817 passed=2806 skipped=11, unchanged.

Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
brettheap added a commit that referenced this pull request Sep 30, 2026
**Authored ahead, as a phase-2 draft.** Brett ruled on openxFactory#656, comment `5857365170` ("Start phase 2's independent tasks"), that phase-2 tasks are authored as drafts. **T049 has landed** (openxFactory#1204 → `9d2e5bc3`), so phase 2 is open. T054 is `After: T050, T052, T053`:
- T050 has landed, as `dc3765dd` (#53);
- T052 has landed, as `fa8862cc` (#54);
- T053 has landed, as openDox-spec `f7ee3c76` (#16), and the openDox root pins it (opensoft/openDox#14).

#56 (T051), which this branch also carried, has landed as `86647320`. This PR stays a draft until the holder un-drafts it.

This is plan 034's **T054 (5.1–5.3: openDox's small neutral projection)**, phase-2 slice **P2-P**. I read the plan at openxFactory `main` `d90df42d` (`specs/034-opendox-standalone-operation/tasks.md`), and re-read it at `9d2e5bc3`: T054's entry is unchanged. The slice is claimed on openxFactory#656, comment `5859496321`.

## What this branch carries

- It is **built on #54's branch**, `build/034-p2g-t052-generator-seam` (T052, the generator seam). It was cut at `4ca45d27`, and it now carries #54's final head, `2f515c57`. T054 replaces that seam's placeholder default with the projection.
- **#53 (T050) has landed as `dc3765dd`.** Its tree equals #53's final head, `4ba410ff`, which this branch had merged first. So `main`'s merge (`d97a4aa`) had one add/add conflict, in `tests/test_plain_documents_fixture.py`, resolved to this branch's side. That file differs from `dc3765dd` by T054's three docstring corrections and nothing else. `git diff dc3765d -- <file>` after the merge is byte-identical to `git diff 4ba410f <pre-merge head> -- <file>`.
- **#56 (T051)** is merged at `44dcc3a1`. It adds `tests/fixtures/malformed`, which the holder's T051 rule reads.
- **#56 and #54 have landed** (`86647320`, `fa8862cc`), and `main` `fa8862cc` is merged here as `1a603677`. Its two add/add conflicts, `src/opendox/default_generator.py` and `tests/test_generator_seam.py`, are resolved to this branch's side: in each, main's blob is #54's final blob, so `git diff fa8862c <pre-merge head> -- <file>` equals `git diff 2f515c5 <pre-merge head> -- <file>`. The merged tree is the pre-merge head's, `45ddf9ec`.
- So the diff against `main` is now T054's alone: its commits `25fe7526` through `5a6fe637`, `8e7da4a`, `03e06ccd`, `50b0d42b` and `d7954fc6` (below).

## What it builds

`src/opendox/neutral_projection.py` is new code over `CorpusAdapter`, written to openDox's own needs. It is not openXdox's generator re-expressed, and it imports nothing of openXdox's or openxFactory's.

`default_generator.generate()` keeps its signature. It resolves the home corpus through the home-corpus seam and projects it. Standalone, that corpus is T022's `WorkingTreeCorpus`, a `LocalGitCorpus` (5.2). `NeutralProjectionNotBuilt` and its refusal case in `tests/test_generator_seam.py` are retired, as the brief asks.

The projection writes T053's neutral snapshot, `opendox-snapshot`. The rules it follows:

- **What is a document.** A document is an entry the adapter lists AND classifies.
  - An entry it cannot classify, such as a `Makefile` or an image, is left out unread (holder ruling).
  - An entry whose path the schema's `path-is-repo-relative` rule cannot carry is also left out, and it is reported. Examples are a backslash or a control character in the name.
- **Where a document lands (R1Q13 (a) with (c)).**
  - The station is the one its neutral `stage:` key names. That key is the first line of the leading `Name: value` block. `local_git_adapter.leading_header` reads the block, and it is the same reader the default adapter's `classify` uses.
  - A document that declares no `stage:` is a source.
  - A value outside the six role keys is not a declaration. That includes the empty value and another casing such as `Grouping`. The generator reads the document as a source and reports it on standard error. For example: `notice: grouping-compost-corner.md: its stage: value 'shelved' is not one of the six station role keys (source, grouping, candidate, selection, submission, completion), so it is not a declaration; the document is read as a source`.
- **`title` and `summary`** are copied exactly as the header gives them, the empty value included. They are `null` only where the key is absent. Nothing is coerced, and no document is dropped for lacking them. This is the holder's rule on T051.
- **The topic rule** (named here, as the task asks). A document with a `topics:` header carries exactly the topics it lists: split on commas, whitespace collapsed, and case-folded. It carries none where the header lists none, because an empty header is still a declaration. A document without the header carries:
  - the **words of its name**, where the name is its `title:`, else its first `#` heading, else its file name without the suffix;
  - plus the **words of the name of every other document it mentions**, where mentioning means its text holds that document's name, or its file name, as a run of whole words.
  - A word is a run of three or more letters, case-folded, that is not in `STOPWORDS`. Letters and digits are split apart, so `Q3planning` holds the word `planning`. So the rule needs no front matter at all.
- **Groups.** A group forms wherever **two or more sources share a topic**, and topics shared by the same sources form one group, named `a · b`. A document that declares `stage: grouping` is a group of its own: it gathers itself and every source that shares one of its topics. Each group has **one edge per member document**, naming the topics that matched.
- **The other stations.**
  - A declared candidate is `unselected`. It is claimed by each group it shares a topic with, and its `claim` is its summary.
  - A declared selection is a `staged_topics` entry.
  - A declared submission or completion is a `changes` entry, `active` or `archived`.
  - Each of these lists the document as its file. Ids are unique within each section.
- **`keyword_index`** is written, and it counts exactly the documents that carry each topic.
- **The anchors.**
  - `source_revision` is the revision the caller pins, else the corpus HEAD (holder ruling 5). With neither, `ProjectionRefused`, a `GeneratorSeamError`, is raised.
  - `generated_at` is the caller's value, else that revision's own committer date. It is looked up only for a revision spelled as a hexadecimal object id, so git never reads a revision as an option. Nothing reads the clock.
  - A pin labels the snapshot; it does not choose the bytes. The content is the working tree's, as openXdox's governed generator also records a supplied revision and scans the tree it is handed.

It also changes these files:
- **`display_profile.py`, in one place (batch G's 5.3).** `SNAPSHOT_VALUES`' defaults become the neutral snapshot's values:
  - `document_stage`: `captured` is `source`, and `organized` is `grouping` (holder ruling 1);
  - `register_state`: `unselected`, `selected`, `declined` and `replaced`, which are `NEUTRAL_DISPLAY`'s own candidate words, role for role, so no word is re-authored.
  - `display.js`'s mirror moves with it and keeps its line count, so the web census is unchanged. The governed values move to openXdox's facet in T060 (holder ruling 4: T060's block lands before openXdox moves its openDox pin past T054).
- **The default adapter's field set (R1Q13 (a)).**
  - `local_git_adapter.NEUTRAL_FIELDS = ("title", "summary")`, and `WorkingTreeCorpus` defaults to it. `LocalGitCorpus()` still defaults to `()`.
  - The suffix branch of `classify` reports a field as missing when it is absent or empty, but only when fields are required. So `authoring.required_header_fields()` answers `("title", "summary")` through the entry point.
  - A document without those fields is still read, as a source.
- **The wheel (holder ruling 3).** The grouping tile counts a group's edges. `views/wheel-model.js` uses `tallies.document_links` where a group carries one, as the governed snapshot's groups do, and counts `document_edges` otherwise. The schema is not widened, and the file keeps its line count.

What the fixtures project to:

| repository | documents | groups |
|---|---|---|
| T050's `plain-documents` | 8, all six stations | `barrel · rain` (the two rain-barrel notes), and the declared `Compost corner ideas, gathered in one place` |
| AT-R1's repository (b), no front matter | 3 sources | `budget · roadmap` (all three notes), `meeting · notes` (two) |
| T051's `malformed` | 2 (`EXPECTED_RULE` is not a document) | none |

## After T049: openDox's own scaffold carries the small neutral field set (`8e7da4a`)

**The holder's decision of 2026-09-28.** `render_scaffold()`'s output read as missing `title` and `summary` under `NEUTRAL_FIELDS`, for two reasons: the H1 comes first, so `leading_header()` stops at the blank line after it, and its field is the capitalized `Summary:`. So standalone `agent_capture` refused a document `create` had written, and the projection lost the supplied summary. Copilot raised it on #59 as r4126022820 and reproduced it there. It is fixed here.

**What changed.**
- `authoring.SCAFFOLD_LEAD_FIELDS = ("title", "summary")`. These are the fields a scaffold can lead with, filled from the create's own input. The neutral title drops the family suffix, which stays on the H1.
- `render_scaffold(..., lead_fields=())` writes those fields first, as `name: value` lines, then a blank line, then the governed block unchanged. It refuses a field it has no value for. With `()`, the default, its output is byte-identical to before.
- `create_scaffold()` passes `scaffold_lead_fields()`: the fields of `SCAFFOLD_LEAD_FIELDS` that `required_header_fields()` answers. Under openDox's own default adapter, that is both.

**Why it follows the corpus rather than always leading.** openxFactory's gated create and openXdox's authoring suite pin the governed layout with the H1 on the first line:
- `tests/ideation-dashboard/test_gate_routes.py::test_create_document_lands_the_scaffold_and_the_record` asserts `text.startswith("# Lens launch session — Brainstorm\n")`;
- `tests/test_authoring_agent.py` asserts the same for its own title.

openxFactory's adapter obliges only the governed block's own fields (`Status`, `Kind`, `Summary`, …), which it reads over a 15-line window (`STATUS_SCAN_LINES`). So there the answer is `()`, and the created bytes do not change. That adapter's readers (`classify`, `ideation_readiness._parse_header`, `families._h1`) would read a scaffold with the lead block correctly anyway, since they scan the window and `_FIELD_RE` needs a capital letter. The lead is still left out there, because those pins hold the exact bytes.

**One behaviour change.** `create_scaffold` asks the corpus as `agent_capture` does, so with no home registered it now refuses (`CorpusRefused`, `ADAPTER_NOT_REGISTERED`), naming the seam (4.2). Every create path runs after an entry point registers one. No running test in openDox-code, openXdox-code or openxFactory calls it in a bare process. openXdox's `tests/test_authoring_agent.py` does, but it is in openXdox-code's declared exclusion (`doc_health`), so it runs nowhere today. Its `agent_capture` cases already need a registered home, through `missing_required_headers`.

**Also in `8e7da4a`, the half of openDox-code#53's review that needs T054's rule.** T054's falsifier case now also asserts that `notes-toolshed-inventory.md`, the source outside the rain-barrel pair, lands in no group. T050's own test pins what the topics are derived from, and this pins the projection's reading of them.

**Tests** (`tests/test_neutral_projection.py`, 25 → 29 cases):
- `test_openDoxs_own_scaffold_carries_the_small_neutral_field_set`: under openDox's default, `leading_header()` of the created text is exactly `{title, summary}` and `missing_required_headers()` is `[]`. `agent_capture` accepts the same text, and the projection keeps both documents' title and summary.
- `test_a_scaffold_keeps_the_governed_layout_where_the_corpus_obliges_neither`: under a corpus that obliges the governed fields, `scaffold_lead_fields() == ()`, and the created bytes equal `render_scaffold()`'s default, H1 first.
- `test_the_lead_block_is_the_neutral_fields_in_order_then_a_blank_line`: the order is `SCAFFOLD_LEAD_FIELDS`' whatever the request's, the suffix is dropped, an unknown field is refused, and `NEUTRAL_FIELDS ⊆ SCAFFOLD_LEAD_FIELDS`.
- `test_a_scaffold_with_no_corpus_registered_refuses_and_writes_nothing`.

**Mutations: 8 of 8 killed.**

| mutant | cases red |
|---|---|
| `create_scaffold` passes no lead | 2 |
| `render_scaffold` always leads with both | 3 |
| the neutral title keeps the suffix | 1 |
| the lead is chosen without asking the corpus | 2 |
| an unregistered corpus is read as obliging nothing | 1 |
| the lead order follows the request | 1 |
| an unknown lead field is ignored | 1 |
| the projection keeps its stopwords (a group `the` then absorbs the toolshed note) | 1, the new no-group assertion; the pre-change case passes it |

**The whole suite at `8e7da4a`**, as CI runs it (`CI=true`, `LANG=C.UTF-8`, PostgreSQL 16, `-e ".[runtime,test]"` under the lock):
- `2587 passed, 11 skipped`, triple `selected=2598 passed=2587 skipped=11`;
- that is +9 over `5a6fe637`'s 2589: #54's review rounds after `4ca45d27` added 5 seam cases, and this change adds 4;
- F4.1's scan (`scan_deferred_reaches.py`, sha256 `fe116203…`) is 19 before and after, with the same reaches.

## The falsifier

From T054's entry in tasks.md:

> **Falsifier**: an in-process test that the projection over T050's fixture, with neither sibling importable, validates against T053's schema and carries none of F5.3's declared words; the topic-rule test over a copy of repository (b); and a test that a `stage:` value outside the six is reported and read as a source.

All three are in `tests/test_neutral_projection.py`, first, in that order:

- The first runs in a fresh process with `openxdox`, `ideation_dashboard`, `doc_health` and `corpus_adapter_openxfactory` blocked. The process asserts each one fails to import. `cli.build_parser()` registers openDox's own defaults, and the process generates through `generator_seam.generate()` over a fresh git repository of T050's fixture.
- The schema is `tests/fixtures/opendox-snapshot.schema.yaml`. It is a byte-identical copy of openDox-spec#16's file at `cd49eb25`, held to its sha256 `f9e3e111…584a`, until T057 ships the packaged copy.
- The evaluator ports openDox-spec's own: the keywords the contract uses and its seven reference rules. The leg installs no `jsonschema`.

Python 3.12.3, pytest 8.4.2, in a venv installed with `-c constraints-cpython312-linux.txt -e ".[runtime,test]"`:

```text
test_the_schema_copy_is_openDox_specs_contract_and_matches_the_product PASSED
test_the_projection_over_the_plain_documents_fixture_is_a_neutral_snapshot PASSED
test_the_topic_rule_groups_repository_b_which_has_no_front_matter PASSED
test_a_stage_value_outside_the_six_is_reported_and_read_as_a_source[shelved] PASSED
test_a_stage_value_outside_the_six_is_reported_and_read_as_a_source[Grouping] PASSED
test_a_stage_value_outside_the_six_is_reported_and_read_as_a_source[] PASSED
test_the_malformed_fixture_keeps_its_one_violation PASSED
test_title_and_summary_are_copied_exactly_and_null_only_when_absent PASSED
test_an_entry_the_adapter_cannot_classify_is_not_a_document PASSED
test_a_path_the_schema_cannot_carry_is_left_out_and_reported[back\\slash.md-backslash] PASSED
test_a_path_the_schema_cannot_carry_is_left_out_and_reported[tab\tin-name.md-control character] PASSED
test_declared_topics_replace_the_derived_ones PASSED
test_an_empty_topics_header_declares_no_topic PASSED
test_a_word_is_a_run_of_letters_even_beside_digits PASSED
test_a_declared_group_gathers_the_sources_that_share_its_topics PASSED
test_a_declared_group_with_no_topic_forms_no_group_and_is_reported PASSED
test_station_ids_are_unique_within_a_section PASSED
test_the_anchors_come_from_the_source_revision_and_the_bytes_repeat PASSED
test_a_repository_with_no_commit_needs_a_pinned_revision PASSED
test_the_default_adapter_obliges_the_small_neutral_field_set PASSED
test_required_header_fields_answers_the_neutral_set_through_the_entry_point PASSED
test_the_header_reader_keeps_an_empty_value_and_stops_at_a_blank_line PASSED
test_the_display_defaults_are_the_neutral_snapshots_values PASSED
test_the_wheel_counts_a_groups_edges_where_it_carries_no_tally PASSED
test_the_projection_imports_with_no_sibling_and_no_third_party_module PASSED
25 passed in 5.26s
```

The file also passes under `--noconftest`. F5.3 itself runs `python -m opendox.cli generate`, whose verb reaches the consumer's generator until T055 routes it (`cli.py:90`). So T056 and T063 quote F5.3, and T056 tests the verb's own report of a `stage:` value outside the six.

**Cross-checks.** The snapshots were checked outside this suite in two ways: with `jsonschema` 4.26.0 (Draft 2020-12, format checker and `rfc3339-validator` installed), and with openDox-spec's own `tests/test_opendox_snapshot_contract.py` evaluator. Both agree:
- T050's snapshot has no error, and neither does repository (b)'s;
- T051's has exactly one, `title-and-summary-are-text` at `/documents/1/title`.

## The repository's own checks

- **The whole suite, against a `postgres:16` container** (CI's service and DSN shape), so the database-backed cases run:

  | run | passed | skipped |
  |---|---|---|
  | base `b1946db` (the branch before T054's commits) | 2554 | 11 |
  | head `5a6fe637` | 2578 | 11 |

  The test-by-test JUnit diff has **25 added** (all of `tests/test_neutral_projection.py`, all passing) and **1 removed** (the retired `test_openDoxs_own_generator_refuses_until_its_projection_lands`). **0** outcomes changed.
- **The triple pin** reads: selected 2589 (floor 2476), passed 2578 (floor 2465), skipped 11 (pinned exactly 11).
- **F4.1's scan** (`scan_deferred_reaches.py` over `src/opendox`) finds 19 deferred reaches at `main` and 19 at head. The only difference is line numbers, so T054 adds no reach. The projection imports with every sibling blocked and pulls in no third-party module.
- **Mutations: 18 of 18 killed.**
  - Coerce an empty title to null.
  - Drop the out-of-six notice.
  - Admit any `stage:` value.
  - Map `organized` to `selection`.
  - Turn off mention scanning.
  - List unclassifiable entries.
  - Carry any path.
  - Miscount `keyword_index`.
  - Let a declared group gather non-sources.
  - Read `generated_at` from the clock.
  - Make the default adapter oblige nothing.
  - Count an empty field as present.
  - Make the wheel ignore edges.
  - Start candidates `selected`.
  - Let one source form a group.
  - Ignore the heading for a document's name.
  - Treat an empty `topics:` header as absent.
  - Drop a letter run that sits beside a digit.
- **`tests/test_display_facet.py`: four node-harness cases edited.** Their fixtures carried the governed snapshot values:
  - the partial-override collision;
  - the board's stripe classes;
  - the explorer's stage word;
  - the funnel's search haystack.

  Each now reads the value openDox ships (`SNAPSHOT_VALUES`), and each still tests what it tested. The canvas case's neutral assertion now compares against openDox's own word instead of a value the neutral install can never write.

The PR stays out of `conftest.py`, `pyproject.toml`, `validate.yml`, `README.md` and every pin, and it edits neither `cli.py` nor `serve.py` (T055's single-writer chains).

## Files (T054's own commits)

| file | change |
|---|---|
| `src/opendox/neutral_projection.py` | new: the projection |
| `src/opendox/default_generator.py` | `generate()` projects the home corpus; `NeutralProjectionNotBuilt` is retired |
| `src/opendox/display_profile.py` | `SNAPSHOT_VALUES`' defaults become the neutral values |
| `src/opendox/web/views/display.js` | the mirror of the same defaults (line count unchanged) |
| `src/opendox/web/views/wheel-model.js` | the grouping tile counts edges where no tally exists (line count unchanged) |
| `src/opendox/runtime/local_git_adapter.py` | `leading_header()` made public, `NEUTRAL_FIELDS` added, `WorkingTreeCorpus`'s default field set, missing fields reported in the suffix branch |
| `src/opendox/authoring.py` | `8e7da4a`: `SCAFFOLD_LEAD_FIELDS`, `render_scaffold(lead_fields=)`, `scaffold_lead_fields()`, and `create_scaffold` leading with what the corpus obliges |
| `tests/test_neutral_projection.py` | new: 25 cases, then 29 at `8e7da4a` |
| `tests/fixtures/opendox-snapshot.schema.yaml` | new: T053's schema, digest-pinned |
| `tests/test_generator_seam.py` | the refusal case retired, and its docstring point updated |
| `tests/test_display_facet.py` | four fixtures read the shipped values; one assertion made positive |
| `tests/test_plain_documents_fixture.py` | T050's docstring (merged from #53) says what is true once T054 and T036 are in |

## CI and review rounds

- **CI at `0f42f678` failed one case, and `b2f92226` repairs the test.** The case was `test_the_anchors_come_from_the_source_revision_and_the_bytes_repeat`.
  - CI's git prints `%cI` for a zero offset as `2026-09-27T12:00:00Z`, and git 2.43.0 prints `2026-09-27T12:00:00+00:00`.
  - The projection records the stamp exactly as git spells it, and the schema admits both spellings.
  - The test compared the stamp to the fixture's date as a string. It now compares them as instants. Its first assertion still holds `generated_at` to the checkout's own `git show` output.
- **Copilot at `0f42f678`: three threads, all taken in `c0747e96`, answered and resolved.**
  - `r4117298988`: an empty `topics:` header fell back to derived topics, which contradicted the rule the module states. It is now a declaration that carries no topic. The new case is `test_an_empty_topics_header_declares_no_topic`, and it fails under the old rule.
  - `r4117299013` and `r4117299033`: T050's test docstring said T054 had not landed, which T054 makes false. It also said the suite ran outside `validate`'s explicit list, which has been false since T036 (#52). It now says what is true. Only the docstring changes.
- **Copilot at `c0747e96`: one thread, answered and resolved, plus one overview remark taken in `5a6fe637`.**
  - `r4117331489` asked that a supplied `source_revision` be passed into the `CorpusRef`. That is not taken, on the product's own contract:
    - the seam and the CLI define the value as an anchor to pin, and openXdox's governed generator records it and scans the tree it is handed;
    - the holder ruled that content comes from the working tree, per Brett's T022 ruling.
    - `default_generator`'s docstring now states the rule in its own paragraph.
  - The overview's remark that digit-adjacent names were tokenized wrongly was right. Letter runs and digit runs are now separate tokens, as the docstring's "a run of three or more letters" says. The new case is `test_a_word_is_a_run_of_letters_even_beside_digits`, and it fails under the old tokenizer.
  - The same overview says the seam's "replacement-generator tracking can reject valid registrations". That is `generator_seam.py`, which is #54's (T052's) code, with no thread here. It is flagged to the holder, not changed here.
- **Copilot at `1a603677` (the merge of `main`): 1 thread, taken in `03e06ccd`.**
  - r4139383472: the lead block interpolated `title` and `summary` as given, so `summary="ok\nstage: completion"` wrote a line `leading_header()` reads as the document's own `stage:`.
  - `render_scaffold()` now refuses a lead value carrying a control character (`Cc`) or a line or paragraph separator (`Zl`, `Zp`), before anything is rendered, so `create_scaffold` writes nothing. With no lead block nothing new is refused.
  - `test_a_lead_value_that_is_not_one_header_line_is_refused`: 20 cases, all red against `1a603677`. Local whole suite: `selected=2618 passed=2607 skipped=11`.
- **Copilot at `03e06ccd`: 2 threads, both taken in `50b0d42b`.**
  - r4139523226: the `kind_field` vocabulary counted a field with an empty value as present. `_classify_by_header` now uses the suffix path's test, so an empty value is no field in both. `test_an_empty_field_is_missing_whichever_vocabulary_is_in_force`, red against `03e06ccd`.
  - r4139523258: `_commit_date` ran a bare `git`. `LocalGitCorpus` exposes its `executable`, and the date is read with the home corpus's own git. `test_the_commit_date_is_read_by_the_home_corpus_s_own_git`, red against `03e06ccd`.
- **Copilot at `50b0d42b`: 2 threads.**
  - r4139607560, taken in `d7954fc6`: a `DocumentId.key` is opaque to the adapter interface, and the projection read every key as a path. An adapter now declares `document_keys_are_paths = True` (`neutral_projection.PATH_KEYS`), `LocalGitCorpus` does, and `project()` refuses any other with `ProjectionRefused`. `test_an_adapter_whose_keys_are_not_declared_paths_is_refused`, red against `50b0d42b`.
  - r4139607585, not taken: it does not reproduce. A path reaches the invalid-stage notice only after `_unwritable()` refuses every control character, so such a path is named by its `repr` and left out first.
- **Copilot at `d7954fc6`: "Needs a closer look", no findings, 0 threads.** CI is green, with `selected=2621 passed=2610 skipped=11 failures=0 errors=0`.

## What the later tasks need

- **T055** (`cli.py`/`serve.py` single writer):
  - The scaffold mismatch #59 raised (r4126022820) is fixed here, in `8e7da4a`. #59 takes it with this branch's head.
  - Route the generate verbs through `generator_seam.generate()`.
  - `_default_home_factory`'s docstring in `cli.py` (around line 877) and `serve.py` (around line 1520) still says the default adapter has bare defaults and that "T054 sets the neutral fields". `WorkingTreeCorpus()` now carries `NEUTRAL_FIELDS`, so that sentence needs correcting.
  - `_report` prints `project=` from a field that the neutral kind does not have. It reads the field with `.get`, so it shows `<ungrouped>`.
- **T056**:
  - The verb's report of a `stage:` value outside the six is the `notice:` line that `default_generator.generate()` writes to standard error. Once T055 routes the verb, it needs no further plumbing.
  - The F5.3 sweep over T050's snapshot is clean in process.
- **T057**: this PR's schema copy is replaced by the packaged copy once T057 ships it.
- **T058**: the malformed fixture yields exactly one violation, `title-and-summary-are-text` at `/documents/1/title`, and `EXPECTED_RULE` is not a document.
- **T060**: the governed `values` block, as T053's writer listed it.

Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)

🤖 Generated with [Claude Code](https://claude.com/claude-code)


Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
brettheap added a commit that referenced this pull request Sep 30, 2026
…) (plan 034) (#58)

Plan 034 (`specs/034-opendox-standalone-operation/tasks.md`, read at openxFactory `main` `6b97c601`), phase-2 slice **P2-V**, its one task: **T057** (#1144's 7.1, 7.1a, 7.1b and 7.2, with 7.1 as T007's batch G amends it). Claimed on openxFactory#656 in `5873510118`.

**Authored ahead, as a phase-2 draft** (Brett 2026-09-27: "Start phase 2's independent tasks"). **T049 has landed** (openxFactory#1204 → `9d2e5bc3`), so phase 2 is open. Both steps it waited on are done:
- **T053 has landed**: openDox-spec#16 → `f7ee3c76`;
- **the openDox root pins that commit**: opensoft/openDox#14 (dox-v1.1) → `52005213`. `e94ab323` moves the record and `SPEC_COMMIT` to it (below).

#57 (T054) has landed too, as `a691e4e4`, and `main` is merged here. This PR stays a draft until the holder un-drafts it.

- **Ruled**: R1Q22 (a), `5817152735`; R1Q12 (a), `5850003126`.
- **After**: T049, T009, T053.

## The stack

This PR was **stacked on #57** (T054), and is now based on `main`: it was retargeted before #57 landed, and #57 landed as `a691e4e4`. The diff below is T057's alone. #57's head `8e7da4a2` was merged here as `27bcefc`, after T049 landed. #57 has since merged `main` `fa8862cc` as `1a603677`, which has `8e7da4a2`'s tree.

- #53 (T050), #56 (T051) and #54 (T052) have landed, as `dc3765dd`, `86647320` and `fa8862cc`. #57's branch carried their final heads' content before they landed.
- T057 needs the seam: the validator's neutral kind is held to T052's `generator_seam.NEUTRAL_SNAPSHOT_KIND`, and the in-process checks run openDox's own projection over T050's and T051's fixtures.
- **Before #57's branch is deleted at its landing, retarget this PR to `main`.** A `--delete-branch` on #57 would close this PR. Then merge `main` in.

## What it does

- **`src/opendox/contracts/`: the input set (7.1, 7.1b).** It holds the four packaged copies, which are openDox's own spec leg's four: `ideation-workbench`, `opendox-snapshot`, `xfactory-workbench-chat-turn` and `xfactory-workbench-model-catalog`.
  - Each copy is byte for byte openDox-spec's file at `f7ee3c76`, T053 as landed and the spec commit the openDox root pins. That commit carries all four. It has the tree of #16's last head, `cd49eb25`, where the copies were first taken. Its three older files are the blobs of the root's previous spec pin, `8fe8c4c7`.
  - `copies.yaml` is the record: the spec-leg commit, and each copy's path and sha256. A copy is read only after its sha256 is proved against the record. A changed, absent or unpinned copy is refused before a byte of it is parsed (`neutral-product-pin`'s rule for a vendored contract).
  - `gate-intent` and `ideation-possibles-register` are not in the set, and neither are the other four schemas of the family. A record that names any copy other than the four, or leaves one out, is refused (`COPY_IDS`), so no edit to the record lets one in.
  - The record and the four copies ship as package data, under a new `opendox.contracts` key in `pyproject.toml` (below).
- **`src/opendox/validator.py`: the validator, new surface at the code leg (7.2).**
  - It evaluates JSON Schema 2020-12, exactly the keywords the four copies use. `format: date-time` is asserted, as the consumer's validator asserts it.
  - A copy that uses a keyword, format, dialect or reference it does not evaluate is refused when its validator is built, never evaluated with that keyword left out.
  - So is a keyword holding a value of another shape, an embedded resource, a subschema that contains itself, and a reference cycle that never moves into the instance. A malformed copy is refused as unavailable, never a crash (below). An instance whose keys are not text, which YAML allows, is judged and never crashed on, and so is a value of any size or depth.
  - A refusal names its rule: `[<x-rule>] <where>: <detail>`.
  - It implements the neutral snapshot's seven reference rules. A snapshot validator is refused if the contract's catalog and the implemented rules differ.
  - `validators()` answers one validator per wire kind, with the jsonschema-shaped `iter_errors()` that the doxBench seam's readers use, built as openxFactory's `doxbench_contracts` builds its own (T085).
  - Its docstring records why the consumer's script cannot be reused (7.1a), measured at openXdox-code `4610bca5` (below).
- **`tests/test_validator_input_set.py`** is the falsifier (28 cases). **`tests/test_validator.py`** tests the evaluator (185 cases).
  - `tests/fixtures/spec-examples/` is its corpus, openDox-spec's own examples at `cd49eb25`. It holds 13 positives of three kinds (2 `opendox-snapshot`, 5 chat-turn and 6 model-catalog) and the neutral contract's 32 negatives, one per rule. All 45 are verified as the spec leg's exact blobs.
  - **The spec leg's two `ideation-workbench` examples are not carried.** This leg's committed-manifest guard (`workbench.committed_manifests`, held by `tests/test_workbench.py::test_no_workbench_manifest_is_tracked_in_this_repo`) refuses a workbench manifest tracked anywhere but the root's `examples/` and `contracts/schemas/`. CI went red on them at `97b314a` (run `36450791192`), and `69f2040` removes them.
  - The kind is held instead over the manifests openDox's own `workbench.Workbench` writes: one per seed kind, each with every member route, an exclusion, every action and a notebook binding. An override with no recorded reason is refused as `[required]` at its member. The cross-check below still covers the two examples, read from the spec leg's own tree.

No skip is added, since `EXPECT_SKIPPED` is exactly 11. It touches no `openspec/changes/` path, no `conftest.py`, no workflow, no `README.md` and no pin. Its one `pyproject.toml` change is the package-data key, on the holder's decision (below).

## The falsifier

T057's falsifier is *"the packaged-copy digest test and the 7.1b test"*. At `80b5f9e`:

```
tests/test_validator_input_set.py::test_each_packaged_copy_is_the_spec_legs_file_at_the_pinned_commit PASSED [ 50%]
tests/test_validator_input_set.py::test_gate_intent_and_the_possibles_register_are_not_in_the_set PASSED [100%]
============================== 2 passed in 0.16s ===============================
```

Both go red when they should. In a scratch clone of `ca52182` I changed one byte of the neutral copy (byte 10181, `i` to `I`) and planted a `gate-intent` copy beside the four:

```
E           AssertionError: src/opendox/contracts/schemas/opendox-snapshot.schema.yaml is b9f3074a6d7d7670289e2a6d048169550a8571820dd8dba72acf4cd52ee9b72b, and the record pins f9e3e111af1d4bd4c377c933027d81b582ae2b0a395b66f4e4621992454a584a. A copy is never edited in place
E           AssertionError: a copy of gate-intent is carried under src/opendox/contracts/schemas/, which 7.1b refuses: requirement 1 keeps it with openxFactory
FAILED tests/test_validator_input_set.py::test_each_packaged_copy_is_the_spec_legs_file_at_the_pinned_commit
FAILED tests/test_validator_input_set.py::test_gate_intent_and_the_possibles_register_are_not_in_the_set
2 failed in 0.46s
```

The two tests' assertions that went red there are unchanged since. `9d2cda1` adds one assertion to the 7.1b test: `COPY_IDS` names neither schema.

**The digest test holds each copy to the spec-leg commit the openDox root pins.** The test states the root's digests apart from the record, so a copy and its recorded digest cannot move together unseen.

- All four are the digests the root's `contracts/manifest.yaml` records at its spec pin `f7ee3c76` (the root's `main` at `52005213`, opensoft/openDox#14).
- The three older ones are unchanged from the previous spec pin, `8fe8c4c7` (the root's `main` at `663ac683`).

Read with `git show <commit>:contracts/schemas/<file> | sha256sum` in openDox-spec:

| copy | sha256 at `8fe8c4c7`, `cd49eb25` and `f7ee3c76` | the root's manifest at `52005213` |
|---|---|---|
| ideation-workbench | `d30438491119…faafc` | same |
| xfactory-workbench-chat-turn | `350bfedc0269…1dc1d` | same |
| xfactory-workbench-model-catalog | `e563cc9fc6ed…21635` | same |
| opendox-snapshot | absent at `8fe8c4c7`; `f9e3e111af1d…4a584a` at `cd49eb25` and `f7ee3c76` | same |

## The package-data line (on the holder's decision)

7.1 ships the four as **package data**. `pyproject.toml` used to package only `web/**`. On the holder's decision, this PR now carries the new key: openDox-code's phase-1 work has landed, so no phase-1 writer edits `pyproject.toml` any more. It is its own key beside the bundle's line, which `test_gate_loop_contributed` holds verbatim:

```toml
opendox = ["web/**"]
"opendox.contracts" = ["copies.yaml", "schemas/*.schema.yaml"]
```

`test_the_package_data_ships_the_record_and_every_copy` lands with it. It holds the table to the record: the patterns under `opendox.contracts` ship exactly the record and every copy the record pins. At `ca52182`, where the line landed (the test is unchanged since):

- It passes.
- With only the key line removed, it fails (`KeyError: 'opendox.contracts'`).
- With a stray schema planted under `schemas/`, it fails, because the patterns would ship a file the record does not pin.

The test parses `pyproject.toml` and builds no wheel. The install-level evidence is real wheels: each built with `pip wheel . --no-deps` from a clean clone, installed into a separate venv and probed from outside any source tree. The two module digests are the head's own files. The probe's `opendox from:` lines are left out; each showed the run importing from its venv's site-packages.

```
== wheel built from 80b5f9e
opendox/contracts/__init__.py  sha256 5b85edfe427e
opendox/contracts/copies.yaml
opendox/contracts/schemas/ideation-workbench.schema.yaml
opendox/contracts/schemas/opendox-snapshot.schema.yaml
opendox/contracts/schemas/xfactory-workbench-chat-turn.schema.yaml
opendox/contracts/schemas/xfactory-workbench-model-catalog.schema.yaml
opendox/validator.py  sha256 9e6fc2974398
kinds: ['ideation-workbench', 'opendox-snapshot', 'workbench-chat-turn-v2', 'workbench-chat-turn-v2-failure', 'workbench-chat-turn-v2-success', 'workbench-model-catalog']
six-stations: no violation
title negative: ["[title-and-summary-are-text] /documents/2/title: '' is shorter than 1"]
rc=0
```

Compared with a wheel built without the line, it adds exactly those five data files and removes nothing: 106 entries outside `dist-info` become 111, and the 41 `opendox/web/` entries are unchanged. Without the line, an installed validator refused. That was measured at `69f2040`, before the line landed:

```
== wheel without the held line
opendox/contracts/__init__.py  sha256 b264a03b6f5b
opendox/validator.py  sha256 f620194b0b4f
UNAVAILABLE: opendox.contracts has no copies.yaml: the package was built or installed without it (FileNotFoundError)
rc=3
```

Copilot's two findings, at `97b314a` and again at `69f2040`, were this line. Both threads were answered twice, with the held measurement and then with `ca52182`, and both are resolved.

## The fail-closed build (Copilot's findings at `ca52182`, `bc3470b`, `2b32cbf`, `9d2cda1` and `4474514`)

The module promises that a copy it cannot evaluate is refused when its validator is built, as `SchemaNotEvaluable` (a `ValidatorUnavailable`). Copilot's review at `ca52182` found a hole in that promise, in code unchanged since `d89f252a`: `type: {}` made `set(names)` raise `TypeError` during the build. I probed the same class with 40 malformed values. At `ca52182`:

- 5 crashed the build: `type: {}`, `type: [["string"]]`, `format: {}`, `allOf: 5`, and two non-text unknown keys (a mixed sort). A pattern with an unbounded repetition crashed it too (`OverflowError`).
- 30 built. Of those, 20 then crashed on an instance. The other 10 judged instances by a value draft 2020-12 does not allow: `uniqueItems: "yes"` read as true, `maxLength: -1` refused every string, and `maximum: nan` passed everything.
- 5 were refused.

`bc3470b`'s commit message says twenty-three of them built. The probe's count is thirty.

At `80b5f9e` all 40 are refused, and so are these:

- Every evaluated keyword's value is checked against the shape draft 2020-12's metaschema gives it (`_SHAPES`). A test holds `_SHAPES` to `KEYWORDS`, so no evaluated keyword goes unchecked.
- Every reference's target, and the kind's entry, is walked like the document. A reference can reach a node no walk of the subschemas passes, such as one inside an `enum`.
- An embedded resource (`$id` or `$schema` below the root) is refused, since it would move where its references resolve.
- A subschema that contains itself, which a YAML alias can build, is refused where it loops.
- A JSON-pointer index that is not a plain decimal (`-1`, `01`) names nothing. Python's `int()` would read another element.
- **From Copilot's review at `bc3470b`:** a reference cycle that never moves into the instance, such as `$ref: "#"` or two `$defs` that refer to each other, is refused, naming the cycle. jsonschema 4.26.0 recurses on those until Python's limit. A recursive schema that moves into the instance before it recurs, such as a tree whose children are items, is still evaluated. A copy nested deeper than Python's recursion limit is refused too.
- **From Copilot's review at `2b32cbf`:** a JSON-pointer token whose `~` is not `~0` or `~1` makes no pointer (RFC 6901). A `$ref` carrying `%` is refused as a percent-encoded fragment this module does not decode. At `2b32cbf`, `#/$defs/a%20b` read the literal key `a%20b` and passed `5`, where jsonschema decodes it to `a b` and fails `5`. The same review's record finding is under the input set above.
- **From Copilot's review at `9d2cda1`:** the record's key refusal ran `sorted()` over a record's keys, so a key that is not text raised `TypeError`. It now orders keys by their `repr`. An instance fuzz of the same class found worse at evaluation: under `additionalProperties: false`, the report ran `sorted()` over an instance's extra keys, and 115 of 3,000 odd instances crashed a validator. Those keys are ordered by `repr` too. YAML nested past Python's recursion limit escaped the three YAML reads (the record's, `contracts.load()` and `validator_for()`) as `RecursionError`, and each now refuses it.
- **From Copilot's review at `4474514`:** a bound past a float's range, such as a 400-digit YAML integer, crashed the build in `math.isfinite()`, and every int is now finite. A `const` or `enum` that contains itself is refused. On the instance side, equality was judged on nested tuples, which CPython compares recursively, so an instance value 5000 deep crashed its judgement. The canon is now text, built without recursing and compared as text, and it keeps JSON equality. A violation's detail always shows something, and PyYAML's `ValueError` (an integer past 4300 digits, an impossible date) is refused by all three YAML reads.
- `bc3470b`'s review also found that `enum: []` and `required: []` should be refused. Those two findings are not taken. Both are valid 2020-12 schemas. The metaschema gives `enum` no `minItems` and gives `required` `default: []`; the `minItems: 1` was draft-04's. jsonschema treats both as this validator does, and their threads carry the evidence.

The four copies use none of the refused forms: they have no anchors or aliases, no nested `$id` or `$schema`, only integer counts, and references only into `$defs`. All six kinds build as before. Of the 58 new cases through `2b32cbf`, 57 fail against `ca52182`'s validator and pass here. The 58th, the recursive tree, passes on both, as the guard against over-refusing. `9d2cda1`'s four new refusal cases fail against `2b32cbf`'s code, and its escape case passes on both, as the same kind of guard. `4474514`'s four new cases fail against `9d2cda1`'s code. `80b5f9e`'s six new refusal and depth cases fail against `4474514`'s code. Its canon-equality case passes on both, as the guard that JSON equality is unchanged.

## After T049: Copilot at `27bcefc0`, one thread, taken in `bf51a30a`

- **r4136329332: an instance deeper than the walk raised `RecursionError`.** A recursive schema that moves into the instance (a tree whose children are items of the node) recurs once per level of the instance, and the build accepts such a schema. Measured at `27bcefc0` with this module's own tree schema, at the default limit of 1000: 100 levels judged, and 200, 300, 400, 1000 and 5000 levels raised.
- **Now judged, not crashed on.** `KindValidator.iter_errors()` catches the `RecursionError` from the walk, once the walk's frames have unwound, and yields one violation, `[evaluation-depth] <root>: …`. Its rule, `DEPTH_RULE`, is exported. So the instance is never valid, which fails closed.
  - What the walk found before the limit stands, and the reference rules still run.
  - `violations()`, `is_valid()` and `validate()` all go through it.
  - The evaluator stays recursive, because rewriting it on an explicit stack would put the 0-disagreement cross-check at risk. A tree the walk reaches is judged as before.
- **The regression case** is `test_an_instance_deeper_than_the_walk_is_judged_not_crashed_on`.
  - A 50-level tree is valid.
  - A 5000-level one yields exactly the depth violation, at the root.
  - With a node near the top broken, both `("required", "/children/0")` and the depth violation are named.
  - Against `27bcefc0`'s validator the case raises `RecursionError`. A mutant that swallows the error silently fails it too.
- **The whole suite at `bf51a30a`:** `selected=2812 passed=2801 skipped=11`, which is +1. F4.1 reads 19.

## Copilot at `bf51a30a` ("Needs a closer look", no thread): taken in `6b68e32a`

- **"Previously missed": a bound of any size crashed the violation's detail.** `_is_bound()` admits an integer of any size, so a schema with `minimum: 10**5000` builds. But eight details (`minimum`, `maximum`, `minLength`, `maxLength`, `minItems`, `maxItems`, `minProperties`, `maxProperties`) put the bound into the text directly. So validating `0` against that schema raised `ValueError`, Python's 4300-digit limit on int-to-text, while the violation was being written.
  - Reproduced for `minimum`, `maximum` (at `-10**5000`), `minLength`, `minItems` and `minProperties`. The three max counts cannot fire at such a size.
- **Now each bound is shown through `_brief()`**, as the instance's value already was, so a huge one reads `<an int of 16610 bits>`. An ordinary bound reads exactly as before, since `_brief(5)` is `"5"`.
- **The regression case** is `test_a_violations_detail_shows_a_bound_of_any_size`, five cases, which all fail against `bf51a30a`'s validator, plus an ordinary-bound check.
- **CI at `6b68e32a`:** `validate` and SonarCloud are green, with `selected=2817 passed=2806 skipped=11 failures=0 errors=0`, which is +5.

## Copilot at `6b68e32a`: "Needs a closer look", no findings, 0 threads

- The overview's one line reads *"Require `audit_ref` whenever the `provider_retry` object is present."* It is **not taken, on the holder's ruling** (2026-09-29), and answered in [this comment](#58 (comment)). The note opened no thread.
  - `provider_retry` is in `xfactory-workbench-chat-turn.schema.yaml`, one of the four packaged copies. That copy must stay byte for byte the spec leg's file, now the file at `f7ee3c76`. Its sha256 (`350bfedc…`) is the one `copies.yaml` and the root's manifest record. Requiring `audit_ref` in the copy alone would break the falsifier this PR exists for.
  - `audit_ref` is optional by the contract (`required: [retried, at_most_once]`), and `serve_wire.py` writes it only when it has one. Making it required is a contract change for the spec leg and its owner, not for T057.

## After the root step: `e94ab323`

- **T053 landed** as openDox-spec `f7ee3c76`, a squash of #16 whose tree is `cd49eb25`'s (`7b00d19e`). **opensoft/openDox#14 moved the root's spec pin to it.** The root's `spec` gitlink and `contracts/spec-pin.yaml` name `f7ee3c76`, and its `contracts/manifest.yaml` records the four files at that commit, with the four digests above.
- **`e94ab323` moves `copies.yaml`'s `commit` and the falsifier's `SPEC_COMMIT` from `cd49eb25` to `f7ee3c76`, together**, on the holder's word. No digest moves. Each of the four copies is `cmp`-identical to the file at `f7ee3c76`. The comments that say what the root pins now say it, and `tests/test_validator.py`'s corpus note names the landed commit.
- Moving `SPEC_COMMIT` back alone fails 2 of the falsifier's 28 cases, so the two still move together or not at all.
- The whole suite at `e94ab323`: `selected=2817 passed=2806 skipped=11`, unchanged.

## After #57 landed: `1433234`, `cb40b977` and three review rounds

- **`1433234` merges #57's final head `d7954fc6`**, with no conflict. T057's own diff against it is byte-identical to its diff against `8e7da4a2`: 55 files, +6320. **`cb40b977` merges `main` `a691e4e4`**, whose tree is `d7954fc6`'s, so it adds no content.
- **Copilot at `cb40b977`: 2 threads.**
  - r4139739110, taken in `3351f6a7`: YAML builds values JSON has not (sets, bytes, dates, non-text keys, non-finite numbers), and `const`/`enum` were checked only for self-containment. `_first_non_json()` now refuses them at build. `test_a_const_or_enum_that_holds_a_value_json_has_not_is_refused`, 6 cases, red against `cb40b977`.
  - r4139739167, not taken: four documents in the six-stations example carry `water`, so its count of 4 is right, the validator finds no violation there, and the file is byte for byte openDox-spec's at `f7ee3c76`.
- **The T058 writer's measurement (openDox-code#68, r4139734412), taken in `2b8ad245`:** a packaged record or copy that is present but unreadable raised `PermissionError` out of `validator_for()`. Every `OSError` in `_read_package_file` is now a `CopyRefused`, and a missing file keeps its message. `test_a_present_file_that_cannot_be_read_is_refused_not_raised`, over the record and the snapshot copy at mode 000 (skipped as root), red against `3351f6a7`.
- **Copilot at `2b8ad245`: 3 threads.**
  - r4139823704 and r4139823779, taken in `753ffa19`: an instance key of `10**5000` has no decimal text, so a pointer beneath it, and the unexpected-properties report, raised `ValueError`. Pointer parts fall back to `_shown`, and extra keys are ordered and shown item by item (`_brief_items`). `test_an_instance_key_of_any_size_is_named_not_crashed_on`, red against `2b8ad245`.
  - r4139823750, not taken: a tuple key canonicalizes as an opaque value, and `enum` and `uniqueItems` judge it without crashing. `test_a_non_text_key_that_is_not_a_scalar_is_judged_as_itself` guards it.
- **Copilot at `753ffa19`: "Needs a closer look", no findings, 0 threads.** CI is green, with `selected=2850 passed=2839 skipped=11 failures=0 errors=0`.

## 7.1a, measured

The consumer's `scripts/validate-ideation-dashboard-contracts.py`, run at openXdox-code `4610bca5`:

```
== no CONTRACTS_DIR, one openDox snapshot example
ERROR harness failure: .../contracts/schemas carries none of the family's 10 schemas (this tree carries no contracts/ and CONTRACTS_DIR is not set; export it as the spec leg's contracts directory), so nothing can be validated and no mode may report success
rc=2
== CONTRACTS_DIR = openDox-spec's contracts (all four there), the same example
ERROR [kind] .../opendox-snapshot-six-stations.example.yaml: unrecognized document (no known kind, no 'possibles_register' section)
rc=1
```

The docstring's six reasons are: it finds its schemas from its own position; it names ten schemas of three owners; it is the consumer's file; it needs `jsonschema`, `referencing` and `rfc3339-validator`; it knows no `opendox-snapshot`; and it is a subprocess script, where openDox-code has no `scripts/`.

## Verification

- **CI at `80b5f9e`**: `validate` (run `36471401716`) and SonarCloud are green.
- **The whole suite**, locally, as CI runs it (`CI=true`, `LANG=C.UTF-8`, PostgreSQL 16, `-e ".[runtime,test]"`), at the committed head with a clean tree. The base is #57's head, `5a6fe637`: **2578 passed, 11 skipped**. At `80b5f9e` it is **2791 passed, 11 skipped**. At `27bcefc`, after #57's head `8e7da4a2` was merged in, it is **2800 passed, 11 skipped** (`selected=2811`). That is #57's own 2598 plus these 213.
  - The case-by-case junit diff shows **+213 added** (185 and 28), all passed and all in the two new files. It shows **0 removed and 0 changed outcomes**, and the same 11 skips.
  - `--noconftest` passes too (213).
  - CI was red at `97b314a` on one case: the committed-manifest guard, over the two workbench examples then carried (above). My earlier local whole-suite run had passed because it ran before those files were committed, so these runs are at the committed head.
  - `LANG=C.UTF-8` is set because CI's runner sets it. In a shell with no locale, `test_model_provider_broker::test_the_broker_child_inherits_no_credential_shaped_environment` fails at `ca52182` and here alike, because Python's C-locale coercion (PEP 538) puts `LC_CTYPE` in the broker child's environment. That is the shell, not this PR.
- The cross-check, both fuzzes, the scan and the mutation check below all ran on `80b5f9e`'s committed source.
- **Against jsonschema and the spec leg's own evaluator**, over every one of openDox-spec's 86 examples at `cd49eb25`, all kinds, positives and negatives: **0 disagreements**.
  - jsonschema 4.26.0 ran with its format checker, per kind as openxFactory builds its validators.
  - For the neutral kind, the rules found equal the spec leg's `tests/test_opendox_snapshot_contract.py` evaluator's (rule, place) exactly, and equal jsonschema's read through `error.schema`'s `x-rule`.
  - The two examples whose kind is not openDox's raise `UnknownKind`.
- **Mutation fuzz**: 12,000 seeded random edits of the positive examples, compared as (keyword, place) against jsonschema, gave **0 disagreements** beyond one deliberate divergence, met 26 times. `rfc3339-validator` anchors with `$`, so it admits `...Z` followed by a newline, and this validator refuses it. That divergence is documented in `_is_date_time`, and the snapshot contract's own patterns guard the same tail.
- **Instance fuzz**: 6,000 instances over two seeds, each a positive example with an odd value planted somewhere. The values are non-text keys, sets, timestamps, bytes, NaN and infinity, lists 5000 deep, self-containing lists and mappings, and 5000-digit ints. All six validators gave **0 crashes**, where 115 of the first seed's 3,000 crashed at `9d2cda1`.
- **Mutation check**: 77 mutations of the two new modules, each killed by the new tests (77/77), with the sources restored and verified by sha256. One mutant, the cycle search blind to its own trail, loops allocating. The run caps each mutant at 4 GiB, and that one failed there.
- **F4.1's deferred-reach scan**: 19 at the base and 19 here, with the same list. The two new modules reach nothing. With every sibling blocked, the validator imports and validates, and it adds no third-party module beyond PyYAML.

## For the later tasks

- **T058** (the post-render validator in the generate verbs):
  - call `opendox.validator.validate(snapshot, kind=<the generator's declared contract>)`, and print `validator.report(...)` on stderr;
  - `ValidatorUnavailable` is the "could not run" case, which `--strict` makes fatal;
  - T051's fixture reports `[title-and-summary-are-text] /documents/1/title`;
  - `tests/test_neutral_projection.py` should read this packaged copy (`opendox.contracts`) in place of T054's `tests/fixtures/opendox-snapshot.schema.yaml`.
- **T055** (`validate_manifest` for `ideation-workbench`):
  - This validator checks the manifest against its schema. It does not check the old script's two workbench rules (pinned ⊆ checked, the schema's own VALIDATOR RULE comment; `new_candidates` disjoint from members ∪ excluded), nor its committed-manifest guard. So routing `validate_manifest` here drops those rules unless T055 carries them.
  - `test_every_manifest_openDox_own_workbench_writes_validates` holds the manifests `workbench.Workbench` writes to pass here: every seed kind, every member route and every action, with an exclusion and a notebook binding.
- **T085** (doxBench defaults): register `opendox.validator.validators` at `serve_wire.register_doxbench_validators`. The semantic rules of the two wire kinds are still T085's.
- **T061**: nothing from T057 is needed. The consumer's three schemas stay out of this set.
- **The openDox root**:
  - its `contracts/manifest.yaml` says the code leg *"carries no `contracts/` path at all"*, which is no longer true of `src/opendox/contracts/`;
  - nothing at the root holds these copies to its spec pin, so T062's `make pins` could gain that check.

## Before READY (not this PR's act)

1. ~~T049 lands.~~ Done: openxFactory#1204 → `9d2e5bc3`.
2. ~~T053 lands, and its root step moves the openDox root's spec pin. Then `copies.yaml`'s `commit` and the test's `SPEC_COMMIT` move to that commit together.~~ Done: T053 → `f7ee3c76`, opensoft/openDox#14 → `52005213`, and `e94ab323` moves the two together, with no digest moved.
   - The holder's answer (2026-09-29) stood throughout: T057's falsifier says "the spec-leg commit the openDox root pins", so the record moved only once the root pinned T053's landed commit.
3. ~~#57 (T054) lands, with this PR retargeted to `main` first.~~ Done: retargeted, #57 → `a691e4e4`, and `main` merged in as `cb40b977`.

Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)

🤖 Generated with [Claude Code](https://claude.com/claude-code)


Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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