Skip to content

§ 4.3: profile_openxfactory becomes a lazy proxy registered by the host at process start, read by BOTH composition points (RULED ASK-2; routes half RULED ASK-6 → 1) - #11

Merged
brettheap merged 19 commits into
mainfrom
build/section-4-3-profile-lazy-proxy
Sep 11, 2026
Merged

brettheap merged 19 commits into
mainfrom
build/section-4-3-profile-lazy-proxy

Conversation

@brettheap

@brettheap brettheap commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Lane: openxfactory-4-opendox-extraction (formerly openxfactory-opendox)

split-opendox-two-layer-product § 4.3, BOTH HALVES. profile_openxfactory — the composition point build_parser() reads its contributed subcommands from and build_server() reads its contributed routes from — comes back as a LAZY PROXY over one host registration, so the name resolves at first attribute access instead of raising NameError for every caller.

Rebased onto main. This PR was stacked on build/remove-back-imports-2b, which landed as #10, squashed onto main as 0f1f2e59; the base is now main and the branch carries 2b's content only through it. The ROUTES half (serve.py) was added after that move, on RULED ASK-6 → 1.

RULED ASK-2 option (2) — openxFactory#656 comment 5628886636, verbatim: "LAZY PROXY — a module in openDox-code resolves the profile at first attribute access; openxFactory registers the real module at process start; that operational contract is DOCUMENTED in the runbook." Option (1) (injection through build_parser()/build_server() parameters, 31 call sites over 27 test files) and option (3) (a plugin package openxFactory publishes — "the shape every future <Domainx>Dox profile may want; not now") were the offered alternatives.

The defect this repairs is the slice-2b finding, comment 5633826227: profile_openxfactory.py is not_moved / deleted_at_carve in openxFactory's docs/opendox-carve-manifest.yaml, the deferred import that fed the reach went with the carve, and the reach was left behind.

CLAIM: openxFactory#656 comment 5634719281.

The composition point, before and after

Before (base build/remove-back-imports-2b @ cc1d806b, src/opendox/cli.py:926-927) — no binding anywhere in the module, the only other occurrences being two docstring mentions:

    subcommand_extension.register_all(
        profile_openxfactory.SUBCOMMAND_EXTENSIONS, sub)

After (src/opendox/cli.py:948-949) — byte-identical; it only moves line:

    subcommand_extension.register_all(
        profile_openxfactory.SUBCOMMAND_EXTENSIONS, sub)

What is ADDED is one import, at src/opendox/cli.py:112, in the same declared import window slice 2b used for its own late bindings (corpus_root_refusal, generate_snapshot), under a comment that states the ruling and the refusal:

from opendox.profile_proxy import profile_openxfactory  # noqa: E402

So build_parser() no longer raises NameError, the reach is a DECLARED one, and the diff at the composition point itself is zero.

The finding's proposed repair is deliberately not taken. 5633826227 asked for a row annotation so the line could be REMOVED, one line for one line, as serve.py's was. ASK-2 rules the opposite direction for the same name — the composition point comes BACK through a proxy — and a deletion would have foreclosed the ruling. The annotation is still owed, for the ADDED binding rather than for the read (below).

The ROUTES half — RULED ASK-6 → 1

openxFactory#656 comment 5635150678, verbatim: "the routes half of § 4.3 — serve.py reads the proxy too; after 2b lands and openDox-code #11 is rebased onto main, the same author adds the server-side binding in the same PR (one mechanism, one registration, under ASK-2)."

Before the carve, build_server() collected its route bindings from tuple(profile_openxfactory.ROUTE_EXTENSIONS) + tuple(route_extensions). The carve deleted the deferred import that fed the name (the declared :1371) and left the reach behind; BUILD slice 2b cut the reach out rather than repairing it, because repairing it needed a ruling it did not yet have. It has one now:

  • the deferred import returns at its own site, inside build_server()'s body, bound to the proxy rather than to an in-tree module — from opendox.profile_proxy import profile_openxfactory;
  • the collect_bindings expression is restored byte-identical to the carve commit's own two lines — host routes ahead of the caller's tuple, route_extensions still the § 2.4 seam for whatever a caller adds on top, and the default () still meaning "add nothing".

serve.py binds inside the function where cli.py binds at module scope, and that difference is deliberate and asserted: a parser is built from the profile at import time, a server is not.

A server with no host registered now REFUSES, naming opendox.domain_profile.register(...), exactly as build_parser() already refuses at its own read. That is ASK-2's "REFUSAL, NOT A DEFAULT" — a server silently missing its contributed routes looks exactly like a working one — and it makes domain_profile.current()'s message true of both readers rather than one: that text has always told a host to register "before it calls cli.build_parser() or serve.build_server()".

The proxy keeps its precision under two readers. One object is now bound by both composition points, so _LateProfile maps FACET → READER: a missing ROUTE_EXTENSIONS names serve.build_server(), a missing SUBCOMMAND_EXTENSIONS names cli.build_parser(). Concatenating the labels would have thrown away exactly what the earlier single label was narrowed for (the Copilot thread on this PR: a refusal naming a reader that made no access misdirects the host it exists to help).

Q-L1 — the declared-lines check, run before the edit

The manifest's line numbers are the carve commit's, not the destination's (verify-carve-arrival.py::_check_declared_lines: "a destination-side numbering would move under the very edits it is meant to bound"; and the serve.py row's own note on 1283/1287 vs 1282/1286). So this was checked by running the arrival verifier's own logic — _check_declared_lines over scripts/carve_lines.py records — against the blob at b075fd91 (sha256 matches the row), not by reading destination line numbers.

Manifest read at openxFactory cc4ae9d3 (PR-2 #940's merge) and confirmed byte-identical at openxFactory main 8015d45f.

destination file manifest row carve lines this PR's diff changes declared?
src/opendox/cli.py scripts/ideation_dashboard/cli.py, moved_with_declared_edit 56, 67–76, 79–84, 104, 113, 577, 635, 779, 979–987 yes, all
src/opendox/serve.py scripts/ideation_dashboard/serve.py, moved_with_declared_edit 109–111, 122–123, 134–138, 170, 172–177, 185, 191–199, 534, 552, 578, 628–629, 829, 1242, 1282, 1286, 1353, 1371, 1379–1380 (insertion neighbours), 1614, 1639 yes, all
.github/workflows/validate.yml, README.md, conftest.py, tests/test_consumer_reach.py no row n/a leg-assembled, not arrived
domain_profile.py, profile_proxy.py, test_profile_registration.py, docs/profile-registration-runbook.md no row (RULED OQ-C) n/a created

_check_declared_lines reports UNDECLARED: none for both arrived files. No openxFactory annotation is owed by this PR. The two carve lines the routes half needed — :1371 (the deferred profile import) and :1380-1381 (the collect_bindings reach) — were already declared on the serve.py row, the second by the Q-L1 row annotation RULED 5628560136 that landed with PR-2 #940. The runbook's earlier "once its row is declared" caveat is satisfied.

One detail worth naming: because the restored expression is byte-identical to the carve's own two lines, :1380-1381 now fall in an equal run and the new explanatory comment above them registers as an insertion beside carve 1379/1380 — declared, since 1380 is. The reach itself is no longer an edit at all.

The registration contract, verbatim

From docs/profile-registration-runbook.md, the contract openxFactory's half must honour:

import opendox.domain_profile as domain_profile
domain_profile.register(<the host's profile module or object>)

called ONCE, at process start, by the descendant's own adapter (D3: the adapter code stays in openxFactory) and before the first cli.build_parser() or serve.build_server(). Nothing in the neutral packages registers a profile for a host. With nothing registered, the first attribute read refuses:

no host profile is registered, so openDox has no contributed subcommands and no contributed routes to compose from. openDox is the NEUTRAL product and ships no profile of its own: the § 3 carve deleted the in-tree profile_openxfactory.py rather than moving it, and the descendant that drives openDox registers its own profile at process start with

opendox.domain_profile.register(<the host's profile>)

before it calls cli.build_parser() or serve.build_server() (RULED ASK-2 option (2), openxFactory#656 comment 5628886636; the operational contract is docs/profile-registration-runbook.md). This is a REFUSAL, not a missing default: composing from an empty profile would produce a parser with its contributed verbs silently absent, which looks exactly like a working one.

REFUSAL, NOT FALLBACK — the same stance as the § 4.4 engine half (openXdox-code #14). There is no silent empty tuple. A second, DIFFERENT registration raises AlreadyRegistered; re-registering the same object is a no-op, so an idempotent host start-up is not punished. A profile that IS registered and lacks the facet a reader named raises ProfileFacetMissing (an AttributeError subclass, so hasattr/getattr(..., default) keep their meaning), naming the attribute, the profile and the reader — a real gap in a host's profile, which "register a profile" would misdirect.

Q5 — how ONE registration serves TWO accessors, with no cross-leg import

RULED ASK-4 Q5 (5634195861): "one registration, two accessors" — openxdox.domain_profile.current() rides the same registration as this proxy.

Realized as: THIS LEG'S REGISTRY IS THE SHARED SEAM. The host calls opendox.domain_profile.register(<profile>) once. openDox's accessor (profile_proxy.profile_openxfactory) reads it directly. openXdox's accessor reads it by DELEGATION: when its own registry is empty, openxdox.domain_profile._upstream() imports opendox.domain_profile late and duck-types it on is_registered() / current().

This is not a shape invented here — openXdox-code #14 (a4bda011) already built that delegation and names this module verbatim (_UPSTREAM_REGISTRY = "opendox.domain_profile"), which is also why the registry module is domain_profile.py: its PATH is part of a contract.

It adds no import between the legs in the forbidden direction: openXdox PINS openDox (§ 4.2, RULED OQ-2), so openXdox reaching openDox is the lawful direction and the only one used; nothing in this PR names, imports or requires openxdox, and tests/test_consumer_reach.py's census still reads 0 import-time openxdox reaches across src/ (2b's number, not regressed).

The one registered object serves both readers because each names only what it reads: openDox reaches SUBCOMMAND_EXTENSIONS / ROUTE_EXTENSIONS and type-checks nothing; openXdox type-checks its own DomainProfile and treats anything else as "not here". A host wanting one object for both registers a profile that satisfies both readers — its composition, documented in the runbook, deliberately not legislated from the neutral leg.

REJECTED ALTERNATIVE: "the host calls BOTH legs' register() in one documented process-start hook." Simpler to write down, refused for two reasons. (1) It is TWO registrations wearing one hook's name; Q5's words are "one registration", and two states that can disagree is precisely the failure AlreadyRegistered exists to refuse. (2) openXdox-code #14 has already built the delegation to this module, so the two-call hook would have left that code dead and owed a second leg's PR to remove it. The one-call shape also survives a host that installs only openDox.

What is in the PR

file
src/opendox/domain_profile.py NEW — the one registration: register / current / is_registered / unregister / name_of, ProfileNotRegistered, AlreadyRegistered. Import-side-effect-free.
src/opendox/profile_proxy.py NEW — profile_openxfactory, a _LateProfile that forwards attribute reads through domain_profile.current() at FIRST ACCESS, on consumer_reach._LateConsumerModule's pattern (dunders never resolve; repr never resolves; no local cache).
src/opendox/cli.py +22 lines: the binding at :112 and its comment. The read at :949 is byte-identical.
src/opendox/serve.py the ROUTES half (ASK-6 → 1): the deferred binding at the carve's own :1371 site, and the collect_bindings reach restored byte-identical to the carve's :1380-1381.
tests/test_profile_registration.py NEW — the proxy, registry and BOTH composition points, 30 cases, --noconftest safe.
tests/conftest.py a test profile registered at test-process start — the host contract, exercised.
docs/profile-registration-runbook.md NEW — the operational contract ASK-2 requires be documented.
.github/workflows/validate.yml the new suite added to the two validate runs.

Both new modules are CREATED files: no carve-manifest row (RULED OQ-C — the manifest declares what LEAVES openxFactory, never what a destination assembles).

How it came onto main — a MERGE, because a force-push is refused by policy

A rebase was the intended act, and it is what fixed this tree: git rebase --onto origin/main cc1d806b replayed all seven § 4.3 commits with zero conflicts and produced a diff against main byte-identical to the pre-rebase diff against cc1d806b — proof that main's squash of 2b and this branch's 2b ancestry are the same content.

It could not be pushed as a rebase. The opensoft org-level ruleset 8981805 applies non_fast_forward to every branch of this repository, not just main, so history replacement is refused for this branch by policy (GH013 … Cannot force-push to this branch). Bypassing an org ruleset is not this author's act.

So the same result arrives append-only: main was merged into the branch (6a5b4f5), with the merge resolved to exactly the verified rebase's tree (16cf0c43). git diff origin/main...HEAD is unchanged by that commit. Landing is unaffected — #9 and #10 both landed as squashes (da8aae96, 0f1f2e59), so the merge commit and the duplicated 2b ancestry never reach main.

Still owed, and deliberately not taken here

  • The openxFactory half. The real profile_openxfactory profile (the SUBCOMMAND_EXTENSIONS / ROUTE_EXTENSIONS tuples) and the process-start hook that calls register() are adapter code, and adapter code stays in openxFactory (design § D3). PR-2 #940 has landed at cc4ae9d3; the adapter is the act after it.
  • The four stale docstring lines — cli.build_parser()'s at :867 and serve.py's at :166 / :755 / :1368 — still describe the in-tree profile. RULED ASK-7 → 1 (5635150678) leaves all four standing and fixes them at the next declared-edit window, with no manifest rows for prose. In-tree comments beside each edit carry the correction until then — the posture slice 2b took at the same docstrings.
  • Neither opendox.cli nor opendox.serve can be imported in this repository: serve.py:181 still reaches ideation_dashboard, openxFactory's pre-carve package, present at neither carve destination, and cli.py imports serve. Both are recorded by name in tests/test_consumer_reach.py's STILL_REACHING and owed to a later act of the BUILD arc. It is why this PR's composition-point tests lift the statements out by AST (below) rather than calling the functions.

Both composition points are EXECUTED, not described

import opendox.cli and import opendox.serve both raise ModuleNotFoundError: No module named 'ideation_dashboard' in this repository, so neither composition point can be reached by calling it. Each is therefore lifted out of its own file by AST — the binding of the proxy, wherever that module puts it, plus the statement that reads a facet off it — and those statements are executed against stand-ins for the two § 2.4 seams.

What runs is the tree's own lines, so a deleted binding, a renamed import or a deleted read all fail there — including the original defect (NameError: profile_openxfactory at build_parser()) that a unit test of the proxy alone could never see. Nothing is pinned to a line number the next declared edit would move, and nothing has to change the day the two modules become importable.

The census does not move

This slice adds one import of opendox.profile_proxy — openDox's own module — so nothing here names, imports or requires openxdox. tests/test_consumer_reach.py's consumer census and its pre-carve-package census (known = {"src/opendox/serve.py": 2}) are unchanged and both still green: import-time 0, deferred 19, 2b's numbers exactly. validate goes 62 → 71 passed purely by the nine new cases (21 → 30 in test_profile_registration.py).

Green

validate SUCCESS — run 34635937045 on head 585f9078, 71 passed. SonarCloud SUCCESS. Base main.

Seven Copilot threads, all answered and resolved.

Four were answered earlier in the stack: two already closed by later commits (the conftest registration 856bf5c, the runbook 4703c52), and two real and fixed (name_of() promised repr and returned the type name, making two instances of one class indistinguishable in the very message that exists to tell them apart; the proxy's reader label named a reader that made no access).

Two more arrived on the rebased head and are fixed in 261eb7c, both real and both invisible to validate:

  1. The teardown stripped the process's registration. _empty_registry unregistered on the way out as well as in, so after this module ran, the empty _SuiteProfile the root conftest.py registers at process start was gone for the rest of the session — collection order would have decided whether the suite passed. The fixture now saves what it found and puts it back. validate cannot see it: this file runs there under --noconftest (RULED Q-L5 (b′)), so there is no registration to destroy.
  2. The suite never built a parser, so the NameError regression the binding exists to prevent could have returned with every test green. Answered with the AST lift above: three cases now cover the parser composition point (it resolves, it refuses when unregistered, and it binds at module scope where serve.py deliberately does not).

A seventh arrived when the PR left draft and is fixed in 585f907: conftest.py's except Exception around the scaffold import would have swallowed a SyntaxError or any other import-time breakage inside opendox/domain_profile.py, left _domain_profile as None and skipped the process-start registration in silence — the registry broken, and this file the reason nobody could tell. The guard now catches ModuleNotFoundError and only when it is opendox itself that is missing; a failure raised from inside the registry, and a SyntaxError in it, both re-raise. Proven at four shapes.

All three of this round's findings were invisible to validate, which runs the suites under --noconftest (RULED Q-L5 (b′)) — worth saying plainly, since the gate being green is not by itself evidence about the conftest path.

Refs opensoft/openxFactory#656.

🤖 Generated with Claude Code

Summary by Sourcery

Provide a documented, lazily resolved host profile registration mechanism for composing openDox commands and routes.

New Features:

  • Add a host profile registration API and lazy profile proxy for contributed subcommands and routes.

Bug Fixes:

  • Restore profile-backed composition in both parser and server builders, replacing missing-profile failures and preventing silent omission of host contributions.

Enhancements:

  • Share one process-start registration across both composition points with explicit missing-registration and missing-facet errors.

CI:

  • Run the profile registration tests in the validation workflow.

Documentation:

  • Document the host profile registration contract, refusal behavior, and shared accessor model in a new runbook and link it from the README.

Tests:

  • Add coverage for lazy resolution, registration lifecycle, facet errors, both composition points, and consumer reach constraints.

Chores:

  • Register an empty test-process profile through the root test configuration while preserving existing registry state across tests.

Brett Heap and others added 11 commits September 10, 2026 23:49
… need

`src/opendox/defaults.py` (CREATED) owns the three values eleven of openDox's
own signatures defaulted to `<consumer module>.<CONSTANT>` — the default
arguments openDox-code #9 § 3 converted, measured and REVERTED because a
default runs at import time and the openXdox-side ratchet, an AST census over
Import nodes, cannot see one.

`src/opendox/consumer_reach.py` grows the three module stand-ins, the four
callables and the ONE constant the remaining reaches need, each with the
reason it still points that way. `_LateConsumerValue` is new and is the
family's narrowest member: `cli.py`'s `SCANNED_ROOTS` is read at a line the
carve manifest does not declare, so the NAME has to keep behaving like the
tuple it was.

No carved file is touched by this commit.

Refs opensoft/openXfactory#656

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

`from openxdox import gate_console` (:77, declared) becomes
`from .consumer_reach import gate_console` — the same NAME, bound to the late
stand-in step 1 added, so all thirty-odd `gate_console.X` call sites below are
unchanged and only the DIRECTION at import time goes (`design.md`:243).

The nine `records_dir: str = gate_console.DEFAULT_RECORDS_DIR` DEFAULT
ARGUMENTS (:1740, :1859, :1878, :4179, :4217, :4254, :4287, :4504, :4991 — the
nine lines the Q-L1 row annotation declares) become `DEFAULT_RECORDS_DIR` from
`opendox.defaults`. No stand-in can serve them: a default argument is evaluated
where the `def` sits, at import time, which is what openDox-code #9 § 3
measured and reverted.

`import opendox.branch_session` now succeeds with `openxdox` unimportable.
Every edited line is one the row declares — carve 77 (replaced by the import
plus its reason) and the nine annotated default lines; the arrival verifier
reports no undeclared line.

Refs opensoft/openXfactory#656

Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…time — three of the nine

`from openxdox.corpus_root import (SCANNED_ROOTS, corpus_root_refusal)` (:79,
continued :80-81) and `from openxdox.generator import (generate_snapshot,
is_rfc3339_datetime)` (:82, continued :83-84) become bindings to the
`consumer_reach` stand-ins, in the idiom `gate_mod` and `snapshot_mod` two lines
above already use. Every call site is unchanged — the three callables resolve on
first CALL, and `SCANNED_ROOTS` keeps its NAME because :239 iterates it at a
line no row declares.

The NINETEEN-VERB gate re-export (:979, continued :980-987) is DELETED rather
than proxied. The verbs are a CONTRIBUTION: `cli_gate.GateSubcommands.register()`
attaches them to this parser's own subparsers action through
`subcommand_extension` (§ 2.4), so `args.func` carries the function OBJECT and
`openxdox.cli_gate.cmd_gate_*` is the name that holds it. A stand-in would have
answered the call and broken `args.func is cli_mod.cmd_gate_edit_document` — the
identity the re-export existed to keep — so it would have looked like it worked.
No module under `src/opendox/` read any of the nineteen.

DISCLOSED, in the comment that replaces the block: four carved suites at
openXdox-code still spell four verbs through this module at lines that
repository's rows do not declare. None is collected there today, so the
respelling is owed to the act that un-ignores them.

`import opendox.cli` no longer fails on its OWN reaches; it still fails through
`opendox.serve`, which is the next commit. Every edited line is declared —
carve 79-84 and 979-987, the Q-L1 row annotation's own lines; the arrival
verifier reports none undeclared.

Refs opensoft/openXfactory#656

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

`tests/test_consumer_reach.py` keeps two halves — the modules ASSERTED to
import with `openxdox` unimportable (`NEUTRAL_MODULES`) and the modules
RECORDED as still reaching (`STILL_REACHING`) — and the second half's test is
written to FAIL when a module starts importing, because a slice landing is not
a regression and the record then has to move. Step 2 made
`import opendox.branch_session` succeed with no consumer present, and
`test_the_reaching_modules_are_recorded_as_reaching[opendox.branch_session]`
did exactly what it says: *"Move it from STILL_REACHING into NEUTRAL_MODULES in
the same act, so the claim is asserted rather than merely no longer
contradicted."* This is that move, one commit late — `validate` was red at
d1d070b for this and nothing else.

`opendox.cli` is checked and STAYS in the record, which is the more interesting
half. Step 3 removed the last statement in `cli.py` that names the consumer at
import time, so the module itself is clean; it still imports `opendox.serve`,
which names two consumer classes as MIXIN BASES, and an importing module
inherits its imports' reaches. Its entry is rewritten to say so, and to say
that it leaves the list the moment `serve` does — one act, two modules — so
that the record reads as a derived fact rather than as unfinished work of its
own.

`serve`'s entry drops the two clauses that are no longer the obstacle (the
multi-line re-export blocks, the undeclared continuation lines) and names the
two that are: the mixin bases, and `build_server`'s two default arguments.

Refs opensoft/openXfactory#656

Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…t time — the last of the nine

The four remaining import-time reaches in this module, in the order the file
meets them, and the shape each needed:

`from openxdox import snapshot_registry as registry_mod` (:135) becomes a
binding to the `consumer_reach` stand-in, so every `registry_mod.X` read in the
body below is unchanged and only the MOMENT of the reach moves — the idiom
steps 2 and 3 already used.

`build_server`'s two DEFAULT ARGUMENTS (:1304, :1308) could not take that
shape, and they are the reason this slice needed `defaults.py` at all: a
default is evaluated where the `def` sits, which is at import time, so no
stand-in can defer it. They read `defaults.DEFAULT_INDEX_NAME` and
`defaults.PEEK_TTL_SECONDS` — openDox's own spelling of values openDox owns —
and openXdox-code's drift guard holds the two spellings together. Same act as
`branch_session.py`'s seven, same argument.

The two MIXIN BASES (`serve_gate.GateRoutes`, `serve_projection.ProjectionRoutes`
on `DashboardHandler`) are the hard case and the one this step adds machinery
for. A base expression is evaluated when the class statement runs, and a class
needs its bases before its first instance exists, so a base cannot be deferred
by any stand-in in the family. `consumer_reach.route_column` builds a stand-in
BASE instead: one forwarding method per name the consumer's column defines,
each calling `getattr(<consumer class>, name)(self, *args, **kwargs)` — the
same function object with the same `self`, which is the live request handler.
So `/snapshot.json`'s core arm still finds `self._serve_snapshot`, and a
contributed binding naming `_handle_gate_action` or `_serve_index` still
resolves against the bound class at wiring time, which is the check that
refuses an unservable route BEFORE a socket. There is deliberately no
`__getattr__`: a handler is probed for absent attributes constantly, and a base
that answered those by importing openXdox would fire the reach at a moment no
verb chose.

The two RE-EXPORT blocks go, with one correction to the first draft of this
step. Four of the six projection names and the one gate name have no reader in
this repository and stay reachable at `openxdox.serve_projection` /
`openxdox.serve_gate`. Two do have readers and KEEP their names here, bound to
late stand-ins: `hosted_ref_refused`, which decides at :785 that a hosted
response must never name a session ref (FR-048), and — the one the first draft
dropped — `resolve_source_path`, which `notebook_action.py`:52 imports
`from .serve` and :139 re-checks every resolved document through before a
notebook action may name a path. Dropping that one would have turned a
path-containment check into an ImportError, which is the one class of removal
this slice must not make.

`build_server` also stops reaching `profile_openxfactory.ROUTE_EXTENSIONS`,
which is a REPAIR rather than a removal: openxFactory's carve manifest files
`profile_openxfactory.py` as `deleted_at_carve` — "the one file the § 3 carve
deletes rather than moves" — and the deferred import that fed this reach went
with it while the reach itself was left behind, so `build_server()` raised
`NameError: profile_openxfactory` for every caller. A server is now assembled
from exactly what its caller hands it, which is what the § 2.4 seam is for. The
docstring above it still describes the in-tree profile and is NOT corrected
here: those lines are not ones the carve manifest declares for this row, and an
edit outside the declared lines is an undeclared movement the arrival verifier
refuses (RULED OQ-1). The comment beside it is the correction until an act that
declares them lands.

CENSUS. `openxdox` import-time reaches across `src/`: 0, from 9 at the head of
this slice. 19 deferred reaches remain and are not this slice's business —
they resolve inside verbs, which is the direction working, not the direction
surviving.

`opendox.serve` does NOT move into `NEUTRAL_MODULES`, and the record says why
in a field this step adds. It is now blocked by `ideation_dashboard`, not by
`openxdox` — openxFactory's pre-carve package name, a
`stays_openxfactory_adapter` row (RULING DQ-1) present at neither carve
destination, already censused in this file at 2 sites and owed to a later act.
`STILL_REACHING` therefore records the BLOCKING PACKAGE per module and the test
asserts it by name, plus — for a row whose blocker is not the consumer — that
`openxdox` is NOT what the failure names. Without that, the substitution would
have passed unread: the test would have stayed green on a nonzero exit while
the thing it was written to measure had been fixed. `opendox.cli` is the same
row, derived: it names no consumer itself since step 3 and inherits serve's.

Refs opensoft/openXfactory#656

Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The seam's three members were not tested alike. `_LateConsumerModule` and the
late callable had run-time tests from slice 2 — laziness, forwarding, caching,
the dunder rule, the refusal naming the layering — and `_LateConsumerValue`,
added in step 1 of this slice for `SCANNED_ROOTS`, had only its construction
exercised by importing the module. A review pass on this pull request named the
gap; these are the tests it asked for, one per claim the class makes.

CONSTRUCTION RESOLVES NOTHING. `scanned_roots` is built while
`consumer_reach` itself is importing, inside a package that must import with no
consumer present, so a constant that resolved eagerly would make the module
written to remove import-time reaches into one. `repr` is asserted not to
resolve either, for the reason the class comments give: a debugger, a logging
call and pytest's own assertion rewriting all reach for it.

THE SEQUENCE OPERATIONS FORWARD. Iteration (`cli.py`:228's `for root in
SCANNED_ROOTS`, the site the class exists for), length, membership both ways,
indexing from each end, slicing, equality and inequality against the real tuple,
truth, `str`, and `hash` — the last because a re-exported constant can land in a
set or as a dict key. The assertions are written as INDISTINGUISHABILITY from
the tuple, because that is the actual requirement: the read at :228 is not a
line openxFactory's carve manifest declares, so the name had to keep behaving
as what it was rather than be respelled.

THE ATTRIBUTE READ IS REFUSED. `__getattr__` is deliberately absent — an
attribute read on a constant is almost always a caller who wanted the module —
and that refusal is now asserted rather than merely commented, as a plain
`AttributeError`, which is what the tuple would have raised.

THE UNAVAILABLE-CONSUMER PATH, AT EVERY OPERATION. With no consumer installed
the binding is still constructed, so the refusal must arrive at first USE and
must name which way the pin runs. Each of the ten operations is checked to
raise `ConsumerReachUnavailable`, to name `openxdox.<module>`, to cite RULED
OQ-2, and to chain the original `ModuleNotFoundError` so a reader still gets
the import machinery's own account beneath the layering one.

The fixture installs a pretend `openxdox.corpus_root` in `sys.modules` rather
than importing one, so the tests hold both on a machine with openXdox-code
present and in CI where it is absent, and it removes the fake PARENT only if it
created it — the rule the slice-2 forwarding test already follows, because
leaving an empty `openxdox` package behind would make every later test in the
process see an importable-but-empty consumer.

Refs opensoft/openXfactory#656

Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…onstant, not seven and two

A review pass on this pull request caught a wrong number in a comment slice 2b
wrote and a wrong constant name beside it. Both are corrected, and so is the
inherited error behind them.

THE COUNT. `branch_session.py` carries NINE `records_dir: str =
DEFAULT_RECORDS_DIR` default arguments (:1740, :1859, :1878, :4179, :4217,
:4254, :4287, :4504, :4991 — the line numbers step 2's own comment beside the
import already lists), not seven. Seven is slice 2's number, written into this
file's docstring when the conversion was reverted and repeated into
openXdox-code's ratchet file; slice 2b copied it forward without counting. The
docstring is corrected here and says that it was wrong, because a number a
later reach-removal audit reads off a comment is worth no more than the count
behind it. openXdox-code's copy is corrected in the ratchet act that lowers the
census.

THE NAME. There is no `DEFAULT_BRANCH_PREFIX` in this. It is ONE constant at
nine sites — `gate_console.DEFAULT_RECORDS_DIR`, now `defaults.DEFAULT_RECORDS_DIR`
— and `defaults.py` carries three values in total, the other two being
`serve.py`'s `DEFAULT_INDEX_NAME` and `PEEK_TTL_SECONDS`. The comment now says
so explicitly rather than leaving a reader to infer a second constant that does
not exist.

The eleven default-argument sites across the two modules therefore read three
values, which is the sentence the docstring now makes.

No behaviour changes: this act edits comments in `tests/test_consumer_reach.py`
and nothing else.

Refs opensoft/openXfactory#656

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

A review pass on this pull request made the right objection: the import-isolation
tests prove the generated bases can be BUILT, and nothing called through one.
The forwarders are `getattr(<consumer class>, name)(self, *args, **kwargs)`, so
a wrong method list or a forwarding signature that dropped an argument would
leave every import green and break requests — and `route_extension` resolves a
contributed handler BY NAME against the bound class, which is the check that
refuses an unservable route before a socket is opened. Six tests, one per claim:

CONSTRUCTION RESOLVES NOTHING. The class statement runs at import time, which
is the entire reason this member of the family exists; a base that resolved
while being built would defer nothing. The `LATE_COLUMN` triple is asserted
here too, because that is the surface openXdox-code's drift guard reads to hold
the two sides together, and the forwarder is asserted to keep the method's
`__name__` — a contributed binding is resolved by name.

THE FORWARDING CONTRACT, against a fake column whose methods read state off
`self`. That is the assertion that matters: `self` must be the live request
HANDLER and not the column, so the fake's methods return `self.marker`, which
only the handler carries. Positional and keyword arguments, the return value,
and the fact that the bound method is the forwarder rather than the column's
own function.

ONLY THE NAMES IT WAS GIVEN. `__getattr__` is deliberately absent, and the
absence is now asserted: a probe for `do_PUT` raises `AttributeError`, and so
does a method the consumer's column really defines but the NAMED list leaves
out. A base that answered those by importing openXdox would fire the reach at a
moment no verb chose, and would raise `ConsumerReachUnavailable` where the
caller was testing for `AttributeError`.

THE UNAVAILABLE-CONSUMER PATH fires at the CALL, names `openxdox.<module>`,
cites RULED OQ-2 and chains the original `ModuleNotFoundError`. An empty method
list is refused, because a column standing in for nothing would inherit nothing
and hide it.

THE TWO LIVE COLUMNS are held against the names `serve.py` and the § 2.4
bindings actually dispatch. `_serve_snapshot` is the one to watch:
`/snapshot.json`'s HANDLER travelled to the projection column while its
dispatch ARM stayed core, so `serve.py` itself calls `self._serve_snapshot` and
dropping it from the list would leave every import green and that route broken.

Refs opensoft/openXfactory#656

Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
RULED ASK-2 option (2) (openxFactory#656 comment 5628886636): a module in
openDox-code resolves the profile at first attribute access and openxFactory
registers the real module at process start. This is the REGISTRY half; the
accessor half (the `profile_openxfactory` proxy) follows in the next commit.

The module PATH is part of a contract, not a preference: openXdox-code #14's
§ 4.4 engine (`a4bda011`) names `opendox.domain_profile` verbatim as its
upstream registry and duck-types it on `is_registered()` / `current()`. That
realizes RULED ASK-4 Q5 (`5634195861`, "one registration, two accessors") as
ONE registration on THIS leg's registry, read directly by openDox's accessor
and by DELEGATION by openXdox's — which adds no import between the two legs in
the forbidden direction, because openXdox pins openDox (RULED OQ-2) and nothing
here names, imports or requires `openxdox`. The rejected alternative (a host
hook calling BOTH legs' `register()`) is stated in the module docstring.

Refusal, not a default: `current()` with nothing registered raises
`ProfileNotRegistered` quoting the exact registration call, and a second
DIFFERENT registration raises `AlreadyRegistered` — the same stance, and the
same two error names, openXdox-code #14 takes for the same reason. Nothing here
is type-checked: the only types worth checking live in packages openDox may not
name.

A CREATED file: no carve-manifest row (RULED OQ-C).

Refs opensoft/openXfactory#656.

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

The accessor half of RULED ASK-2 option (2) (openxFactory#656 comment
5628886636). `_LateProfile` forwards ATTRIBUTE reads to
`domain_profile.current()` at FIRST ACCESS and nothing at import time —
`consumer_reach._LateConsumerModule`'s shape (§ 4.1, landed) pointed at a
different question, and deliberately NOT filed in that module: a host profile
is not a reach into `openxdox`, and filing it there would corrupt the one
number `tests/test_consumer_reach.py` holds at zero.

Two refusals, never an empty tuple. Nothing registered ->
`ProfileNotRegistered`, quoting the registration call and the runbook.
Registered but lacking the facet -> `ProfileFacetMissing`, naming the
attribute, the profile and the READER — a real gap in a host's profile, which
"register a profile" would misdirect. `ProfileFacetMissing` subclasses
`AttributeError` so `hasattr` and `getattr(..., default)` keep their meaning,
and dunder lookups never resolve the profile (the rule
`_LateConsumerModule` holds, for the same probers).

No local cache: every read goes through the one registration, so an
`unregister()` is seen at once and one registration stays one. `name_of()` is
made public in the same commit because both accessors quote it — a private
helper reached across a module boundary is a contract pretending not to be one.

A CREATED file: no carve-manifest row (RULED OQ-C).

Refs opensoft/openXfactory#656.

Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
`build_parser()` reads `profile_openxfactory.SUBCOMMAND_EXTENSIONS` and nothing
in this package bound the name — the § 3 carve files `profile_openxfactory.py`
as `not_moved / deleted_at_carve` and the deferred import that fed the reach
went with it — so `build_parser()` raised `NameError: profile_openxfactory` for
EVERY caller (the slice-2b finding, openxFactory#656 comment 5633826227).

The name now binds to the lazy proxy (RULED ASK-2 option (2), comment
5628886636). THE DIFF AT THE COMPOSITION POINT IS ZERO: the read is
byte-identical and only moves line (base :927 -> :949); what is added is one
import in the same declared import window BUILD slice 2b used for its own late
bindings, plus the comment that explains it. The finding's proposed repair —
DELETE the line, as `serve.py` did — is deliberately not taken: ASK-2 rules the
composition point comes BACK through a proxy rather than out, and the deletion
would have foreclosed the ruling.

The `build_parser()` docstring at :867 still describes the in-tree profile and
is NOT corrected here: those lines are not declared for this row and an edit
outside the declared lines is an undeclared movement the arrival verifier
refuses (RULED OQ-1). The new comment carries the correction until a declaring
act lands — the same posture, for the same reason, BUILD slice 2b took at
`serve.py`'s matching docstring.

`serve.py` is untouched by this commit: slice 2b already removed its
`ROUTE_EXTENSIONS` reach outright, and restoring the contribution through this
proxy is a HOST act and a separate declared edit, not a revert of a sibling's
landed decision. The runbook records it as owed.

Refs opensoft/openXfactory#656.

Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 11, 2026 13:01
@sourcery-ai

sourcery-ai Bot commented Sep 11, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR repairs the removed profile_openxfactory reach by introducing a shared, import-side-effect-free host registry and a lazy proxy bound into cli.build_parser(). The proxy resolves the host profile only when a facet is read, refuses missing registrations or facets instead of silently falling back, and leaves host registration and the process-start adapter contract to openxFactory.

Sequence diagram for lazy host profile registration and parser composition

sequenceDiagram
    participant Host as Host adapter
    participant Registry as opendox.domain_profile
    participant CLI as cli.build_parser()
    participant Proxy as profile_openxfactory
    participant Profile as Host profile

    Host->>Registry: register(profile)
    CLI->>Proxy: Read SUBCOMMAND_EXTENSIONS
    Proxy->>Registry: current()
    Registry-->>Proxy: profile
    Proxy->>Profile: Read SUBCOMMAND_EXTENSIONS
    Profile-->>Proxy: extension tuple
    Proxy-->>CLI: extension tuple
    CLI->>CLI: register_all(SUBCOMMAND_EXTENSIONS, sub)
Loading

File-Level Changes

Change Details Files
Added a process-wide host profile registry that supports one-time registration and explicit refusal states.
  • Added import-side-effect-free register, current, is_registered, unregister, and naming helpers.
  • Rejected missing profiles, conflicting registrations, and invalid None registrations with dedicated errors.
  • Provided the shared registry seam used by the other product leg through late duck-typed access.
src/opendox/domain_profile.py
Restored the profile_openxfactory composition name as a lazy, non-caching proxy.
  • Resolved the registered profile only on non-dunder attribute access.
  • Distinguished an absent registration from a registered profile missing the requested facet.
  • Preserved probe-friendly AttributeError behavior and avoided import-time host resolution.
src/opendox/profile_proxy.py
Bound the lazy proxy into the CLI without changing the existing composition read.
  • Added the declared late import in cli.py while leaving the SUBCOMMAND_EXTENSIONS read byte-identical.
  • Documented the deferred binding and the intentionally unchanged docstring scope.
src/opendox/cli.py
Added coverage and operational documentation for the registration contract.
  • Added registry/proxy tests and test-process profile registration.
  • Documented process-start registration, refusal semantics, and host responsibilities.
  • Included the new suite in both validation workflow runs.
tests/test_profile_registration.py
tests/conftest.py
docs/profile-registration-runbook.md
.github/workflows/validate.yml

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

brettheap and others added 2 commits September 11, 2026 09:04
…te` runs it

`tests/test_profile_registration.py` (NEW, 18 cases) holds both halves of RULED
ASK-2 option (2) to their word: nothing resolves at import time (proved in a
SUBPROCESS, since that is the one thing a lazy proxy exists to prevent); an
unregistered read REFUSES and the message names the registration call, the
ruling and the runbook; it never answers empty; a registered profile resolves
both facets; a second DIFFERENT registration refuses while re-registering the
same object is a no-op; a registered profile lacking a facet raises its own
refusal, which stays an `AttributeError` so `hasattr` and
`getattr(..., default)` keep their meaning; dunder and `repr` probes never
resolve. Case 7 pins the duck type openXdox delegates to — the module PATH
included, because `openxdox.domain_profile._UPSTREAM_REGISTRY` names it
verbatim and a rename here would silently break Q5's one registration in a leg
this repository cannot import and therefore cannot test against.

`validate` runs it beside `test_leg_shape.py` and `test_consumer_reach.py`: it
is `--noconftest` safe and needs no consumer, by the same means as its
neighbours (RULED Q-L5 (b′)). Without this the ruled contract would be executed
nowhere in CI, the carved suites still being collect_ignore'd.

`test_consumer_reach.py`'s census is WIDENED, never narrowed: the two new
modules join `NEUTRAL_MODULES`, so the count of import-time `openxdox` reaches
across `src/` stays 0 and now covers the seam where a reach into the consumer
would have looked most reasonable.

The root `conftest.py` registers an EMPTY host profile at the root of the
conftest chain — this suite's process start — because a test process is a host
like any other. It is the contract exercised, not worked around: the refusal is
proved in isolation by the new suite, with the registry emptied around every
case. Empty because openDox ships no profile and this scaffold must not invent
openxFactory's; empty tuples compose the CORE parser, which is the surface this
leg's suites pin.

Refs opensoft/openXfactory#656.

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

RULED ASK-2 option (2) ends "that operational contract is DOCUMENTED in the
runbook" (openxFactory#656 comment 5628886636). This is the runbook, and it is
the only artefact in the slice a host reads before writing its adapter: what it
registers, when (process start, before the first `build_parser()` /
`build_server()`), the exact call, the three refusals with their texts, what
openDox reads off a profile and what it deliberately does not type-check.

It carries RULED ASK-4 Q5's realization in a diagram and in words — this leg's
registry is the shared seam; openXdox's accessor delegates to it LATE in the
lawful direction (it pins openDox, RULED OQ-2); no import is added between the
legs; the module PATH is part of the contract because openXdox-code #14 names
it verbatim — together with the alternative rejected (a host hook calling both
legs' `register()`) and why.

It also records what is deliberately NOT taken here: `serve.build_server()`'s
route contribution, removed outright by slice 2b and owed a separate declared
edit rather than a revert of a sibling's landed decision; the docstring
corrections held by RULED OQ-1; and the openxFactory half, which is adapter
code and stays in openxFactory (design § D3).

Linked from the README doc index, which lists everything under `docs/`.

Refs opensoft/openXfactory#656.

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Existing parser tests lack required profile registration, while dedicated registry/proxy tests and the referenced runbook are absent.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds a host profile registry and lazy proxy so CLI composition can resolve host contributions at runtime.

Changes:

  • Adds profile registration lifecycle and refusal errors.
  • Adds lazy profile-facet resolution.
  • Binds the proxy into CLI composition.
File summaries
File Description
src/opendox/profile_proxy.py Lazy profile proxy and facet errors.
src/opendox/domain_profile.py Host profile registry and lifecycle API.
src/opendox/cli.py Imports the proxy for parser composition.
Review details

Suppressed comments (3)

src/opendox/domain_profile.py:151

  • The new registry/proxy contract is not exercised by this branch: there is no tests/test_profile_registration.py, and validate.yml still runs only the shape and consumer-reach suites with --noconftest. That leaves the critical empty-registry refusal, idempotent registration, conflicting registration, and unregister paths without CI coverage; add a dedicated hermetic suite before relying on this seam.
def register(profile: Any) -> Any:
    """THE one registration. Called by the host's adapter at process start.

    Returns the profile, so a host can register and hold it in one expression.

src/opendox/profile_proxy.py:125

  • The new lazy-profile path is not exercised by the repository's tests: tests/test_profile_registration.py is absent, and validate.yml runs only test_leg_shape.py and test_consumer_reach.py, neither of which imports this proxy or exercises registration, missing facets, idempotent re-registration, or unregister behavior. Add the dedicated registry/proxy tests and include them in the validation command so this contract is checked in CI.
        profile = self.resolve()
        try:
            return getattr(profile, attr)
        except AttributeError:
            raise ProfileFacetMissing(

src/opendox/profile_proxy.py:134

  • The missing-facet refusal also points to docs/profile-registration-runbook.md, which is absent from this checkout, so the remediation link in this error is unusable. Add the runbook or change the message to reference documentation that ships with the package.
                "5628886636): see docs/profile-registration-runbook.md for what "
  • Files reviewed: 9/9 changed files
  • Comments generated: 4
  • Review effort level: Lite

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

Comment thread src/opendox/cli.py Resolved
Comment thread src/opendox/domain_profile.py Resolved
Comment thread src/opendox/domain_profile.py Resolved
Comment thread src/opendox/profile_proxy.py Resolved
Copilot AI review requested due to automatic review settings September 11, 2026 13:06
brettheap and others added 2 commits September 11, 2026 09:07
… names

Two Copilot findings on openDox-code#11, both about the TEXT of a refusal,
which is the only part of this slice a host actually reads.

`name_of()` promised `repr` in its docstring and returned the TYPE NAME. For an
opaque profile that made two instances of one class indistinguishable — which
is precisely the case `AlreadyRegistered` is reporting — so a message about the
difference between two profiles named neither. It now returns a guarded,
truncated `repr`, with the type name kept as the step below it and the constant
below that: no branch may raise, because `repr` is arbitrary code on an object
this module deliberately does not type-check, and none may run long, because a
refusal that pastes a screenful buries its own words.

The proxy's reader label named `cli.build_parser() / serve.build_server()`.
`build_server()` does not read this proxy on this branch — slice 2b removed its
`ROUTE_EXTENSIONS` reach outright and restoring it is a separate declared edit
— so a `ProfileFacetMissing` would have claimed a reader that made no access,
misdirecting the host the message exists to help. The label is now
`cli.build_parser()`, and `serve.build_server()` is added to it by the act that
adds the read.

Three cases cover both: two opaque profiles of one class are named apart, a
hostile `repr` neither raises nor runs long, and the proxy names only the reader
that reads it. 62 passed.

Refs opensoft/openXfactory#656.

Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The fix round took the suite from eighteen cases to twenty-one and the runbook
still said eighteen. A figure in a record is a claim; this one names what the
three added cases assert (how a refusal names a profile, and which reader it
names) rather than only moving the number.

Refs opensoft/openXfactory#656.

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Moderate issues remain around parser integration coverage, test registry restoration, documentation accuracy, and state assertion strength.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (4)

src/opendox/cli.py:112

  • This binding is the fix for build_parser()'s former NameError, but the added suite never imports opendox.cli or calls build_parser(); it only reads the proxy directly. The existing parser integration suite is currently excluded by conftest.py:80-90, so CI can remain green if this import is misplaced or the composition point is still broken. Add an integration test that registers a real SubcommandExtension and verifies cli.build_parser() composes it (and refuses when unregistered).
from opendox.profile_proxy import profile_openxfactory  # noqa: E402

src/opendox/domain_profile.py:242

  • This docstring says the fallback is repr, but name_of() never calls repr; after trying __name__ and mapping_id, it returns the profile type name at lines 251-252. Update the description so maintainers do not rely on a representation that the refusal path intentionally does not produce.
    PUBLIC because `profile_proxy.py` quotes it in its own refusal: the two
    accessors of one registration must name a profile the same way, and a
    private helper reached across a module boundary is a contract pretending
    not to be one.

tests/test_profile_registration.py:153

  • This verifies the proxy by reading its attributes directly, but no test registers a profile and then calls cli.build_parser(). The new binding in cli.py could be removed or misbound while this suite remains green; the existing parser tests are currently collect-ignored and are not in validate. Add an --noconftest-safe integration case with a minimal real SubcommandExtension and assert that the registered profile's command is present and parses.
def test_a_registered_profile_resolves_both_composition_points() -> None:
    profile = _HostProfile()
    assert domain_profile.register(profile) is profile, (
        "register() returns the profile so a host can register and hold it in "
        "one expression")

tests/test_profile_registration.py:266

  • "registered" is a substring of "unregistered", so this assertion also passes if repr(profile_openxfactory) incorrectly remains unregistered after registration. Assert the state token exactly (for example, "(registered)") so the transition is actually covered.
    assert "registered" in repr(profile_openxfactory)
  • Files reviewed: 9/9 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread tests/test_profile_registration.py Resolved
Copilot AI review requested due to automatic review settings September 11, 2026 13:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Add parser integration coverage and preserve the pre-test profile registration state.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (1)

tests/test_profile_registration.py:82

  • This fixture removes the process-start profile in the root conftest.py and leaves the registry empty after the module finishes. When this suite is collected with the normal conftest chain, any later parser test (for example when the currently ignored suites are re-enabled) then fails with ProfileNotRegistered; preserve and restore the pre-test registration instead of unconditionally unregistering it at teardown.
    domain_profile.unregister()
    yield
    domain_profile.unregister()
  • Files reviewed: 9/9 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread src/opendox/cli.py Resolved
…f1f2e5

This PR was STACKED on `build/remove-back-imports-2b`; that branch landed as
openDox-code #10, squashed onto `main` as `0f1f2e59`. The stack therefore had to
be brought onto `main` before the ruled serve.py half (ASK-6 -> 1) could be
authored against the file main actually carries.

A REBASE was the intended act and IS what fixes this tree: `git rebase --onto
origin/main cc1d806 build/section-4-3-profile-lazy-proxy` replayed all seven
§ 4.3 commits with ZERO conflicts and produced a diff against `main` that is
BYTE-IDENTICAL to the pre-rebase diff against `cc1d806b` — proof that main's
squash of 2b and this branch's 2b ancestry are the same content, and that
§ 4.3 touches nothing 2b left unsettled.

It could not be PUSHED as a rebase. The `opensoft` org-level ruleset 8981805
applies `non_fast_forward` to EVERY branch of this repository, not just `main`,
so history replacement is refused for this branch by policy
(`GH013 ... Cannot force-push to this branch`). The lane's permitted single
force is unavailable, and bypassing an org ruleset is not this author's act.

So the same result arrives append-only: this is `main` merged INTO the branch,
with the merge resolved to EXACTLY the verified rebase's tree
(`16cf0c43` = `ef67c83`^{tree}, the rebase head's tree). The two conflicted
files — `src/opendox/cli.py` and `tests/test_consumer_reach.py`, the two the
§ 4.3 commits edit on top of 2b — take the rebase's resolution, which is
main's 2b shape with the § 4.3 intent re-applied on top, because that is what
the conflict-free rebase computed. `git diff origin/main...HEAD` is unchanged
by this commit.

Landing is unaffected: #9 and #10 both landed as SQUASHES (`da8aae96`,
`0f1f2e59`), so the merge commit and the duplicated 2b ancestry do not reach
`main` — the squash carries this tree and nothing else.

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

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@brettheap
brettheap changed the base branch from build/remove-back-imports-2b to main September 11, 2026 18:30
…position point

RULED ASK-6 -> 1 (Brett Heap, openxFactory#656 comment 5635150678): "the routes
half of § 4.3 — serve.py reads the proxy too; after 2b lands and openDox-code #11
is rebased onto main, the same author adds the server-side binding in the same PR
(one mechanism, one registration, under ASK-2)."

WHAT THE TWO LINES ARE. `build_server()` collected its route bindings from
`tuple(profile_openxfactory.ROUTE_EXTENSIONS) + tuple(route_extensions)` before
the carve. The carve deleted the deferred import that fed the name (the declared
`:1371`) and left the reach behind, so `build_server()` raised `NameError:
profile_openxfactory` for every caller; BUILD slice 2b cut the reach out rather
than repairing it, because repairing it needed a ruling it did not yet have. It
has one now, so:

  * the deferred import returns AT ITS OWN SITE, bound to the LAZY PROXY
    (`from opendox.profile_proxy import profile_openxfactory`) instead of to an
    in-tree module, inside `build_server()`'s body and not in the import header;
  * the `collect_bindings` expression is restored BYTE-IDENTICAL to the carve
    commit's own two lines — host routes ahead of the caller's tuple, and
    `route_extensions` still the § 2.4 seam for whatever a caller adds on top.

THE EDIT IS DECLARED, checked before it was made and not after. openxFactory's
carve manifest declares BOTH carve lines on the `scripts/ideation_dashboard/
serve.py` row: `:1371` under the row's first `import rewrites` class, and
`:1380-1381` under the Q-L1 row annotation (RULED `5628560136`) that landed with
PR-2 #940 at `cc4ae9d3`. Verified by running the arrival verifier's OWN logic
(`scripts/verify-carve-arrival.py::_check_declared_lines` over
`scripts/carve_lines.py` records) against the blob at `b075fd91` — whose sha256
matches the row — rather than by reading destination line numbers, which are not
the numbering the manifest uses. Every changed carve line on this file is
declared; so is every changed carve line on `cli.py`.

A SERVER WITH NO HOST NOW REFUSES, naming `opendox.domain_profile.register(...)`,
exactly as `build_parser()` already refuses at its own read. That is ASK-2's
"REFUSAL, NOT A DEFAULT" — a server silently missing its contributed routes looks
exactly like a working one — and it makes `domain_profile.current()`'s message
true of both readers rather than one: that text has always told a host to
register "before it calls `cli.build_parser()` or `serve.build_server()`".

THE PROXY KEEPS ITS PRECISION UNDER TWO READERS. One object is now bound by both
composition points, so `_LateProfile` maps FACET -> READER: a missing
`ROUTE_EXTENSIONS` names `serve.build_server()` and a missing
`SUBCOMMAND_EXTENSIONS` names `cli.build_parser()`. Concatenating the labels
would have thrown away exactly what the earlier single label was narrowed for
(the Copilot review thread on this PR: a refusal naming a reader that made no
access misdirects the host it exists to help). `repr` has no facet and names the
whole surface; so does a facet neither reader knows.

EXECUTED, NOT DESCRIBED — and got at sideways, because `import opendox.serve`
cannot be performed in this repository at all: `serve.py:181` still reaches
`ideation_dashboard`, openxFactory's pre-carve package, present at neither carve
destination (recorded in `test_consumer_reach.py`'s `STILL_REACHING`, owed to a
later act). So the suite lifts `build_server()`'s two composition statements out
of the real file BY AST and executes them against a stand-in `route_extension`
seam: the tree's own lines run, the host-ahead-of-caller order is pinned, the
unregistered refusal is proven AT THE SERVER, and none of it is pinned to a line
number that the next declared edit would move. Seven new cases, 21 -> 28; the
runbook's count moves with them, in this commit.

THE CENSUS DOES NOT MOVE, and that is asserted rather than asserted-away: this
slice adds one import of `opendox.profile_proxy`, openDox's OWN module, so the
consumer census (`tests/test_consumer_reach.py`) and the pre-carve-package census
(`known = {"src/opendox/serve.py": 2}`) are both unchanged and both still green.
`validate` goes 62 -> 69 passed purely by the seven new cases.

The runbook's "owed" entry for this contribution is replaced by the section that
records the act; the docstring corrections stay owed, now citing RULED ASK-7 -> 1,
which leaves all four standing until the next declared-edit window.

Refs opensoft/openXfactory#656

Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings September 11, 2026 18:40
…th composition points

The two open Copilot threads on openDox-code#11. Both are correct, and both name
a defect a passing `validate` could not have shown.

1. THE TEARDOWN STRIPPED THE PROCESS'S REGISTRATION
   (`tests/test_profile_registration.py:92`). `_empty_registry` unregistered on
   the way out as well as on the way in, so after this module ran, the empty
   `_SuiteProfile` the root `conftest.py` registers AT PROCESS START was gone for
   the rest of the session — and every later test that reached a composition
   point (`cli.build_parser()`, and now `serve.build_server()`) would have raised
   `ProfileNotRegistered` for a reason that had nothing to do with it. COLLECTION
   ORDER would have decided whether the suite passed.

   The fixture now saves what it found and puts it back. `validate` cannot see
   this failure — this file runs there under `--noconftest` (RULED Q-L5 (b')), so
   there is no conftest registration to destroy — which is the reason to fix it
   rather than note it: the bug was waiting for the day the ignore list shrinks.

2. THE SUITE NEVER BUILT A PARSER (`src/opendox/cli.py:112`). It exercised
   `_LateProfile` directly, so the regression the binding exists to prevent —
   `build_parser()` raising `NameError: profile_openxfactory`, the carve's own
   defect (`openxFactory#656` comment `5633826227`) — could have returned with
   every new test green.

   The asked-for integration assertion cannot be written literally: NEITHER
   `opendox.cli` NOR `opendox.serve` can be imported in this repository.
   `serve.py:181` still reaches `ideation_dashboard`, openxFactory's pre-carve
   package, present at neither carve destination, and `cli.py` imports `serve`
   and inherits the block; both are recorded by name in `test_consumer_reach.py`'s
   `STILL_REACHING` and owed to a later act of the BUILD arc.

   So the answer is the one this commit's sibling already used for the server,
   generalized to both: each composition point is lifted OUT of its own file BY
   AST — the binding of the proxy, wherever that module puts it, plus the
   statement that reads a facet off it — and those statements are EXECUTED
   against stand-ins for the two § 2.4 seams. The tree's own lines run, so a
   deleted binding, a renamed import or a deleted read all fail here. Nothing is
   pinned to a line number the next declared edit would move, and nothing has to
   change the day the two modules become importable.

   Three cases follow for the parser: it resolves rather than raising `NameError`,
   it refuses with the registration call named when no host registered, and it
   binds at MODULE SCOPE — which `serve.py` deliberately does not, because a
   parser is built from the profile at import time and a server is not. Asserting
   only "a binding exists somewhere" would let either file drift into the other's
   shape and silently falsify the comment in both.

The import-time walk is also corrected: `ast.walk` over a module descends into
function bodies, which called `serve.py`'s deferred binding an import-time one.
It now prunes function bodies while keeping decorators, default arguments and
class bodies — the line `test_consumer_reach.py::_import_time_uses` already
draws, for the same reason.

30 cases (was 28 in the sibling commit, 21 before the slice); `validate` 71
passed. The runbook's count and its description of what is executed move in this
commit. No census number moves: nothing here adds a name in `openxdox`.

Refs opensoft/openXfactory#656

Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@brettheap brettheap changed the title § 4.3: profile_openxfactory becomes a lazy proxy registered by the host at process start (RULED ASK-2; stacked on slice 2b) § 4.3: profile_openxfactory becomes a lazy proxy registered by the host at process start, read by BOTH composition points (RULED ASK-2; routes half RULED ASK-6 → 1) Sep 11, 2026
@brettheap
brettheap marked this pull request as ready for review September 11, 2026 18:47

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Address the three unresolved review comments covering parser coverage, server scope reconciliation, and test registry restoration.

Review details

Suppressed comments (3)

src/opendox/cli.py:112

  • The new binding here is not exercised by the added suite: tests/test_profile_registration.py reads profile_openxfactory directly, while only the server half has an AST execution check. The existing parser tests are in collect_ignore, and validate runs this suite with --noconftest, so a typo in this import or a mismatch at the real build_parser() read could pass CI while the parser remains broken; add a dependency-free AST/subprocess check for the actual cli.py binding and composition read.
from opendox.profile_proxy import profile_openxfactory  # noqa: E402

src/opendox/serve.py:1420

  • The PR description says serve.py is untouched and explicitly defers restoring the route contribution as a later host act, but this hunk imports the proxy and reintroduces ROUTE_EXTENSIONS into every build_server() call. Please reconcile the description and scope with this behavior (or remove the server-side change); otherwise it is unclear whether server construction now requires registration and host routes are restored in this PR.
    from opendox.profile_proxy import profile_openxfactory

tests/test_profile_registration.py:92

  • The root conftest.py registers _SuiteProfile at process start (conftest.py:129-130), but this autouse fixture removes that process-global registration and leaves the registry empty after every test. In a normal full pytest run, any later suite that builds a parser or server will now receive ProfileNotRegistered, and the fixture does not actually satisfy its “starts and ends” isolation claim; save the pre-test profile and restore it after the yield while still clearing it during each case.

    THE RESTORE IS NOT COSMETIC (Copilot review thread on openDox-code#11). The
    root `conftest.py` registers an empty `_SuiteProfile` AT PROCESS START,
  • Files reviewed: 10/10 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings September 11, 2026 18:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Address the two unresolved moderate review findings in conftest.py and tests/test_profile_registration.py.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (1)

tests/test_profile_registration.py:528

  • _composition_statements() discards the source order by returning binding + reads, so it always executes the proxy import before the facet read. A future edit that moves the deferred import below route_bindings = ... would still pass this AST test while the real build_server() raises NameError; preserve the function-body order (and assert the binding precedes the read) before executing the extracted statements.
    return binding + reads
  • Files reviewed: 10/10 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread conftest.py Resolved
…oken registry

The Copilot thread opened when this PR left draft, on `conftest.py:119`, and it
is correct: `except Exception` around the scaffold import would have swallowed a
`SyntaxError` — or any other import-time breakage inside
`opendox/domain_profile.py` — left `_domain_profile` as `None`, and SKIPPED the
process-start registration in silence. After which every suite that reached a
composition point (`cli.build_parser()`, `serve.build_server()`) would fail, or
pass, according to what happened to be collected. The registry would be broken
and this file would be the reason nobody could tell.

TWO THINGS ARE SCAFFOLDING, and the guard now says so in the code rather than in
the comment: the package is not importable yet, AND it is the PACKAGE that is
missing rather than something the registry itself imports.

    except ModuleNotFoundError as _missing:
        if (_missing.name or "").split(".")[0] != "opendox":
            raise
        _domain_profile = None

Proven at all four shapes rather than argued: the package present registers the
empty `_SuiteProfile`; `opendox` blocked leaves `_domain_profile` as `None` and
collects; a `ModuleNotFoundError` raised from INSIDE the registry re-raises with
its own name intact (`definitely_not_here_at_all`); a `SyntaxError` in the
registry re-raises. `from opendox import domain_profile` with the package present
and the submodule absent raises `ImportError`, not `ModuleNotFoundError`, so it
re-raises too — which is right: an installed openDox with no registry is a
regression, not a scaffold.

`validate` is unchanged by this (71 passed): it runs the three suites under
`--noconftest` (RULED Q-L5 (b')), which is why this defect, like the two before
it in this round, was invisible to the gate that guards the branch.

`conftest.py` is leg-assembled and has no carve-manifest row, so this edit is not
a declared-line question.

Refs opensoft/openXfactory#656

Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings September 11, 2026 18:54
@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Narrow conftest.py missing-module handling so missing opendox submodules are not silently suppressed.

Review details

Suppressed comments (1)

conftest.py:130

  • This check is still broader than the scaffolding case it claims to allow: ModuleNotFoundError.name can be opendox.domain_profile when the registry module itself is missing, or another opendox.* name when an import inside it fails, and split('.')[0] silently treats both as “the package is absent.” That skips registration and masks a broken/incomplete installed package; only suppress the error when the missing name is exactly the top-level opendox package (as the consumer reach code distinguishes the candidate package from its submodules).
    if (_missing.name or "").split(".")[0] != "opendox":
  • Files reviewed: 10/10 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants