Skip to content

Declare the handler-contribution facet (plan 034 T010, R1Q1 (a)) - #40

Merged
brettheap merged 11 commits into
mainfrom
build/034-p1a-t010-handler-facet
Sep 27, 2026
Merged

brettheap merged 11 commits into
mainfrom
build/034-p1a-t010-handler-facet

Conversation

@brettheap

@brettheap brettheap commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Plan 034, task T010, slice P1-A (the route seam). The plan is specs/034-opendox-standalone-operation/tasks.md at opensoft/openxFactory main. It has been unchanged since a65230f6 (#1167, the phase-1 gate), and was re-read at 79a720a2. This PR realizes box 2.2 (the mechanism) of the ratified add-neutral-product-standalone-operability.

  • Ruled: R1Q1 (a) and R1Q22 (a), in openxFactory#656 comment 5817152735. R1Q1 (a) reads: "A handler-contribution facet is composed into BoundDashboardHandler, so the lanes mixin can be dropped." The edits to carved files need no declared-edit act (R1Q22 (a)).
  • Claim: openxFactory#656 comment 5850112604.

What changes

A host profile, or a route extension, may now declare HANDLER_CONTRIBUTIONS. That is a plain tuple of the mixin classes holding the methods its route bindings name.

  • src/route_extension.py declares the facet. The module still imports only the standard library, and it names no contributor.

    • declared_handler_contributions(contributor) reads one contributor. An absent facet or None contributes nothing. Anything but a plain tuple of classes is refused.
    • collect_handler_contributions(contributors, *, base) flattens the declarations and checks them against the core handler. It then composes them once, as a throwaway class, so a conflict only type() can find is refused at wiring time. It runs beside collect_bindings, before the build's expensive work.
    • compose_handler(name, base, contributions, namespace) is type(name, (base, *contributions), namespace), and it repeats the checks where the class is made. With nothing declared, it builds exactly the class that type("BoundDashboardHandler", (DashboardHandler,), {...}) built.
    • resolve_handlers is unchanged. It still runs after the composition, so every binding is checked against the class that will dispatch it.
  • src/opendox/serve.py changes in build_server only. It reads the facet off the host profile and off every extension it collected bindings from. It builds BoundDashboardHandler through compose_handler, with DashboardHandler first among the bases.

  • A contribution may only ADD. Each of these is refused with RouteBindingError at wiring time:

    • a name the core handler already resolves;
    • a name the core handler sets on its instances, such as path, wfile or _headers_buffer, which no class's dir() lists. These names are measured at wiring time from the source of every class in the core's MRO, reading each method through its own receiver, whatever it is called. The instance's attribute would take precedence over the contributed method, so a binding naming one would dispatch the core's value. For DashboardHandler the surface is the fifteen names the stdlib bases set. It takes 280 ms, once per process, and a build that composes nothing measures nothing;
    • a name two contributions both define;
    • a dunder beyond class bookkeeping (the object protocol). The bookkeeping set is measured from probe class statements, and includes __orig_bases__, which a class statement writes where a base resolved through __mro_entries__, and __type_params__. A generic mixin is still refused, for the __init_subclass__ and __class_getitem__ of its implicit typing.Generic base;
    • a data descriptor: a property, a named slot, or anything with __set__ or __delete__. It would intercept the core's per-instance state under its name, however that state is set. Under a class-bookkeeping name, one is refused unless the core answers that name itself;
    • a descriptor that is not a method: anything whose type defines __get__ and is not exactly a function, a staticmethod or a classmethod, such as a cached_property, a partialmethod or a __get__ of its own. Python binds those three the same way on the class and on an instance, and resolve_handlers checks each binding on the class. So a contribution holds methods, static and class methods, and plain values;
    • a metaclass other than the core handler's. The composed class would take it. One whose __getattr__ answered any name would pass resolve_handlers for a method no instance has;
    • an ancestor shared with the core other than object, which keeps the core's MRO a prefix;
    • a declaration that is not a plain tuple of classes, a class declared twice, or classes type() cannot compose.

    Classes are compared by identity, never by hash or equality. Class-ness is decided by an object's real type, never by the __class__ it reports. Every refusal names what it refuses through a formatter that cannot raise. The module docstring gives the argument for each refusal. It also says the checks are not a sandbox, since a contributor is host code in the same process.

  • docs/profile-registration-runbook.md: the table of what openDox reads off a profile gains the optional HANDLER_CONTRIBUTIONS row. Its type-checking statements now say that the profile object is never type-checked, and that the values read off it are checked where they are read.

DashboardHandler still takes serve_openxfactory_lanes.LaneRoutes as a base in this PR. T011 removes that base. openxFactory's T045 then declares LaneRoutes, which holds six plain methods, under this facet in scripts/profile_openxfactory.py.

The falsifier: a new tests/test_route_handler_contribution.py

T010's two named cases come first:

  • A binding that names a method only a contributed mixin has resolves, against the composed class and not the core alone.
  • A binding that names a method no class has is refused at wiring time.

The file's other cases cover:

  • each refusal above;
  • dispatch against the live handler;
  • absence, MRO order and neutrality;
  • the build_server wiring.

opendox.serve does not import until T011, so the file drives the facet over a stand-in core handler built on http.server.SimpleHTTPRequestHandler. It reads build_server with ast, as tests/test_profile_registration.py does (tasks.md § Phase 1). The run is under --noconftest, because tests/conftest.py imports opendox.serve, which reaches serve.py:199:

$ python -m pytest -q --noconftest tests/test_route_handler_contribution.py
........................................................................ [ 85%]
............                                                             [100%]
84 passed in 0.29s

Beside tests/test_profile_registration.py, under the same flag, the result is 114 passed.

Each guard has been proved to bite. A driver applies each mutation to a scratch copy of this head's src/ and tests/, and runs the file. An anchor that is missing or not unique aborts the run, so it is never counted as a catch. The baseline is 84 passed, and every mutation fails at least one case:

# mutation result
M1 contributions placed before the base 2 failed
M2 the shadow refusal removed 5 failed
M3 the object-protocol refusal removed 7 failed
M4 the clash refusal removed 1 failed
M5 serve.py back to a bare type(...) 2 failed
M6 the facet read off the profile only 1 failed
M7 any iterable accepted 10 failed
M8 a bare repr in the refusals 2 failed
M9 the preflight composition removed 1 failed
M10 the metaclass refusal removed 6 failed
M11a declared-twice checked by == 1 failed
M11b membership by in, not identity 1 failed
M12 the data-descriptor refusal removed 6 failed
M13 isinstance for the tuple check 2 failed
M14 isinstance for the class check 1 failed
M15 an unguarded class name in _describe 2 failed
M16 the instance-state refusal removed 18 failed
M17 the core measured when nothing is contributed 1 failed
M18 unpacked targets not measured 3 failed
M19 setattr(...) on the receiver not measured 3 failed
M20 class bookkeeping exempt by name alone 1 failed
M21 the resolved-base probe dropped 1 failed
M22 __type_params__ not bookkeeping 1 failed
M23 the non-method-descriptor refusal removed 4 failed
M24 method kinds tested by subclass, not exact type 1 failed
M25 the receiver assumed to be self 4 failed
M26 a staticmethod given a receiver 1 failed
M27 nested classes read as the core's 1 failed

Review

  • Copilot 5327667492 at 3e9a613a had three points: unsafe formatting, tuple-shaped declarations, and preflighting composability. All three were taken in 6b429f7, and both threads were answered and resolved.
  • Copilot 5327728032 at 6b429f7 had one "previously missed" point: unhashable class objects. It was taken in 2492d2a, together with the metaclass and data-descriptor refusals it led to and the runbook row. Its point on CI coverage belongs to T036, as the PR comment says.
  • Copilot 5328238157 at 353d418 found that a contributed name the handler sets on its instances (path, wfile) passed. It was taken in e1b8d4d, which measures that surface from the core's source. Its point on refusing namespace collisions before the side effects is pinned by a test that reads serve.py. The thread was answered and resolved.
  • Copilot 5328260656 at e1b8d4d reported no findings. Its overview asked about descriptor safety and the runbook's type-checking statement. Both were taken in c450a4a, as the PR comment says.
  • Copilot 5328285317 at c450a4a reported no findings. Its overview asked that the bookkeeping check account for __orig_bases__, with a regression test. Both were taken in 1bd2087.
  • Copilot 5328302496 at 1bd2087 reported no findings. Its "previously missed" item said a PEP 695 generic mixin was falsely refused for __type_params__. Measured, it is refused for Generic's own hooks, by design, as the PR comment shows. __type_params__ became bookkeeping in 0084434, with a regression test.
  • Copilot 5328333206 at 0084434 and 5328343519 at 8a41109 reported no findings. The first remark (non-method descriptors that pass wiring and fail at dispatch) was confirmed and taken in 1abb631. The second (instance-state detection and the preflight) is answered with the rule's documented limits and backstops in the PR comment.
  • Copilot 5328370858 at 1abb631 found that the instance-state measurement read only assignments through a receiver named self. It was taken in c8d5c80, which reads each method through its own receiver. The thread was answered and resolved.

The repository's own check

The three report-producing pytest steps of .github/workflows/validate.yml were run locally. Their file lists were read out of the file itself, and the results were summed the way Pin the triple sums them. The venv was Python 3.12.3 with -c constraints-cpython312-linux.txt -e ".[test]", as the job installs.

  • main 1e4a57fb: selected=1121 passed=1118 skipped=3 failures=0 errors=0.
  • this head, c8d5c80, with main 8017cd5 merged in: selected=1121 passed=1118 skipped=3 failures=0 errors=0. The pins are >=1114, >=1111 and ==3.

tests/test_profile_registration.py is on that list. It executes build_server's ROUTE_EXTENSIONS statement by AST, against a stand-in seam that has collect_bindings alone, and it stays green. That is why that statement stays ONE statement and names its tuple with contributed :=, as the comment in build_server says.

This PR does not touch:

  • validate.yml, which is T036's. So the new file is not yet on the required check's lists.
  • tests/test_profile_registration.py, which is P1-B's.

A measurement, never committed: the real build_server, composing

This used research R0's Group-2 simulation shim, whose bytes match the recorded digest e00c4c5f…, and it stubbed the three phase-1 reaches:

  • the snapshot source, injected;
  • _checkout_real, whose body imports openxdox.corpus_root (serve.py:629);
  • compute_capabilities' registry_mod.BINDING_* reads.

A stand-in host profile declares ROUTE_EXTENSIONS = (Ext(),) and HANDLER_CONTRIBUTIONS = (Mixin,), and the extension binds GET /probe.json to a method that only Mixin has. Two more profiles contribute a metaclass-built mixin, and a method named path bound to GET /path-probe.json. At c8d5c80:

built: BoundDashboardHandler | Mixin in MRO: True | core first: True | bootstrapped: True
GET /probe.json -> 200 {'probe': 'contributed', 'loopback': True}
refused: RouteBindingError | names the metaclass: True | bootstrapped before the refusal: False
refused: RouteBindingError | INSTANCE: True | names http.server.BaseHTTPRequestHandler: True | bootstrapped before the refusal: False

So the composed class dispatches the contributed method against the live handler. Both the metaclass and the instance-state name are refused before the snapshot source is bootstrapped. Research R7 names only :1647, but a phase-1 standalone build_server meets all three of the reaches listed above. T011's build_server case stubs the same three.

Landing

  • It depends on T006 only, which is done (openxFactory #1167).
  • It lands by squash or merge, never rebase. A squash message is built from the commit messages, which carry both trailers. A merge landing must write them into the merge message (11.0).
  • serve.py has one writer at a time. T011 and T012 follow this PR, then P1-B's T016.

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

🤖 Generated with Claude Code

A host profile, or a route extension, may now declare
HANDLER_CONTRIBUTIONS: the mixin classes that hold the methods its route
bindings name. build_server composes them into BoundDashboardHandler
after the core handler, through route_extension.compose_handler.
resolve_handlers is unchanged, so every binding is still checked against
the class that will dispatch it.

A contribution may only add. RouteBindingError refuses one at wiring
time when it shadows a core name, clashes with another contribution,
reaches the object protocol, shares ancestry with the core, or is
malformed or declared twice.

The new tests/test_route_handler_contribution.py drives the facet over a
stand-in core handler, because opendox.serve does not import until T011.
It reads build_server with ast for the wiring. T011 adds the case
through build_server itself.

Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 26, 2026 22:05
@sourcery-ai

sourcery-ai Bot commented Sep 26, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds an optional, standard-library-neutral handler-contribution seam: profiles and route extensions declare mixins, wiring validates them, build_server composes them behind DashboardHandler, and bindings resolve against the resulting class. Extensive tests cover dispatch, safety refusals, neutrality, and AST-level server integration.

Sequence diagram for composing contributed route handlers

sequenceDiagram
    participant Profile as HostProfile
    participant Extension as RouteExtension
    participant Server as build_server
    participant Facet as route_extension
    participant Handler as BoundDashboardHandler

    Server->>Profile: read ROUTE_EXTENSIONS
    Server->>Extension: collect_bindings
    Server->>Profile: read HANDLER_CONTRIBUTIONS
    Server->>Extension: read HANDLER_CONTRIBUTIONS
    Server->>Facet: collect_handler_contributions((Profile, Extension), base=DashboardHandler)
    Facet-->>Server: validated contributions
    Server->>Facet: compose_handler(BoundDashboardHandler, DashboardHandler, contributions, namespace)
    Facet-->>Server: composed handler class
    Server->>Facet: resolve_handlers(route_bindings, BoundDashboardHandler)
    Facet-->>Server: resolved handlers
    Server->>Handler: bind composed class
Loading

Flow diagram for handler-contribution validation

flowchart TD
    A[Profile and extensions declare HANDLER_CONTRIBUTIONS] --> B[declared_handler_contributions]
    B --> C[collect_handler_contributions]
    C --> D{Contribution may only ADD}
    D -->|valid classes and MRO| E[compose_handler]
    D -->|shadow, clash, dunder, duplicate, ancestry, or composition error| F[RouteBindingError at wiring time]
    E --> G[DashboardHandler first in MRO]
    G --> H[resolve_handlers against composed class]
Loading

File-Level Changes

Change Details Files
Introduces an optional handler-contribution facet and validates declared mixins before wiring.
  • Reads HANDLER_CONTRIBUTIONS from profiles and route extensions, treating absence or None as empty.
  • Rejects malformed, duplicate, shadowing, conflicting, object-protocol, ancestry-entangled, and non-composable contributions.
  • Keeps route_extension standard-library-only and reports wiring defects through RouteBindingError.
src/route_extension.py
Composes the bound dashboard handler from the core handler and validated contributions during server construction.
  • Collects profile and binding-contributing extension facets beside route bindings.
  • Builds BoundDashboardHandler with DashboardHandler first, then resolves bindings against the composed class.
  • Preserves the existing no-contribution class shape and AST-tested wiring statement.
src/opendox/serve.py
Adds focused coverage for contribution declaration, composition safety, dispatch, neutrality, and server wiring.
  • Verifies contributed-only bindings resolve and dispatch against live composed handlers.
  • Covers absence, MRO ordering, malformed declarations, duplicate and unsafe contributions, and type() failures.
  • Statically checks build_server call order and facet sources without importing the pre-T011 server module.
tests/test_route_handler_contribution.py

Tips and commands

Interacting with Sourcery

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

Customizing Your Experience

Access your dashboard to:

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

Getting Help

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Address unsafe formatting, enforce tuple-shaped declarations, and preflight class composability before startup side effects.

Review effort: Lite
Findings: 2 Medium severity

Open (2)
What changed in this PR

Adds wiring-time composition of handler mixins declared by host profiles and route extensions.

Changes:

  • Adds contribution discovery and validation.
  • Composes contributed handlers during server construction.
  • Adds tests for dispatch, safety checks, MRO behavior, and wiring.
File Description
tests/​test_route_handler_contribution.py Tests contribution behavior and wiring.
src/​route_extension.py Defines and validates handler contributions.
src/​opendox/​serve.py Composes the bound handler during server construction.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/route_extension.py Resolved
Comment thread src/route_extension.py Resolved
)

Copilot's review of #40 at 3e9a613 found three gaps, and this closes
each one.

- The facet accepted any iterable, though its contract and its refusal
  both say tuple. A set would make the composed MRO depend on hashing,
  and a generator would compose nothing on a second build.
  HANDLER_CONTRIBUTIONS must now be a tuple, and so must
  compose_handler's contributions.
- Three refusals interpolated the refused object's repr directly, so an
  object whose repr raises escaped as that exception. They now name it
  through _describe, which never raises.
- An MRO or layout conflict that only type() can find surfaced in
  compose_handler, after the build's expensive work.
  collect_handler_contributions now composes the contributions once, as
  a throwaway class, beside the bindings.

Each fix has a case, and each case fails when its fix is reverted.

Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings September 26, 2026 22:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Address the validation error handling, required CI coverage, and profile-contract documentation.

Review effort: Lite
Findings: None

Resolved since last review (2)
Previously missed (1)

In code that hasn't changed since last review

Medium severity Handle unhashable class objects with RouteBindingError

src/​route_extension.py:763

The facet accepts any isinstance(item, type), but this duplicate check uses the class object as a dictionary key. A valid class whose metaclass sets __hash__ = None therefore raises a raw TypeError: unhashable type here instead of the promised RouteBindingError; the later set/dict operations in _refuse_an_unsafe_composition have the same assumption. Either reject unhashable class objects through the module's error type or track declarations by identity throughout both validation paths.

brettheap and others added 2 commits September 27, 2026 00:17
… descriptor (review of #40)

Copilot's review of #40 at 6b429f7 found one case it had missed. A
contributed class whose metaclass refuses hashing escaped the duplicate
check as a raw TypeError, instead of the promised RouteBindingError.
Classes are now compared by IDENTITY throughout, never by hash or equality.

Probing that case turned up two ways a contribution could still do more
than ADD:

- A METACLASS of the contribution's own becomes the composed class's
  metaclass. One whose __getattr__ answers any name makes
  resolve_handlers, which looks each method up on the class, pass a
  binding that no instance has. The test demonstrates that on an
  unchecked composition. So a metaclass that is not the core handler's is
  refused, and it is checked first, before anything is read through it.
- A DATA DESCRIPTOR (a property, a named slot, anything with __set__ or
  __delete__) takes precedence over an instance's own attributes. So a
  contributed one named like state the core sets on each request
  (self.wfile) intercepts that state, and dir() of no class lists it. A
  contribution holds methods.

Also:

- The facet, and compose_handler's argument, must be a PLAIN tuple, since
  a tuple subclass may iterate however it likes.
- Class-ness is decided by the REAL type, never by the __class__ an object
  reports.
- _describe tries each way of naming an object in turn.
- The runbook's table of what openDox reads off a profile gains the
  optional HANDLER_CONTRIBUTIONS row.
- The layout-conflict cases now use an MRO conflict, because named slots
  are refused earlier as data descriptors.

54 cases pass under --noconftest, and 16 mutations are each caught.

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Since this branch was cut, main gained T020 (#37), T026 (#39) and T015
(#38). None of them touches src/route_extension.py, src/opendox/serve.py,
the facet's tests or the profile-registration runbook.

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings September 27, 2026 00:19
@brettheap

Copy link
Copy Markdown
Contributor Author

Copilot's review of 6b429f7 (review 5327728032), answered at 353d418:

  1. Unhashable class objects ("Previously missed", src/route_extension.py:763). Taken in 2492d2a.

    • Classes are now compared by IDENTITY throughout, through _is_one_of. That covers the declared-twice check, both MRO checks and compose_handler's duplicate check. No contributed class is hashed or compared with ==.
    • test_classes_are_compared_by_identity_never_by_hash_or_equality drives every path with a metaclass whose classes refuse both.
    • Putting either identity test back to == fails that case (M11a, M11b in the body).

    Probing this found a wider gap. The composed class takes a contribution's own METACLASS. A metaclass whose __getattr__ answers any name makes resolve_handlers, which looks each binding's method up on the class, pass a binding no instance has. test_a_metaclass_is_refused_because_it_would_pass_a_binding_no_instance_answers shows this on an unchecked composition.

    • So a metaclass other than the core handler's is refused. It is checked first, from type(mixin), before anything is read through it.
    • Data descriptors are refused as well. A property or a named slot takes precedence over an instance's own attributes, so one named wfile would intercept the stream the core sets on each request. No class's dir() lists that stream.
    • A never-committed probe ran through the real build_server, with the Group-2 shim (e00c4c5f) and the three phase-1 stand-ins. A metaclass-built contribution is refused with RouteBindingError before the snapshot source's bootstrap() runs.
  2. Required CI coverage. Correct. validate.yml's three --noconftest steps run named file lists, and this PR's new file is not on them. Plan 034 gives that change to T036, "The required check runs the whole suite" (it realizes 2.5, 9.1 and 9.2a), and this slice's brief forbids editing validate.yml before then. So the body quotes the run: python -m pytest -q --noconftest tests/test_route_handler_contribution.py gives 54 passed, and the triple is unchanged at 1121/1118/3. Until T011 removes serve.py:199, tests/conftest.py cannot import opendox.serve in a lone checkout. That is why the run is --noconftest.

  3. Profile-contract documentation. Taken in 2492d2a.

    • docs/profile-registration-runbook.md has a table of what openDox reads off a profile. It gains an optional HANDLER_CONTRIBUTIONS row and a paragraph: presence-read, may also be declared by a route extension, composed after the core handler, and may only ADD.
    • domain_profile.py and profile_proxy.py name only the two REQUIRED facets, the ones a missing registration is refused for by name. The new facet is read by presence and never refused when absent, so their text stays true. Both files are slice P1-B's.

Lane: openxfactory-4 (openXfactory-4-openDox_extraction)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Address instance-state name collisions and validate final namespace conflicts before startup side effects.

Review effort: Lite
Findings: 1 High severity

Open (1)

Comment thread src/route_extension.py Resolved
…om source (review of #40)

Copilot's review of #40 at 353d418 found a gap. The shadowing refusal
compares contributed names only with dir(base), and so misses names the
request handler creates on each INSTANCE. A contributed method named
`path` passes resolve_handlers, which looks on the class. The stdlib
handler then sets self.path to the request path on every request, and
dispatch finds a string. The test shows this on an unchecked composition.

That instance state is now part of the wiring-time contract.
_instance_state(base) measures the names each class in the core's MRO
assigns on self, from its source: plain, augmented, annotated and unpacked
assignment, for and with targets, and setattr(self, "name", ...) with a
literal name. A contribution defining one is refused, and the refusal
names the core class that sets it.

- The source is read with inspect, imported locally. Each class is
  measured once per process.
- A build that composes nothing measures nothing.
- A class with no readable source (object, a class built at run time)
  adds no names.
- For DashboardHandler the surface is the fifteen names the stdlib bases
  set. It takes 192 ms, once. The real LaneRoutes collides with none.

The review also asked that a namespace collision be refused before the
build's side effects. Every one of the 25 names build_server hands
compose_handler is declared in DashboardHandler's own body, so the
shadowing refusal in collect_handler_contributions already refuses it.
That call precedes _head_of, the snapshot source and bootstrap(). A test
now reads both facts out of serve.py.

71 cases pass under --noconftest, and 20 mutations are each caught.

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings September 27, 2026 00:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Address the descriptor safety issue and clarify the runbook’s type-checking statement.

Review effort: Lite
Findings: None

Resolved since last review (1)

…k type-checks (review of #40)

Copilot's review of #40 at e1b8d4d asked for two things: that the
descriptor safety issue be addressed, and that the runbook's statement
about type-checking be clarified.

- Descriptors. The class-bookkeeping dunders pass the object-protocol
  refusal by NAME, so a data descriptor under one was never looked at.
  The core answers __dict__ and __weakref__ itself, ahead of the
  contribution in the MRO, so a contributed one is never reached. Where
  the core does not answer the name, for example __annotations__ on a
  core with no annotations, a contributed data descriptor would answer on
  every instance. It is now refused. A new test covers both sides.
- The runbook. It said openDox "type-checks nothing". It now says that
  the profile OBJECT is never type-checked, and that the values openDox
  reads off it are checked where they are read: the route bindings as they
  are collected, and HANDLER_CONTRIBUTIONS as a plain tuple of classes.

72 cases pass under --noconftest, and 21 mutations are each caught.

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@brettheap

Copy link
Copy Markdown
Contributor Author

Copilot's review of e1b8d4d (review 5328260656, no findings) named two items in its overview. Both are answered at c450a4a:

  1. The descriptor safety issue. No finding located it, so I audited every place a descriptor could still pass. The one that did: the class-bookkeeping dunders (__dict__, __weakref__, __doc__, __module__, __annotations__, __slots__) pass the object-protocol refusal by NAME, so a data descriptor under one was never looked at.

    Measured on the stand-in core, each of these was accepted. The core answers __dict__, __weakref__ and __annotations__ ahead of the contribution in the MRO, and the composed class answers __doc__ and __module__, so none of them was reached. A core that does not answer a name, such as one with no annotations, would let a contributed data descriptor under __annotations__ answer on every instance. That case is now refused.

    test_a_bookkeeping_name_may_hold_a_data_descriptor_only_where_the_core_answers_it covers both sides, and exempting by name alone fails it (M20).

  2. The runbook's type-checking statement. docs/profile-registration-runbook.md said openDox "type-checks nothing". It now says the profile OBJECT is never type-checked, and that the values openDox reads off it are checked where they are read: the route bindings as they are collected, and HANDLER_CONTRIBUTIONS as a plain tuple of classes that may only add to the core handler.

At c450a4a:

  • python -m pytest -q --noconftest tests/test_route_handler_contribution.py gives 72 passed, or 102 passed beside tests/test_profile_registration.py.
  • All 21 mutations are caught.
  • The validate triple is unchanged at 1121/1118/3.

Lane: openxfactory-4 (openXfactory-4-openDox_extraction)

Copilot AI review requested due to automatic review settings September 27, 2026 00:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Update bookkeeping validation for __orig_bases__ and add a regression test.

Review effort: Lite
Findings: None

Copilot's review of #40 at c450a4a asked that the bookkeeping check account
for __orig_bases__, with a regression test.

A class statement writes __orig_bases__ by itself whenever a base resolves
through __mro_entries__, as a generic alias's base does. It records the
bases as written, so it is bookkeeping, not a hook. Until now, a mixin that
carried it was refused as reaching the object protocol.

It is now measured from a second probe class statement, whose base
resolves. That keeps the set measured rather than listed. The second probe
is kept apart from the first, because a base of its own would move
__dict__ and __weakref__ off the class being measured.

The regression test composes a mixin whose base resolved. It also shows
that a typing.Generic mixin is still refused, for the __init_subclass__
and __class_getitem__ that Generic itself defines.

73 cases pass under --noconftest, and 22 mutations are each caught.

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings September 27, 2026 00:47
@brettheap

Copy link
Copy Markdown
Contributor Author

Copilot's review of c450a4a (review 5328285317, no findings) asked that the bookkeeping check account for __orig_bases__. Taken in 1bd2087.

A class statement writes __orig_bases__ by itself whenever a base resolves through __mro_entries__, as a generic alias's base does. It records the bases as written, so it is bookkeeping, and it is no longer refused as a hook.

  • It is MEASURED, like the rest of the set, from a second probe class statement whose base resolves.
  • The second probe is kept apart from the first, because a base of its own would move __dict__ and __weakref__ off the class being measured.
  • The measured set is now __annotations__, __dict__, __doc__, __module__, __orig_bases__ and __weakref__, plus __slots__.

The regression test is test_a_resolved_base_is_class_bookkeeping_not_the_object_protocol:

  • It composes a mixin whose base resolved.
  • It resolves bindings to both the mixin's method and its resolved base's method.
  • It shows that a typing.Generic mixin is still refused, for the __init_subclass__ and __class_getitem__ that Generic itself defines.
  • Dropping the second probe fails it (M21).

At 1bd2087:

  • python -m pytest -q --noconftest tests/test_route_handler_contribution.py gives 73 passed, or 103 passed beside tests/test_profile_registration.py.
  • All 22 mutations are caught.
  • The validate triple is unchanged at 1121/1118/3.

Lane: openxfactory-4 (openXfactory-4-openDox_extraction)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Two moderate validation issues remain unresolved.

Review effort: Lite
Findings: None

Previously missed (1)

In code that hasn't changed since last review

Medium severity Allow __type_params__ in generic mixin bookkeeping

src/​route_extension.py:723

The bookkeeping probe misses __type_params__, which Python 3.12 adds to classes declared with PEP 695 type parameters. A valid generic mixin therefore reaches the dunder scan with this class-generated name, is rejected as OBJECT PROTOCOL, and cannot contribute any route methods. Include this class-statement bookkeeping name (and cover it with a regression test) so generic mixins are not falsely refused.

…refused for Generic's hooks (review of #40)

Copilot's review of #40 at 1bd2087 reported, as "previously missed", that
a PEP 695 generic mixin was falsely refused because the bookkeeping probe
misses __type_params__.

Measured, the refusal did not rest on __type_params__. A class declared
with type parameters takes typing.Generic as an implicit base, and it was
refused for four names: __class_getitem__, __init_subclass__,
__parameters__ and __type_params__. Composing one unchecked runs
Generic.__init_subclass__ on the handler class, which writes
__parameters__ onto it. So a generic mixin is refused by design, as the
object-protocol rule intends.

__type_params__ itself is written by the class statement, so it is now
classified as bookkeeping and the refusal names only the hooks. It is
listed rather than measured. A PEP 695 probe would also sweep in the
__parameters__ that Generic's hook writes. The regression test pins both
halves: the refusal, and the hook's write on an unchecked composition.

74 cases pass under --noconftest, and 23 mutations are each caught.

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@brettheap

Copy link
Copy Markdown
Contributor Author

Copilot's review of 1bd2087 (review 5328302496, no findings) listed one "previously missed" item: that a PEP 695 generic mixin is falsely refused because __type_params__ is not bookkeeping. Answered at 0084434, and merged with main 8017cd5 as 8a41109.

Measured, the refusal did not rest on __type_params__. A class declared as class M[T]: takes typing.Generic as an implicit base (M.__mro__ is [M, Generic, object]). It was refused for four names: ['__class_getitem__', '__init_subclass__', '__parameters__', '__type_params__']. Generic defines the first two itself. __parameters__ is written by Generic.__init_subclass__, which is a hook's work.

Composed without the checks, Generic.__init_subclass__ runs on the HANDLER class and writes __parameters__ = () onto it. Unchecked[int] then raises TypeError: ... is not a generic class. So a generic mixin is refused by design: its base's class-creation hook would run on the core handler.

__type_params__ itself is class bookkeeping, because the class statement writes it. So it is now exempt, and the refusal names only the hooks. It is listed next to __slots__ rather than measured, because a PEP 695 probe would also sweep in the hook-written __parameters__. The comment at _CLASS_BOOKKEEPING says why.

The regression test is test_a_generic_mixin_is_refused_for_the_hooks_generic_brings_not_its_type_params. The refusal names __init_subclass__ and __class_getitem__ and not __type_params__, and the unchecked composition shows the hook's write. Reverting the exemption fails it (M22).

At 8a41109:

  • 74 passed under --noconftest, or 104 passed beside tests/test_profile_registration.py.
  • All 23 mutations are caught.
  • The validate triple is unchanged at 1121/1118/3.

Lane: openxfactory-4 (openXfactory-4-openDox_extraction)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Custom non-data descriptors can pass wiring validation but fail during live request dispatch.

Review effort: Lite
Findings: None

Copilot AI review requested due to automatic review settings September 27, 2026 00:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Unresolved moderate issues remain in instance-state detection and composition preflight behavior.

Review effort: Lite
Findings: None

Copilot's review of #40 at 0084434 said that custom non-data descriptors
can pass wiring validation and then fail during live request dispatch.

Measured through DashboardHandler, a descriptor with a __get__ of its own
that answers the class with a function and an instance with a value
passes both the facet and resolve_handlers. On a live handler it is not
callable. resolve_handlers checks each binding on the CLASS, so any
descriptor that answers the class and an instance differently could pass
at wiring time and fail at request time.

"A contribution holds METHODS" is now enforced as written. An attribute
whose type defines __get__ must be exactly a function, a staticmethod or a
classmethod, the three kinds Python binds the same way on the class and on
an instance. The test is on the exact type, so a staticmethod subclass
with its own __get__ is refused too. So are a cached_property and a
partialmethod. A callable that is not a descriptor, such as a builtin, is
looked up unchanged and still allowed. The real LaneRoutes holds six plain
functions.

The value exemption for class-bookkeeping names now serves both
descriptor refusals.

79 cases pass under --noconftest, and 25 mutations are each caught.

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@brettheap

Copy link
Copy Markdown
Contributor Author

Two Copilot reviews reported no findings and one remark each in the overview. Both are answered at 1abb631:

  1. Review 5328333206 at 0084434: "Custom non-data descriptors can pass wiring validation but fail during live request dispatch." Confirmed through DashboardHandler and taken in 1abb631.

    • A __get__ of the contribution's own that answers the class with a function and an instance with a value passed both the facet and resolve_handlers. On a live handler it was not callable.
    • "A contribution holds METHODS" is now enforced as written. An attribute whose type defines __get__ must be EXACTLY a function, a staticmethod or a classmethod. Those are the three kinds Python binds the same way on the class and on an instance.
    • The same refusal covers a cached_property, a partialmethod and a staticmethod subclass with a __get__ of its own.
    • A callable that is not a descriptor, such as a builtin, is looked up unchanged and still allowed.
    • The tests are test_a_contribution_carrying_a_descriptor_that_is_not_a_method_is_refused (4 cases) and test_a_non_method_descriptor_is_refused_because_its_binding_would_fail_at_request_time, which shows the failure on an unchecked composition. Mutations M23 and M24 are caught.
  2. Review 5328343519 at 8a41109: "instance-state detection and composition preflight behavior." No finding located either item, so this is the state of both:

    • Instance-state detection measures what the core's classes assign on self in their own source. It cannot see a setattr with a computed name, state set from outside the core's class bodies, or a class with no readable source. Those limits are documented at the rule. Each has a backstop:
      • a data descriptor is refused, so nothing a contribution carries can intercept instance state under any name;
      • since 1abb631 no other descriptor is accepted, so what a contribution carries is a method, a static or class method, or a plain value.
      • A contributed method named like unmeasured state is at worst shadowed by the instance's own attribute. That breaks the contributor's own binding, not the core.
    • The composition preflight composes the contributions once, with an empty namespace, before any side effect.
      • No contributed code runs in it: hooks, metaclasses and non-method descriptors are refused before it.
      • The only __init_subclass__ in DashboardHandler's MRO is object's, measured through the shim.
      • A collision with the bound class's own namespace is refused there too, because every one of the 25 namespace names is a DashboardHandler class attribute. test_a_name_the_bound_class_sets_is_refused_before_build_servers_side_effects pins that.

At 1abb631:

  • python -m pytest -q --noconftest tests/test_route_handler_contribution.py gives 79 passed, or 109 passed beside tests/test_profile_registration.py.
  • All 25 mutations are caught.
  • The validate triple is unchanged at 1121/1118/3.

Lane: openxfactory-4 (openXfactory-4-openDox_extraction)

Copilot AI review requested due to automatic review settings September 27, 2026 01:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Instance-state collision detection only recognizes assignments through a receiver named self, allowing unsafe contributions when another receiver name is used.

Review effort: Lite
Findings: 1 High severity

Open (1)

Comment thread src/route_extension.py Resolved
…ever it is called (review of #40)

Copilot's review of #40 at 1abb631 found that the instance-state
measurement recorded only assignments through a receiver literally named
`self`. A core method whose receiver is called `handler` or `request`
would hide its state, and a contribution named like it would pass.

Each method of a core class is now read through ITS receiver, its first
positional parameter, whatever it is called:
- a method, including one defined under an `if` or a `try`;
- a lambda in a class-level expression;
- a classmethod, whose receiver is the class. A name the core sets on its
  class at run time would replace a contributed one there.

A staticmethod has no receiver, and a nested class's methods receive that
class's instances, so neither is read.

For DashboardHandler the measured surface is unchanged: the fifteen names
its stdlib bases set, measured in 280 ms once. The real LaneRoutes collides
with none of them.

84 cases pass under --noconftest, and 28 mutations are each caught.

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings September 27, 2026 01:17
@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Account for __classcell__ bookkeeping so valid mixins using zero-argument super() are not rejected.

Review effort: Lite
Findings: None

Resolved since last review (1)

@brettheap

Copy link
Copy Markdown
Contributor Author

Copilot's review of c8d5c80 (review 5328389771, no findings) suggested accounting for __classcell__ as bookkeeping, so that mixins using zero-argument super() are not rejected. Measured on Python 3.12.3, no mixin reaches the check with it: type.__new__ sets the cell and then DELETES __classcell__ from the class dict. So a mixin using zero-argument super() and __class__ is already accepted.

The run was against c8d5c80's route_extension. A mixin _UsesSuper(_Cooperative) calls super()._lane_note() and reads __class__.__name__:

__classcell__ in vars(_UsesSuper): False | __classdictcell__: False
dunders left in vars(_UsesSuper): ['__doc__', '__module__']
accepted and resolved; dispatch -> (200, {'notes': ['uses super', 'cooperative'], 'cls': '_UsesSuper'})

It is collected, composed and resolved, and the dispatched method runs its cooperative super() chain. No code change is needed. The bookkeeping set is measured from probe class statements, so a later interpreter that left a new name in the class dict would be measured, not hard-coded.

Lane: openxfactory-4 (openXfactory-4-openDox_extraction)

@brettheap
brettheap marked this pull request as ready for review September 27, 2026 01:24

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 4 days and 15 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@brettheap

Copy link
Copy Markdown
Contributor Author

READY at c8d5c80 — Lane: openxfactory-4 (openXfactory-4-openDox_extraction)

@brettheap
brettheap merged commit 0f10b1f into main Sep 27, 2026
5 checks passed
@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-4 (openXfactory-4-openDox_extraction)

LANDED — lane openxfactory-4, 2026-09-27T01:31:20Z, PR #40 → 0f10b1f (opensoft/openDox-code main; plain gate)

Brett: land the phase 1 PRs when green

brettheap added a commit that referenced this pull request Sep 27, 2026
… T011, with T030) (#46)

Plan 034, tasks **T011** and **T030** (T030's "Lands with: T011"), slice P1-A (the route seam). The plan is `specs/034-opendox-standalone-operation/tasks.md` at opensoft/openxFactory `main`. It has been unchanged since `a65230f6` and was re-read at `79a720a2`. This PR realizes boxes **2.1**, **2.1a**, **2.2** (openDox's half) and **2.4** of the ratified `add-neutral-product-standalone-operability`, and gives 9.2a its instrument (T036 makes a required check run it).

- **Ruled:** R1Q1 (a) and R1Q22 (a), in openxFactory#656 comment `5817152735`. The edits to carved files need no declared-edit act.
- **Claim:** openxFactory#656 comment `5850112604`.
- **After:** T010. Its handler-contribution facet landed in #40 as `0f10b1f`, and this branch is cut from that main.

## What changes

`serve.py:199` imported openxFactory's lanes column, and `:206` re-exported its five route names. So `import opendox.serve` needed a package openDox can never have. So did `opendox.cli` and `opendox.notebook_action`, which import it.

- **`src/opendox/serve.py`**:
  - both statements are deleted;
  - `serve_openxfactory_lanes.LaneRoutes` is off `DashboardHandler`'s bases. A host now declares that column under `HANDLER_CONTRIBUTIONS`, and `build_server` composes it (T010);
  - comments at both sites record why.

  The module is **not vendored** (2.1a). No openDox reader of the five names remains (2.2). The web bundle's `repo-selector.js` keeps its own `ACTIONS_REFRESH_ROUTE` spelling, and `tests/test_split_route_tails.py` reads the bundle, not `opendox.serve`.
- **`tests/test_consumer_reach.py`** moves `opendox.cli` and `opendox.serve` into `NEUTRAL_MODULES` in this act, as its record test asks, and sets the pre-carve census to zero.
  - The record is empty now, so it is walked inside ONE test.
  - An empty `parametrize` would be reported as a skip, and `validate.yml` pins `SKIPPED` at exactly 3.
- **`tests/test_imports_standalone.py`** (T030, new) imports every module of the package in a fresh interpreter.
  - It first asserts that no sibling (`openxdox`, `ideation_dashboard`, `doc_health`, `corpus_adapter_openxfactory`) is importable.
  - It imports the package itself, then every module the package's `.py` files define, in sorted order, so a package precedes its own modules. A package whose `__init__` fails, the root included, is imported and reported; `pkgutil.walk_packages` would skip its children. The test process only finds the package, so its `__init__` runs in the sweep alone.
  - It fails naming the FIRST module that did not import, and tells apart a sibling, a failure inside openDox's own package, a missing extra, and a third-party module of the wrong version.
  - Only once every module imports does it hold the sweep complete against `pkgutil`'s own walk.
- **Four passages that said `opendox.serve` or `opendox.cli` cannot be imported** now say so in the past tense and name T011. They are in `docs/profile-registration-runbook.md`, `docs/runtime.md` (twice), `tests/test_source_core_arm.py`'s docstring, and `tests/test_consumer_reach.py`'s `STILL_REACHING` comment. `src/opendox/runtime/cli.py:20-26` makes the same claim and is left to T038, which plan 034 gives that file's comments. The comment at `validate.yml:291` is T036's.
- **`tests/test_route_handler_contribution.py`** gains section 6, which drives `build_server` itself, now that `opendox.serve` imports. Its cases:
  - the profile's mixin and a caller extension's own, composed after the core and served against the live handler;
  - a binding no class answers, refused at the END of the build by `resolve_handlers`. It checks the class that will dispatch the route, which is composed last, and the case asserts the snapshot source WAS bootstrapped;
  - a shadowing contribution, an MRO no class can take, and a name the core sets on its instances. Each is refused BEFORE the snapshot source is bootstrapped.

## The falsifiers (T011: F2.1's generated sweep, T030's named test, the facet file with its `build_server` case, and `tests/test_consumer_reach.py`)

**F2.1**, run verbatim at `a827744` and again at `c99b187`, the last change to the sweep. Only `PATH` and `TMPDIR` were set, so that `python` resolves to 3.12 and the scratch space stays in this lane's directory. The script's own lines were not changed. It exits 0:

```
every module of opendox imports with no sibling
.                                                                        [100%]
1 passed in 0.99s
```

Before the sweep, its sibling loop found none of the four importable. The last line is `tests/test_imports_standalone.py::test_every_module_imports_with_no_sibling`, with the conftest in play. The install left an untracked `build/`, which was removed.

**The named test bites.** In a scratch copy with `serve.py:199` restored at its import position, the test fails:

```
AssertionError: opendox.cli does not import with no sibling installed: it still needs the sibling 'ideation_dashboard'.
  ModuleNotFoundError: No module named 'ideation_dashboard'
  Every other module that failed: opendox.notebook_action, opendox.runtime.app, opendox.runtime.db, opendox.runtime.oidc, opendox.serve
```

(The `runtime.*` modules also fail there, because that venv holds `.[test]` alone, as the next section says.)

**The facet file with its `build_server` cases**, with and without the conftest, at `344989a`: `91 passed`. The `build_server` cases:

```
test_build_server_composes_the_class_it_binds_through_the_facet PASSED
test_a_name_the_bound_class_sets_is_refused_before_build_servers_side_effects PASSED
test_build_server_composes_the_declared_mixins_into_the_class_it_binds PASSED
test_a_caller_extensions_own_mixin_is_served PASSED
test_build_server_refuses_a_binding_no_class_answers PASSED
test_build_server_refuses_a_shadowing_contribution_before_its_work PASSED
test_a_profile_that_declares_nothing_binds_the_core_alone PASSED
test_build_server_refuses_what_type_cannot_compose_before_its_work PASSED
test_build_server_refuses_a_name_the_core_sets_on_instances_before_its_work PASSED
```

**`tests/test_consumer_reach.py`**, which the required check runs by name: `31 passed`, with and without the conftest, and no skip.

## The repository's own check

The three report-producing pytest steps of `.github/workflows/validate.yml` were run locally. Their file lists were read out of the file itself, and the results were summed the way `Pin the triple` sums them. The venv was Python 3.12.3 with `-c constraints-cpython312-linux.txt -e ".[test]"`.

- at `3c637b2`: `selected=1122 passed=1119 skipped=3 failures=0 errors=0`, as at `a827744`. The pins are `>=1114`, `>=1111` and `==3`.
- One earlier run of the same tree failed one runtime case. It was `tests_runtime/test_local_git_adapter.py::test_the_group_is_signalled_from_the_id_saved_at_popen_not_looked_up_later`, with `ValueError: invalid literal for int() with base 10: ''`. The test waits for a pid file to EXIST and then reads it, and the shell's `echo $$ > file` can create the file before it writes. This PR touches neither that test nor its module. Alone, the case passed 20 runs of 20, and the triple re-run above is clean. It is recorded here as a race that predates this PR.

**The whole suite, with the conftest**, run in the same `.[test]` venv: `19 failed, 1418 passed, 13 skipped, 66 errors`.
- The red files are research R3's nine, less `test_consumer_reach`, which this PR turns green. The counts per file are unchanged: `test_doxbench_abstract_pane` 28, `test_outline_tab` 25, `test_doxbench_composition` 13, `test_provider_boundary` 12, `test_doxbench_memory_gateway` 3, `test_boundary` 1, `test_doxbench_mcp` 1 and `test_outline_model` 1.
- The one addition is T030's own test. In a `.[test]`-only venv it names `opendox.runtime.app`, which "needs 'fastapi', which is not a sibling", and it asks for the sweep to run where every extra is installed, as F2.1 does. T036 gives the `test` extra the runtime packages.

**F4.1's scan** (`scan_deferred_reaches.py` from research.md's appendix, sha256 `fe11620319b0…`, matching the recorded digest) lists 21 deferred reaches at main `0f10b1f` and 21 at this head.
- Only the `serve.py` entries' line numbers moved, by the comments this PR adds.
- T011's two reaches are at import time, so F2.1 proves them, not F4.1.
- `_head_of`'s `doc_health.corpus` (now `serve.py:723`) is T012's.

**pyflakes**, run on `serve.py` against main's copy, shows no new warning and five fewer: the five unused lane-name re-exports.

## Review

Copilot `5328452123` at `a827744` opened two threads, and both are answered and resolved.
- *The standalone-import test is not in the required CI.* By plan it is not yet. T036 makes a required check run it ("9.2a (a required check now runs T030)"), and `validate.yml` is T036's. Wiring it in now would also turn the `.[test]`-only job red, as the thread reply shows.
- *A refusal after bootstrap.* A binding no class answers is refused at the end of the build, by design. `344989a` narrows the section's claim to say so, and pins it with `standalone.source.bootstrapped is True`.

Copilot `5328465598` at `344989a` reported no findings and raised two items in its overview, both taken, as the PR comment shows:
- a subpackage whose `__init__` fails would have been skipped by the walk. `24fbcb9` imports the file-derived list, which is demonstrated on a scratch copy with a failing subpackage;
- stale consumer-reach documentation, fixed in `3c637b2` as listed under "What changes".

Copilot `5328489225` at `3c637b2` reported no findings. It asked that internal import failures be classified correctly, and that the root package be included in the diagnosis. Both were taken in `c99b187`, and each verdict was demonstrated on a scratch copy, as the PR comment shows.

After `a827744` no source file changed. The later commits touch tests and docs only, so the F4.1 and pyflakes runs above, made at `a827744`, stand for this head. F2.1, the triple and the whole suite were re-run. The whole suite at `3c637b2` gives `19 failed, 1418 passed, 13 skipped, 66 errors`, with the same 85 red cases, none new and none gone.

## Readers outside this repository

Neither of these is an openDox-side reader, so 2.2's openDox half does not move them:
- openXdox-code `tests/test_repo_selector.py` reads `opendox.serve.ACTIONS_REFRESH_ROUTE`. It is in the `doc_health`-blocked set that T041 excludes.
- openxFactory `tests/ideation-dashboard/test_extension_point_parity.py` and `test_serve_column_split.py` pin `LaneRoutes` on `DashboardHandler`. T045 updates them, and declares `HANDLER_CONTRIBUTIONS = (LaneRoutes,)` in `scripts/profile_openxfactory.py`.

## Two observations, for phase 2 and 3

- A standalone `/capabilities` can still advertise `refresh` where no class answers `POST /actions/refresh`, because that handler is openxFactory's `LaneRoutes`.
- plan.md's "Phase-1 limit" note names the injected snapshot source alone. Measured, a standalone `build_server` also meets `_checkout_real`, which imports `openxdox.corpus_root`, and `compute_capabilities`' reads of `registry_mod.BINDING_*`. Section 6's fixture stubs all three, and says so.

## Landing

- It depends on T010, which landed as `0f10b1f`.
- It lands by squash or merge, never rebase. A squash message is built from the commit messages, which carry both trailers. A merge landing must write them into the merge message.
- `serve.py` has one writer at a time. T012 follows this PR, then P1-B's T016.

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

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


Lane: openxfactory-4
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
brettheap added a commit that referenced this pull request Sep 27, 2026
main is 2768302. It carries P1-A's T010 (#40), T011 (#46) and T012 (#47),
which T016 waits for, and P1-E's T025 (#43) and T027 (#41).

Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
brettheap added a commit that referenced this pull request Sep 27, 2026
T010 (#40) added a fifth facet, HANDLER_CONTRIBUTIONS, and build_server()
reads it by presence. The default does not declare it: it contributes no
route, so it has no method to supply, and
route_extension.declared_handler_contributions() answers () for it.
default_profile.py's docstring now counts five facets, and
test_default_profile.py asserts the absence through that same reader.
Declaring HANDLER_CONTRIBUTIONS = () fails the facets test.

The proxy's docstring and the runbook's "What counts as a build" say where
that read stands. It is optional and not in READERS, so the server's build
is recorded at its ROUTE_EXTENSIONS read. The docstring also cites the
holder's recorded readings on U4 and DISPLAY (openxFactory#656 comment
5851560764).

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

## Summary

Plan 034's **T016** (openxFactory `specs/034-opendox-standalone-operation/tasks.md`, slice P1-B), which realizes box **3.2** of the ratified `add-neutral-product-standalone-operability` (#1144): registration semantics, on R1Q3 (a) with (i) and (ii), and RN-1 (a).

- **The entry points register openDox's default where nothing is registered.** `cli.build_parser()`, `serve.build_server()`, `cli.main()` and `serve.main()` each open with `domain_profile.register_default(default_profile)`, one line each. Afterwards `is_registered()` answers True. The default is an entry-point registration and never a fallback inside `current()`.
- **A bare process that builds nothing still meets `ProfileNotRegistered`** (R1Q3 (i)). `profile_proxy`'s nothing-registered refusal is kept, never weakened into `()`. `current()`'s refusal now names the default. It says that nothing is registered now, either because nothing was built through an entry point or because `unregister()` has dropped the registration since.
- **A host registration made before anything is built replaces the default** (RN-1 (a)). That covers a host that registered first, which the default then never displaces. It also covers a default an entry point registered that nothing has been built from yet, for example after `serve.main()` has registered it at process start.
- **After a parser or a server was built from the default, a host registration is refused** with today's `AlreadyRegistered` (R1Q3 (ii); RN-1 (a)). The message names the default and the build, and says to register before the first build, or to call `unregister()` first for a deliberate swap.
- **Re-registering the object already registered stays a no-op, the default included.** The registration keeps its kind, a host's or the entry point's default, and a build from the default stays on record.
- **What counts as a build.** Only a composition point's read of the facet it composes from. Those are `SUBCOMMAND_EXTENSIONS` in `cli.build_parser()` and `ROUTE_EXTENSIONS` in `serve.build_server()`, the two facets `profile_proxy._LateProfile.READERS` names. Those reads go through `domain_profile.current_for_build()`, which is `current()` plus the record. Every other read only asks and records nothing: `is_registered()`, `current()`, `repr`, a dunder probe, the proxy's `resolve()`, and the `DISPLAY` and `VIEW_EXTENSIONS` reads. So none of these closes the window in which a host still replaces the default: openXdox's `_upstream()`, `view_extension.host_profile_name()`, `display_profile.host_display()`, `view_extension.host_view_facet()` and `canvas_drafts`. T010's optional `HANDLER_CONTRIBUTIONS` is not one of the two reads either: a server's build is recorded at its `ROUTE_EXTENSIONS` read.

## Authority

- Ratified packet: openxFactory#656 comment [`5815412869`](opensoft/openXfactory#656 (comment)).
- **R1Q3 (a)**, with (i) and (ii): openxFactory#656 comment [`5817152735`](opensoft/openXfactory#656 (comment)). *"The default profile and the default adapter are both entry-point registrations, and F3.1 line 2 is amended. 3.2's 'ambiguous registration' wording is corrected. A late host registration replaces the default until something is built, and is refused after that."*
- **RN-1 (a)**: openxFactory#656 comment [`5850003126`](opensoft/openXfactory#656 (comment)). *"reword requirement 3 so a host registration overrides the default only before anything is built from it, and add the after-build refusal scenario."* The requirement's text was amended by openxFactory#1170 (T007 batch D) → `79a720a2`. Its two scenarios are what this PR's cases assert. "A host registers its own profile" covers a registration before a build, which replaces the default. "A host registers a profile after a build from the default" covers the refusal.
- **T007 batch A**, openxFactory#1171 → `bca4a260`, records the ruled amendments to box 3.2 and to F3.1's line 2 in the packet. T016 carries out both, and the amended line 2 is the one run below.
- **R1Q22 (a)**: `cli.py` and `serve.py` are carved files, and no declared-edit act precedes an arc edit.
- The holder's readings on `DISPLAY` and on U4 (`ProjectSubcommand` stays out of the default) are recorded on openxFactory#656 comment [`5851560764`](opensoft/openXfactory#656 (comment)). `default_profile.py` cites both.
- **After**: T015, #38 → `a435aecf`; T012, #47 → `27683028`, with T010 (#40 → `0f10b1f5`) and T011 (#46 → `0e88454a`) before it. All are on `main`, and `main` @ `9d13bd16` is merged in.
- Claim: openxFactory#656 comment [`5850105728`](opensoft/openXfactory#656 (comment)).

## The falsifier

tasks.md, T016: *"**Falsifier**: F3.1 with line 2 as amended (T007 batch A); `tests/test_profile_registration.py`."* Batch A's amendment, now in the packet at `bca4a260`: *"The line asks after `build_parser()`: `python -c "from opendox.cli import build_parser; from opendox import domain_profile as d; build_parser(); print('OK', d.name_of(d.current()))"`. The prose under it adds that a bare process that builds nothing still meets `ProfileNotRegistered`, which `tests/test_profile_registration.py` asserts."*

F3.1 as #1144 writes it, with line 2 as amended, run from the checkout root. The run uses `python3` for `python`, and `pip install -q` to quiet the install:

```sh
set -euo pipefail
W=$(mktemp -d)
python3 -m venv --clear "$W/v3"
. "$W/v3/bin/activate"
pip install -q ".[test]"
python -c "from opendox.cli import build_parser; build_parser(); print('OK')"
python -c "from opendox.cli import build_parser; from opendox import domain_profile as d; build_parser(); print('OK', d.name_of(d.current()))"
python -m pytest -q tests/test_profile_registration.py
```

At `69fecb9d`, in a fresh venv, with nothing on `PYTHONPATH`. T011 is on `main`, so no shim stands in any more:

```
== F3.1, amended line 2, from the checkout root at 69fecb9, no shim
OK
OK opendox.default_profile
...................................................                      [100%]
51 passed in 1.25s
rc=0
```

Line 3 ran with the root conftest in play, as F3.1 runs it.

`tests/test_profile_registration.py` grows from 30 to 51 cases. Its new section 10 asserts the three cases and the seams between them:

| case (R1Q3, RN-1) | test |
|---|---|
| a bare process that builds nothing refuses (i) | `test_a_bare_process_that_builds_nothing_still_meets_the_refusal`, in a fresh interpreter that imports `opendox.cli`, `opendox.serve` and the default, and builds nothing |
| the entry points register the default (a) | `test_f3_1s_second_line_as_amended_names_the_default` (F3.1 line 2, verbatim, in a fresh process); `test_build_parser_registers_the_default_and_builds_on_it`; `test_cli_main_registers_the_default_and_builds_on_it`; `test_build_server_registers_the_default_before_its_first_read` |
| a host registration before a build replaces it (RN-1 (a)) | `test_a_host_registered_before_any_entry_point_keeps_its_own_tree` (no `runtime` command, so a host keeps its 31-entry tree); `test_a_host_registration_replaces_a_default_nothing_was_built_from`; `test_serve_main_registers_the_default_first_and_a_host_may_still_replace_it` |
| a host registration after a build is refused (ii) | `test_a_host_registration_after_a_build_from_the_default_is_refused`, whose message names the default, the build, `5634195861`, R1Q3 (ii), RN-1 (a) and `unregister()` |
| what is a build | a composition point's read of its facet is, once per `READERS` facet (`test_a_composition_points_read_of_its_facet_is_a_build`). Asking is not (`test_asking_which_profile_is_registered_is_not_a_build`), and nor is a read that only asks: the profile's name, `DISPLAY`, `VIEW_EXTENSIONS`, `canvas_drafts` and `resolve()` (`test_a_read_that_only_asks_is_not_a_build`) |
| the other seams | `unregister()` clears the default and its build. Re-registering the object already registered is a no-op, the default included (three cases). `register_default()` never displaces a registration and refuses `None`. The refusal names the default, and after `unregister()` it claims nothing about what the process built |

`build_server()` and `serve.main()` are held from their own lines, lifted by AST, as this file already holds the server's composition point: a server still reaches `openxdox` to be BUILT in phase 1 (research R7), and `serve.main()`'s `--ref` default reads `openxdox.snapshot_registry` (T055, phase 2). The parser and `cli.main()` are run for real.

**Runs at `69fecb9d`**, in a venv built as `validate` builds one (`pip install -c constraints-cpython312-linux.txt -e ".[test]"`):

| run | result |
|---|---|
| `--noconftest tests/test_profile_registration.py tests/test_default_profile.py` | `68 passed` |
| `validate.yml`'s three pytest steps with its "Pin the triple" arithmetic | `selected=1143 passed=1140 skipped=3 failures=0 errors=0`, OK. `main` @ `9d13bd16` gives `1122 / 1119 / 3`, and the 21 more are this slice's new cases |
| CI at `69fecb9d` | `validate`, `runtime` and SonarCloud all green |
| the whole suite, `python -m pytest -q` with the root conftest in play, `main` @ `9d13bd16` against this branch | `19 failed, 1427 passed, 13 skipped, 66 errors` against `19 failed, 1448 passed, 13 skipped, 66 errors`. The 85 red results are the same set on both, in nine files. Eight are research R3's, and T011 cleared its ninth, `tests/test_consumer_reach.py`. The other is `tests/test_imports_standalone.py` (T011), which asks for every extra and passes on both under `pip install -e ".[runtime,test]"` |

**The tests can fail.** Each mutation below was applied to the checkout at `69fecb9d`, `tests/test_profile_registration.py` re-run without any shim, and the file restored:

| mutation | failed |
|---|---|
| `build_parser()` loses its registration line | 3: F3.1 line 2, the parser test, the after-build refusal |
| a host always replaces the default, even after a build (RN-1 (b)) | 6: the server test, the `cli.main()` test, the after-build refusal, both composition-facet builds, the build kept on record |
| a host never replaces the default | 7: both before-build replacements, the after-build refusal's wording, both not-a-build cases, both re-registrations of the default |
| `current()` falls back to the default (R1Q3 (b)) | 9: every refusal case, the bare process among them |
| `current()` records a build | 4: the `serve.main()` window, both not-a-build cases, re-registering before a build |
| `build_server()` reads `ROUTE_EXTENSIONS` before it registers | 1: the server test |
| `serve.main()` loses its registration line | 1: the `serve.main()` test |
| no read records a build | 6: the server test, the `cli.main()` test, the after-build refusal, both composition-facet builds, the build kept on record |
| every read records a build, `resolve()` included (`46519d61`'s proxy) | 1: the read that only asks |
| re-registering the same object falls through (`c755147b`'s `register()`) | 2: both re-registrations of the default |
| the refusal claims the process built nothing (`aee57d5e`'s text) | 1: the refusal after `unregister()` |

`tests/test_default_profile.py`'s facets test now also asserts that the default declares no `HANDLER_CONTRIBUTIONS`. Declaring `HANDLER_CONTRIBUTIONS = ()` fails it.

## Copilot's review

- **At `c755147b`**, *"Changes recommended"*, one thread. `register()` fell through on the object already registered, so re-registering the default cleared its bookkeeping. Fixed in `1dee448e` (the re-registration row above). The thread was answered with the failing run, and it is resolved.
- **At `46519d61`**, *"Changes recommended"*, one thread. Every proxy read went through `current_for_build()`, so `view_extension.host_profile_name()` and `canvas_drafts._facet()` closed the window with nothing built. I reproduced it read by read in fresh processes: all eight reads were refused before the fix, and after it six let a host replace the default. Fixed in `aee57d5e`, at the proxy (the two read-recording rows above). The thread was answered and is resolved.
- **At `aee57d5e`**, *"Needs a closer look"*, no thread, and one note under "previously missed". `current()`'s refusal claimed "this process has built nothing through one", even after `unregister()` had dropped a default that a parser was built from. Fixed in `16d597b8` (the last row above).
- **At `16d597b8`** and **at `69fecb9d`**, *"Needs a closer look"*, Findings: None. At `69fecb9d`: *"The registration lifecycle and build-boundary changes require final human review."* No thread is open.

## The files, and why each is touched

- `src/opendox/domain_profile.py`: `register_default()` and `current_for_build()` are new. `register()` gains a same-object early return, the before-build replacement and the after-build refusal. The refusal texts and the docstrings say what is now true. `is_registered()` and `current()`, the duck-typed contract openXdox's `_upstream()` reads, answer as before, and only the refusal's words changed.
- `src/opendox/profile_proxy.py`: `__getattr__` records a build for the `READERS` facets only. `resolve()` and every other read go through `current()`. The docstrings say which read is a build, and that the nothing-registered refusal is kept.
- `src/opendox/cli.py` and `src/opendox/serve.py`: the one-line calls, and the one paragraph each that said the unregistered case refuses.
- `src/opendox/default_profile.py`: its registration paragraph now describes what the entry points do. Its facet list names T010's `HANDLER_CONTRIBUTIONS`, which it does not declare, and it cites the holder's readings on `DISPLAY` and U4. `tests/test_default_profile.py` asserts that absence.
- `docs/profile-registration-runbook.md`: `current()`'s refusal cites it as the operational contract, and its body described the contract this PR changes. It is a `Status: record`, so it is not rewritten. It gains a pointer under its introduction and a closing section, "The default profile, since plan 034". That section states the new contract, says what counts as a build, and lists what it supersedes, down to rows of the first refusal table. `README.md`'s index row for it follows, one line.

## Left for the tasks that own them

- `tests/test_consumer_reach.py` (T034), `.github/workflows/validate.yml` (T036) and the root `conftest.py` (T035) are not touched. `opendox.default_profile` is not in `test_consumer_reach.py`'s `NEUTRAL_MODULES`. `tests/test_default_profile.py` asserts its import claim in a fresh interpreter with the siblings blocked, and T034 re-derives the census. `conftest.py`'s comment still says *"openDox ships no profile"*. Its `_SuiteProfile` registration stays correct: it registers before any build, so every suite keeps composing the core surface.
- `build_parser()`'s and `build_server()`'s docstrings still carry the stale pre-carve sentence the runbook lists as owed. This PR adds nothing false there, and it leaves that debt to the act that takes it.
- A suite that registers a stand-in profile should register it before it builds, or call `unregister()` first. Once an entry point has built from the default in a process, the default is that process's registration. The suites that register today are this file, `tests/test_view_registry.py` and `tests/test_route_handler_contribution.py`, and all three unregister around every case that registers. The other two put back what they found through `register()`. So an entry point's default found there would come back as a host's registration. No suite depends on that difference today, and neither file is this slice's.

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

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


Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
brettheap added a commit to opensoft/openXdox-code that referenced this pull request Sep 27, 2026
Plan 034 task T040, slice P1-I, on Brett Heap's ruling of 2026-09-27
(opensoft/openXfactory#656 comment 5856475254, P1-K's question 1, answered
at (a)): "openxFactory scripts/route_extension.py and openXdox-code
src/route_extension.py are resynced to openDox-code #40's
src/route_extension.py. T007 batch E admits both as named arc edits, each
with its reason. ... openXdox-code's in P1-I (T040, openXdox-code#29)."

src/route_extension.py is the carve's replica of the neutral route
extension point (carve manifest row scripts/route_extension.py, not_moved /
replicated_at_destination, RULING Q-L1). It still held the carve-time blob
3480207 (30,017 bytes). openDox-code's copy moved on in
opensoft/openDox-code#40 (merge 0f10b1f5, plan 034 T010), which declares
the handler-contribution facet (R1Q1 (a)). This commit copies that file
byte for byte:

  blob    3480207 -> 7781665
  size    30,017 -> 62,817 bytes, mode 100644 unchanged
  sha256  d81124e62dba9df33abe44f3eb467188c98156f002cc7a92e297cd689da87515

The blob is the same at that PR's head c8d5c802, at its merge 0f10b1f5, and
at openDox-code main 796838e8. The change is additive. No top-level name is
removed, 30 are added (HANDLER_FACET, collect_handler_contributions,
compose_handler, declared_handler_contributions and their private helpers),
and the only changed definition is RouteBindingError's docstring.

This copy is the one a test session imports. pyproject.toml's pytest
pythonpath and the root conftest put src/ ahead of site-packages, so
openXdox's own columns and the installed openDox both resolve the bare
`import route_extension` to this file (measured: blob 7781665 from
src/route_extension.py, with and without --noconftest). The pinned wheel's
copy in site-packages is shadowed.

Verified at the current pin (5c137a90), Group 2 simulated: the whole suite
gives 107 failed, 1026 passed, 10 skipped and 126 errors, with 0 outcome
differences from 0336288. A plain run (no shim) shows 0 differences. The
required job gives 558 passed and 6 skipped, triple 564/558/6.

Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
brettheap added a commit to opensoft/openXdox-code that referenced this pull request Sep 27, 2026
…re rfc3339-validator; the opendox pin bump waits on P1-R (#29)

Lane: openxfactory-4 (openXfactory-4-openDox_extraction)

> **P1-R has landed, and the pin is moved.** This is plan 034's task **T040** (slice **P1-I**, openxFactory `specs/034-opendox-standalone-operation/`). It was authored **ahead of its dependency**, on Brett's "draft ahead of dependencies", and kept DRAFT until its one dependency landed. T040 is `After: T039`, and T039 (P1-R, the openDox root pin) landed as opensoft/openDox#13 (merge `663ac683`, 2026-09-27T21:01:09Z), pinning the code leg at openDox-code `2d116415`. The carve residue (T005's classes B–G, plus the `rfc3339-validator` declaration) and the ruled `src/route_extension.py` resync were done against the old pin, `5c137a90`. The final commit, `37fac9f`, moves `opendox @` to `2d116415`. The whole suite was then re-measured at the new pin with no shim (§ "At the P1-R pin").

## What T040 says

> Move `pyproject.toml`'s `opendox @` to the phase-1 openDox-code commit … Give `test_create_project.py`, `test_edit_project.py` and `test_register_edit_lane.py` a helper of their own, in place of the openxFactory-only `test_gate_routes` module … Do the same for the importers of two more openxFactory-only helpers (T005, classes C and D) … Declare `rfc3339-validator` in the `test` extra. Add two fixtures (T005, classes F and E) … Respell the pre-carve source paths, `scripts/ideation_dashboard/<module>.py` … (T005, class G) … No protected suite is edited.

**Ruled:** R1Q22 (a), `5817152735`: the edited test files are carved rows, and no declared-edit act is needed. R1Q24 (a) and R1Q25 (b) (`5850003126`) send **eight named files** to the declared exclusion under T041/T043:
- R1Q24 (a)'s seven: `test_doxbench_packet.py`, `test_doxbench_turns.py`, `test_doxbench_abstract_envelope.py`, `test_validate_ideation_dashboard_contracts.py`, `test_wheel_action_contracts.py`, `test_project_schema_election.py` and `test_project_action_contracts.py`;
- R1Q25 (b)'s `test_snapshot.py`.

**The holder's reading of T040 against R1Q24 (a).** The lane coordinator relayed it to this slice on 2026-09-27, verbatim: *"#29 makes the fix. T040's own task text and falsifier name the source paths in test_doxbench_packet.py, so they are T040's. R1Q24 (a) covers only that file's exemption-rail failures, which stay for T041/T043's declared exclusion."* So this PR changes one of the eight. `0336288` fixes `test_doxbench_packet.py` at its three source-path sites and changes nothing about its rail cases. The other seven are unchanged.

**Ruled 2026-09-27: the `route_extension.py` resync** (Brett Heap, opensoft/openXfactory#656 comment `5856475254`, P1-K's question 1 answered at (a), verbatim): *"openxFactory `scripts/route_extension.py` and openXdox-code `src/route_extension.py` are resynced to openDox-code #40's `src/route_extension.py`. T007 batch E admits both as named arc edits, each with its reason. openxFactory's copy is resynced in T047's PR, and openXdox-code's in P1-I (T040, openXdox-code#29)."* `f65537a` makes this repository's half:
- `src/route_extension.py` is the carve's replica of the neutral route extension point (carve-manifest row `scripts/route_extension.py`, `not_moved` / `replicated_at_destination`, RULING Q-L1). It still held the carve-time blob `34802071` (30,017 bytes). It now holds opensoft/openDox-code#40's blob `7781665d9ae0d4be298cd7d9cbe625666f7481ee` byte for byte: 62,817 bytes, mode `100644`, sha256 `d81124e62dba9df33abe44f3eb467188c98156f002cc7a92e297cd689da87515`. That blob is the same at the PR's head `c8d5c802`, at its merge `0f10b1f5` and at openDox-code `main` `796838e8`.
- The change is additive: the handler-contribution facet of opensoft/openDox-code#40 (R1Q1 (a)). No top-level name is removed, 30 are added, and the only changed definition is `RouteBindingError`'s docstring.
- It is the copy a test session imports. pytest's `pythonpath = ["src"]` and the root `conftest.py` put `src/` ahead of site-packages, so openXdox's columns and the installed openDox both resolve the bare `import route_extension` to this file. Measured with and without `--noconftest`: the pinned wheel's own copy is shadowed.
- The admission is T007 batch E's, in openxFactory, as a named arc edit with its reason. Its figures are above.

`test_doxbench_blank_reason.py` is **not** one of the eight. T040 names it for classes C and G, and those are its only edits here. The one class I case that shows behind them reads openxFactory's `contracts/manifest.yaml`. That makes it the eighth file T005's experiment found behind the residue, as R1Q24's re-measure note (T006) records, and the note leaves it to T043's triage by class. At this pin, five files this PR changes fail on `doc_health` alone: the three class B importers and the two module-scope class C importers. Only their residue imports change here. T041 writes its list from the run at T040's pin, and its test asserts that each listed file fails for exactly that reason.

## The commits (one class each; every commit carries the `Arc:` and `Lane:` trailers)

| commit | class (T005) | change |
|---|---|---|
| `27a007a` | M | `rfc3339-validator>=0.1.4` in the `test` extra. The floor is what openxFactory's validator-input lock pins (`requirements/hermes-runtime-contracts.in`), the same source PyYAML's floor came from. It is a test dependency, since nothing under `src/` imports it. |
| `8769210` | B | `tests/gate_routes_harness.py`: `_post` and `_serving` plus the 4 definitions they reach. The three project suites import it in place of openxFactory's `test_gate_routes` (a `not_moved` row). |
| `2b34084` | C | `tests/doxbench_routes_harness.py`: ONE harness for its three importers, carrying the 21 names they import. It is the closure of those names, 52 of the source module's 272 statements. |
| `ee569e1` | D | `tests/doxbench_port_ban.py`: `FORBIDDEN_PORT_MEMBERS`, for the bridge suite. |
| `1e04515` | E | `tests/fixtures/fake_omp_child.py`, byte-identical: blob `e51045fc`, the same at openxFactory's carve tag, at openDox-code `5c137a90` and at openDox-code `main`. |
| `b20a514` | F | `tests/fixtures/base-repo`, byte-identical: tree `cef59fd9`, the same at the carve tag and at openxFactory `main`, eleven blobs. |
| `d266db3` | G | Each moved module is read where the carve put it (details below). |
| `0336288` | G | `test_doxbench_packet.py`'s three source-path sites, on the holder's reading above (details below). |
| `f65537a` | ruled arc edit | `src/route_extension.py` resynced to opensoft/openDox-code#40's, byte for byte (`5856475254`, above). |
| `37fac9f` | the pin | `opendox @` → openDox-code `2d116415159b721b55613fe20a159afc46202d1f`, the commit T039 pins. The ratchet is unchanged (§ "At the P1-R pin"). |

**How the helpers were made, and proved.** Each helper's definitions are copied from openxFactory at the carve tag `opendox-carve-0` (`b075fd91`), the tree the importers were carved from. An AST comparison of every carried definition against that source, after the declared rewrites, gives `mismatches: 0` for the gate harness and the port ban. The routes harness gives `mismatches: 1`, which is `released_only`, the one declared change. The declared rewrites are these:
- the carve's own import rewrites (`ideation_dashboard.serve` → `opendox.serve`, `generator` → `openxdox.generator`, …);
- the pre-carve served web root → the pinned bundle, `opendox_bundle.web()`, read per call;
- in the routes harness, the four wire kinds → openDox's own `serve_wire.DOXBENCH_*_KIND`. Those are the kinds the routes emit, and the keys they look an injected validator up by (`serve_workbench.py`, `validators.get(kind)`). The source read them from `doxbench_contracts`, which stays in openxFactory.

`released_only` skips here, naming why. That rung, and `build_server`'s default validator seam, both need openxFactory's `doxbench_contracts`, and this checkout has neither. **None of the helpers is named `test_*.py`.** So pytest never collects a harness as a suite, and 12.5's protected-suite grep over `tests/test_*.py` cannot select one. That set is still the same 16 files.

**Class G, in detail.**
- `tests/conftest.py`'s `serve_surface_paths()` reads each serve file at its carved home through a new `carved_module_path()`. openDox's four come through the PIN (the installed `opendox`), and openXdox's two from this leg's `src/openxdox/`. The resolver refuses a name found in both homes or in neither.
- The one file of the tuple that is at neither home, openxFactory's lane column `serve_openxfactory_lanes.py` (`not_moved`), is NAMED in `SERVE_SURFACE_NOT_AT_THIS_LEG` rather than dropped. Any other absence still refuses.
- `test_doxbench_bridge.py` and `test_doxbench_blank_reason.py` read the module each already imports, through `__file__`. That is § 3.4 slice S8's repair of `MODULE_PATH`.
- `test_scope_column_split.py`'s parser now takes the package to be both halves the carve made. It reads the `opendox`/`openxdox` spellings beside the pre-carve two (T040: *"its import parser must also recognise an `opendox.` import"*).
- `test_doxbench_packet.py` (`0336288`): `MODULE_PATH` is `Path(pk.__file__)`, the same S8 repair. It covers the read at `:309` and the 11-case test at `:1054`. The watch-list sweep at `:963` reads each module through `carved_module_path()`. Its one module at neither home, openxFactory's rail `doxbench_status_exemption.py` (`not_moved`), is NAMED in `SWEEP_NOT_AT_THIS_LEG` and stays in the tuple, which the file's own rule only ever widens.
- Both declarations are held to their word. `assert_not_at_this_leg()` (`conftest.py`) refuses once a declared file is present in either home, so a skip can never hide code this leg carries. A 28-case mutation check caught every needle injected into each of the packet suite's respelled reads, and each declaration refused when its file was planted in either home.
- A mutation check fed a reader the back-edge in five spellings: `from openxdox.doxbench_scope import ScopeKey`, `from openxdox import doxbench_scope`, the pre-carve absolute, the relative, and `import openxdox.doxbench_scope`. Every one was caught. A reader with its types import removed trips the non-vacuity assertion.

## The falsifier, and the evidence at both pins

> **Falsifier (T040):** collection no longer fails on `test_gate_routes`, `test_doxbench_routes` or `test_doxbench_model`. No test reads a source path under `scripts/ideation_dashboard/`. `test_register.py` and `test_snapshot_validation_launch.py` find their fixture, and the bridge suite finds its child.

Measured exactly as T005 measured, from `cd "$W/openXdox-code"`, with research R0's Group 2 shim. The shim digests match T005's record, and it is never committed. The venv is fresh, from THIS branch's `pyproject.toml`: `pip install -e ".[test]"` now brings `rfc3339-validator 0.1.4`, and jsonschema's `date-time` checker registers. The runs: The last column is the new pin instead: a fresh venv from `37fac9f`'s `pyproject.toml`, the root conftest in play, and **no shim**, since T011 landed Group 2.

    PYTHONPATH="$W/shim" python -m pytest -q --continue-on-collection-errors --junitxml="$W/whole.xml"
    python3 "$W/tools/classify_whole_suite.py" "$W/whole.xml"      # T005's classifier, sha256 3a76945d…

| | `e28930bf` (T005's `oxr` run, reproduced exactly) | `d266db3` | `0336288` (old pin, shim) | **`37fac9f` (new pin `2d116415`, no shim)** |
|---|---|---|---|---|
| whole suite | `166 failed, 967 passed, 10 skipped, 126 errors`, **292** red | `120 failed, 1013 passed, 10 skipped, 126 errors`, 246 red | `107 failed, 1026 passed, 10 skipped, 126 errors`, 233 red | `106 failed, 1027 passed, 10 skipped, 126 errors`, **232** red |
| B `test_gate_routes` | 3 | 0 | 0 | **0** |
| C `test_doxbench_routes` | 3 | 0 | 0 | **0** |
| D `test_doxbench_model` | 2 | 0 | 0 | **0** |
| E the bridge's child | 32 | 0 | 0 | **0** |
| F `base-repo` | 13 | 0 | 0 | **0** |
| G pre-carve source paths | 22 | 13, all in `test_doxbench_packet.py` | 0 | **0** |
| M `rfc3339-validator` (T005's `ox` run) | 23 | 0 | 0 | **0** |

The accounting closes. At `0336288`, 75 residue results are cleared, and 16 became visible behind them: `doc_health` +6, openxFactory contracts +1, `ProfileNotRegistered` +9. That is net −59, and the passes rose by exactly +59: the bridge suite +36, the packet suite +13, the scope split +4, `test_register.py` +4, `blank_reason` +2. At `f65537a` the resync moves nothing: the whole suite has 0 outcome differences from `0336288`, and so does the plain run. The packet suite's 13 expose nothing behind them. Against `d266db3`, the whole suite differs in exactly those 13 results, each one failure → passed. That file's 54 rail failures and 3 `doc_health` failures are the same tests with the same causes.

- **Collection no longer fails on the three helpers.** No red result anywhere names `test_gate_routes`, `test_doxbench_routes` or `test_doxbench_model`, and no module imports them (`git grep`). The five importers that failed at collection on them now fail collection **one layer further in, on `doc_health`**. That layer is T041's declared exclusion (R1Q6 (d)), not residue:
  - `test_create_project.py`, `test_edit_project.py` and `test_register_edit_lane.py` fail at `openxdox/gate_console.py:63`;
  - `test_doxbench_knowledge_service.py` and `test_doxbench_thread_wiring.py` fail at `openxdox/generator.py:66`, the harness's fixture snapshot.
- **No test reads a source path under `scripts/ideation_dashboard/`.** Class G is **0**. The packet suite's 13 went with `0336288`, on the holder's reading above. The only static pre-carve reads that remain are in 8 files that fail **collection** on `doc_health` and so never execute: `test_completeness`, `test_doxbench_knowledge_service`, `test_doxbench_share`, `test_doxbench_thread_wiring`, `test_doxbench_threads`, `test_repo_selector`, `test_round_trip` and `test_session_document_ownership`. They are respelled when they become runnable, as T043 records for the excluded files.
- **`test_register.py` and `test_snapshot_validation_launch.py` find their fixture.** `test_register.py`: 4 failed / 6 passed → **10 passed**. The launch suite: its 9 base-repo failures are gone. It now fails its 9 cases one layer further in, on `ProfileNotRegistered` at `build_parser()`. T005's experiment saw the same layer, and it is T016's to clear at the phase-1 pin. It is a protected suite (5.4a), and this PR does not edit it.
- **The bridge suite finds its child.** `test_doxbench_bridge.py`: 36 failed / 24 passed → **60 passed**.

## The repository's own required check

`validate.yml`'s `validate` job, reproduced locally in the same fresh venv with `CI=true`: 16 named files, `--noconftest`, then its "Pin the triple" step verbatim:

    558 passed, 6 skipped
    triple: selected=564 passed=558 skipped=6 failures=0 errors=0
    pins:   selected>=564 (margin 0) passed>=558 (margin 0) skipped==6

None of this PR's files is on that list, and the triple is unchanged. The result was the same at `d266db3`, `0336288` and `f65537a` on the old pin, and at `37fac9f` on the new pin. CI's own `validate` run on this PR is the gate.

## What remains red at the new pin, and where it goes (not this PR's): T043's triage

| cause | files | goes to |
|---|---|---|
| `doc_health` (A) | 58 files, 68 results: T005's 51, the 5 importers above, one `blank_reason` case, and at the new pin `test_snapshot_validation_launch` 9 (below) | T041's declared exclusion |
| the status-exemption rail (H) | `test_doxbench_packet` 54, `test_doxbench_turns` 32, `test_doxbench_abstract_envelope` 1. At the new pin they fail CLOSED at openDox's seam: `StatusExemptionNotRegistered` at `opendox/doxbench_packet.py:304` (70), and the rail's absent attributes at `:1555` (17). T005's classifier has no pattern for the new text, so it prints them as unclassified | R1Q24 (a): the exclusion, T041/T043 |
| openxFactory's contracts (I) | the four contract-family files (74) and **`test_doxbench_blank_reason` 1**: `test_every_textual_home_states_the_admission_rule` reads openxFactory's `contracts/manifest.yaml`. This is the "eighth" file of R1Q24's re-measure note (T006), which T005's experiment found and which now shows behind its residue | R1Q24 (a), by class: T043's triage |
| the validator's schemas (J) | `test_snapshot` 2 | R1Q25 (b): the exclusion |
| ~~`ProfileNotRegistered`~~ | `test_snapshot_validation_launch` 9: **cleared at the new pin** (T016). Behind it the suite reaches `doc_health` through `opendox/consumer_reach.py:120` → `src/openxdox/corpus_root.py:34`. It is a protected suite (5.4a) and is not edited | now class A: T041 |
| ~~the shim itself (K)~~ | `test_dependency_direction` 1: **gone** at the new pin, since no shim is installed | none |

**Also for T043's re-pin.** With `rfc3339-validator` declared, `tests/test_validator_schema_home.py` (C3's suite, which `importorskip`s the package) runs its **12** cases instead of skipping. In the plain run (no shim) that is the one difference from `e28930bf`: `5 skipped, 1126 errors` becomes `4 skipped, 1138 errors`. The base tree in the same venv gives the same figure, so this PR's test edits move nothing in a plain run.

## At the P1-R pin (done)

opensoft/openDox#13 landed as `663ac683`, and its code leg is openDox-code `2d116415159b721b55613fe20a159afc46202d1f`, which is on openDox-code `main`.
1. **The pin.** `37fac9f` moves `pyproject.toml`'s `opendox @` to that commit, and nothing else. The ratchet is unchanged (T040; plan.md § Pins, step 3).
2. **The whole suite, with no shim**, in a fresh venv built from this `pyproject.toml` (pip's `direct_url.json` records `commit_id` `2d116415`): `106 failed, 1027 passed, 10 skipped, 126 errors`, 232 red. The test ids are the same as the old pin's shim run. Classes B–G and M stay **0**. No red result names the three helpers, no test reads a `scripts/ideation_dashboard/` path, `test_register.py` passes 10/10 and the bridge suite 60/60. The pin moves three things, all in the table above:
   - the rail's 87 now fail closed at openDox's seam;
   - `test_snapshot_validation_launch`'s `ProfileNotRegistered` clears, and `doc_health` shows behind it;
   - the shim's own red is gone.

   **No residue of T040's kind shows.** What the pin shows is T043's to triage by class: the `doc_health` set (68 results in 58 files, T041), the rail (87, R1Q24 (a)), the contract family (75 including `blank_reason`'s one case, R1Q24 (a) by class) and `test_snapshot` (2, R1Q25 (b)).
3. **The required check**: `558 passed, 6 skipped`, triple `selected=564 passed=558 skipped=6`, the same as at the old pin. The pin guard agrees: `opendox_bundle.declared_pin()` == `installed_commit()` == `2d116415`, and `find()` resolves the installed bundle. CI's own `validate` run on `37fac9f` is the gate.
4. **`src/route_extension.py`** at `2d116415` is `7781665d`, byte-identical to this branch's copy. opensoft/openDox-code#40 is the only openDox-code commit touching it since `5c137a90`, so the ruling's version is the pinned version. `src/subcommand_extension.py` (`1d4833b2`) and `tests/fixtures/fake_omp_child.py` (`e51045fc`) are identical at the pin too.
5. **`main`** has not moved (`e28930bf`), so there is nothing to merge in.

## Notes

- **Protected suites:** none edited. 12.5's grep set is the same 16 files, and 5.4a's glob is untouched. `test_doxbench_packet.py` is in neither set. `test_snapshot_validation_launch.py` gains only its fixture.
- **Rule 6:** not applicable. openXdox-code holds no OpenSpec record, and the `openspec/changes/` paths under `tests/fixtures/base-repo/` are fixture content.
- **Created files at this leg** (the three helpers and the two fixtures) have no carve-manifest row (RULED OQ-C). openxFactory's `docs/opendox-carve-admissions.yaml` says a new admission is a reviewed one-line diff *"in the pull request that bumps the destination's pin"*, with `since:` set to the leg commit. That is openxFactory's pin PR (T047, P1-K), once this PR's landing commit is known. The `route_extension.py` resync is not a created file. T007 batch E admits it, as ruled above.
- **The holder's question, answered.** At `d266db3` this draft asked whether T040 or T043 respells `test_doxbench_packet.py`'s 13 class G reads. The holder's reading (above) gives them to T040, and `0336288` makes the three-site fix. T041's listing rule is why it matters: a file with another cause *"is listed only once T040 or R1Q24's answer has dealt with that other cause"*. With the paths respelled, the file's remaining red is its rail (54, R1Q24 (a)) and its 3 `doc_health` cases (T041).

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

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


Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants