Repository navigation
View registry: refuse a malformed contributed-routes column instead of coercing it (S3 follow-up; fails closed per § 4.1) - #18
Conversation
…ry instead of coercing it Copilot found this on openDox-code #16, a thread on `view_extension.js:358` left for its owner (S3's view registry, `views/view_extension.js`): `contributedViewBindings`'s caller, `manifestRoutes()`, validated only that `contributed_routes` was an array, and `ownershipBreach()` read a contributed entry's `is_prefix` with a truthy check (`claimed.is_prefix && route.startsWith(pattern)`). Neither refused an ENTRY that was individually malformed — missing a string `pattern`, or carrying `is_prefix` as something other than a real boolean (including simply absent) — so a manifest like that rode through as if it were valid, and a truthy-but-wrong-type `is_prefix` (or a missing one, which is falsy) was silently read as "not a prefix" rather than refused. `view_extension.py`'s own note on "MALFORMED... REFUSES" is the rule this breaks: a payload this seam cannot reason about must fail closed, the same way `viewBinding()` already does for every OTHER shape defect in a contributed entry. THE FIX, both halves in `view_extension.js` alone: * a new `requireRouteShape(claimed)` — one shape check for a single contributed-route entry, shared by both callers so a malformed entry refuses at whichever of the two sees it first. * `manifestRoutes()` now runs it over every entry once the array check passes, instead of only checking the array's own type. * `ownershipBreach()` now calls it too, so `is_prefix` refuses when it is not a strict boolean, rather than falling through the old truthy check. PYTHON MIRROR PARITY. `view_extension.py`'s `_route_ownership_breach` reads `is_prefix` as `bool(getattr(contributed, "is_prefix", False))` — a coercion, not a refusal — but that is safe ONLY because its `contributed_routes` arrive as already-constructed `RouteBinding` objects, and `RouteBinding.__post_init__` (`route_extension.py`) has already refused a non-bool `is_prefix` at construction, before `_route_ownership_breach` ever runs. The JS mirror has no such upstream gate: its `contributed_routes` arrive as raw JSON off `/capabilities`, so this fix is deliberately stricter than the literal Python line it mirrors, matching what construction-time validation already guarantees on the Python side. TESTS (`tests/test_view_registry.py`), node-driven against the real file per its own `_run_node` pattern: extended `test_js_manifest_routes_refuses_a_malformed_contributed_routes_field` with an entry missing `pattern` and an entry with a non-boolean `is_prefix`, both inside an otherwise well-formed array; added `test_js_ownership_check_refuses_a_non_boolean_is_prefix_rather_than_coercing_it` covering a missing `is_prefix`, a non-boolean truthy one, and — so the fix does not over-refuse — a well-formed `true` (still breaches) and `false` (still resolves). Confirmed both fail against the pre-fix code and pass against the fix. `tests/fixtures/web_boundary_census.yaml`: `views/view_extension.js` grew 463 -> 499 lines; `loc` and the class-A `totals:` are re-derived and updated to match (`test_web_boundary.py`'s own drift check), with a note recording what changed and why. `app.js` is untouched — nothing here needed it. Refs opensoft/openXfactory#656 Lane: openxfactory-4-opendox-extraction Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Reviewer's GuideThe PR hardens the client-side view registry against malformed raw JSON in Flow diagram for strict contributed-route validationflowchart TD
A["Read capabilities manifest"] --> B{"contributed_routes is an array?"}
B -- No --> R["refuse"]
B -- Yes --> C["requireRouteShape for every entry"]
C --> D{"pattern is string and is_prefix is boolean?"}
D -- No --> R
D -- Yes --> E["Return validated routes"]
E --> F["ownershipBreach checks route ownership"]
F --> G["requireRouteShape reused for each inspected entry"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved review issues were identified.
Pull request overview
Hardens the client-side view registry to reject malformed contributed-route entries.
Changes:
- Validates route patterns and strict boolean
is_prefixvalues. - Adds regression tests.
- Updates web-boundary census metadata.
File summaries
| File | Description |
|---|---|
tests/test_view_registry.py |
Adds malformed-route regression coverage. |
tests/fixtures/web_boundary_census.yaml |
Updates census counts and notes. |
src/opendox/web/views/view_extension.js |
Adds shared route-shape validation. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…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>
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 1 day and 21 hours by commenting @sourcery-ai review. Upgrade to get a review now.
… fix/view-registry-fail-closed
… 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.
|
…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>
…f coercing it (S3 follow-up; fails closed per § 4.1) (retarget of #18) (#22) Lane: openxfactory-4-opendox-extraction Refs opensoft/openXfactory#656 (stays OPEN). CLAIM: 5647338637. Corrects a landing error: #18 (`fix/view-registry-fail-closed`) was stacked with base `build/s4-split-route-tails` and was never retargeted to `main` before the destination gate squash-merged it, so #18 landed into that now-orphaned feature branch (`7466d619`) instead of `main` — `main` stayed at #17 (`69d27602`) and never received #18's fix. This PR is `git cherry-pick 7466d61` (byte-identical tree, same 3 files, 107/10 +/-) onto current `origin/main`, re-verified: census totals re-derive exactly (A 25/16329, B 7/2174, C 14/11854, ?/1435, 47 rows) and narrowed pytest 207 passed / 3 xfailed. Same fix as #18: a shared `requireRouteShape(claimed)` in `view_extension.js` refuses a contributed-routes entry with a missing string `pattern` or a non-boolean `is_prefix`, called from both `manifestRoutes()` and `ownershipBreach()`; `app.js` untouched. Gate evidence: destination gate; base confirmed `main` @ `69d27602` before merging (the error class this PR corrects); `validate` SUCCESS at `d6748081` (run 34726223644); 0 review threads. CLEAN/MERGEABLE, not draft.
…odules leave, the registry mounts, requires acts, ViewBindingError surfaces (RULED Q1–Q12) (#20) Lane: openxfactory-4-opendox-extraction Refs opensoft/openXfactory#656 (stays OPEN). CLAIM: 5648073924. **§ 3.4 slice S5, leg B — the shell loses the gate loop and reaches what it keeps of it through the registry.** openDox-spec `docs/front-end-package-boundary.md` § 5 row S5 @ `7d12428c`: *"The four class-B files and all 13 route constants — now all declared in class-B files — move behind a binding openXdox supplies; a student install comes up with no gate bar, no dispose tray, no session verbs, and no 404."* The contract is openXdox-spec `docs/gate-loop-view-contract.md` @ `d73767b7`, whose § 8 Q1–Q12 were RULED by Brett Heap on 2026-09-12 at opensoft/openXfactory#656 — `5648044785` (Q5, Q1, Q3), `5648049748` (Q2, Q4, Q7, Q8), `5648065587` (Q9–Q12). **Paired with opensoft/openXdox-code#18, which supplies what this removes. It landed first, moments before this, as `c1ad341a930b69052b4c32f04ef3c762c033561c`** — the shell stops shipping these six modules in the same act that the column starts shipping them. Six class-B modules leave (S4's `views/gate-lens.js` and `views/gate-projects.js` among them — their own headers say "AT S5 THIS FILE LEAVES THE BUNDLE"), and what the shell keeps of them it reaches through the registry: RULED Q1's generic mount pass runs **per region, after that region's core render** and through the tab router's `onRegionRendered` hook, because every `dom` region is a root its core renderer CLEARS and a non-initial tab renders lazily; RULED Q2's `resolveView` hands back a namespace BOUNDED by the declaration; RULED Q4's `requires` are probed as dotted `/capabilities` paths and ACTED on; RULED Q8's `page-overlay` host is built by the shell, because `index.html` is a `moved_verbatim` carve row that cannot grow an element; RULED Q10's static `app.js:57` import is gone, `firstEditTransport` reached off `gate.workbench.session` with a `refusalTransport()` — a refusal in the shape `runSave` understands — when the column is absent; RULED Q11 catches `ViewBindingError` separately ("The snapshot is fine — the assembly is not"); RULED Q12's concatenation left with `dispose.js` and **no gate route literal survives anywhere in this bundle**. **The line slice S3 built both ends of and deliberately did not write is written here:** `serve.build_server()` now sets `capabilities["views"] = view_extension.view_manifest(…)`, collected from the host's `VIEW_EXTENSIONS` facet against the routes THIS assembly contributed. No new route and no second fetch. **Both boundary assertions reach zero at the slice their own markers named, and both markers are removed** (leaving either would be an XPASS that turns the check red): assertion 2 — no file outside class B names another column's route — 18 at S1 → 20 at S3 → 10 in scope after S4 → 6 once S6 landed → **0**, the last six being `app.js`'s CORE-arm `gate.bar` / `gate.lens` / `gate.projects` entries, each a class-B binding's `routes:` declaration sitting in a class-A file; assertion 3 — every relative import resolves, no class-A/C file imports class B — 7 → 6 → 4 → **0**, each closed by the module LEAVING. `views/lens.js`'s two openxFactory-lane sites remain assertion 2's declared exception, untouched. The student-install proof is four separately-measured facts, so a failure names which one broke: no gate bar / tray / session verbs; the module graph resolves without them (§ 1.2(b)'s blank-page failure mode closed); no 404, because no gate route literal survives; and unoffered-not-undefined — `NO_DISPOSE_COLUMN`, `NO_CREATE_COLUMN`, `NO_SESSION_COLUMN`, each answering `false` to its capability predicate. **The annotation this leg was owed LANDED FIRST, as RULING Q-L1 requires:** opensoft/openXfactory#1023 → `ee251d6c54b7e16728f2648c71faa90d6be76496`, carrying the four RE-DESTINATIONS under the form RULED Q6, the declared edits on `serve.py`, `web/app.js`, `views/wheel.js`, `views/staging-workbench.js` (moved_verbatim → moved_with_declared_edit) and `test_bullseye_widget.py`, the `created:` admission for `tests/test_gate_loop_contributed.py`, and the removal of the two admissions that went STALE here when S4's created files moved to the other destination. Measured from that landed main against this head: `verify-carve-arrival.py --destination opendox_code --phase B` answers **OK — 119 rows arrived, 52 digests verified, 66 declared-edit rows within their lines, 146 files with NONE undeclared, 0 rows re-destined HERE and 4 re-destined AWAY and VERIFIED VACATED (RULED Q6), 18 declared admissions used** (plus the one pre-existing ad-hoc `tests/conftest.py`, openDox-code#19's declared depth fix, which this slice did not create). **The caveat this PR carried about riding in with unlanded content is RESOLVED.** The S3 fail-closed follow-up (`requireRouteShape`) was merged into the old stack after #17 had been squashed; it has since landed on `main` on its own as #22 (`05bbde80`), and `git show origin/main:src/opendox/web/views/view_extension.js | grep -c requireRouteShape` answers 3. This branch merged that main in. Copilot rounds 1–6, twenty-one threads, none unresolved. Round 2 took eight: a `requires` probe reading INHERITED members (`requires: ["toString"]` met a requirement no payload carries); a declared export checked present but not callable; the pass re-resolving by `binding.id` when bindings are unique by SLOT; the pass running once before every core mount; `VIEW_EXTENSIONS` truthiness read as presence, so a host declaring `()` looked like a host that never grew the facet; `wheel.js` and `staging-workbench.js` holding their columns in module-level `let`s, so two live renders shared one column; and two arrived test files still reading modules that left. Round 3 took three more — the lazy profile proxy refusing every dunder, so `host_profile` could only ever be `null`; the per-region pass having no cancellation once it could start from a tab's first render and await an import; and a late refusal having nowhere to be written, since `render()` ends with `status.remove()` — and refuted two with executed evidence (`mountProjectGate` does pass the outer snapshot in Q3's order; recursive `**` in `package_data` arrived in setuptools 62.3.0 and this leg declares `setuptools>=68`, with a real `python -m build` packaging 40 entries under `opendox/web/`). **Round 4, found at this head and taken rather than deferred**, is the same defect round 3 fixed one layer in: the six contributed resolves each await a dynamic import, and EVERYTHING below them mounts — the declared namespaces are handed down, `ensurePageOverlayHost()` builds RULED Q8's host, the dispose panel is mounted into it, and every region's core render follows. A repository switch during one of those imports aborts this render's scope, but the old render still resumed after the awaits and mounted its stale snapshot into the page the newer render owns; `mountContributedViews`'s own signal check guards the generic pass and cannot undo a shell mount that already happened. The render that lost its scope now stops between the last resolve and the first mount, and its ERROR path stops with it — `reportAssemblyFailure` is a closure of ONE render, handed rejections by the per-region pass that can arrive minutes later, so a refusal from a render the user has already switched away from would have been written over the live render's own surface. The new test pins the guard's POSITION rather than its presence, since the ordering is the whole finding, and the boundary census's `app.js` row moves 1584 → 1602 loc (class-A total 16918 → 16936) with the reason in its note. The destination gate was re-run on the fixed tree BEFORE the push and answers OK with identical figures: the guard falls inside `web/app.js`'s already-declared edit lines, so no amendment to the landed annotation is owed. **Round 5, likewise found and taken at the landing**, is this bundle's registry contradicting its own contract. RULED Q1's generic pass read `const unmet = capabilities === undefined ? null : unmetRequirement(...)`, so a caller that omitted the payload skipped RULED Q4's gate entirely: a REQUIRED binding with an unmet requirement was imported and MOUNTED — the one outcome the ruling says must refuse — and an OPTIONAL one mounted where it owed an empty region and a named reason. Fifteen lines into this file's own Q4 block stands the sentence it broke: "A MISSING PAYLOAD IS AN UNMET REQUIREMENT, NOT AN ERROR … `undefined` at the end of the path is the honest answer 'this plane does not offer it'." `undefined` for the whole payload says that about every path at once, and it is the same fail-closed posture `probeCapabilityPath` was rewritten into at round 2. `unmetRequirement` is now evaluated unconditionally. Production behaviour is unchanged — `mountContributedInto` has always passed `{ capabilities: probedCaps, regions, signal }` — so what closes is the seam a later caller, a probe or a contributed column's own harness would have found open. The new node-driven test was run against the OLD read and FAILS there, so it pins the behaviour rather than restating it; `views/view_extension.js` is slice S3's CREATED file, so no amendment is owed for it either. **Round 6 is round 4's finding one and two awaits further down, and it was taken the same way.** RULED Q1's generic mount pass is itself AWAITED twice at the top level of `render()` — after `mountExplorer()` and after `mountStagingWorkbench()`, which is where round 2 put it — and each await is a dynamic `import()` per contributed binding. `mountContributedViews`'s own signal check (round 3) stops only ITS mounts; it cannot stop the CALLER that resumes after it, and below those two lines the render keeps writing to the page: the staging workbench overlay, the tab strip, the repository selector, `initAbout`, the global search listener — and finally `status.remove()`, which on a repository switch strips the NEWER render's `#loadstatus` while the stale render's workbench and tab strip land on top of the new one's. `if (signal.aborted) return;` now sits immediately after each. There is deliberately no fifth guard: the third call of the same pass, the tab router's `onRegionRendered` hook, is not awaited (it runs from a synchronous click handler, round 2), so its scope check is its rejection path's — the guard round 4 put at the top of `reportAssemblyFailure`. Four sites is the whole census, and the tests now say so: the new test pins each stop BETWEEN its own pass and the next thing this render writes and both above `status.remove()`, while round 4's test pins the census at four rather than two and names each one; both were run against the OLD read and FAIL there. The boundary census's `app.js` row moves 1602 → 1618 loc (class-A total 16945 → 16961) with the reason in its note, and the destination gate re-run on the fixed tree before the push answers OK with identical figures — both guards fall inside `web/app.js`'s already-declared edit lines, so again no amendment to the landed annotation is owed. **Round 7 (`5c6f762`) posted ZERO new comments** — 22/22 files reviewed, 21 threads, none unresolved, `validate` green — and its check completed success. Its verdict line reads "Needs a closer look" on the strength of three SUPPRESSED comments, which Copilot declines to post as threads and which have been a standing class in every round of this review (3-7 per round since `fd7160d`). They are REGISTERED here rather than silently passed over, and none is a regression of the round-6 fix: (a) `view_extension.py:657` — the `_NO_FACET` sentinel comment says `VIEW_EXTENSIONS = None` is a MALFORMED declaration while `host_view_facet()` returns `("absent", ())` for it and its own docstring says a profile "is entitled to spell 'I contribute no views' as `None`"; READ AND CONFIRMED ACCURATE — a comment/implementation contradiction, no behaviour defect, and a one-line comment fix owed as a later declared act. (b) `app.js:1092` — a binding whose manifest names an entry but omits a second export (`isGateBearing`) passes the resolve and is reached later from the async `renderViewer` path, outside `render()`'s `try`, so the proxy's `ViewBindingError` would become an unhandled rejection instead of reaching RULED Q11's surface. (c) `views/view_extension.js:692` — the Q2 namespace proxy's `then` pass-through lets an undeclared `then` export cross the boundary. (b) and (c) are RAISED AND NOT YET ADJUDICATED: each is a fail-closed question about the registry seam rather than about what this slice moved, and each is registered on openxFactory#656 for a later declared act rather than taken at the landing. Register, carried forward: RULED Q7's contributed CSS is NOT realized and not skipped — `styles.css` is a `moved_verbatim` row and "a stylesheet block leaves for another leg" is in none of RULING OQ-1's three classes (measured: 51 classes exclusive to the six modules, 24 shared). The two intent-feed suites (`test_intent_tray_dom.py`, `test_wheel_verbs_dom.py`) copy `views/intent-feed.js`, RULED `not_moved` under OQ-F, so both have failed since the CARVE COMMIT and removing `views/dispose.js` from their copy lists would not make either run — they are slice S8's, and `.github/workflows/validate.yml` records that by name. RULED Q4 produces one named behaviour change: now that the shell ACTS on `requires`, `gate.bar`, `gate.workbench.create`, `gate.workbench.session` and `gate.dispose` declare NO requirement, because requiring `actions.gate` would delete the read-only gate surface — and, for `gate.dispose`, the refusal tray — on every HOSTED plane. Five node probes moved with their modules to openXdox-code#18 rather than being deleted. Landing authority: **Brett Heap's word, 2026-09-13 — "merge #1023, #18 and #20 when green"** (relayed by the orchestrator, session openXfactory-4). Gate evidence: destination gate above, re-run from openxFactory main `ee251d6c` against this head (whose carve manifest, admissions and verifier are byte-identical to openxFactory `origin/main` `04340d77`); `validate` SUCCESS at `5c6f762` (run 34787811773, check run 103806385253), the one required check in this repository's ruleset; 21 review threads / 0 unresolved; Copilot re-reviewed at every head after `gh pr ready` and after each of the round-4, round-5 and round-6 fixes; Sourcery review skipped (budget) = advisory; SonarCloud success and advisory either way. The narrowed `validate` list was also run locally exactly as CI runs it (`--noconftest`): 253 passed, 1 xfailed, 0 failed.



STACKED PR — lands after #17 (which itself stacks on #14). Base branch here is
build/s4-split-route-tails(openDox-code #17, head8fdc6ac), notmain; this PR should merge only once #17 (and #14 beneath it) have landed.The finding
Copilot, on openDox-code #16, left a thread on
src/opendox/web/views/view_extension.js:358for its owner:manifestRoutes()(the function that actually readscontributed_routesat that line —contributedViewBindings()itself never touches that field) validated only thatcontributed_routeswas an array, andownershipBreach()read a contributed entry'sis_prefixwith a truthy check (claimed.is_prefix && route.startsWith(pattern)). Neither refused an individual entry that was malformed: missing a stringpattern, or carryingis_prefixas anything other than a real boolean — including simply absent, which is falsy and so silently read as "not a prefix" instead of refused.view_extension.js's own comment on the manifest-absence case states the rule this breaks: "MALFORMED... REFUSES: a payload that claims to be a view manifest and is not is a contribution nobody can reason about, and failing closed is the only safe answer for something that decides which code the shell imports." (I could not find a literal "§ 4.1 absence table" in the openDox-spec doc at ref61866d29— § 4.1 there is prose describing the registry mirroringroute_extension.collect_bindings; the fail-closed principle above is the JS file's own, and is what this PR extends consistently to both checks.)The fix (
view_extension.jsonly —app.jsuntouched)requireRouteShape(claimed)validates a single contributed-route entry: stringpattern, and now a strict-booleanis_prefix.manifestRoutes()runs it over every entry once the array check passes, so a malformed entry refuses at manifest-read time — not only if some binding's route happens to reach it insideownershipBreach().ownershipBreach()calls the same helper, sois_prefixrefuses when it isn't a real boolean rather than falling through the old truthy read.Python mirror parity.
view_extension.py's_route_ownership_breachreadsis_prefixasbool(getattr(contributed, "is_prefix", False))— a coercion, not a refusal — but that's safe only because itscontributed_routesarrive as already-constructedRouteBindingobjects, andRouteBinding.__post_init__(route_extension.py) already refuses a non-boolis_prefixat construction, before_route_ownership_breachever runs. The JS mirror has no such upstream gate — itscontributed_routesarrive as raw JSON off/capabilities— so this fix is deliberately stricter than the Python line it mirrors, matching what construction-time validation already guarantees server-side. Thepatterncheck was already refusing and is unchanged in behavior, just shared between the two call sites now.Tests (
tests/test_view_registry.py, node-driven per its existing_run_nodepattern)test_js_manifest_routes_refuses_a_malformed_contributed_routes_fieldwith two entry-level cases (entry missingpattern; entry with a non-booleanis_prefix), each inside an otherwise well-formed array.test_js_ownership_check_refuses_a_non_boolean_is_prefix_rather_than_coercing_it: a missingis_prefix, a non-boolean truthy one, plus — so the fix doesn't over-refuse — a well-formedtrue(still breaches correctly) andfalse(still resolves correctly).tests/fixtures/web_boundary_census.yaml:views/view_extension.jsgrew 463 → 499 lines;locand the class-Atotals:are re-derived and updated to matchtest_web_boundary.py's own drift check, with a note recording what changed.Narrowed
validatecommand (.github/workflows/validate.yml's pytest step, run locally against a matchingpytest>=8,<9install): 181 passed, 3 xfailed (baseline before this change: 180 passed, 3 xfailed — the 3 xfails are pre-existing and unrelated, per that workflow's own comments).Refs opensoft/openXfactory#656
Lane: openxfactory-4-opendox-extraction
🤖 Generated with Claude Code
Summary by Sourcery
Make the client-side view registry fail closed when contributed-route entries cannot be reliably classified.
Bug Fixes:
Enhancements:
Tests:
Chores: