Repository navigation
§ 3.4 S3: the view registry — ViewBinding + collectViewBindings on the § 2.4/§ 4.3 seams, one view wired - #14
Conversation
… 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>
Reviewer's GuideImplements the S3 front-end view registry as a Python authority and JavaScript mirror, then wires the shell's core views and optional gate bar through the collected registry while preserving empty-column behavior and validating the seam with Python, Node, drift, and end-to-end tests. Sequence diagram for collecting and resolving a view bindingsequenceDiagram
participant App as app.js
participant Registry as view_extension.js
participant Caps as capabilities payload
participant Module as View module
App->>Caps: read probed capabilities
App->>Registry: contributedViewBindings(caps)
Registry-->>App: consumer bindings or empty array
App->>Registry: collectViewBindings(core and consumer bindings)
alt binding collision or invalid declaration
Registry-->>App: ViewBindingError
else valid registry
Registry-->>App: collected views
App->>Registry: resolveView(views, gate.bar)
alt optional binding absent
Registry-->>App: null
App->>App: render without gate bar
else binding present
Registry->>Module: import binding.module
Module-->>Registry: binding.entry export
Registry-->>App: resolved module exports
end
end
Flow diagram for optional and required view lookupflowchart TD
Start[Lookup view binding] --> Found{Binding registered?}
Found -->|yes| Load[resolveView loads module export]
Found -->|no| Optional{Binding optional?}
Optional -->|yes| Null[lookupView returns null]
Optional -->|no| Refuse[requireView refuses with layering error]
Load --> Mount[Shell mounts resolved view]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical and moderate issues remain in test compatibility, binding validation, contributed-view safety, and capability enforcement.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds a Python-authoritative, JavaScript-mirrored view registry and wires core and optional views through it.
Changes:
- Adds binding validation, collection, manifests, and view resolution.
- Refactors tab and gate wiring through the registry.
- Adds registry tests, import census coverage, and CI integration.
File summaries
| File | Summary |
|---|---|
tests/test_view_registry.py |
Adds registry, validation, manifest, and integration coverage. |
tests/test_consumer_reach.py |
Updates consumer import census coverage. |
src/opendox/web/views/view_extension.js |
Adds the JavaScript registry mirror and contributed-view resolution. |
src/opendox/web/app.js |
Wires core views and optional gate loading through the registry. |
src/opendox/view_extension.py |
Implements the Python registry authority and binding collection. |
.github/workflows/validate.yml |
Integrates registry tests into validation. |
Review details
Suppressed comments (4)
src/opendox/view_extension.py:270
- The Python authority and JavaScript mirror accept different entry names:
str.isidentifier()accepts Unicode identifiers and rejects$, while the client regex accepts only ASCII identifier characters plus$. A host can therefore publish a binding that passes server validation but is refused by the browser; use the same ASCII/$rule on both halves.
if not isinstance(self.entry, str) or not self.entry.isidentifier():
src/opendox/view_extension.py:456
runtime_checkableprotocol checks only that theviewsattribute exists; an extension with a non-callableviewsmember passes this test and then raises rawTypeErrorhere. Likewise, a conforming-lookingviews()returningNonefails in theforloop rather than as the declaredViewBindingErrorrefusal; validate the callable and iterable result explicitly.
if not isinstance(extension, ViewExtension):
raise ViewBindingError(
f"{extension!r} does not conform to ViewExtension: it must "
f"declare {list(MEMBERS)}")
declared = extension.views()
src/opendox/web/views/view_extension.js:322
- This silently converts a missing or malformed
contributed_routesfield into an empty list. BecausecollectViewBindingsuses that list for Q3 ownership checks, a manifest can omit the route claims and make a class-A/C binding naming another column's route pass validation; malformed manifests are supposed to fail closed. Validate the field and its route entries before returning it.
export function manifestRoutes(capabilities) {
const manifest = capabilities && capabilities.views;
const routes = manifest && manifest.contributed_routes;
return Array.isArray(routes) ? routes : [];
src/opendox/web/views/view_extension.js:162
requiresis validated and serialized, but no client path reads it:resolveViewimports the module and the app mounts it without checking the declared capability/facet. A contributed binding can therefore declare a requirement that is absent and still be loaded/mounted, contradicting the field's stated contract; enforce the requirements at mount or remove the field until that behavior exists.
const requires = b.requires === undefined ? [] : b.requires;
if (!Array.isArray(requires) || requires.some((r) => typeof r !== "string" || !r)) {
refuse("view binding " + JSON.stringify(b.id) + " declares requires "
+ JSON.stringify(requires) + ": every entry is a capability or facet name");
- Files reviewed: 6/6 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.
You can request another review in 5 days and 22 hours by commenting @sourcery-ai review. Upgrade to get a review now.
…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>
There was a problem hiding this comment.
🔵 Needs a closer look
Unresolved moderate findings affect cross-language validation, malformed input rejection, requirement enforcement, and mount-contract checks.
Review details
Suppressed comments (7)
Previously missed (4) — in code that hasn't changed since the last review.
src/opendox/view_extension.py:275
ViewBindingis the server-side authority for entry names, butstr.isidentifier()is not the JavaScript identifier grammar used by the mirror: it rejects valid exports such as$mountwhile accepting Unicode names such aséthatviewBinding()rejects at line 142. A binding can therefore be valid in one half and refused in the other; use the same ASCII JS-compatible predicate in Python.
src/opendox/view_extension.py:467- Because
ViewExtensionis checked structurally, an object with a callableviews()returningNonepasses the protocol check and then line 467 raises a rawTypeErrorinstead of the module's promisedViewBindingErrorfor malformed extensions. Validate the declared container before iterating, as the JavaScript mirror does for arrays.
src/opendox/web/app.js:598 requiresis declared as a client-side mount prerequisite, but no client path reads it: the registry only copies the field andresolveView()/app.jsnever check the capabilities or facets it names. Thusgate.bar(and any contributed binding) is still resolved and mounted whenactions.gateis absent, so the new dependency field has no effect. Enforce requirements before mounting, or defer exposing this field until the resolver has a context-aware implementation.
src/opendox/web/views/view_extension.js:343- A malformed
contributed_routessection is silently converted to an empty route set here. Inapp.jsthat result is passed tocollectViewBindings(), so a class-A/C binding can declare a route owned by another column and bypass Q3 whenever the manifest has a non-array or malformed route list. Since malformed manifests are meant to refuse, validate the route array and each route entry at manifest ingestion instead of treating invalid data as no contributed routes.
src/opendox/web/app.js:940
- The binding contract validates only
entry(mountGateBar), but this call also assumes the dynamically loaded namespace exportsisGateBearing. A contributedgate.barcan therefore pass collection and resolution, then throw a rawTypeErrorwhenever a proposal is opened if it omits that undeclared helper. Make the predicate an explicit validated part of the binding or keep this decision in the core arm.
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:177
controlmarks a tab, andapp.js:initTabs()callstarget.mount(...)for every binding with a control. This validator only checks the control's type, so a malformed core binding with a validcontrolbut nomountis accepted and crashes the shell on initial tab activation; reject that field combination here (contributed manifests are already prohibited from carrying both).
if (b.control !== undefined && typeof b.control !== "string") {
refuse("view binding " + JSON.stringify(b.id) + " declares a control that "
+ "is not an element id");
}
src/opendox/web/views/view_extension.js:298
- A non-null malformed
/capabilitiesresponse such as JSON[]or a string is treated as an absent manifest: property access producesundefined, so this returns[]instead of refusing. That silently skips contributed modules and the route-ownership checks even though malformed manifest data is supposed to fail closed; reject non-object capabilities before readingviews.
export function contributedViewBindings(capabilities) {
const manifest = capabilities && capabilities.views;
if (manifest === undefined || manifest === null) return [];
if (typeof manifest !== "object" || Array.isArray(manifest)) {
refuse("the /capabilities payload carries a `views` that is not a view "
+ "manifest object");
}
- Files reviewed: 7/7 changed files
- Comments generated: 0 new
- Review effort level: Lite
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>
There was a problem hiding this comment.
🟡 Changes recommended
Six unresolved review findings remain in the registry validation and resolution paths.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (2)
src/opendox/view_extension.py:239
requiresis validated and serialized as a client-enforced dependency, but no client path reads it:resolveViewonly imports the module/entry andapp.jsmounts collected bindings without checking capabilities or facets. A contributed binding can declare a missing capability and still be resolved/mounted, so this field is decorative rather than the documented contract. Enforce it at the mount/resolve boundary or remove the field until a consumer exists.
#: Capability keys (`/capabilities`' `actions`) or profile facets the
#: binding needs. Consulted by the CLIENT at mount; carried here because the
#: manifest is what the client reads.
requires: tuple[str, ...] = ()
src/opendox/web/views/view_extension.js:176
- A core binding with a string
controlbut nomountpasses this validation.initTabsincludes every binding with a control and later unconditionally callstarget.mount, so a malformed core declaration crashes on first tab activation instead of being refused at assembly. Require a callable mount whenevercontrolis present; contributed entries are already rejected separately.
if (b.control !== undefined && typeof b.control !== "string") {
refuse("view binding " + JSON.stringify(b.id) + " declares a control that "
+ "is not an element id");
- Files reviewed: 9/9 changed files
- Comments generated: 4
- Review effort level: Lite
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>
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved manifest-validation, lookup, and test-harness issues remain.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (5)
Previously missed (4) — in code that hasn't changed since the last review.
src/opendox/web/views/view_extension.js:128
- This check coerces non-string property keys, so a malformed JSON region such as
["view-docs"]is accepted because it becomes the valid key"view-docs"; the returned binding then carries the array instead of a region string. That bypasses the Python authority's type validation and lets malformed contributed manifests reach mounting. Reject non-string regions before the dictionary lookup, as the Python half does.
src/opendox/web/views/view_extension.js:177 - A core binding with a
controlbut nomountpasses these checks, is included ininitTabs, and then crashes whenshow()callstarget.mount(...). Contributed entries are now forbidden from carryingcontrol, but malformed core declarations still need the same seam-level refusal; require a callable mount whenever a control is present.
src/opendox/web/views/view_extension.js:358 - This now rejects a non-array
contributed_routesfield, but it still returns malformed route entries unchanged. For example, a stringis_prefixis later treated as truthy byownershipBreach, and a malformed route can pass unnoticed when the collected bindings have no non-B routes; that silently disables the Q3 check instead of refusing the manifest. Validate each entry's object shape, rooted pattern, booleanis_prefix, and prefix/path constraints before returning it.
src/opendox/web/views/view_extension.js:369 - The registry deliberately defines a slot as
(region, id)and even allows the same id in two different regions, but this lookup compares onlyidand returns the first match. In that valid state the second binding cannot be resolved, andresolveView/requireViewinherit the ambiguity; use the full slot for lookup or make ids globally unique instead of mixing the two contracts.
src/opendox/web/views/view_extension.js:294
- A present manifest with
views: nullis treated as an absent column here, sorender()silently proceeds without contributions instead of refusing malformed input as the manifest contract requires. Distinguish an absentcapabilities/viewsfield from a present null manifest and fail closed for the latter.
const manifest = capabilities && capabilities.views;
if (manifest === undefined || manifest === null) return [];
- Files reviewed: 9/9 changed files
- Comments generated: 1
- Review effort level: Lite
…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>
There was a problem hiding this comment.
🔵 Needs a closer look
Seven moderate review findings remain in the registry and application wiring.
Review details
Suppressed comments (7)
Previously missed (4) — in code that hasn't changed since the last review.
src/opendox/view_extension.py:191
- The Python authority uses
$withPattern.match, which accepts a trailing newline before the end anchor (for example, an id ending in\n); the JavaScript mirror's equivalent regex rejects it. The authority can therefore publish a binding that the client refuses, and the same mismatch applies to_MODULEand_ENTRY; use full-string matching for all three validators and cover a trailing-control-character case.
src/opendox/web/views/view_extension.js:163 requiresis validated and copied into bindings, andgate.bardeclaresactions.gate, but no client path reads it:resolveViewimports solely from the binding andapp.jsnever compares requirements withprobedCaps. A binding that declares an unavailable capability is therefore still loaded/mounted, making this prerequisite metadata decorative; enforce it at the resolution/mount seam or remove the field until a consumer exists.
src/opendox/web/views/view_extension.js:357manifestRoutesonly checks thatcontributed_routesis an array, then_route_ownership_breachconsumes each entry'sis_prefixby truthiness. A present manifest can therefore setis_prefix: 0(or omit it) for a contributed prefix and let a class-A binding naming that route bypass Q3, even thoughview_manifest()always emits a validated route binding. Validate each route object's path and boolean/prefix shape here so malformed manifests fail closed.
src/opendox/web/views/view_extension.js:454- For a declared
domregion whose element is missing, this returnsnullinstead of refusing. The next contributed mount can then call intonulland leak a raw TypeError, contrary to the registry's fail-closed contract; reject a missing host with the region name so an HTML/JS deployment mismatch is diagnosed at the seam.
src/opendox/web/app.js:994
- This wrapper ignores
gateView.binding.entryand hard-codesmountGateBar. A contributedgate.barbinding whose declared entry is a different valid function can passresolveView()'s validation and then fail here (or invoke the wrong export), so the binding does not actually control the mount entry. Call the validated named export from the binding.
? (host, gctx) => gateView.exports.mountGateBar(host, gctx, { caps })
src/opendox/web/views/view_extension.js:369
- The collision key intentionally permits the same
idin different regions (the suite asserts that), butlookupViewaccepts onlyidand returns the first match. A valid registry can therefore contain two distinct bindings whilelookupView,resolveView, andrequireViewcannot address the second and may resolve the wrong module; either make IDs global or include the region/slot in these lookup APIs.
export function lookupView(bindings, id) {
for (const binding of bindings || []) {
if (binding.id === id) return binding;
}
return null;
src/opendox/web/views/view_extension.js:128
hasOwnPropertycoerces its property-key argument, so a malformed non-string region such as['view-docs']is converted to"view-docs"and accepted. The returned binding still carries the array asregion, unlike the Python half, and later registry consumers expect a string region; check the type before the dictionary lookup.
if (!Object.prototype.hasOwnProperty.call(REGIONS, b.region)) {
- Files reviewed: 10/10 changed files
- Comments generated: 0 new
- Review effort level: Lite
…e by row, admit S3's new files Copilot review on openxFactory PR #1001 (three unresolved threads): - README.md + docs/opendox-cutover-runbook.md carried only the pre-S2 totals (906 declared lines / 151 edit-carrying rows). Now that #1002 (§ 3.4 slice S2, dispose.js/wheel.js) is merged into this branch too, re-derive the § 2 table and its prose from the parsed manifest for the combined S2+S3 state: 909 declared lines / 153 rows carrying `edits:` (166 moved_verbatim / 152 moved_with_declared_edit / 138 not_moved), `opendox_code` 123 rows at 58/65 verbatim/edited for 336 declared lines. Figures are computed from the landed manifest, not transcribed. - tests/carve_manifest/test_carve_manifest.py: pin the app.js and test_bullseye_widget.py rows by disposition and exact (class, lines), the same idiom the ASK-7 pins use for cli.py/serve.py, so the aggregate assertion is not the only thing standing between a passing suite and the S3 edits landing on the wrong row or under the wrong class. Also reconciles the aggregate assertion's own merge conflict against #1002 to the correct combined (909, 153). - docs/opendox-carve-admissions.yaml: `verify-carve-arrival.py --phase B --destination opendox_code` against the S3 leg's current head (opensoft/openDox-code#14 @ 28de9c3b) refuses `arrival-undeclared-file` five times over — S3's own `view_extension.py` / `view_extension.js` / `test_view_registry.py`, and S1's `test_web_boundary.py` / `tests/fixtures/web_boundary_census.yaml` (landed already via openDox-code#13; S1 touched no arrived file, so it needed no row-annotation PR of its own, but its created files were never admitted). This is the first PR to run the verifier against the merged S1+S2+S3 tree and need them declared; all five are governed admissions now, alphabetical by path, none ad hoc. Verified: `scripts/validate-carve-manifest.py` OK (166/152/138, 909/153); `scripts/verify-carve-arrival.py --destination opendox_code --phase B` against a fresh detached checkout of openDox-code#14 OK with zero ad-hoc --allow-created flags; `pytest tests/carve_manifest tests/carve_arrival tests/carve_conformance` 269 passed. Lane: openxfactory-4-opendox-extraction Refs #656 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
Critical and moderate findings remain in the application wiring, JavaScript mirror, and registry-test isolation.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (5)
src/opendox/web/app.js:598
requires: ["actions.gate"]is currently only validated and serialized;resolveViewand the rest of the client never inspectbinding.requires. The binding is therefore still resolved whenprobedCaps.actions.gateis absent, despite the Python contract documentingrequiresas capabilities/facets consulted at mount. Either enforce this metadata before resolving/mounting or remove it until its absence semantics are defined.
routes: ["/actions/gate/ratify"], requires: ["actions.gate"],
src/opendox/web/app.js:940
resolveViewvalidates only the binding's declaredentry(mountGateBar), but this path also callsgateView.exports.isGateBearing(...). A contributed module can therefore pass registry resolution while missing or mis-typing that second export, then throw a rawTypeErrorwhen a proposal document is opened. Declare/validate all exports this consumer requires, or resolve the classifier through its own validated binding before using it.
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:354
- This only verifies that
contributed_routesis an array; entries with a non-booleanis_prefix, an invalid pattern/prefix shape, or even a missing pattern are accepted when no binding happens to iterate them. The later matcher also usesclaimed.is_prefixby truthiness, so a malformed capabilities payload can make the client-side Q3 ownership check diverge from Python's validatedRouteBindingsemantics. Validate each route entry while reading the manifest and refuse malformed entries, regardless of whether a view currently declares routes.
const routes = manifest.contributed_routes;
if (!Array.isArray(routes)) {
refuse("the /capabilities `views` payload declares contributed_routes "
+ JSON.stringify(routes) + ", not an array: view_manifest() always "
+ "emits this field as one, and a manifest that cannot be trusted for "
src/opendox/web/views/view_extension.js:128
hasOwnPropertycoerces property keys, so a malformed JSON binding such asregion: ["view-docs"]passes this check and is returned with a non-stringregion;slotandregionHostthen coerce it again. The Python authority rejects non-string regions, so the client mirror should validate the type before the dictionary lookup.
if (!Object.prototype.hasOwnProperty.call(REGIONS, b.region)) {
src/opendox/web/views/view_extension.js:177
- A core tab binding is accepted when it declares
controlbut omitsmount.initTabsfilters oncontroland unconditionally callstarget.mount(...), so such a declaration reaches the first click as a rawTypeErrorinstead of the registry's refusal contract. Require a callablemountwhenevercontrolis present (contributed entries are already rejected before this point).
if (b.mount !== undefined && typeof b.mount !== "function") {
refuse("view binding " + JSON.stringify(b.id) + " declares a mount that is "
+ "not a function; a contributed binding declares no mount at all and is "
+ "loaded through resolveView()");
}
if (b.control !== undefined && typeof b.control !== "string") {
refuse("view binding " + JSON.stringify(b.id) + " declares a control that "
+ "is not an element id");
}
- Files reviewed: 10/10 changed files
- Comments generated: 3
- Review effort level: Lite
… 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>
|
There was a problem hiding this comment.
🔵 Needs a closer look
Unresolved moderate validation, lookup, export, and capability-enforcement issues remain.
Review details
Suppressed comments (6)
Previously missed (3) — in code that hasn't changed since the last review.
src/opendox/web/app.js:939
resolveViewvalidates only the declaredentry, but this call assumes every validgate.barmodule also exports a callableisGateBearing; that second export is neither part ofViewBindingnor checked. A contributed gate module exporting only its declared entry can therefore resolve successfully and then throw a rawTypeErrorwhen a proposal is opened. Put this predicate behind an explicitly declared and validated binding capability instead of hard-coding another export name.
src/opendox/web/views/view_extension.js:357- Checking only the container type lets malformed descriptors such as
[{}]pass. In the current app the only core binding with routes is class B (whichownershipBreachskips), while all other core bindings declare no routes, so this bad payload is never inspected and a present malformed manifest is accepted instead of failing closed. Validate each descriptor'spatternandis_prefixbefore returning it.
src/opendox/web/views/view_extension.js:369 - The registry deliberately treats
(region, id)as the slot and allows the same id in different regions (test_one_id_in_two_different_regions_is_not_a_collision).lookupView/resolveViewnevertheless accept only an id and return the first match, so the second valid binding is unaddressable and a consumer can resolve the wrong panel. Either make ids globally unique or make lookup/require/resolve take the region (or slot) as well.
src/opendox/view_extension.py:427
- This structural route check coerces
is_prefixwithbool(), so malformed contributors such asis_prefix="false"are treated as a true prefix (and a missing field as false) instead of being refused.RouteBindingvalidates this field as a real boolean, and this mirror should do the same; otherwise a malformed route can create a false ownership refusal or bypass the Q3 check.
is_prefix = bool(getattr(contributed, "is_prefix", False))
if route == pattern or (is_prefix and route.startswith(pattern)):
src/opendox/web/views/view_extension.js:163
requiresis validated and serialized, but nothing inresolveView,render, or the mount paths reads it against the capabilities object. Consequently the newgate.bardeclaration (requires: ["actions.gate"]) is still resolved and mounted when that capability is absent, and any contributed binding can claim unmet requirements without changing behavior. Either enforce these requirements at the client seam or make this field explicitly informational; the current API promises a check that does not exist.
const requires = b.requires === undefined ? [] : b.requires;
if (!Array.isArray(requires) || requires.some((r) => typeof r !== "string" || !r)) {
refuse("view binding " + JSON.stringify(b.id) + " declares requires "
+ JSON.stringify(requires) + ": every entry is a capability or facet name");
}
tests/test_view_registry.py:551
- This drift assertion compares only the JavaScript region names, not their
dom/shellvalues. Those values are load-bearing—regionHostrefuses shell regions anddom_regions()drives the HTML checks—so the Python and JavaScript halves can disagree about mounting semantics while this test still passes. Compare(name, kind)pairs.
def test_the_two_halves_declare_the_same_regions_in_the_same_order():
assert _js_object_keys("REGIONS") == list(REGIONS)
- Files reviewed: 11/11 changed files
- Comments generated: 0 new
- Review effort level: Lite
…to build/s4-split-route-tails Lane: openxfactory-4-opendox-extraction Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ready does S3's Copilot re-review (#14, `e176947`) replaced `gateView.exports.mountGateBar(...)` with `gateView.exports[gateView.binding.entry](...)`: a contributed binding NAMES its entry in the manifest, and reading a hardcoded export name here would silently ignore the name it declared — the binding would resolve, the mount would be `undefined`, and the panel would fail at the click rather than at assembly. The same is true of S4's two mounts, so they read the declared entry too. Census `loc` for app.js refreshed with the change (1331 -> 1337) and the declared totals re-derived. Refs opensoft/openXfactory#656 Lane: openxfactory-4-opendox-extraction Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…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>
…tails Resolves conflicts limited to S4's own additions layered on S3's landed content: validate.yml's S4 pytest entry, view_extension.py/.js REGIONS (lens-gate, repo-projects), app.js's two new gate mounts, and the census/ xfail narratives. Also collapses a duplicate views/view_extension.js census row (S3's pre-merge 455-loc row vs S4's reconciled 463-loc row) introduced by the add/add conflict on that file, updating its note to chain the S3->S4 loc growth; totals now re-derive exactly (A 25/16293, B 7/2174, C 14/11854, ? 1/1435 = 47 files/31756 loc). tests/conftest.py's REPO_ROOT depth fix (#19) arrives from main unchanged. Lane: openxfactory-4-opendox-extraction Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… 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.



Lane: openxfactory-4-opendox-extraction
Refs opensoft/openXfactory#656
The ruling. § 3.4's five open questions were RULED at #656 comment
5642758731
(Brett Heap, 2026-09-12), same sitting: "START S1–S3 NOW, with the note
amended to carry these rulings." S3 is the view registry, claimed in that same
comment. The note is openDox-spec
docs/front-end-package-boundary.md(maina44ac06d; the amendment carrying the rulings is openDox-spec #9).The design
§ 4.1 asks for the front-end analogue of
route_extension.collect_bindings, andthis is it — the AUTHORITY in Python, its MIRROR in the language the shell is
written in, and one vocabulary held across both by a drift test.
route_extension.RouteBindingViewBindingroute_extension.collect_bindingscollect_view_bindings/collectViewBindingsconsumer_reach.route_columnresolveView/requireView/lookupViewprofile_proxy.profile_openxfactoryhost_view_extensions(theVIEW_EXTENSIONSfacet)The registry API
src/opendox/view_extension.py— the authority (578 lines):VIEW_CLASSES?REGIONSdom, threeshellPROFILE_FACET"VIEW_EXTENSIONS", besideROUTE_EXTENSIONSon the ONE profileViewBindingErrorRouteBindingError's reasoningViewBinding__post_init__;.slot= (region, id);.as_manifest_entry()ViewExtensionruntime_checkableProtocol, never an ABCcollect_view_bindingsdom_regionsindex.htmlitself declareshost_view_extensionsview_manifestschema_version+kind+ the NAMED absencesrc/opendox/web/views/view_extension.js— the mirror (387 lines):VIEW_CLASSES:54,REGIONS:69–83,ViewBindingError:99,viewBinding():119–192,
collectViewBindings():233–276,contributedViewBindings():292–313,
manifestRoutes():318,lookupView():328,requireView():340,resolveView():360–375,regionHost():381–387.Four refusals, and why each one
views()yielding anything but abinding. Structural conformance, never nominal —
RouteExtension's reason: abinding authored in the column that PINS openDox must conform without
importing anything from here, or the seam becomes the dependency it was drawn
to remove.
(region, id)slot.collect_bindings' refusalone tier out: "a declared route silently unreachable" becomes "a declared
panel silently unmounted", and the message names both modules.
RULED Q3 made executable: "a route constant travels with the binding that
calls it, never with the model that declares it." Class B is exempt BY
CONSTRUCTION (§ 4.5 assertion 2: a gate-loop binding naming a gate route is
the boundary working); class A, class C and the transitional
?are inscope. Ownership is read from the
RouteBindings another column actuallyCONTRIBUTED, never from a literal table here — a table would be a second copy
of the routing that drifts the moment a column adds a route.
"no CDN, no external font, no remote script", and a contributed binding is
exactly the hole that policy would leak through.
Order is declaration order, flat — and the divergence from
collect_bindingsis argued, not inherited: that function puts exact before prefix because an HTTP
dispatcher consults its table until something matches; a panel mounts into the
ONE region it names, and two panels in one region are a refused collision rather
than a race.
The absence semantics (§ 4.2 / § 4.3)
ProfileNotRegisteredpasses through untouchedVIEW_EXTENSIONSfacetProfileFacetMissingsubclassesAttributeErrorsogetattr(…, default)answers; a shell with no contributed PANELS is the shell this leg ships today, and refusing would impose a flag day on every host that has not grown the facet — which is every host/capabilitiesmanifest (static image)nullfromlookupView/resolveViewconsumer_reach's posture: the reach is LATE, NAMED, and the caller decides what absence meansAnd the absence is NAMED, never silent:
view_manifestcarrieshost_facet="declared"/"absent"with the facet and profile names, whichis § 4.3 point 5's "renders its region empty with a named reason" applied to a
facet rather than to a profile.
The view wired end to end
The DOC LIST —
docs.list→ regionview-docs→./views/docs.js/renderDocs, class A. Wired in both directions and proven both ways:registry (
test_app_js_wires_the_doc_list_through_the_registry);resolveViewloads the REALviews/docs.jsfrom a binding read out of a/capabilitiesmanifest andhands back its
renderDocsexport, undernode(
test_js_resolves_the_real_doc_list_module_from_its_binding), and acontributed panel mounts into its region under a minimal DOM
(
test_js_mounts_a_contributed_panel_into_its_region).The gate bar is the second proof, of the opposite property.
app.js's line43 — the shell's ONE direct import of a class-B module — is now the
gate.barbinding: class B,
optional: true, declaring/actions/gate/ratifyas its own.A shell assembled without it renders the viewer with no gate bar instead of
failing to load, because
views/viewer.jsalready tolerates a nullmountGate(
const mountGate = o.mountGate || null) — the absence was always representabledownstream and was simply unreachable from here, so no second file is touched.
That is § 4.1's sentence realized: "a shell built with no gate binding
registered renders the tab strip WITHOUT the gate bar rather than failing to
load."
Nothing is contributed yet, so the shell renders exactly as today with an
empty extension tuple — the note's own S3 row.
Q-L1
src/opendox/web/app.jsis an ARRIVED file (amoved_verbatimrow ofopenxFactory's
docs/opendox-carve-manifest.yaml). Its 37 edited lines aredeclared by openxFactory PR
#1001, which lands
FIRST: one
import rewritesline (43) and 36adapter callslines. The rowconverts
moved_verbatim→moved_with_declared_edit; no referent digestmoves.
verify-carve-arrival.py's own_check_declared_linesover all 123opendox_coderows against this branch:…and the declaration is minimal — all 37
app.jslines touched, none spare;the three bullseye lines are single-line replaces with no insertion, so no
neighbour is declared either.
A second arrived file turns out to be edited by this slice and is declared
on the same PR:
tests/test_bullseye_widget.pyassertsapp.js's shape byQUOTING ITS LINES BACK, so three of its quotations name the tab router's field
before the rename (
:900,:1781,:1785). They are migrated.view→.regionin the act that invalidated them — the only time anyone can be surethe migration is a rename and not a behaviour change — and declared as three
adapter callslines on a row that already carried an edit. That suite is redtoday for an unrelated reason (it imports through
serve.py, which stillreaches the carved-away
ideation_dashboard) and is not invalidate's list;neither fact makes a stale assertion acceptable, because S8 re-homes it. A
diff of every
app.jsquotation in the leg against base and head foundexactly three newly invalidated, all of them these.
tests/test_consumer_reach.pyis leg-assembled, not arrived (created atda8aae9; it has no manifest row), so its census edit needs no annotation.The two registry files are created, not arrived — Q-L1's "new files are
created, not arrived".
index.htmlis NOT touched. Adata-regionattribute would have been asecond 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) — declaring it would have meant inventing an edit class ratherthan using one. The region contract is held by the registry's own
REGIONStable plus a drift test against the shell's existing ids, and the row stays
moved_verbatim, byte-identical.Tests
tests/test_view_registry.py, 67 tests, added tovalidate's explicit--noconftestlist in the SAME commit — the discipline § 4.5 states and the oneits three neighbours already keep.
?in scope · a class-B binding declaring the same route is allowed · nothing to breach with no contributed routesdomregion is an elementindex.htmlcarries · noshellregion pretends to have one ·app.jsno longer imports the gate module · no control byte in either filenodeviews/view_extension.js, skipped and never failed where node is absentA real defect, kept as a test rather than a memory. The client's slot key
joins region and id with a separator neither can contain, and it was first
written as a literal NUL byte in the source. Everything parsed and every
other assertion passed — but
git,grep,file(1)and every diff viewerclassify a file containing a NUL as binary, so the module would have reached
review as an unreadable blob. Fixed to the escape sequence, and
test_neither_half_carries_a_control_character_a_separator_needs_escapedreadsBYTES, because reading the file as text is exactly what hides it.
Three review findings, all accepted
Copilot's review found three real defects and each is fixed with a test
(
2c75f5b):REGIONSis a dict, so<unhashable> not in REGIONSraisedTypeErrorout of the hash before__post_init__could raise theViewBindingErrorthis module promises forevery declaration defect. The type is now checked before the membership, on
regionandview_classboth — a seam whose refusal depends on the TYPE ofwhat it refuses is not a seam.
contributedViewBindingspassedmanifest entries straight to
viewBinding, which preservedmountandcontrol.controlis what makes a binding a TAB, and a contributed entrycannot carry the
mountFUNCTION the tab router calls — so a manifestdeclaring a control put an entry in the strip whose mount is
undefined,and the click that selected it threw. Now refused where the payload is READ,
not stripped: stripping turns a manifest defect into a panel that silently
never appears, which is what this seam's collision refusal exists to prevent.
resolveViewchecked only that theentry NAME existed, so a module exporting it as a string or a
nullhandedback a binding that looked resolved and threw a raw
TypeErrorfrom insidethe mount — the dangling-import failure mode this seam replaces. The entry
must now be a function, and the refusal distinguishes "not exported" from
"exported as something that cannot be called".
Local run of
validate's exact command: 149 passed, 3 xfailed(
test_view_registry.pyis 67).What the later slices touch
lens-model.js,repo-selector.js,staging-workbench-model.jsSPLITfiles so the 10 gate-route constants stop living outside class B. The precondition for S5. This PR's Q3 refusal is what makes their split checkable.routesis deliberately undeclared on every core TAB binding so that S4's answers are not encoded before S4 has done its work.dispose.js,gate.js,swb-create.js,swb-session.js+serve.pygate.barentry inCORE_VIEWSis transitional: S5 deletes it and the identical binding arrives throughcontributedViewBindings()with nothing else inapp.jschanging. The server hop is ONE line —capabilities["views"] = view_manifest(…)— insideserve.py's own declared-edit window, which the in-flight ASK-7 act owns; the client already readscaps.viewsand is tested against a stub payload.serve_projection.py,serve.py,viewer.js,wheel.js/source/per RULED Q4. Untouched here.styles.cssviews) the same hop will travel on.validate. This PR adds one file to the narrowed list, in the ruled way.How S2 folds in
S2 (in flight) and S3 do not touch the same files — S2 edits
dispose.js,wheel.jsandstyles.css; S3 editsapp.jsand adds two new files.The fold-in is already provided for:
wheel-intentanddispose-intentaredeclared
shellregions inREGIONSnow, in both halves. Declaring a regioncosts nothing and refuses nothing; an UNDECLARED one costs a slice. So when S2's
optional intent-chip binding is contributed, it names a region that already
exists, and the two call sites read it with
lookupView(ctx.views, "…")→nullwhen the column that supplies it is not installed — which is exactlyRULED Q5: "the chips become an OPTIONAL contributed binding; absent, the wheel
and the dispose tray render without them."
ViewBinding.optionalis thatruling made a field. Nothing in this PR needs re-opening when S2 lands; the
landing order is S1 → S2 → S3, the lane merging main into each before landing.
The lane lands this PR — after openxFactory #1001, per Q-L1. This branch
does not merge itself.
🤖 Generated with Claude Code
Summary by Sourcery
Introduce a shared front-end view registry and wire core and contributed panels through it, allowing optional views to be absent safely while enforcing consistent ownership and mounting contracts.
New Features:
Bug Fixes:
Enhancements:
Build:
CI:
Tests:
Chores: