You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
T022: 4.1a, openDox's own default adapter over LocalGitCorpus - #45
READY.#44 (T021) LANDED (squashed as 9d13bd16); this PR retargeted to main directly. T016 (P1-B, #42) has ALSO LANDED (19370adc) and is merged into this branch (ea83200). T011/T012 landed earlier still. Every gate this task's own "After:" line named is on main and merged into this head. Since the merge, Copilot's review ran to completion across eleven rounds at this head and its predecessors -- every finding fixed, verified red-before/green-after, and either replied-and-resolved (a threaded finding) or explained in the landing commit (an untitled "previously missed" one with no thread to reply to). See "Copilot's review, in full" below for what those eleven rounds actually found and fixed -- several were genuine security/correctness bugs, not nitpicks. Final head 9283278, all three validate.yml steps and the whole authoring-seam suite green, zero unresolved review threads.
RULING, applied at head d6abe60, carried forward unchanged through every merge and fix since: the default reads the working tree, not git HEAD. Brett, 2026-09-27, via the holder: working tree. Standalone users edit files in their own editor, and the hosted openxFactory adapter already shows worktree bytes — so the standalone default must show the same uncommitted bytes, not the session branch's last commit. Recorded on opensoft/openXfactory#656 by the holder. See "The working-tree ruling" section below.
Plan 034, slice P1-D, task T022. The plan is specs/034-opendox-standalone-operation/tasks.md in opensoft/openxFactory, read at #1167's head 42f34ab7 (landed as a65230f6, unchanged on main at b5ec3899). The claim is opensoft/openXfactory#656 comment 5850371775 (both T021 and T022).
Where no host has called corpus_adapter.register_home(...), openDox's own entry points now register a home_corpus-shaped factory over its own conformant WorkingTreeCorpus (src/opendox/runtime/local_git_adapter.py, a LocalGitCorpus subclass — see the ruling below) — exactly as the default profile stands in for an unregistered host (Group 3, T016). It starts at bare defaults (required_fields=()); phase 2's T054 sets the neutral fields R1Q13 decides. A bare process that builds nothing still meets 4.2's ADAPTER_NOT_REGISTERED refusal (T020, unchanged). _default_home_factory builds a fresh WorkingTreeCorpus() on every call — no listing cache keyed on HEAD, so there is nothing to invalidate when the working tree changes under it.
The seam gains one function, mirroring T016's domain_profile.register_default(). While authoring this task I found T016's own draft PR (#42, not yet landed) already open, and it puts the "register only where nothing is" check insidedomain_profile.py as register_default(profile), so cli.build_parser()'s own call is genuinely one line. corpus_adapter.py had no such helper (only register_home()/home(), T020), so this task adds corpus_adapter.register_default_home(factory): it calls home() first, and registers factory only on the ONE refusal kind that means "nothing is registered yet" (any other CorpusRefused is re-raised, never swallowed). Unlike register_default(), there is no after-build refusal to track — box 4.1a asks for nothing like RN-1's after-build semantics for the corpus adapter, so this stays as simple as register_home() itself.
LocalGitCorpus's own factory (_default_home_factory) is duplicated, byte-identical, in cli.py and serve.py rather than living in corpus_adapter.py: that module cannot import local_git_adapter without creating the cycle local_git_adapter.py already has the other way (from opendox.corpus_adapter import …).
Four call sites, mirroring T016's four exactly:
cli.build_parser() — the FIRST statement, ahead of the (pre-T016) profile read that can still refuse ProfileNotRegistered today.
cli.main() — redundant with build_parser()'s own call (which main() calls next), kept for the same reason T016 keeps its own match: the outermost entry point states the contract on its own.
serve.build_server() — the FIRST statement, ahead of the profile read two lines below.
serve.main() — redundant with build_server()'s own call, same reasoning.
LocalGitCorpus (the conformant local-git adapter RULING C3 asks for) reads via git plumbing at a resolved revision — git ls-tree/git cat-file blob at resolve()'s revision, defaulting to git HEAD. That is the right read for a hosted session bound to a commit, but the wrong one for a standalone default: a standalone user's uncommitted edit would be invisible until they committed it, which is not what "point openDox at my working directory" means to someone editing in their own editor.
WorkingTreeCorpus(LocalGitCorpus), appended to local_git_adapter.py, overrides exactly the two methods that decide where bytes come from, and nothing else:
_read_bound — (Path(corpus.location) / document.key).read_bytes() when no explicit revision is named, falling back to the parent's commit-based read (super()._read_bound(...)) when the caller DOES name one. An explicit revision still means what it always meant; only the default, no-revision read moved to disk.
resolve(), classify() (which reads through read(), so the override already flows into it), check() and write_back() are inherited unchanged — check()'s existing "uncommitted change" divergence semantics are deliberately untouched by this ruling, which is only about where the DEFAULT corpus's bytes come from.
The edge case the ruling doesn't mention, and had to be decided anyway: the repository openDox's own "create a repository" act produces is bare (RULING C3, confirmed by tests_runtime/test_local_git_adapter.py's own fixtures) — no working tree at all. WorkingTreeCorpus refuses CorpusRefused(CORPUS_UNREADABLE, ...) with a detail naming the reason ("this repository is bare … register a host adapter instead, or point this default at an ordinary checkout") rather than silently falling back to git-HEAD reads or crashing on a missing directory.
Falsifier, added to tests/test_authoring_seam.py: test_an_uncommitted_edit_is_visible_through_the_default builds an ORDINARY (non-bare) checkout by hand, commits one file, resolves it through the registered default, reads the committed bytes, edits the file on disk WITHOUT committing, reads again through the same resolved corpus object, and asserts the new bytes are visible; then adds a brand-new untracked file and asserts list_documents includes it too.
Red-checked: temporarily reverting cli.py's factory back to plain LocalGitCorpus() makes this same test fail with AssertionError: the default served the committed bytes after an uncommitted edit -- it is reading git HEAD, not the working tree — proving the test actually exercises the ruling, not a vacuous assertion. Restored immediately after confirming the failure; the PR's actual head builds WorkingTreeCorpus().
A second, unplanned falsifier this class tripped: tests_runtime/test_runtime_cli.py's anti-leak walk (an AST scan, run over every module in the runtime package, that a except <non-package-exception> as exc handler may not format exc's text into evidence except through _safe_message/redact_credentials/redact_remote_url — the A25-1 regression class) flagged my first cut of _read_bound's except OSError as failed: branch, which passed str(failed) straight to _refuse(...). Fixed by routing it through this file's own established idiom for the identical concern (redact_credentials(str(exc)), already used for GitCommandFailed's OS-error path, with the exact same rationale recorded there: "An OS error's text can carry the argv's filename, so it is cleaned where it is composed" — here it is the working-tree file's own path, read by Path.read_bytes(), that could otherwise leak). Confirmed red before the fix (1 failed, 360 passed, the one failure being exactly this finding) and green after (361 passed) in tests_runtime's full three-file replay of validate.yml's step 3.
Falsifier: the named test -- now genuinely real, T011 has landed
tests/test_authoring_seam.py::test_an_entry_point_registers_the_local_git_corpus_when_no_host_has calls cli.build_parser() with nothing registered, then requires corpus_adapter.home() to return a factory whose adapter is a WorkingTreeCorpus instance (updated for the ruling above; was LocalGitCorpus before it).
T011 (#46 → 0e88454a), T012 (#47 → 2768302) and T016 (#42 → 19370adc) have all landed, so opendox.cli/opendox.serve import cleanly, domain_profile.register_default() runs at the same entry points this task's own registration does, and this whole file runs for real -- the ordinary way, with the root conftest in play, no --noconftest, no shim, no skip:
All twelve pass (ten at the T016 merge, plus two more added during the Copilot remediation below: an end-to-end classify-through-the-default falsifier, and the same entry-point coverage for serve.build_server()). Every try: cli.build_parser() except domain_profile.ProfileNotRegistered: pass tolerance in this file is now genuinely dead code -- T016 landed, so build_parser() no longer raises at all -- kept only as a harmless compatibility fallback, and the two stale docstrings/comments that used to describe this as a live "SKIPS today" condition were corrected during the Copilot rounds below.
The remaining two cases (test_register_default_home_leaves_an_existing_registration_alone, test_register_default_home_registers_where_nothing_has) exercise corpus_adapter.register_default_home() directly, over stand-in factories, and always ran unconditionally -- no shim, no --noconftest, needed neither before this merge nor after.
(Historical note, preserved for the record: before this merge, the two importorskip-gated cases above skipped under both plain and --noconftest runs -- 8 passed, 2 skipped -- and were verified only under the Group 2 simulation shim, research.md's Appendix, giving 10 passed. That shim is no longer needed for anything in this PR and was never committed.)
Falsifier: F4.1's scan is unchanged
This task registers a default; it does not remove a deferred reach, and corpus_adapter/local_git_adapter name neither openxdox nor ideation_dashboard nor doc_health nor corpus_adapter_openxfactory. Re-run at the main-merged head (8a3625e) against main's OWN current tip (9d13bd16, carrying T021+T011+T012 -- T011/T030 and T012 each removed a hit of their own, which is why the absolute count dropped from the 23/24 seen in earlier rounds of this PR to 19 here): both main at 9d13bd16 and this merged head scan to exactly 19, identical hits by identity (same file, same imported name, same enclosing function) -- the only per-line differences are the expected line-number shifts in cli.py (610→618) and serve.py (640→647, 2055→2106) from this task's own registration call and _default_home_factory sitting above them. Zero new reaches, zero removed, confirmed by a normalized diff against a fresh worktree at main's exact merged-in commit.
Not re-run against the full scan tool after the T016 merge or the Copilot remediation rounds below, since neither touched an import statement: T016's own two files (domain_profile.py, cli.py/serve.py's registration lines) are unrelated to this scan's targets, and every file the Copilot rounds touched (local_git_adapter.py, tests_runtime/test_local_git_adapter.py, tests/test_authoring_seam.py) was grepped directly for the same four names at the final head -- the only hits are pre-existing prose in authoring.py's comments/docstrings (doc_health.corpus..., doc_health.lines..., and the corpus_adapter_openxfactory name inside a docstring describing what T021 REMOVED), none of them an actual import or attribute reach.
The repository's own checks, replayed locally
validate.yml's three pytest steps are unaffected (no slice edits validate.yml before T036; this task's new/changed tests are not in any of its file lists, except tests_runtime/test_local_git_adapter.py, which IS on the runtime, hermetic step's list) — replayed at each stage, file lists read directly from the workflow file each time:
(The pytest step's 746 → 767 climbs further than the earlier 745 → 746 because several more upstream PRs (T025/T026/T027 and others) merged into main between the earlier checkpoints and this final one, all touching files already on that step's list, none of them this task's own doing -- same reasoning as the earlier 745→746, just a larger number of intervening merges by this point. The runtime, hermetic step's 361 → 372 is fully this task's own: 11 new cases added across the Copilot remediation rounds below, all in tests_runtime/test_local_git_adapter.py.)
(The pytest step's 745 -> 746 is identical to what #44 itself measured post-merge -- not investigated to the single test name, but confirmed NOT this task's doing: this task's own new tests are all in tests/test_authoring_seam.py, which is not on this step's file list at all, and the same +1 appears on #44's branch, which carries none of T022's changes. tests_runtime's total floats by ±1 across repeated runs at the SAME commit -- a pre-existing, environment-timed flake unrelated to this change, recorded once and not re-investigated at every stage.)
*One genuine regression surfaced mid-way, caught before commit, not a flake:WorkingTreeCorpus's first cut of _read_bound's except OSError as failed: branch put str(failed) straight into a refusal, and tests_runtime/test_runtime_cli.py's anti-leak walk correctly flagged it (1 failed, 360 passed — see "The working-tree ruling" section above for the fix and the exact failure text). Fixed by routing the text through redact_credentials(str(failed)), matching this file's own established idiom; every 361 passed in the table above (including at this PR's very first, pre-ruling head, where the bug did not yet exist) is genuinely clean.
The whole tests/ directory (real conftest throughout at and after the main merge; the Group 2 shim only for the two earlier, pre-T011 stages):
The 20→18 failed and 66 unchanged errors match #44's own post-merge numbers exactly (both branches merged the same main). JUnit test-by-test diff (by classname::name, exact) between the pre-ruling and post-ruling shimmed heads: zero outcomes changed, one new passing test (the working-tree falsifier). The jump to 1432 passed at the merged head is main's own T010/T011/T012 tests joining the run for the first time (this PR touches none of them) plus this file's own count going from 6 (T021-only, on the old base) to 10 (all of T022's, all genuinely running now).
T016 merged in
Merged main (carrying T016, 19370adc) into this branch at ea83200. One real conflict, in cli.py/serve.py: both T016's domain_profile.register_default(default_profile) and this task's own corpus_adapter.register_default_home(_default_home_factory) wanted to be the literal first statement in build_parser()/main() and build_server()/main(). Resolved by keeping T016's call first (it has an immediate downstream read in the same function) and this task's second, with a comment explaining the order; also fixed a now-stale comment in serve.py left over from before the merge. A second conflict, in tests/test_authoring_seam.py (main's squashed T021 and this branch's pre-squash T021 ancestor carrying the same content by different commit objects, the identical class of conflict the earlier main merge hit), resolved the same way -- "theirs" contributed nothing, confirmed by an empty post-resolution diff.
Copilot's review, in full: eleven rounds, every finding fixed
Per the standing instruction to wait for Copilot's review AT THE HEAD before READY -- and to read the review body, not just trust a green check-run conclusion -- eleven successive rounds of Copilot review each found something real after the T016 merge, every one fixed and verified red-before/green-after before moving to the next. In finding order:
Temp-directory classification was broken by the T016 merge's own registration: once the default registered for real, authoring._classify_proposal() staged its input in a plain, non-git TemporaryDirectory, and WorkingTreeCorpus.resolve() requires a git repository -- every classification call started refusing CORPUS_UNCLASSIFIABLE. Fixed with a _stage_as_a_repository_if_git_is_available() step, gated by the registered adapter's own MODULE NAME (never isinstance, preserving _classify_proposal's "no privileged direct call" principle) so a host's non-git adapter is never affected.
Path-traversal and symlink-escape in _read_bound: a plain Path(corpus.location) / document.key open was vulnerable to an absolute-key override, .. traversal, and a symlinked intermediate component. Fixed with a new _open_confined() -- a component-by-component, O_NOFOLLOW-at-every-step, descriptor-relative open -- plus name-based rejection of absolute/../.git/NUL keys.
The listing could advertise what read() could not serve: gitlinks, untracked nested checkouts, and tracked-but-deleted files. Fixed with mode-based gitlink filtering, trailing-slash nested-repo filtering, and a per-candidate existence check through the same confined open.
A pinned CorpusRef.revision was silently ignored in favor of current disk bytes. Fixed by also checking corpus.ref.revision.
git init's ambient environment: GIT_TEMPLATE_DIR was missing from the shared environment sanitizer, so an ambient template directory could plant a repository-local info/exclude into a staged tree (demonstrated live: a hostile template really does get copied in unsanitized, and doesn't once filtered); a test helper (_init_ordinary_checkout) and this PR's OWN new test for the fix above BOTH separately built their git subprocess environment from a raw os.environ copy instead of the shared sanitizer, the identical hazard found and fixed three times in three different places across this remediation, plus once more in this file's own long-standing shared _GIT_ENV fixture (exposed, not introduced, by this task's first fixture to call git init on a fresh location).
A blocking read of a tracked FIFO could hang forever, taking list_documents()'s own existence check down with it. Fixed with O_NONBLOCK on the leaf open plus an S_ISREG check.
read() exposed files the corpus's own definition excludes: a directly-constructed DocumentId for a .gitignored secret (a .env, say) was served, because confinement-to-the-root is not the same guarantee as membership-in-the-corpus. Fixed with a new _tracked_or_not_ignored() check ("tracked always wins" over a later ignore rule; a git failure here is CORPUS_UNREADABLE, never a false "not tracked" -- the eleventh finding, on this fix's own first cut).
Stale historical documentation, twice: a module docstring and two individual test docstrings/comments still described --noconftest/skip behavior in the present tense after T011 and T016 had already landed on this branch, which would misreport current coverage to a future reader.
Missing runtime test coverage for WorkingTreeCorpus itself (a large new class with zero direct tests_runtime/ cases before this remediation) and for serve.build_server()'s own registration line (AST-lifted, mirroring test_profile_registration.py's established technique for the identical problem).
Every fix above was verified by first reproducing the exact failure against the pre-fix code (a manual repro script, a temporary revert via sed/direct text substitution, or a deliberately broken assertion), confirming it failed for the stated reason, fixing it, confirming green, and -- for anything touching a committed file -- confirming the revert-and-restore cycle left the file byte-identical to before. One mistake was caught and fixed within this same remediation, before it shipped: the first cut of finding 7's fix used :(literal)key pathspec magic, which GitRunner's own pre-existing --literal-pathspecs flag (predating this session) turns from protective into actively wrong -- measured directly, then fixed by passing the bare key.
Every threaded finding got a reply citing the exact fixing commit, then was resolved via GraphQL; two "previously missed" findings (9's WorkingTreeCorpus coverage gap, and one instance of 5's _GIT_ENV hazard) had no inline thread to reply to at all -- Copilot's overview lists them without a #discussion_r link -- so their reasoning lives only in the fixing commit's own message. Zero unresolved review threads remain as of the final head.
Status: READY
Final head 9283278. Working tree clean, T016/T011/T012 all landed and merged in, all three validate.yml steps green (767p/2s, 13p, 372p), tests/test_authoring_seam.py at 12 passed, the anti-leak scan and the home-vocabulary scan both green, zero unresolved Copilot review threads.
…d seam
`opendox.authoring._classify_proposal` read the publisher's factory by
NAME -- `from corpus_adapter_openxfactory import home_corpus` -- one of
#1144's F4.1 scan's 27 deferred reaches, and design.md § D6's more
dangerous class: it survives any import-based health check and fails
only when a caller reaches this far.
It now resolves the REGISTERED factory through `corpus_adapter.home()`
instead (4.1, T021), built on P1-C's T020 (openDox-code#37 ->
e295b1a), which added `register_home()`/`home()` to the seam. With
nothing registered, `home()` refuses `CorpusRefused(ADAPTER_NOT_REGISTERED)`,
naming the seam and the remedy (4.2, unchanged); with a factory
registered, `home()` returns it, unevaluated, for this function to call
with its own root: `adapter, ref = home()(root)`.
`tests/test_authoring_seam.py` gains
`test_required_header_fields_come_from_the_registered_adapter`
(T021's named falsifier), which registers two distinct stand-in
adapters in turn and requires `authoring.required_header_fields()`'s
answer to follow each one's own declared fields -- proving the answer
comes from the registry and not from a name, a cache, or a coincidence.
The named test runs with the root conftest in play, so it needs T011
(P1-A), which has not landed: `opendox.cli`/`opendox.serve` still raise
`ModuleNotFoundError: No module named 'ideation_dashboard'` in a lone
checkout, and the autouse `declared_human_console` fixture
(`tests/session_fixtures.py:397`) imports `opendox.cli`. This PR is
therefore a DRAFT, verified `--noconftest` for now (as T020/T026's own
seam tests were), and re-verified without `--noconftest` once T011 has
landed, before READY.
Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Where no host has called `corpus_adapter.register_home(...)`, openDox's
own entry points now register a `home_corpus`-shaped factory over its
own conformant `LocalGitCorpus` -- exactly as the default profile
stands in for an unregistered host (Group 3, T016). It starts at
`LocalGitCorpus()`'s bare defaults (`required_fields=()`); phase 2's
T054 sets the neutral fields R1Q13 decides. A bare process that builds
nothing still meets 4.2's `ADAPTER_NOT_REGISTERED` refusal (T020,
unchanged).
`corpus_adapter.py` gains `register_default_home(factory)`, mirroring
T016's own `domain_profile.register_default(profile)` (found in that
task's own draft PR, #42, while authoring this
one): it checks `home()` first and registers `factory` only on the one
refusal kind that means nothing is registered yet, so a host's own
registration, made before an entry point runs, is left alone.
`LocalGitCorpus`'s own factory is duplicated byte-identical in cli.py
and serve.py, since corpus_adapter.py cannot import local_git_adapter
without the cycle that module already has the other way.
Four call sites, mirroring T016's four: cli.build_parser(),
cli.main(), serve.build_server(), serve.main() -- the first statement
in build_parser()/build_server(), ahead of the (pre-T016) profile read
that can still refuse ProfileNotRegistered today.
tests/test_authoring_seam.py gains three cases: two exercise
register_default_home() directly (no cli/serve import needed), and the
named falsifier, test_an_entry_point_registers_the_local_git_corpus_when_no_host_has,
calls cli.build_parser() and requires corpus_adapter.home() to answer a
LocalGitCorpus. That one `pytest.importorskip`s opendox.cli: proving
"an entry point registers..." means calling the entry point, which
does not import until T011 lands. It skips today and runs for real
once T011 has landed; verified now under the Group 2 simulation shim
(research.md's Appendix, never committed), as T005/T006 measured
pre-T011 behaviour. The file's own docstring is corrected to say so,
in place of T020's earlier prediction that none of the three tasks'
tests would need opendox.serve/opendox.cli.
Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The PR implements T022's 4.1a default home-corpus behavior by adding a non-overwriting registration helper and invoking it from all CLI and server entry points with a LocalGitCorpus factory, while preserving the bare-process refusal semantics and adding seam and integration tests.
Sequence diagram for default home-corpus registration
sequenceDiagram
participant Host
participant EntryPoint
participant corpus_adapter
participant LocalGitCorpus
Host->>EntryPoint: build_parser() or build_server()
EntryPoint->>corpus_adapter: register_default_home(_default_home_factory)
corpus_adapter->>corpus_adapter: home()
alt home corpus already registered
corpus_adapter-->>EntryPoint: preserve existing factory
else ADAPTER_NOT_REGISTERED
corpus_adapter->>corpus_adapter: register_home(_default_home_factory)
corpus_adapter-->>EntryPoint: default registered
end
EntryPoint->>corpus_adapter: home()
corpus_adapter->>LocalGitCorpus: _default_home_factory(root)
LocalGitCorpus-->>corpus_adapter: LocalGitCorpus and CorpusRef
Loading
File-Level Changes
Change
Details
Files
Add an entry-point-owned default home-corpus registration seam that preserves host registrations and continues refusing when no entry point has run.
Add register_default_home() to probe home() and register only on ADAPTER_NOT_REGISTERED, re-raising other refusals.
Register a LocalGitCorpus-backed factory at the start of CLI and server builders and outer entry points.
Keep the default factory duplicated in CLI and server modules to avoid an import cycle.
Add focused coverage for default registration behavior and entry-point wiring while accommodating the pre-T011 CLI import dependency.
Verify existing host registrations survive and missing registrations receive the supplied factory.
Exercise CLI registration and assert the resulting adapter is LocalGitCorpus with the supplied root reference.
Use pytest.importorskip for the CLI-backed test until T011 removes the ideation_dashboard import blocker, with shim-backed validation documented.
tests/test_authoring_seam.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!
Registers LocalGitCorpus as the default home adapter for CLI and server entry points while preserving host registrations.
Changes:
Adds guarded default home-corpus registration.
Wires the default factory into CLI and server entry points.
Adds registration and entry-point tests.
File
Summary
tests/test_authoring_seam.py
Tests registration and CLI provisioning; two moderate findings concern masked import failures and fixture-time skipping.
src/opendox/serve.py
Adds server registration; critical staged-proposal incompatibility, missing server coverage, and a stale helper reference were identified.
src/opendox/corpus_adapter.py
Adds guarded default registration logic.
src/opendox/cli.py
Adds CLI registration; critical staged-proposal incompatibility and two nits concerning a stale reference and duplicated factory logic were identified.
Brett, 2026-09-27, via the holder: working tree. The standalone default
reads the WORKING TREE, uncommitted edits included, not the session
branch's HEAD -- standalone users edit files in their own editor, and
the hosted openxFactory adapter already shows worktree bytes.
Add WorkingTreeCorpus(LocalGitCorpus) in local_git_adapter.py, overriding
only _list_documents_bound (git ls-files --cached --others
--exclude-standard) and _read_bound (Path.read_bytes(), falling back to
the parent's commit-based read when an explicit revision is named).
resolve/classify/check/write_back are inherited unchanged. Refuses
CORPUS_UNREADABLE when the repository is bare (the product's own
repository-creation act makes bare repos, by RULING C3 -- there is no
working tree for this adapter to read in that case).
_default_home_factory in cli.py and serve.py now builds a fresh
WorkingTreeCorpus() per call (no listing cache keyed on HEAD), with a
docstring citing the ruling.
tests/test_authoring_seam.py: the entry-point test now asserts
WorkingTreeCorpus specifically; added
test_an_uncommitted_edit_is_visible_through_the_default, proving an
uncommitted edit and a brand-new untracked file are both visible
through the default corpus without a commit.
Also fixes an unredacted-exception-text finding
(tests_runtime/test_runtime_cli.py's anti-leak walk) that this class
introduced: _read_bound's `except OSError` handler now runs the
caught text through redact_credentials(str(failed)) before handing it
to _refuse, matching this file's own established idiom for the same
concern (redact_credentials(str(exc)) in GitRunner's OS-error path) --
an OS error reading a working-tree file can carry the full path in its
text.
Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…nded)
#44 (T021) squash-landed as 9d13bd1, bringing T011 (#46) and T012 (#47)
in with it (already merged into #44's own branch earlier this session,
now folded in via main's squash instead). T022's own diff (cli.py,
serve.py, corpus_adapter.py, local_git_adapter.py,
tests/test_authoring_seam.py) is layered on top of what main now has.
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
# Conflicts:
# tests/test_authoring_seam.py
T016 (#42 -> 19370ad) landed: cli.build_parser()/cli.main()/
serve.build_server()/serve.main() each now open with
domain_profile.register_default(default_profile). This branch's own
corpus_adapter.register_default_home(_default_home_factory) call sat at
the same 'first statement' position in the same four functions, so this
merge resolves that positional conflict by keeping T016's already-landed
call first (it has an immediate downstream read in the same function
body -- the SUBCOMMAND_EXTENSIONS/ROUTE_EXTENSIONS reads a few lines
below) and this task's own call second, immediately after. R1Q3 (a)
(openxFactory#656 comment 5817152735) names both as independent
entry-point registrations with no specified order between them.
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
# Conflicts:
# src/opendox/cli.py
# src/opendox/serve.py
Nine open findings from the review at head ea83200, three of them high
severity. Each addressed on its merits, not just its severity, since
several are genuinely correctness/security bugs and not merely style:
1. HIGH: the registered default was unusable by the one path that
consumes it. authoring._classify_proposal() stages a create/edit
proposal in a plain tempfile.TemporaryDirectory(), never a git
repository, but WorkingTreeCorpus/LocalGitCorpus.resolve() requires
the location to already be one -- so required_header_fields()/
missing_required_headers() always refused CORPUS_UNCLASSIFIABLE once
this default is registered. Fixed with a new, best-effort
_stage_as_a_repository_if_git_is_available() in authoring.py: `git
init` only, never a commit, swallowed entirely if git is unavailable
(no new hard dependency for a host whose own adapter never reads git
plumbing -- git never lists its own .git/ among tracked/untracked
files either way). Confirmed end to end through the real registration
seam, not a stand-in.
2. HIGH: _read_bound's filesystem read was not confined to the corpus.
An absolute DocumentId.key discards the corpus root under
Path.__truediv__ entirely, a `..` component walks back out of it, and
a tracked symlink could point anywhere -- unlike LocalGitCorpus's
`cat-file blob <rev>:<key>`, safe by construction inside git's tree
object model. Fixed: reject an absolute or `..`-carrying key by name
before ever touching the filesystem, and open the remaining key
O_NOFOLLOW, relative to the SAME already-verified no-follow directory
descriptor `_bound` secured for the whole operation (`git.inherit_fd`)
-- never a second, by-name `Path(corpus.location) / key` that a
concurrent replacement could redirect.
3. HIGH: the listing could advertise what the read then refused.
`git ls-files --cached` still reports a path after an unstaged
deletion; `--cached`/`--others` both include a gitlink's path with no
mode filtering (unlike the parent's `ls-tree`, which excludes mode
160000); an untracked nested checkout was listed as its own bare
directory path. Fixed: `-s` (stage format) on the cached half to
filter gitlinks by mode, a trailing-`/` check to exclude an untracked
nested repository, and an existence check (dir_fd-relative lstat) to
drop a tracked-but-deleted path -- every remaining listed key is one
`read()` can actually serve.
4. MEDIUM: a pinned CorpusRef.revision was silently replaced by current
disk bytes. Both _list_documents_bound and _read_bound now check
`corpus.ref.revision` (the CALLER'S pin, set at resolve() time) in
addition to any per-call revision argument, and delegate to the
parent's commit-based (traversal-safe) implementation whenever either
is set -- an ordinary, unpinned resolve (ref.revision is None) still
reads the working tree even once resolved.revision itself holds a
real HEAD sha, which is the distinction that makes this fix compatible
with the ruling rather than defeating it.
5. MEDIUM: pytest.importorskip caught ANY ModuleNotFoundError raised
while importing opendox.cli, not only the known pre-T011
ideation_dashboard one -- so an unrelated broken import discovered
after T011 landed would SKIP instead of FAILING, masking the very
regression the falsifier exists to catch. Replaced with a shared
_import_opendox_cli_or_skip() that re-raises anything whose
exc.name != "ideation_dashboard".
6. MEDIUM: serve.build_server()'s own registration had no coverage --
the named falsifier exercises only cli.build_parser(). Added
test_build_server_registers_the_default_where_no_host_has, AST-lifting
_default_home_factory and the one registration statement out of
build_server() (which still cannot be called whole, pending later,
unrelated openxdox reaches), mirroring test_profile_registration.py's
own technique for the identical problem. Red-checked: removing the
registration line fails this test with a precise message.
7/8. LOW (x2): two comments in cli.py/serve.py named a helper,
`_register_default_home_if_unregistered`, that no longer exists after
the refactor onto `corpus_adapter.register_default_home` --
corrected to name the actual functions.
Verified: py_compile clean on all five files; whole test_authoring_seam.py
11 passed (was 10; the new build_server test, red-checked separately);
validate.yml's three steps unchanged (767+2 / 13 / 361); whole tests/
directory 18 failed/1454 passed/13 skipped/66 errors (was 1453 passed,
+1 exactly); F4.1 scan unchanged at 19. A comprehensive ad-hoc script
covering deleted-file exclusion, gitlink exclusion, untracked-nested-repo
exclusion, absolute-path refusal, `..`-refusal, symlink-escape refusal
(ELOOP, not followed), and pinned-revision read/listing all passed.
Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Four more findings at head 5348fd7, refining round one's fixes rather
than replacing them:
1. HIGH: the first cut's git-init ran unconditionally, even when a HOST
supplied a non-git adapter -- adding a .git/ tree to that host's
temporary corpus, which its own (possibly non-git) filesystem walk had
no obligation to ignore. Fixed by asking the seam for the adapter
FIRST, then preparing a repository only when its type's own module is
opendox.runtime.local_git_adapter -- a module-name comparison, never
an isinstance import of a concrete adapter class, keeping
_classify_proposal's "no privileged direct call" rule intact.
Confirmed empirically both ways: the real default gets a .git/, a
non-git stand-in does not.
2. HIGH: O_NOFOLLOW on a single os.open(key, ..., dir_fd=root) protects
only the FINAL path component -- a symlinked INTERMEDIATE one
(`nested` in `nested/file.md`) was still followed by ordinary kernel
path resolution. Added _open_confined(), walking every component with
O_NOFOLLOW from the already-verified root descriptor (the same
technique open_no_follow_chain uses for a directory, adapted to end
in a file open; not reused directly, since that helper always starts
from the filesystem root by pathname). Used by both _read_bound and
the listing's existence check. Confirmed: replacing a tracked
directory component with a symlink now refuses on read and is
excluded from listing, not followed.
Fixing this surfaced a second bug in the listing's existence check:
it treated any OSError beyond FileNotFoundError as a corpus-wide
refusal, so the intermediate-symlink case above crashed the whole
listing instead of excluding its one entry. Narrowed to catch OSError
broadly and exclude just that candidate -- every error a per-candidate
confined open can raise is a fact about that one path, never about
the corpus, since the root is already verified by the time this runs.
3. MEDIUM: an untracked pathname containing a literal tab was
misparsed -- the tab-presence check meant to distinguish a cached
entry's `<mode> <object> <stage>\t<path>` from a bare untracked path
instead truncated the untracked one's own key at its embedded tab.
Replaced the single combined `--cached --others` command with two
separate ones (`-s --cached`, then `--others --exclude-standard`),
removing the ambiguity outright rather than trying to out-guess it.
Verified: py_compile clean; test_authoring_seam.py 11 passed (unchanged);
validate.yml's three steps unchanged (767+2 / 13 / 361); whole tests/
directory 18 failed/1454 passed/13 skipped/66 errors (unchanged -- no
new tests this round, refinements to existing code only); F4.1 scan
unchanged at 19. Ad-hoc scripts covering: git-init runs for the real
default, not for a non-git stand-in; a multi-component read still works;
an intermediate-symlink substitution refuses on read and is excluded
(not crashing) the listing; a tab-containing untracked filename lists
and reads correctly.
Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Three more findings at head 9e6fd14:
1. HIGH: the conditional git-init's `subprocess.run` inherited the
process's own GIT_DIR/GIT_WORK_TREE (and relatives) -- a caller
started with one set (a unit file, a git hook) would have initialized
or mutated THAT ambient repository instead of the throwaway staging
tree, silently, then had the later sanitized resolve() refuse the
tree it never touched. Fixed by running it through
local_git_adapter.sanitized_git_environment() -- the same stripped
base every GitRunner call already uses -- with GIT_CONFIG_GLOBAL/
GIT_CONFIG_SYSTEM still forced to /dev/null on top (this call, unlike
a GitRunner's, never leaves the throwaway tree or touches a remote,
so it has no legitimate use for an operator's own git config).
That function was private (a leading underscore); made public,
mirroring GitRunner's own "public because a second caller reaches in"
precedent, now that opendox.authoring genuinely is one. Its two other
pre-existing call sites, both in conformance_corpus.py, needed the
same rename (a "second caller" this file already had, discovered only
by the rename breaking its import at collection time -- validate.yml's
first pytest step collects that file).
2. MEDIUM: _open_confined's os.open(..., O_RDONLY) blocks indefinitely
on a tracked FIFO until a writer opens the other end -- git accepts a
FIFO/socket/device into the index like any other blob, and the block
would have taken list_documents()'s own existence-check loop down
with it, not only a direct read(). Fixed: the leaf open adds
O_NONBLOCK (a no-op for a regular file; POSIX-defined as an immediate
return instead of a block for a FIFO), and the descriptor's mode is
checked (stat.S_ISREG) before ever handing it back -- a directory OR
any other special file is refused the same way, under the same
IsADirectoryError signal both callers already translate.
Simplified _read_bound's handler for this signal to build its own
literal refusal text rather than str()-ing the caught exception:
IsADirectoryError is a built-in, so the anti-leak walk
(tests_runtime/test_runtime_cli.py) scrutinizes any handler that
catches it and formats its text, even though every byte of the
message is this file's own -- the walk cannot know that, and the
established idiom is a fresh message, not a caught one.
Also fixed two collateral breaks the above surfaced, both confirmed by
actually running the suite rather than assumed clean:
- The redactor/anti-leak check (tests_runtime) initially reported RED
for the reason above -- confirmed red, then green after the fix.
- The home-vocabulary check (tests_runtime/test_local_git_adapter.py)
initially reported RED: a docstring I wrote named
authoring._classify_proposal by function name, and "proposal" is
banned governance vocabulary in this adapter's own source text
(RULING C2, "a clinician... must never meet an engineering noun that
arrived by way of the reader"). Reworded to describe the caller
without naming it.
Verified: py_compile clean on all four files; test_authoring_seam.py 11
passed (unchanged); validate.yml's three steps unchanged (767+2 / 13 /
361, INCLUDING test_conformance_corpus.py, which failed to even COLLECT
until the second sanitized_git_environment call site was renamed -- a
real regression this round introduced and then fixed, not merely a risk
avoided); whole tests/ directory 18 failed/1454 passed/13 skipped/66
errors (unchanged); F4.1 scan unchanged at 19. A consolidated 12-point
ad-hoc script re-verifies every fix from all three review rounds
together end to end: baseline listing, uncommitted-edit visibility,
deleted-file exclusion, gitlink exclusion, untracked-nested-repo
exclusion, absolute/`..` refusal, direct and intermediate symlink-escape
refusal (the latter excluded from listing, not crashing it), pinned-
revision read/listing, a tab-containing untracked filename, and a
tracked FIFO under a 5-second SIGALRM watchdog (no hang). Plus two more,
specific to this round: git-init runs and succeeds under an ambient
GIT_DIR/GIT_WORK_TREE without touching that ambient repository, and does
not run at all for a non-git stand-in adapter.
Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
Copilot review overview
🟡 Changes recommended
Unresolved critical and moderate findings remain in WorkingTreeCorpus, including .git exposure, per-document error handling, and missing focused coverage.
Add runtime coverage for WorkingTreeCorpus security branches
src/opendox/runtime/local_git_adapter.py:2884
This adds a substantial public adapter path with security- and semantics-sensitive branches (bare repositories, pinned revisions, absolute/parent-traversal keys, symlinked components, deleted files, and special files), but the runtime test diff only updates a docstring and the new authoring test covers one ordinary tracked file plus one untracked file. Because callers can instantiate WorkingTreeCorpus independently of the default factory, these branches can regress while the named test remains green; add focused cases to tests_runtime/test_local_git_adapter.py for the refusal and pinned-revision paths.
Reject NUL-containing document keys as unknown documents
src/opendox/runtime/local_git_adapter.py:3062
DocumentId.key is caller-controlled, but this validation does not reject embedded NULs. PurePosixPath preserves the NUL and _open_confined() then calls os.open, which raises ValueError("embedded null byte"); that escapes the corpus adapter instead of producing the promised CorpusRefused for an unknown document (the existing adapter tests cover this input for writes). Reject NULs here alongside absolute and .. keys, or translate that ValueError to DOCUMENT_UNKNOWN.
claims
One low-severity finding, threaded this time ("Update stale test
docstring about skip behavior", on
test_an_entry_point_registers_the_local_git_corpus_when_no_host_has's
own docstring, which still said "This case SKIPS today... runs for
real once T011 has landed" after the module docstring above it was
already corrected last commit). Fixed the same way: past tense, the
skip guard named as a retained compatibility fallback rather than an
expected-to-fire condition.
Grepped the whole file afterward for the same pattern rather than
waiting for a tenth round to find the next one: found one more, in a
plain code comment (not a docstring) a few lines below the one
Copilot flagged -- "the still-unregistered, pre-T016 host profile...
refuses ProfileNotRegistered today... once T016 lands, build_parser()
will not raise at all, so this except clause becomes dead code". T016
landed on this branch several commits ago (the merge at ea83200), so
this is the identical staleness, one task earlier, in the same
function. Fixed it the same way. The other two try/except
ProfileNotRegistered blocks in this file (lines ~493 and ~553) carry
no attached comment and needed no change.
Documentation only -- no code or test logic changed. 12 passed,
unchanged.
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Arc: neutral-product-standalone-operability
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
corpus excludes
One high-severity finding: "read() exposes ignored files omitted from
the corpus". _read_bound confined a key to the corpus ROOT (absolute,
.., .git, NUL all refused), but never checked that the corpus's own
DEFINITION -- tracked files, plus untracked-but-not-ignored ones,
this class's own docstring -- actually includes it. A caller building
a DocumentId directly, unmediated by list_documents() (which already
excludes a .gitignore'd path), was served it anyway: a working
directory's own .env or other gitignored secret was one direct call
away from being read through the registered default.
Fixed with a new _tracked_or_not_ignored() helper: a single-pathspec
git ls-files --cached --others --exclude-standard query, run before
_open_confined ever touches the filesystem. Tracked always wins (a
file added before a later .gitignore rule that would now match it
stays fully readable -- ignore rules only ever narrow the untracked
half of the corpus's own definition); anything neither tracked nor
let through as untracked is refused DOCUMENT_UNKNOWN.
One real mistake caught before it shipped: the first cut passed the
key through `:(literal)key` pathspec magic, reasoning it would protect
a filename containing a wildcard character the same way the NUL/../.git
checks protect against other kinds of caller-supplied strings.
GitRunner already puts --literal-pathspecs ahead of every argument it
runs (that class's own docstring, predating this session) specifically
to make a caller-supplied key a literal path always -- so the
`:(literal)` prefix was not redundant, it was actively wrong: with
pathspec magic globally disabled, `:(literal)` became part of the
literal filename git looked for instead of the magic it was meant to
invoke, and the query matched nothing at all, including a genuinely
tracked file. Measured (a `git ls-files --cached` smoke test against a
real repo returned empty for a tracked path once `:(literal)` was
added, non-empty without it) and fixed by passing the bare key,
letting GitRunner's own existing global flag do the literal-matching
work it already does for every other call.
A second thing this surfaced empirically, corrected in the test suite
rather than the product: `git ls-files --others --exclude-standard`
does not list an untracked FIFO at all (measured directly against git
2.43.0) -- an earlier round's test docstring had assumed it did. Split
the one special-file case into two: an untracked special file is now
excluded by the new, earlier, more general check (same path a
gitignored file takes); a TRACKED path later replaced on disk by a
special file still reaches _open_confined's own O_NONBLOCK + S_ISREG
detection and its more specific "special file" message, which the new
companion test proves is still reachable.
Three new WorkingTreeCorpus cases (tracked-always-wins,
gitignored-file-refused, tracked-then-special-file), one existing
case's assertion and docstring corrected to match measured git
behavior. Full regression: tests_runtime/test_local_git_adapter.py 145
-> 148 passed; tests/test_authoring_seam.py 12 passed unchanged;
validate.yml's three required steps replayed clean (767p/2s, 13p,
371p -- runtime step +3 for the new cases here). Red-checked: reverting
the new confinement check reproduces the exact exposure the finding
described; restored byte-identical.
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Arc: neutral-product-standalone-operability
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
CORPUS_UNREADABLE, never DOCUMENT_UNKNOWN
One medium-severity finding on last commit's own new helper: "Propagate
Git failures instead of reporting missing documents".
_tracked_or_not_ignored() caught GitCommandFailed and returned False,
so a repository or git itself going unavailable AFTER _bound()'s own
root probe surfaced as the misleading DOCUMENT_UNKNOWN ("not tracked")
instead of CORPUS_UNREADABLE -- hiding a corpus-wide failure as a
missing document.
Fixed by raising _refuse(CORPUS_UNREADABLE, ...) directly (the helper
now takes corpus as a parameter to name it), matching
_list_documents_bound's own two ls-files calls exactly -- same
exception, same plain str(failed) with no additional redaction, since
GitCommandFailed is this package's own exception type and the
anti-leak walk does not scrutinize it.
New test: monkeypatches GitRunner.out to fail ONLY the specific
ls-files query this helper runs (leaving _refuse_if_bare's own earlier
rev-parse probe working normally), and asserts the read refuses
CORPUS_UNREADABLE, not DOCUMENT_UNKNOWN. Red-checked: reverting to the
old catch-and-return-False behavior reproduces the exact
misclassification the finding described; restored byte-identical.
tests_runtime/test_local_git_adapter.py: 148 -> 149 passed.
tests/test_authoring_seam.py: 12 passed, unchanged. Anti-leak scan:
84 passed, unchanged.
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Arc: neutral-product-standalone-operability
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
T016 (#42 -> 19370adc), T011 (#46 -> 0e88454a) and T012 (#47 -> 2768302) are all landed and merged into this branch (T016 merge: ea83200). Retargeted to main earlier; base is main.
Since the T016 merge, Copilot's review ran to completion across eleven rounds at this head and its predecessors -- every finding fixed, verified red-before/green-after, and the code restored byte-identical after every red-check. Several were genuine security/correctness bugs (path traversal via a symlinked intermediate component, a blocking FIFO read, a .gitignored file readable via a direct DocumentId, git init's ambient GIT_TEMPLATE_DIR), not nitpicks. Full account in the PR body under "Copilot's review, in full."
Final verification at 9283278:
Working tree clean, all commits pushed, no force-push used anywhere in this branch's history.
T022 was the last task T032 comes after. This takes main at 255514d, so
the sweep and F4.1's scan run over the tree where every phase-1 lane has
joined.
Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
T022 has landed, so this takes main at 255514d and re-verifies the nine
files, the triple and the whole suite over it. T034 stays after T032
(#49), and takes main again once T032 lands.
Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…48)
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
## What this is
Plan 034's task **T038**, slice **P1-H, the console script**
(`specs/034-opendox-standalone-operation/tasks.md` § "Phase 1 writer
slices", read at openxFactory `main` `bca4a2600299535271761ac24d8adf492a8875fe`;
unchanged since #1167's head `42f34ab7`, which landed as `a65230f6`, and
re-checked against #1176's round-2 re-plan diff, which touches no T038 line).
This PR realizes box **10.1** of the ratified `add-neutral-product-standalone-operability`.
- **Ruled:** R1Q4 (a), R1Q5 (a), R1Q22 (a) — openxFactory#656 comment
`5817152735`.
- **Claim:** openxFactory#656 comment `5852235792`.
- **After:** T016 (#42), T022 (#45) — `cli.py`'s single-writer order. Opened
as a DRAFT on Brett's "draft ahead of dependencies," while both were still
open. **T016 has since landed** (`19370ad`); `main` merged in at `41dfb75`
and the falsifier re-verified for real (below). **T022 (#45) is still
OPEN**, so this PR stays draft until it lands too.
## What changes
- **`pyproject.toml`**: adds `opendox = "opendox.cli:main"` under
`[project.scripts]`, alongside the existing `opendox-runtime =
"opendox.runtime.cli:main"`. This is the one documented entry point
requirement 10 asks for: `opendox.cli:main` already builds and dispatches
the whole command tree (`generate`, `generate-and-open` — which serves the
browser surface — `create`, `edit`, `model-binding`, plus whatever a host
or the default profile contributes), where `opendox-runtime` only ever
started the lifecycle subsystem.
- **`src/opendox/runtime/cli.py`**: corrects two stale comments (R1Q22 (a);
plan 034 T011), each to the past tense:
- the "two measured reasons" bullet, which said a line added to
`src/opendox/cli.py` needed a declared-edit act at openxFactory first
(retired by R1Q22 (a)) and that `opendox.cli` could not be imported at
all (fixed by T011, which removed the `ideation_dashboard` reach);
- the "AND THAT IS THE RULED SHAPE" paragraph, which described Q-R4's
answer in the future tense and named a mechanism ("wired into
`opendox.cli` in the BUILD-arc act that repairs `opendox.serve`") that
is not quite how it turned out. It now names where the verbs actually
reach `opendox`: through the default profile (T015/T016), not by
editing `cli.py`.
- **`src/opendox/cli.py`** (added at the holder's word, see below): corrects
its own matching stale comment and the `build_parser()` docstring
(R1Q22 (a)), comment-only.
**`src/opendox/cli.py`: two comments, added after a holder ruling.** The
first authoring pass made no edit here — I'd read PR #42 (T016) and #45
(T022)'s diffs against `cli.py` beforehand, and neither touches the stale
composition-point comment at `cli.py`:92-111 or the `build_parser()`
docstring, and `src/opendox/default_profile.py`'s own header (T015, already
on `main`) states this task's job as the console-script addition alone. I
flagged the ambiguity in this PR rather than guess. The holder ruled: fold
it in, comment-only, since R1Q22 (a) covers `cli.py` the same way it covers
`runtime/cli.py`, and T038 is phase 1's last task in `cli.py`'s
single-writer order (`After: T016, T022`; nothing later in phase 1 touches
this file). `f9dfc2a` does that:
- the note above the `profile_openxfactory` import said the `build_parser()`
docstring "is NOT corrected here … until an act that declares them lands"
(RULED OQ-1); it now says R1Q22 (a) retired that gate and names T038 as
the act that makes the correction;
- `build_parser()`'s own docstring said the composition point is "the one
line the § 3 carve deletes rather than moves: afterwards the core names
no profile and openXdox declares its own" — superseded by ratified
requirement 3, which has the core carry its OWN default profile
permanently (T015/T016), not become profile-less. It now says whichever
profile is current gets composed (a host's, or openDox's own default),
and names the default's `RuntimeSubcommand` as how `opendox` reaches the
runtime verbs with no separate wiring in this file.
No behavior change: `build_parser()` already read
`profile_openxfactory.SUBCOMMAND_EXTENSIONS` unconditionally before this
commit, and still does. Re-verified after `f9dfc2a` in a fresh venv:
`opendox --help`, `opendox runtime --help` and `opendox-runtime --help` all
exit 0; `tests/test_consumer_reach.py`, `test_route_handler_contribution.py`
and `test_profile_registration.py` (173 tests) unaffected.
## The falsifier (F10.1's first assertion, and `opendox runtime --help`)
Run in a fresh venv, `pip install .` (no extra, matching F10.1's method):
```
$ opendox-runtime --help
usage: opendox-runtime [-h] {runtime,project} ...
exit=0
```
`opendox --help` and `opendox runtime --help` do **not** exit 0 yet, and
this is expected, not a defect in this PR: `build_parser()` reads
`profile_openxfactory.SUBCOMMAND_EXTENSIONS` unconditionally, and until
P1-B's T016 lands, nothing registers a default profile, so the lazy proxy
raises:
```
opendox.domain_profile.ProfileNotRegistered: no host profile is registered,
so openDox has no contributed subcommands and no contributed routes to
compose from. ...
```
identically for both invocations (both go through `opendox.cli.main` →
`build_parser()`). `opendox-runtime --help` above is unaffected: it never
reaches `opendox.cli`.
`pyproject.toml` parses (`tomllib.load`); `src/opendox/runtime/cli.py`
compiles and `tests_runtime/test_runtime_cli.py` (83 passed, 1 skipped, no
change from the pre-existing skip) is unaffected by the docstring-only edit.
## Landing
- **READY at `ceab6489`.** Both #42 (T016) and #45 (T022) have landed;
`main` merged in twice (once per dependency), auto-merging cleanly both
times. Re-ran `opendox --help`, `opendox runtime --help` and
`opendox-runtime --help` for real in a fresh venv (editable install,
matching CI's `pip install -e ".[test]"`): all three exit 0.
Copilot's review at the merge head (`2c75ce0`) found three findings (two
medium, one low); two are fixed (an entry-point metadata test, and the
one remaining internally-contradictory paragraph in `runtime/cli.py`) and
the third (the standalone `--help`'s hard-coded `prog="ideation-dashboard"`)
is answered with evidence rather than fixed, since `prog` is unconditional
and changing it would also change the HOSTED case's byte-identical
`--help` text that `build_parser()`'s own docstring says a golden
snapshot asserts — raised as a follow-up, not silently dropped. Copilot's
next review, at this exact head, reports 0 new findings and all three
resolved. All three checks (`validate`, `runtime`, `SonarCloud Code
Analysis`) SUCCESS.
- `cli.py` has one writer at a time; this PR is last in that chain for
phase 1 (`After: T016, T022`).
- 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.
Arc: neutral-product-standalone-operability
🤖 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>
…into openxFactory at all (#49)
Plan 034, task **T032**, slice P1-F (the sweep and the nine-file repair). The plan is `specs/034-opendox-standalone-operation/tasks.md` at opensoft/openxFactory `main` `468863d1`, where round 2 (#1176) has landed. The T032 through T035 entries there are byte-identical to `0d48231b`'s, which this record was first written against. This PR realizes box **2.3** of the ratified `add-neutral-product-standalone-operability`.
- **Ruled:** R1Q22 (a), openxFactory#656 comment `5817152735`.
- **Claim:** openxFactory#656 comment `5852380744`.
- **After:** T011, T012, T016, T021, T022, T025–T027 ("every lane joins here"). **All have landed.** T022 landed last, as #45 → `255514df`, merged in at `5270acf0`. T038 then landed as #48 → `796838e8`, and `main` at `796838e8` is merged in (`dc8fa87a`, no force-push). Everything below was re-run at this head, `b53b9db2`.
## The sweep (2.3)
The four names in import position under `src/`: import statements, and `importlib.import_module(...)` or `__import__(...)` with a literal name. Every hit is classified by when it runs. It was run at the arc's base, openDox-code `1e4a57fb` (ARC_BASE, `evidence/arc-base.md`), and at `main` `796838e8`. That is where the last lane (T022) joined, plus T038's console script. This PR changes nothing under `src/`, so this head gives the same result.
| | at `1e4a57fb` | at `796838e8` |
|---|---|---|
| import-time reaches | 2 (`ideation_dashboard`) | **0** |
| deferred reaches into openxFactory | 8 | **0** |
| deferred reaches into `openxdox` | 19 | **19** |
**Closed: every reach into openxFactory, and every import-time reach.**
| reach at `1e4a57fb` | target | closed by | landed |
|---|---|---|---|
| `serve.py:199`, `:206` (import time) | `ideation_dashboard.serve_openxfactory_lanes` | T011 (2.1), the handler-contribution facet | #46 → `0e88454a` |
| `serve.py:713`, `_head_of` | `doc_health.corpus` (`RealGit`) | T012, openDox's own HEAD reader | #47 → `27683028` |
| `authoring.py:318`, `_classify_proposal` | `corpus_adapter_openxfactory` | T021, `corpus_adapter.home()` | #44 → `9d13bd16` |
| `workbench.py:746`, `session_documents` | `doc_health.corpus` | T025, the registered adapter's `list_documents` | #43 → `c46430fb` |
| `workbench.py:1407`, `:1408`, `:1409`, `run_scoped_doc_health` | `doc_health`, `.families`, `.runner` | T026, the health-check seam | #39 → `582ed073` |
| `serve_wire.py:1369`, `default_doxbench_validators` | `ideation_dashboard.doxbench_contracts` | T027, the doxBench validator seam | #41 → `8017cd52` |
| `doxbench_packet.py:177`, `_status_exemption` | `ideation_dashboard.doxbench_status_exemption` | T027, the status-exemption seam | #41 → `8017cd52` |
**Deferred: 19 reaches, all into `openxdox`, each inside a function body.** Each is routed no later than the phase whose surface calls it (research R5, the release map). openXdox-code's `OPENDOX_BACK_IMPORTS` ratchet counts them by module: `branch_session` 7, `serve_workbench` 7, `serve` 2, `serve_project` 2, `cli` 1.
| reach at `796838e8` | target | inside | reason it stays, and who routes it |
|---|---|---|---|
| `branch_session.py:1568` | `openxdox.generator` | `_change_rows` | the snapshot generator is openXdox's column; phase 2, T055 (5.4/5.5) |
| `branch_session.py:1587` | `openxdox.register` | `_active_pick_fallbacks` | the cross-reference register; phase 3, T084 |
| `branch_session.py:2005` | `openxdox.kickoff` | `proposal_state_for` | the kickoff column; phase 3, T084 |
| `branch_session.py:2105`, `:2151`, `:2228`, `:3573` | `openxdox.snapshot_registry` | `session_entry`, `register_session_entry`, `refresh_session_snapshot`, `refresh_main_view` | the snapshot registry; phase 2, T055 |
| `cli.py:628` | `openxdox.snapshot_registry` | `_session_registry` | the snapshot registry; phase 2, T055 |
| `serve.py:648` | `openxdox.corpus_root` | `_checkout_real`, called by every `build_server` | the corpus-root predicate; phase 2, T055 (research R7) |
| `serve.py:2118` | `openxdox.corpus_root` | `_refuse_impossible_checkout_root`, called by `serve.main()` | the corpus-root predicate; phase 2, T055 |
| `serve_project.py:246`, `:247` | `openxdox.gate_console`, `openxdox.kickoff` | `_serve_project_register` | the gate console and kickoff; phase 3, T084 |
| `serve_workbench.py:347`, `:544`, `:1665`, `:2607` | `openxdox.doxbench_scope` | `_is_live_session_ref`, `_handle_workbench_thread`, `_handle_workbench_chat_turn`, `_handle_workbench_document_abstract` | doxBench scope; phase 3, T084 |
| `serve_workbench.py:407`, `:408` | `openxdox.gate_console`, `openxdox.gate_routes` | `_thread_gate` | the gate column; phase 3, T084 |
| `serve_workbench.py:1215` | `openxdox.gate_console` | `_handle_workbench_model_approval` | the gate column; phase 3, T084 |
The line numbers moved since research R5 (`cli.py:610` → `:628`, `serve.py:629` → `:648`, `serve.py:1993` → `:2118`), with the code that phase 1, T022 and T038 added. The reaches and their functions did not.
**The late seam, which the scan cannot read.** `consumer_reach.py` holds seven `module(...)` stand-ins (`gate_console`, `snapshot`, `snapshot_registry`, `corpus_root`, `generator`, `serve_projection`, `serve_gate`). Each resolves `openxdox.<name>` at first use. `module()` refuses a prefixed name, so no stand-in can name another package. Research R6's census is unchanged: 65 use sites, in `serve.py` 22, `branch_session.py` 20, `cli.py` 18, `serve_workbench.py` 4 and `workbench.py` 1. They are deferred too, into `openxdox` alone, and T084 retires the module.
**Prose, not import position.** `git grep -w` finds each name in `src/` beyond these: `ideation_dashboard` on 44 lines, `doc_health` on 25, `corpus_adapter_openxfactory` on 2, and the rest of `openxdox`'s 57. Every one of them outside the table above is a comment, a docstring or a string. Several docstrings still describe the pre-carve layout. `serve_project.py:30`, `serve_wire.py:80`, `serve_workbench.py:33` and `doxbench_scope_types.py:40` say *"this module uses ABSOLUTE `ideation_dashboard.*` imports"*. None of them is a reach. They sit in carved files with other writers, so this PR leaves them. A later edit to each file can correct its sentence.
## What changes
**`tests/test_reach_sweep.py`**, a new file, so the sweep's result is held and not only recorded here. It parses `src/` whole, the two top-level extension modules included, as F4.1 parses the package, and it asserts four things:
1. no reach into any of the four runs at import time;
2. no reach of any kind names `ideation_dashboard`, `doc_health` or `corpus_adapter_openxfactory`, in either spelling (the pre-carve `scripts.` one too), the phase-1 cut of 4.3;
3. every reach left is deferred and into `openxdox`, the positive form of F4.1 "lists only `openxdox` targets";
4. no code under `src/` spells an openxFactory package's name at all. That means no string or bytes literal outside documentation, because every import needs the name, however the importer is reached.
**It does not pin the count of 19.** openXdox-code's ratchet already counts those reaches, and each one that T055 or T084 routes simply stops being one. So no later task has to edit this file when a reach closes. A reach may not come back at import time, and none may go into openxFactory. No instrument watched that direction (#1144 task 9.2a), and `tests/test_imports_standalone.py` proves only its import-time half, where no sibling is installed. On this tree, the sweep itself finds exactly F4.1's 19, all `openxdox` and all deferred.
**How it reads a module.** It reads by syntax, not by grep. Prose names the four packages on purpose.
- **Statements.** Import statements, including `from a import b`'s members as the submodules they may be (`from scripts import doc_health`). A star member is named too.
- **Calls.** `import_module` and `__import__` calls with a literal name, by position, as `name=`, or spelled out of a literal `*[...]`/`**{...}`, and under an import alias.
- **Relative names.** They are resolved against a literal `package`. `__import__` resolves against its `globals`: `globals()` is the module's own, and a literal `{"__package__": ...}` resolves. `__import__`'s literal `fromlist` also counts.
- **A module that holds an importer as a value** (assigns, passes, stores it, or looks it up by name) is read strictly. Every call with a literal module name counts there, read as either importer, since it may be bound to either.
- **Refused as UNREADABLE:** a call whose module a spread hides; a relative call whose package or context is unknown; a relative call that leans on `globals()` or `__package__` in a module that rebinds them; a `fromlist` that is not a literal; and a star import, in either form, from a package a sibling lives under (`from scripts import *`). A star from `os` names nothing.
- **Not refused:** a computed name, which is how `consumer_reach`'s seam imports.
- **Timing.** Where position and run time part (`TYPE_CHECKING`, postponed annotations, a generator), it reads position, the stricter reading. PEP 695's lazy positions are read as deferred.
- **What it is not.** It is a regression guard for the code this repository writes, not a sandbox. A name built from pieces at run time is review's to hold, and at import time the runtime sweeps (`test_imports_standalone.py`, `test_consumer_reach.py`) hold it too.
**`tests/import_scan.py`**, the shared reader, which exists so that no direction check keeps its own copy of the extraction. The node reader `names_imported_by` and its helpers live there, and `imported_modules` reads with it. Every new behaviour is opt-in, so `imported_modules`' output, `bound_names`', and `string_literals`' default output are identical to `main`'s reader over every parsed file in this repository: 141 files, 1524 imports, 0 differ. The three callers of `imported_modules` give the same result with and without the edit.
## The falsifier: F4.1's scan, which lists only `openxdox` targets
`scan_deferred_reaches.py`, research.md's appendix, persisted in opensoft/brett-wip. Its sha256 is `fe11620319b02c23dd9a014bc581e1f4867f013f3c26890d43b12dccce5530a0`, which matches the digest `evidence/remeasure-2026-09-25.md` records. Run from this head, `python3 scan_deferred_reaches.py src/opendox`:
```
src/opendox/branch_session.py:1568: openxdox [in _change_rows]
src/opendox/branch_session.py:1587: openxdox.register [in _active_pick_fallbacks]
src/opendox/branch_session.py:2005: openxdox [in proposal_state_for]
src/opendox/branch_session.py:2105: openxdox.snapshot_registry [in session_entry]
src/opendox/branch_session.py:2151: openxdox.snapshot_registry [in register_session_entry]
src/opendox/branch_session.py:2228: openxdox.snapshot_registry [in refresh_session_snapshot]
src/opendox/branch_session.py:3573: openxdox.snapshot_registry [in refresh_main_view]
src/opendox/cli.py:628: openxdox.snapshot_registry [in _session_registry]
src/opendox/serve.py:648: openxdox.corpus_root [in _checkout_real]
src/opendox/serve.py:2118: openxdox.corpus_root [in _refuse_impossible_checkout_root]
src/opendox/serve_project.py:246: openxdox.gate_console [in _serve_project_register]
src/opendox/serve_project.py:247: openxdox.kickoff [in _serve_project_register]
src/opendox/serve_workbench.py:347: openxdox [in _is_live_session_ref]
src/opendox/serve_workbench.py:407: openxdox [in _thread_gate]
src/opendox/serve_workbench.py:408: openxdox [in _thread_gate]
src/opendox/serve_workbench.py:544: openxdox [in _handle_workbench_thread]
src/opendox/serve_workbench.py:1215: openxdox [in _handle_workbench_model_approval]
src/opendox/serve_workbench.py:1665: openxdox [in _handle_workbench_chat_turn]
src/opendox/serve_workbench.py:2607: openxdox [in _handle_workbench_document_abstract]
19 deferred reaches
```
Every target is `openxdox`. At `1e4a57fb` the same tool printed 27, eight of them into openxFactory. F4.1 WHOLE, *"no deferred reach names the consumer or the publisher"*, is T089's, after T084 routes the last 19 and retires `consumer_reach.py`.
**The new test.** `python -m pytest -q tests/test_reach_sweep.py` at this head gives `35 passed`, with the root conftest and under `--noconftest`. The same file, with this head's `tests/import_scan.py`, run over `1e4a57fb`'s tree fails the three reach assertions:
```
AssertionError: 2 reach(es) into a sibling run at IMPORT time, so the module cannot be imported without it (#1144 task 2.1's defect): src/opendox/serve.py:199: ideation_dashboard (AT IMPORT TIME, in <module>); src/opendox/serve.py:206: ideation_dashboard.serve_openxfactory_lanes (AT IMPORT TIME, in <module>)
AssertionError: 10 reach(es) into openxFactory, which openDox can never install (#1144 task 4.3's phase-1 cut), or imports the source does not spell out (behind a spread, a star, or a context that is not a literal), which could be: src/opendox/authoring.py:318: corpus_adapter_openxfactory (deferred, in _classify_proposal); …
3 failed, 32 passed
```
**83 mutations, and each fails its assertion.** Each is a copy of this tree with one change. Roughly a third plant a reach in `src/`, and the rest weaken the reader or the sweep. The list is in the review record below, and the spec is kept with the slice's tools. Every finding in the review record was also planted at the head it was raised on, where it passed, before its fix.
## The repository's own check
`.github/workflows/validate.yml`'s three report-producing pytest steps, run as the file writes them, and summed as `Pin the triple` sums them. The venv was Python 3.12.3 with `-c constraints-cpython312-linux.txt -e ".[test]"`:
```
triple: selected=1155 passed=1152 skipped=3 failures=0 errors=0
pins: selected>=1114 (margin 41) passed>=1111 (margin 41) skipped==3
```
This matches `main`. The new file is not on the workflow's list, and neither is any caller of `tests/import_scan.py`. T036 owns `validate.yml` and makes the whole suite the required run.
**The whole suite, with the root conftest**, in the same venv: `main` `796838e8` gives `19 failed, 1454 passed, 13 skipped, 66 errors`, and this head gives `19 failed, 1489 passed, 13 skipped, 66 errors`. A test-by-test JUnit diff shows no changed outcome, nothing gone, and 35 new cases, all this file's and all passing. The 85 red cases are research R3's nine files and T030's `.[test]`-only case. T034 repairs the nine.
## Review record (Copilot)
There were eighteen threads over fifteen rounds, plus four findings raised without a thread. Every thread is answered with its evidence and resolved. Copilot's review at `19b0ecc2` recommends approval, with no findings. Every finding was a way to reach a sibling that the reader did not follow. Each was planted at the head it was raised on, where it passed, and it fails since its fix.
| round, at | finding | fixed in |
|---|---|---|
| 1, `61b308ed` | `import_module(name=...)`; PEP 695 type parameters; one shared reader | `ae82e2b5` |
| 2, `ae82e2b5` | an import alias of `import_module` | `eece371e` |
| 3, `eece371e` | a relative `import_module` against a literal `package` | `9862669f` |
| 4, `9862669f` | "matched by the name it spells" (docstring) | `ab022702` |
| 5, `ab022702` | a destructured alias; a lawful consumer case | `d9d3f3f9` (a module holding an importer as a value is read strictly) |
| 6, `d9d3f3f9` | literal `*[...]` and `**{...}` | `981fce65` |
| 7, `5270acf0` | nested literal spreads | `e6bd5ef5` (UNREADABLE for any other spread) |
| 8, `e6bd5ef5` | an alias looked up by name; a keyword an unreadable entry overwrites | `4b0cb725` |
| 9–10, `4b0cb725`, `aa92f71a` | a bound package; custom `globals` | `aa92f71a` (the spelling check), `6cf729ef`, `c3283e55` |
| 11, `6cf729ef` | the `scripts.` spelling; the full-name match; a concatenated lookup key | `c3283e55` |
| 12, `c3283e55` | a shadowed `globals`; a rebound `__package__` | `1fdd7fbb` |
| 13, `1fdd7fbb` | `from scripts import doc_health` | `a5a7f745` |
| 14, `a5a7f745` | `__import__`'s `fromlist` | `0f7af1a1` |
| 15, `0f7af1a1` | a star import from `scripts`; with it, found in measuring, a strict module's calls read by one importer's rule only | `19b0ecc2`; `b53b9db2` names UNREADABLE for each case it stands for |
## Landing
- T022 (#45) and T038 (#48) have landed, and `main` `796838e8` is merged in. Everything above was re-run at this head.
- T034 comes after it: T034 re-derives `tests/test_consumer_reach.py`'s record against this sweep.
- Squash or merge, never rebase. Each commit message carries both trailers, and so does this body.
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>
…16.6's phase-1 repair) (#50)
Plan 034, task **T034**, slice P1-F (the sweep and the nine-file repair). The plan is `specs/034-opendox-standalone-operation/tasks.md` at opensoft/openxFactory `main` `468863d1`, where round 2 (#1176) has landed. The T034 entry there is byte-identical to `0d48231b`'s, which this record was first written against. This PR realizes box **9.1 (part)** and **16.6 (the phase-1 repair)** of the ratified `add-neutral-product-standalone-operability`.
- **Ruled:** R1Q2 (a) and R1Q22 (a), openxFactory#656 comment `5817152735`. Eight of the nine files are carved `moved_with_declared_edit` rows, and `tests/test_consumer_reach.py` has no row. None needs a declared-edit act.
- **Claim:** openxFactory#656 comment `5852380744`.
- **After:** T032, "whose sweep fixes the import inventory that the re-derived censuses must match". **It has landed**, as #49 → `68be484a`, after T022 (#45 → `255514df`) and T038 (#48 → `796838e8`). `main` at `68be484a` is merged in (`7e3dc9ff`, no force-push). Everything below was re-run at this head, `bc6b168d`. The inventory the sweep fixes is the one the re-derived record holds. At `68be484a` the sweep finds no reach at import time, and `STILL_REACHING`, which the record now derives on every run, is empty. The sweep's 19 deferred reaches sit in `branch_session`, `cli`, `serve`, `serve_project` and `serve_workbench`, the five modules openXdox-code's ratchet counts. The sweep's own file passes on this tree (`35 passed`).
## For T007's batch E and T047: what this PR moves to openxFactory
**Four test cases leave openDox-code and become NAMED openxFactory composition tests (R1Q2 (a)).** T007's batch E adds each destination path to F11.1's named set (`COMPOSITION_TESTS`) before T047 lands. T047's openxFactory PR lands the cases there, and T049 checks that they arrived. **`tests/test_session_harness.py` is not moved here.** It is in `collect_ignore`, and it is T035's.
**The holder's decision on the three memory-gateway cases: accepted under R1Q2 (a)** (relayed to this lane's writer, 2026-09-27). T034's text names only the outline case. The memory-gateway cases take the same route because the spec they read exists only in openxFactory.
| moved case | from (openDox-code) | to (openxFactory), proposed | why it cannot stay |
|---|---|---|---|
| `test_the_model_and_the_doc_health_family_agree_on_the_contract` | `tests/test_outline_model.py` | `tests/ideation-dashboard/test_outline_template_agreement.py` | It holds `views/outline-model.js`'s `REQUIRED_SECTIONS` and `QUESTION_SUBFIELDS` equal to openxFactory's `doc_health.families` (`_TEMPLATE_SECTIONS`, `_QUESTION_SUBFIELDS`). It imports `doc_health`, which openDox can never install. openDox has no checker of its own until Group 6 (release 2), so there is no openDox contract to rewrite it against. |
| `test_the_roster_is_exactly_the_promoted_capabilitys_requirements` | `tests/test_doxbench_memory_gateway.py` | `tests/ideation-dashboard/test_memory_gateway_roster.py` | It reads `openspec/specs/memory-gateway/spec.md`, the promoted capability that `doxbench_memory_gateway.CAPABILITY_REQUIREMENTS` is transcribed from. That spec is openxFactory's, and no openDox repository carries a copy (checked in openDox-spec, openDox, openXdox-spec, openXdox and openXdox-code). It failed on `FileNotFoundError`. |
| `test_the_tier_column_is_TRANSCRIBED_not_invented` | same | same | the same spec's tier block |
| `test_the_untiered_requirement_really_is_absent_from_the_tier_block` | same | same | the same spec's tier block |
Both destinations compose openDox at openxFactory's pin, which `scripts/carved_reach.py` already puts on the path for `tests/ideation-dashboard/`. The outline case then reads `openDox/code/src/opendox/web/views/outline-model.js` from the pin, and the memory-gateway cases import `opendox.doxbench_memory_gateway`. **The paths are proposals.** If T047's writer chooses others, batch E records what T047 lands. The cases' own text, verbatim from `main` `19370adc`, is below, so no archaeology is needed.
<details><summary>The outline-template agreement case (from <code>tests/test_outline_model.py</code>)</summary>
```python
def test_the_model_and_the_doc_health_family_agree_on_the_contract():
"""The surface and the checker must mean the same thing by conformance."""
import sys
sys.path.insert(0, str(REPO_ROOT / "scripts"))
from doc_health import families
js = MODEL_JS.read_text(encoding="utf-8")
for _needle, label in families._TEMPLATE_SECTIONS:
assert f'label: "{label}"' in js, f"model omits required section {label}"
for field in families._QUESTION_SUBFIELDS:
assert f'"{field}"' in js, f"model omits sub-field {field}"
```
`MODEL_JS` was `REPO_ROOT / "src/opendox/web/views/outline-model.js"`. At openxFactory it is the pinned leg's copy of that file.
</details>
<details><summary>The three memory-gateway roster cases (from <code>tests/test_doxbench_memory_gateway.py</code>)</summary>
```python
SPEC_PATH = REPO_ROOT / "openspec" / "specs" / "memory-gateway" / "spec.md"
# ===========================================================================
# THE ROSTER — transcribed, and asserted against the capability itself
# ===========================================================================
def test_the_roster_is_exactly_the_promoted_capabilitys_requirements():
"""The declaration is only complete if the roster it is complete OVER is
the capability's own. Read from the promoted spec, so a requirement added
upstream fails here rather than becoming a silent gap in the declaration."""
published = {
line[len("### Requirement: "):].strip()
for line in SPEC_PATH.read_text(encoding="utf-8").splitlines()
if line.startswith("### Requirement: ")
}
assert published == set(mg.CAPABILITY_REQUIREMENTS)
def _published_tiers() -> dict[str, str]:
"""The spec's OWN tier block, parsed: requirement name -> the tier line it
is named on."""
spec = SPEC_PATH.read_text(encoding="utf-8")
block = spec.split("```text", 1)[1].split("```", 1)[0]
published: dict[str, str] = {}
for match in re.finditer(r"(M\d):((?:.|\n)*?)(?=\nM\d:|\Z)", block):
tier, body = match.group(1), " ".join(match.group(2).split())
for name in body.split(";"):
published[name.strip().rstrip(".")] = tier
return published
def test_the_tier_column_is_TRANSCRIBED_not_invented():
"""RE-PINNED (adversarial review, F7). The roster test checked NAMES only,
so two wrong tier values sat in the column unchallenged: one requirement
carried `M0` although the spec's tier block never tiers it at all, and
`Expert Memory And Knowledge DBs Are Gateway-Governed` was FLATTENED to
`M4` although the spec says in as many words that it follows the tier of
the operation it mirrors. Both are now transcribed, and this test reads the
spec's own block so neither error can recur silently."""
published = _published_tiers()
for requirement, declared in mg.CAPABILITY_REQUIREMENTS.items():
named = [line for line in published
if line.lower().startswith(requirement.lower())]
if not named:
# Not tiered by the spec at all -- which the column must SAY.
assert declared == mg.TIER_UNTIERED, requirement
continue
line = named[0]
if line != requirement:
# The spec qualifies this row rather than tiering it outright.
assert declared == mg.TIER_MIRRORS_OPERATION, requirement
assert "follows the tier of the operation it mirrors" in line
continue
assert declared == published[line], requirement
def test_the_untiered_requirement_really_is_absent_from_the_tier_block():
published = _published_tiers()
untiered = [name for name, tier in mg.CAPABILITY_REQUIREMENTS.items()
if tier == mg.TIER_UNTIERED]
# TWO since 2026-08-22: add-doxbench-editing-phase-b's archive promoted
# `Subject-Free Local Consumers…` into the capability, and the spec's tier
# block does not tier it either. The list stays EXACT rather than becoming
# a membership check — an untiered requirement is a fact about the spec, so
# a third one appearing should fail here and be looked at.
assert untiered == [
"Derived memory bindings validate against the neutral schema",
"Subject-Free Local Consumers Declare Their Inapplicable Rails"]
for name in untiered:
assert not any(line.lower().startswith(name.lower())
for line in published)
```
`mg` is `opendox.doxbench_memory_gateway`, and the helper needs `import re`. At openxFactory, `REPO_ROOT` is openxFactory's own root, where the spec is (22 requirements at `0d48231b`, and `CAPABILITY_REQUIREMENTS` holds 22).
</details>
## The nine files (research R3), at `main` `68be484a` and at this head
With the root conftest in play, Python 3.12.3, `-c constraints-cpython312-linux.txt -e ".[test]"`. The nine files give the same results on `main` at `68be484a` as at `19370adc`:
| file | `main` | this head | cause | repair |
|---|---|---|---|---|
| `test_doxbench_abstract_pane.py` | 18 passed, 28 errors | 46 passed | § 3.4 slice S5 moved the workbench gate column out of the bundle, so a shell mounted with no column withholds the canvas, and the generate control with it | The harness is the host, so it contributes the column `app.js` resolves. It imports `_CONTRIBUTED_GATE` from `test_doxbench_view.py`, whose S7 note gives the reason, the way it already imports the DOM shim. The column answers `createGateLive` off the same `caps`, so the ungated and hosted mounts still have no gate. |
| `test_outline_tab.py` | 3 passed, 25 errors | 28 passed | the same | the same, and the pre-template sentence reads the SELECTION role's word from `NEUTRAL_DISPLAY`. It spelled openxFactory's "staged" before S7 parameterized it. |
| `test_doxbench_composition.py` | 13 errors | 13 passed | the same | the same |
| `test_provider_boundary.py` | 16 passed, 12 failed | 24 passed | 16.6's three stale reasons | See below. |
| `test_doxbench_memory_gateway.py` | 36 passed, 3 failed | 36 passed | read openxFactory's `openspec/specs/memory-gateway/spec.md` | the three cases move to openxFactory (above) |
| `test_consumer_reach.py` | 31 passed | 36 passed | none left after T011, whose bullet says *"T034 re-derives the rest of the file"* | re-derived: see below |
| `test_boundary.py` | 27 passed, 1 failed | 28 passed | the surface scan kept names whose `__module__` was the literal `"output_boundary"`, so after the carve every class fell out of the census | the guard's home is read off `output_boundary.__name__` |
| `test_doxbench_mcp.py` | 23 passed, 1 failed | 24 passed | the child was started as `-m ideation_dashboard.doxbench_mcp` with `PYTHONPATH=scripts/` | `-m opendox.doxbench_mcp` with `PYTHONPATH=src/` |
| `test_outline_model.py` | 47 passed, 1 failed | 47 passed | imported `doc_health` | the case moves to openxFactory (above) |
| **total** | **201 passed, 18 failed, 66 errors** | **282 passed** | | |
**`test_provider_boundary.py`, for 16.6's three reasons.** None of the twelve failures was a crossing. The file's docstring now records each reason.
1. **It read `snapshot_registry.py`**, its second HTTP-client holder, which the carve sent to openXdox-code. It is no holder in this package now, and the claim about it is not this leg's to make.
2. **It pinned seven per-module scan suites by filename.** The carve manifest sent five to openXdox-code (`test_doxbench_turns.py`, `test_doxbench_packet.py`, `test_doxbench_threads.py`, `test_doxbench_bridge.py` and `test_doxbench_mutation_boundary.py`) and left two in openxFactory (`test_doxbench_model.py` and `test_doxbench_status_exemption.py`, `stays_openxfactory_adapter`). `PRESERVED_SCANS` now pins the three this checkout carries. `PRESERVED_ELSEWHERE` records the seven with their homes, and a case asserts that none of them is here, so the record cannot go stale.
3. **Its sweep reached the runtime (§ 3.5).** `runtime/app.py` spells `Authorization` and `Bearer ` for the identity broker's token, which it checks on the way in. `runtime/oidc.py`, which verifies that token, spells `Authorization` in prose. Both are named as tier-two holders in place of `snapshot_registry.py`, and the provider tier is asserted absent from each, as it was from that module. The named list is an exemption, so it is not its own authority. Since review round 5, `test_the_identity_surface_is_the_runtimes_two_modules` holds it to exactly these two modules, and a third holder has to be argued on its own PR. `runtime/config.py` names `access_token` in `SECRET_PARAMETER_KEYS`, the credential names the runtime refuses and redacts. It gets one permit: that needle, in that module, only while that tuple still names it (read with `ast`), and no other provider-tier spelling there. Since review round 1, the permit covers only the tuple and the module's prose. The sweep asks `_spelled_in_code`, which reads every identifier, attribute name and string literal off the syntax tree outside the declaration and the documentation. A spelling there fails with its line. A case also holds the table to that one entry, not only to its size, so a second permit, or one moved to another module or needle, has to be argued on its own PR.
The boundary is still one module wide for anything that holds a provider credential. 16.6's own measurement agrees: only `doxbench_provider.py` reaches a model provider.
**`test_consumer_reach.py`, re-derived over the whole package.** T011 emptied `STILL_REACHING` by moving its only two entries.
- `test_the_record_is_the_whole_packages_own` now derives the record on every run. It imports every module the package's files define, in one interpreter, with all four siblings blocked. It follows the exception chain, because a stand-in resolved at import time raises `ConsumerReachUnavailable` with the `ModuleNotFoundError` as its cause. The modules that fail on a sibling must be exactly the record. Before this, a module outside `NEUTRAL_MODULES`, which names nine, could start needing `openxdox` at import time and pass the whole file. At this head none fails.
- Every other failure is classified, not dropped. The one read past is a module of `opendox.runtime` missing a package of the runtime extra, where the extra is not installed. In a `.[test]`-only venv, that is `app`, `db` and `oidc`, on `fastapi`, `psycopg` and `httpx`. Anything else fails the test by name: a syntax error, a broken module of openDox's own, an undeclared dependency, or a runtime package needed outside `opendox.runtime`. `RUNTIME_EXTRA` tables the extra's distributions with their import names, and `test_the_runtime_extra_is_the_one_pyproject_declares` holds its keys to `pyproject.toml`'s `runtime` list. `test_the_runtime_extras_modules_are_the_runtimes_own` holds the import names to two independent authorities, the runtime's own imports and the installed metadata. Each tabled name is one that a module of `opendox.runtime` imports. Every third-party package the runtime imports is tabled, or comes from one of the package's required dependencies. Where a tabled distribution is installed, each of its names is installed by it or by a distribution it requires.
- `CONVERTED_SITES` had fallen behind the tree by five names in two files: `branch_session.py`'s `gate_console`, the module whose nine default-argument reads the guard is named for, and `cli.py`'s `corpus_root_refusal`, `generate_snapshot`, `is_rfc3339_datetime` and `SCANNED_ROOTS`. They join the table. `test_every_name_bound_to_the_seam_is_guarded` holds the table equal to the names each module binds to the seam. None of the five is read at import time. The census reads every spelling of the seam:
- `Y = <seam>.X`, its annotated form, and `Y = <seam>.module(...)`;
- `<seam>` spelled as an alias of the module, as `opendox.consumer_reach` after `import opendox` or `import opendox.consumer_reach`, or through `from .. import consumer_reach` in a subpackage;
- each of these wherever the module runs it at import time, a module-level `if` or `try` included.
A wildcard import from the seam fails with its own message.
**Thirty-seven mutations, each a copy of this tree with one planted change, and each fails the assertion it targets.** One more runs in the `.[runtime,test]` venv. The first thirteen:
- an unlisted module gains a module-level `from openxdox import …`;
- an unlisted module resolves a stand-in at import time, which is caught through the exception chain;
- a new name is bound to the seam;
- `branch_session.py` reads `gate_console` at import time;
- a provider endpoint appears in a non-provider module;
- a `Bearer ` header appears in an unnamed module;
- the identity surface gains `MintedToken`;
- `SECRET_PARAMETER_KEYS` stops naming `access_token`;
- the redaction module gains `client_secret`;
- a carved-away scan suite comes back;
- the guard gains a public class the shim does not re-export;
- the pre-template sentence goes back to "staged topic";
- the abstract-pane harness loses its contributed column.
The twelve added in review round 1:
- an import-time `import doc_health` where a `doc_health` is installed;
- a module importing a missing module of openDox's own;
- a module that raises while importing;
- an undeclared dependency;
- `import fastapi` outside `opendox.runtime`;
- a runtime module importing a package the extra does not declare;
- a distribution added to pyproject's runtime extra and not tabled;
- `Y: T = consumer_reach.X`;
- `Y = consumer_reach.module(...)`;
- `runtime/config.py` spelling `access_token` in a dict key, in an attribute read, and in an f-string.
Eight more came from review rounds 2 and 3:
- `import opendox.consumer_reach` then `opendox.consumer_reach.module(...)`;
- `import opendox` then `opendox.consumer_reach.snapshot`;
- an alias of the seam module;
- a subpackage's `from .. import consumer_reach`;
- the seam imported inside a module-level `try`;
- a stand-in bound inside a module-level `if`;
- a wildcard import from the seam;
- a second redaction permit.
Two came from review round 4, and one more runs in the `.[runtime,test]` venv:
- an invented module in a `RUNTIME_EXTRA` row;
- a runtime module importing a package nothing declares, read statically;
- in `.[runtime,test]`, a module tabled under a distribution that does not install it.
Two came from review round 5:
- a third identity holder listed, with `Authorization` in its code;
- the one redaction permit moved to another needle, with `runtime/config.py` spelling that name instead.
Two controls pass, as they must: a new comment and a new docstring in `runtime/config.py` that name `access_token`.
## The falsifier: `python -m pytest -q` over the nine files
```
$ python -m pytest -q tests/test_doxbench_abstract_pane.py tests/test_outline_tab.py tests/test_doxbench_composition.py tests/test_provider_boundary.py tests/test_doxbench_memory_gateway.py tests/test_consumer_reach.py tests/test_boundary.py tests/test_doxbench_mcp.py tests/test_outline_model.py
282 passed in 22.93s
```
It also passes under `--noconftest`, file by file, and in a `.[runtime,test]` venv.
## The repository's own check
`.github/workflows/validate.yml`'s three report-producing steps, run as the file writes them and summed as `Pin the triple` sums them, in the `.[test]` venv above:
```
triple: selected=1160 passed=1157 skipped=3 failures=0 errors=0
pins: selected>=1114 (margin 46) passed>=1111 (margin 46) skipped==3
```
`main` at `68be484a` gives `1155/1152/3`. The five new cases are `test_consumer_reach.py`'s, which the required job runs by name. `test_provider_boundary.py`'s new cases are not on the job's list. No skip was added.
**The whole suite, with the root conftest.** A test-by-test JUnit diff against `main` in the same venv:
| venv | `main` | this head |
|---|---|---|
| `.[test]` | 19 failed, 1489 passed, 13 skipped, 66 errors | 1 failed, 1570 passed, 13 skipped |
| `.[runtime,test]` (F2.1's install) | 18 failed, 1490 passed, 13 skipped, 66 errors | **1571 passed, 13 skipped** |
- 69 cases go from red to passed, all in the nine files.
- 15 are gone: the 4 moved cases, and 11 of `test_provider_boundary.py`'s old ids. Nine were `PRESERVED_SCANS` rows for files this checkout does not carry, one was the renamed tier-two case, and one was the `snapshot_registry.py` case.
- 12 are new, all passing: 5 in `test_consumer_reach.py` and 7 in `test_provider_boundary.py`.
- No other outcome changed.
- The `.[test]` venv's one failure is T030's `test_every_module_imports_with_no_sibling`, which needs the `runtime` extra there, as #46 recorded. T036 gives the `test` extra those packages.
## Review round 1 (Copilot, at `6898748a`)
Each finding was planted at `6898748a` first, and every plant passed there. Each is fixed in `86b8f522`, where every plant fails, and each thread is answered with its evidence and resolved.
- **The derivation blocked only `openxdox`.** With a `doc_health` on the path, a module gaining `import doc_health` dropped out of the census. The derivation, and the record entry check that reads the same failure, now block all four.
- **The derivation dropped every failure that named no sibling.** They are classified now (above).
- **The `access_token` permit covered the whole of `runtime/config.py`.** It covers the declaration and the prose now (above).
- The review's overview also named annotated assignments in the seam census, with no thread. That is done too (above).
## Review rounds 2 and 3 (Copilot, at `86b8f522` and `9d52122b`), no threads
- **Round 2: one previously missed finding.** `import opendox.consumer_reach` binds `opendox`, so a stand-in bound through `opendox.consumer_reach` went unseen. Three sibling forms were unseen the same way. All four are read since `9d52122`, and each passed as a plant at `86b8f52`.
- **Round 3: a summary line only, "seam-alias and wildcard-import gaps, and the single provider-boundary permit invariant."** Since `9a9b21a`:
- the census reads a module-level `if` or `try`, where both plants passed at `9d52122`;
- a wildcard import fails with its own message;
- the permit table is held at one entry.
- **At `9a9b21ae` Copilot reports "Needs a closer look", with no finding and no thread.**
## Review round 4 (Copilot, at `7867614c`, the first merge of `main`)
- **`RUNTIME_EXTRA`'s import names were checked only through its keys.** Adding `"planted"` to fastapi's row left the whole of `test_consumer_reach.py` green at `7867614`, and a missing `planted` import in `opendox.runtime` would then have been read past as an absent extra. Fixed in `383b3232` by the new case above, which holds the names to the runtime's imports and to the installed metadata. The thread is answered with that evidence and resolved.
- **At `383b3232` Copilot reports "Needs a closer look", with no finding and no thread.**
## Review round 5 (Copilot, at `7e3dc9ff`, the merge of T032)
- **`IDENTITY_MODULES` was its own authority.** `holders_seen == permitted` proves only that each listed module holds a needle. Planted at `7e3dc9ff`, `runtime/db.py` added to the tuple, with an `Authorization` string in its code, passed the whole file (`24 passed`). The thread also names line 318, the permit table's pin, which held `REDACTION_PERMITS` by its size only. Planted there, the permit moved to `refresh_token`, with `runtime/config.py` spelling that name in place of `access_token`, passed too (`23 passed`). Fixed in `bc6b168d`: each table is held to the surface it names (above), and both plants fail. The thread is answered with that evidence and resolved. All five threads on this PR are resolved.
## Landing
- T032 (#49) and T022 (#45) have landed, and `main` `68be484a` is merged in. Everything above was re-run at this head.
- `tests/test_consumer_reach.py` has one writer at a time (T011 → T034), and this is its second.
- P1-G (T035–T037, T031) follows this PR.
- Squash or merge, never rebase. Each commit message carries both trailers, and so does this body.
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>
**Authored ahead, as a phase-2 draft.** Brett ruled on openxFactory#656, comment `5857365170` ("Start phase 2's independent tasks"), that phase-2 tasks are authored as drafts. **T049 has landed** (openxFactory#1204 → `9d2e5bc3`), so phase 2 is open. This PR stays a draft until the two tasks below have landed and the holder un-drafts it.
T055 is `After: T054, T057, T022, T038`, and all four have landed (#57 `a691e4e4`, #58 `8ec08e91`, #45, #48). Before they landed:
- T054 is #57, a clean draft. It waits on #54, #56 and T053 (openDox-spec#16).
- T057 is #58, a clean draft. It also waits on the openDox root pinning T053's landed spec commit. See "T057 and the validator default" below.
- T022 (#45) and T038 (#48) have landed.
This is plan 034's **T055 (serve and generate standalone: 5.5, and 4.3 in part)**, phase-2 slice **P2-R**. I read the plan at openxFactory `main` `6b97c60` (`specs/034-opendox-standalone-operation/tasks.md`). The slice is claimed on openxFactory#656, comment `5873583149`.
## What this branch carries
- It is **built on #57's branch**, `build/034-p2p-t054-neutral-projection` (T054, the neutral projection), which is itself built on #54 (T052, the generator seam). It was cut at `5a6fe637`, with #54's head `8d507c5b` merged in as `e8a733d`.
- After T049 landed, **#57's head `8e7da4a2` is merged in as `8cbb1ea`**, clean. That head carries:
- #54's final head, `2f515c57`;
- #56's head, `44dcc3a1`;
- `main` `dc3765dd`, where #53 (T050) landed;
- the holder's scaffold decision (`8e7da4a`), which answers r4126022820 below.
- **#58 (T057) is not merged in**, on the holder's decision (below).
- Until #54, #56 and #57 land, the diff against `main` carries their changes as well. T055's own change is:
- its commits `c27eac35` through `f4ef63d3`: the first builds T055, and the other six take Copilot's review rounds;
- `d7aa9d8c` (the holder's decision on empty source options), and `687d37bf`, `96f18c45` and `e3ef506a` (the next three review rounds), all after T049.
## What it builds
### Four seams, each with an openDox default of its own (R1Q10 (a))
`src/opendox/projection_seams.py` is new and uses the standard library only. It declares four seams:
| seam | what a registration carries | openDox's default |
|---|---|---|
| `registry` | the entry, registry and source types; the key, containment and publishable-ref rules; the data-source readers; the refresh bindings and defaults | `opendox.default_registry` |
| `corpus_root` | `corpus_scan_defect`, `corpus_root_refusal`, `change_rows`, `SCANNED_ROOTS` | `default_projection.CORPUS_ROOT` |
| `writer` | `write_snapshot(snapshot, path, boundary)` | `default_projection.WRITER` |
| `validators` | one validator per KIND: `validate(path, *, strict, search_from)`, answering a `ValidationResult` | `default_projection.VALIDATOR`, for `opendox-snapshot` and `ideation-workbench` |
The rules are the ones the profile and generator seams keep (R1Q3 (a) and (ii); RN-1 (a)):
- **Nothing registered refuses** (4.2). The refusal names the seam, its call and the four entry points. There is never a silent fallback.
- **The entry points register the defaults where no host has.** They are `cli.build_parser()`, `cli.main()`, `serve.build_server()` and `serve.main()`. `register_defaults()` reads nothing.
- **A host's registration replaces a default until a consumer has read it**, and is refused (`SeamAlreadyRegistered`) after that. A host over a host is refused. The same object again is a no-op. `unregister()` makes a swap explicit.
- **Each registration is probed for its names when it is made.** A missing or non-callable name is a `TypeError` naming what is missing. A lookup that raises is chained as the cause (T027's rule).
- **A consumer resolves the seam at each use.** `serve.py` and `serve_workbench.py` bind `registry_mod = projection_seams.registry.proxy`, which resolves on every attribute read. No proxy is read at import time, and a test walks the AST to hold that.
The defaults are new code, not openXdox's modules moved.
- **`default_registry`** is one in-memory registry keyed `(repository, ref)`, with `ref` defaulting to `main`.
- It keeps `/source`'s containment rule (`resolve_within`).
- Its `SnapshotSource` serves the snapshot it was handed, and it regenerates that snapshot.
- It reads **no data source and no index**, because openDox has no index kind (T053). A declared `--data-source-*` or `--local-index` is **refused**, naming the seam, rather than ignored.
- `compose_view` composes nothing.
- **`CORPUS_ROOT`** asks, structurally, for a git repository's root: a directory holding `.git`, and a worktree's `.git` file counts. Its `SCANNED_ROOTS` is empty, and `change_rows` answers no row.
- **`WRITER`** writes canonical JSON (sorted keys, indent 2, ASCII, a trailing newline) through the interactivity boundary.
- **`VALIDATOR`** is a stand-in until T057 is in this tree. It answers `validator-unavailable`, naming T057, and never answers `validated`.
### The verbs go through the seams (4.3, in part)
- **Generation.** `cli._generate_and_write` and `cli._gate_snapshot` call `generator_seam.generate(...)`, which looks the generator up on each call.
- Both write through the registered writer.
- An unset `--project-register` or `--possibles` is not passed.
- A set one that the registered generator does not declare is refused (`generate refused: …`) before anything is written.
- **The validator is chosen by the written snapshot's `kind`** (`cli._validate_by_kind`). `_locate_validator` is gone.
- The three outcomes keep their meaning, and so do `--strict` and `--no-validate`.
- A kind with no validator is *unavailable*. It is never given another kind's validator.
- A snapshot that declares no kind fails.
- The remedy line prints only when the validator declares a `dependency_remedy`.
- **The workbench manifest.** `workbench.validate_manifest` asks the lookup for `ideation-workbench`, and no longer calls `consumer_reach.find_validator`. An explicit validator script still runs as before.
- **The regenerate.** The default source's regenerate (`SnapshotSource.refresh`) generates through the seam and writes through the registered writer. It keeps `main` active and never promotes a session ref (FR-014a).
- **`branch_session`.**
- `session_entry`, `register_session_entry`, `refresh_session_snapshot` and `refresh_main_view` use the registered registry's types.
- `_change_rows` (the brief's `:1568`) asks the corpus-root seam's `change_rows`, because the generator seam does not carry it.
- **The RFC 3339 check.** `is_rfc3339_datetime` is openDox's own (`src/opendox/rfc3339.py`). It implements the neutral contract's `generated-at-is-rfc3339` rule, which no seam carries, and it agrees with openXdox's check over 20 vectors.
- **The core `/snapshot.json` arm is `serve.py`'s own.**
- `_query_key`, `_read_snapshot`, `_serve_snapshot` and `_hosted_entry_refused` are now defined on `DashboardHandler`.
- `hosted_ref_refused` is a function in `serve.py`, over the registry seam's `is_publishable_ref`.
- While they were forwarded to openXdox, a standalone server refused every `/snapshot.json`, and `_divergence_headers` asks `hosted_ref_refused` on every response.
- `_checkout_real` and `_refuse_impossible_checkout_root` ask the registered predicate.
- **`_report`** prints `repository=… kind=opendox-snapshot` for the neutral kind, which carries no project. Every other kind's line is unchanged.
- **The empty-projection warning** reads the registered predicate's `SCANNED_ROOTS`. With none, as openDox's own predicate has, it says "it was accepted as a corpus checkout, but nothing in it was read as a document". The governed wording is unchanged.
- **The `_default_home_factory` docstrings** in `cli.py` and `serve.py` now say that the adapter's default `required_fields` is `NEUTRAL_FIELDS` (`title` and `summary`, since T054), as #57 asked. The two copies stay identical apart from each naming the other.
- **`serve.main()` registers the defaults before building its parser**, because its option defaults read the registry.
- So `--help` now runs in a lone checkout, which research R7 found it could not.
- `--data-source-path`'s help reads `(default: the source root)`.
- A seam's refusal prints `serve refused: …` and exits 1.
### Retired from `consumer_reach`
- **The stand-ins.** `snapshot_registry`, `snapshot`, `corpus_root`, `generator`, `find_validator`, `corpus_root_refusal`, `generate_snapshot`, `is_rfc3339_datetime`, `hosted_ref_refused` and `scanned_roots` are gone.
- **The helpers.** The `function` and `constant` stand-in helpers are gone too, since nothing binds through them any more.
- **The projection column.** `LateProjectionRoutes` now forwards ONE method, `_serve_index`, for the column's own `/snapshot-index.json` binding. That binding is T084's.
## The falsifier
From T055's entry in tasks.md:
> **Falsifier**: F4.1's scan, down by these reaches.
The scan is `scan_deferred_reaches.py` from research.md's appendix (sha256 `fe116203…`, as in the remeasure table), run over `src/opendox`. At `e8a733d`, the branch before T055's commit:
```text
src/opendox/branch_session.py:1568: openxdox [in _change_rows]
src/opendox/branch_session.py:1587: openxdox.register [in _active_pick_fallbacks]
src/opendox/branch_session.py:2005: openxdox [in proposal_state_for]
src/opendox/branch_session.py:2105: openxdox.snapshot_registry [in session_entry]
src/opendox/branch_session.py:2151: openxdox.snapshot_registry [in register_session_entry]
src/opendox/branch_session.py:2228: openxdox.snapshot_registry [in refresh_session_snapshot]
src/opendox/branch_session.py:3573: openxdox.snapshot_registry [in refresh_main_view]
src/opendox/cli.py:632: openxdox.snapshot_registry [in _session_registry]
src/opendox/serve.py:652: openxdox.corpus_root [in _checkout_real]
src/opendox/serve.py:2125: openxdox.corpus_root [in _refuse_impossible_checkout_root]
src/opendox/serve_project.py:246: openxdox.gate_console [in _serve_project_register]
src/opendox/serve_project.py:247: openxdox.kickoff [in _serve_project_register]
src/opendox/serve_workbench.py:347: openxdox [in _is_live_session_ref]
src/opendox/serve_workbench.py:407: openxdox [in _thread_gate]
src/opendox/serve_workbench.py:408: openxdox [in _thread_gate]
src/opendox/serve_workbench.py:544: openxdox [in _handle_workbench_thread]
src/opendox/serve_workbench.py:1215: openxdox [in _handle_workbench_model_approval]
src/opendox/serve_workbench.py:1665: openxdox [in _handle_workbench_chat_turn]
src/opendox/serve_workbench.py:2607: openxdox [in _handle_workbench_document_abstract]
19 deferred reaches
```
At `c27eac35`:
```text
src/opendox/branch_session.py:1592: openxdox.register [in _active_pick_fallbacks]
src/opendox/branch_session.py:2010: openxdox [in proposal_state_for]
src/opendox/serve_project.py:246: openxdox.gate_console [in _serve_project_register]
src/opendox/serve_project.py:247: openxdox.kickoff [in _serve_project_register]
src/opendox/serve_workbench.py:351: openxdox [in _is_live_session_ref]
src/opendox/serve_workbench.py:411: openxdox [in _thread_gate]
src/opendox/serve_workbench.py:412: openxdox [in _thread_gate]
src/opendox/serve_workbench.py:548: openxdox [in _handle_workbench_thread]
src/opendox/serve_workbench.py:1219: openxdox [in _handle_workbench_model_approval]
src/opendox/serve_workbench.py:1669: openxdox [in _handle_workbench_chat_turn]
src/opendox/serve_workbench.py:2611: openxdox [in _handle_workbench_document_abstract]
11 deferred reaches
```
- **The eight reaches that are gone** are the ones T055 names:
- `branch_session`'s `_change_rows`, `session_entry`, `register_session_entry`, `refresh_session_snapshot` and `refresh_main_view`;
- `cli`'s `_session_registry`;
- `serve`'s `_checkout_real` and `_refuse_impossible_checkout_root`.
- **The eleven that remain** are all T084's.
- **The census of `consumer_reach` sites** (`census_consumer_reach.py`, sha256 `7f36b848…`) falls from 65 to 29: `gate_console` 27, `LateGateRoutes` 1 and `LateProjectionRoutes` 1. No projection name remains.
**Standalone, end to end:** `tests/test_projection_seams.py::test_generate_and_serve_run_with_no_sibling_importable` runs in a process where `openxdox`, `ideation_dashboard`, `doc_health` and `corpus_adapter_openxfactory` cannot be imported.
- `generate` exits 0 and writes `kind: opendox-snapshot`.
- `serve.build_server` builds.
- The server answers `GET /snapshot.json` 200 (the neutral kind), `/capabilities` 200, `/source/notes-toolshed-inventory.md` 200 and `/source/.git/config` 404.
- No sibling module is loaded.
## The repository's own checks
- **The whole suite, against a `postgres:16` container** (CI's service and DSN shape), on Python 3.12.3 with pytest 8.4.2. The venv was installed with `-c constraints-cpython312-linux.txt -e ".[runtime,test]"`, and `LANG=C.UTF-8`, as the runner sets it.
| run | passed | skipped |
|---|---|---|
| base `e8a733d` (the branch before T055's commit) | 2583 | 11 |
| head `f4ef63d3` | 2701 | 11 |
The test-by-test JUnit diff shows **127 added**, all passing:
- 117 in the new `tests/test_projection_seams.py`;
- 4 new `NEUTRAL_MODULES` parameters in `test_consumer_reach.py`;
- 6 in `test_source_core_arm.py`.
It shows **9 removed**. Each subject is retired or replaced:
- Four tests exercised `consumer_reach.constant()`, which is retired: `test_a_constant_does_not_forward_attribute_reads`, `test_constructing_a_constant_resolves_nothing`, `test_the_sequence_operations_a_re_exported_constant_meets` and `test_an_unavailable_consumer_refuses_at_the_operation_not_at_the_binding`.
- `test_a_converted_name_is_never_used_at_import_time[serve.py|serve_workbench.py|workbench.py]`: those modules bind no `consumer_reach` name any more. The import-time property of the proxies they bind instead is held by `test_no_proxy_over_a_seam_is_read_at_import_time`.
- `test_the_column_keeps_the_rules_the_ruling_did_not_move` asserted that `_serve_snapshot` and `_hosted_entry_refused` stay forwarded, which T055 reverses. It is replaced by `test_the_column_keeps_only_its_own_contributed_route` and `test_the_snapshot_arms_handlers_are_defined_on_this_handler` (four cases).
- `test_hosted_ref_refused_is_still_reached_through_the_late_seam` is replaced by `test_hosted_ref_refused_asks_the_registered_registrys_rule`.
**0** outcomes changed.
- **The triple pin** reads: selected 2712 (floor 2476), passed 2701 (floor 2465), skipped 11 (pinned exactly 11). No test ships skipped. CI's own line at `f4ef63d3` reads `triple: selected=2712 passed=2701 skipped=11 failures=0 errors=0`.
- **One environment note.** In a shell with no `LANG`, `test_model_provider_broker.py::test_the_broker_child_inherits_no_credential_shaped_environment` fails. The child Python's PEP 538 locale coercion adds `LC_CTYPE`, which is not in the bridge's allowlist. With `LANG=C.UTF-8` it passes. T055 touches neither the broker nor the bridge, so this predates it.
- **Mutations: 34 of 34 killed.** Twenty-three were run at `c27eac35`:
- Seams:
- a host replaces a default after it was read;
- reading a default does not close its window;
- `register_defaults` skips the writer;
- a proxy resolves dunders;
- a missing kind answers another kind's validator.
- Validation:
- the validator is chosen by a fixed kind;
- the manifest is validated by another kind's validator.
- Serving:
- the hosted plane never refuses a session ref;
- an active session entry is served hosted;
- the checkout is never real.
- Containment: files below a dot-directory are served.
- Regenerate:
- it promotes a session ref;
- it bypasses the registered writer.
- Registry:
- the neutral source ignores a declared data source;
- the session entry type is not the registered registry's;
- the CLI's session registry is not the registered registry's.
- Routed sites:
- `_report` prints the governed line for the neutral kind;
- `_change_rows` ignores the registered predicate;
- the predicate accepts a directory with no `.git`;
- `generate` skips the corpus-root guard;
- the gate snapshot bypasses the seam.
- RFC 3339:
- it admits a space for the `T`;
- it refuses a lower-case `t`.
One more mutation, admitting second 60, is equivalent, because `datetime` refuses it too.
Eleven more were run in the review rounds, one or two for each change:
- a symlink leads to what a name cannot;
- a declared token variable is dropped;
- dropping the active entry leaves its key;
- an explicitly empty URL is dropped for being falsy;
- an unregistered kind is described as a search;
- the lookup's refusal is cut before its remedy;
- the writer writes NaN and Infinity;
- the snapshot body re-resolves the active entry;
- the source arm resolves the entry twice;
- the writer rewrites the snapshot in place;
- a failed move leaves its temporary sibling.
- **pyflakes over the touched files** finds nothing new: 104 findings at base and 104 at head, all pre-existing re-export F401s.
## T057 and the validator default
- **What T055 asks for.** T055's text makes the lookup's default openDox's own validator (T057).
- **Where T057 is.** When this branch was cut, T057 had no PR. It now has one, #58 (a draft at `ca52182f`, stacked on #57's branch). This PR does **not** merge it, for two reasons:
- #58 edits `pyproject.toml`, which phase-2 drafts in this lane stay out of;
- #58 is still in review.
- **What happens meanwhile.** The default for openDox's two kinds is the stand-in, `OwnValidatorNotBuilt`, which names T057.
- A generate verb warns "validation SKIPPED" and exits 0, or 1 under `--strict`.
- A manifest saved with `validate=True` is refused as unvalidated. That is what a lone openDox answered before T055 whenever no validator was reachable, except that `validate_manifest` no longer reaches the consumer.
- **The swap is one registration** (see T058 below).
- **The holder's decision (2026-09-28): do NOT merge #58 into #59.** The validator stand-in stays until T058 wires `opendox.validator`. This branch takes #58's code only through `main`, once #58 has landed, and still keeps the stand-in until T058.
## Beyond the task's list: `hosted_ref_refused`
- **Where the plan put it.** T084's list names `hosted_ref_refused` (2 sites).
- **Why T055 routes it.** The core `/snapshot.json` handlers that T055 makes `serve.py`'s own call it, and so does `_divergence_headers`, on every response. Without it, a standalone server could not answer `/snapshot.json` or `/capabilities`.
- **So T084's list is one name shorter.**
## Files (T055's own commits)
- **New:**
- `src/opendox/projection_seams.py`
- `src/opendox/default_registry.py`
- `src/opendox/default_projection.py`
- `src/opendox/rfc3339.py`
- `tests/test_projection_seams.py`
- **Changed:**
- Source: `src/opendox/cli.py`, `serve.py`, `serve_workbench.py`, `workbench.py` and `branch_session.py`.
- `consumer_reach.py`.
- Docstrings only: `serve_wire.py`, `generator_seam.py`, `default_generator.py` and `cli_project.py`.
- Tests: `test_consumer_reach.py`, `test_source_core_arm.py`, `test_route_handler_contribution.py`, `test_doxbench_entrypoint.py`, `test_generator_seam.py`, `test_profile_registration.py`, `test_authoring_seam.py`, `test_reach_sweep.py` and `test_neutral_projection.py`.
- **Not touched:** `conftest.py`, `pyproject.toml`, `.github/workflows/validate.yml`, `README.md`, and every pin. The new modules are created files, with no carve-manifest row (RULED OQ-C).
## What the later tasks need
- **T056** (the standalone generate path, end to end). I probed this at `c27eac35`, with the four siblings blocked by a meta-path blocker, over a copy of T050's fixture. In that copy, `candidate-toolshed-rebuild.md`'s `stage:` is `brainstorming`.
- `python -m opendox.cli generate` exits 0 and writes the neutral snapshot. It prints `notice: candidate-toolshed-rebuild.md: its stage: value 'brainstorming' is not one of the six station role keys (source, grouping, candidate, selection, submission, completion), so it is not a declaration; the document is read as a source`. The snapshot reads that document as `stage: source`. So the verb's half of F5.3's `stage:` case needs no further plumbing.
- `generate-and-open --no-open --no-serve` exits 0, builds the server and prints its URL.
- What remains is T056's own:
- a test that the server STARTS and answers, run as `generate-and-open` without `--no-serve` (or `serve.main`) in a subprocess with the siblings blocked, polling the printed URL and then stopping the server;
- F10.1's plain-install run, which is T070's.
- **T058** (the post-render validator in the generate verbs).
- Replace `default_projection.VALIDATOR` with an adapter over #58's `opendox.validator` that keeps T055's protocol: `validate(path, *, strict=False, search_from=())` answers a `projection_seams.ValidationResult`.
- How the adapter should work:
- It reads the file: JSON for `opendox-snapshot`, and YAML for the `ideation-workbench` manifest, which `workbench.py` already parses with PyYAML.
- It calls `validator_for(kind)`, or `validate(instance, kind=…)`.
- How its answers should map:
- No violation is ok, with return code 0.
- Violations are `not-conformant`, with return code 1 and `report(violations)` on stdout, so each rule id is named. F7.2 needs `EXPECTED_RULE`.
- `ValidatorUnavailable` and `SchemaNotEvaluable` are `validator-unavailable`, with the reason.
- `dependency_remedy = None`. No subprocess runs, so F7.2's "no `No such file or directory`" holds by construction.
- `OWN_KINDS` stays `(opendox-snapshot, ideation-workbench)` unless T058 widens it to #58's `KINDS`. The doxBench wire kinds keep their own path (`serve_wire.register_doxbench_validators`).
- The stand-in's cases in `tests/test_projection_seams.py` change with it:
- `test_the_validator_stand_in_concludes_nothing_and_names_T057`;
- `test_openDoxs_own_kind_meets_the_stand_in_and_strict_makes_it_fatal`;
- the stand-in half of `test_a_manifest_is_validated_by_the_validator_for_its_kind`.
- `--strict` and `--no-validate` already mean what T058 says.
- **T059** (openXdox registers its governed mechanisms). It registers everything below at process start, before any entry point reads a default, because a default is sealed once read.
- `openxdox.snapshot_registry` at `projection_seams.registry`. The module already carries every required name.
- An adapter at `corpus_root`. It takes `openxdox.corpus_root`'s `corpus_scan_defect`, `corpus_root_refusal` and `SCANNED_ROOTS`, plus a `change_rows` built from `generator.iter_changes` and `declared_origin_state`, which is what `branch_session._change_rows` computed before T055.
- `openxdox.snapshot` at `writer`.
- A validator adapter for each governed kind, such as `ideation-dashboard-snapshot`. Its `dependency_remedy` is `snapshot.DEPENDENCY_REMEDY`, and it names `VALIDATOR_RELPATH` in `unavailable_reason`.
- It lowers `OPENDOX_BACK_IMPORTS` in `tests/test_dependency_direction.py`. `cli.py` and `serve.py` leave the table, and `branch_session.py` goes from `(0, 7)` to `(0, 2)`. `serve_project.py` stays at `(0, 2)` and `serve_workbench.py` at `(0, 7)`.
- `tests/test_generated_at_anchor.py:223` patches `cli_mod._locate_validator`, which T055 removed. The seam to patch now is `_validate_by_kind`, or a validator registered for the kind.
- Four gaps that the review rounds closed in openDox's own defaults are still open in the governed mechanisms T059 registers. They are openXdox-code's to close, ideally before T059 registers them:
- `snapshot_registry.resolve_within` checks the hidden-name rule only against the URL's spelling, so `link -> .git` serves `/source/link/config`, which is `.git/config` (r4125556296).
- `SnapshotRegistry.drop` leaves the active key pointing at a dropped entry.
- `snapshot.write_snapshot` writes in place through `write_output`, so a request can read a truncated snapshot (r4126138808). Its `canonical_json` also writes NaN and Infinity (r4125900060).
- `SnapshotRegistry` reads `active`, `get`, `entries()`, `keys()` and `len()` without its lock, so a reader can answer from the middle of a block `atomically()` holds (r4136863481).
- **T084**: its list no longer includes `hosted_ref_refused`. The eleven reaches the scan still finds are all T084's.
## For the holder
All three earlier items are now decided:
- **The validator default**: #58 is not merged here (above).
- **T054's `NEUTRAL_FIELDS` default missed openDox's own scaffold** (r4126022820): #57's commit `8e7da4a` takes it, and this branch now carries that commit. openDox's own scaffold leads with `title:`/`summary:` where the registered corpus obliges them, and keeps the governed layout where it obliges neither.
- **Empty generator inputs**: the holder ruled that an empty `--project-register`/`--possibles` is REFUSED, fail closed. It is neither dropped nor read as `Path("")`. Taken in `d7aa9d8c`:
- `cli.SourceOptionRefused`, raised by one helper, `_source_option()`, which both call sites use: `_generate_and_write` for `generate` and `generate-and-open`, and `_gate_snapshot` for the gate verbs. It answers `None` for an option not given, refuses an empty one, and resolves anything else.
- The guard runs beside the other two, before any generation or write. In `generate-and-open` it runs early too, so a refused run mints no run directory. `main()` prints `<verb> refused: …` and exits 1.
- `serve.main` refuses an empty `--project-register` the same way, before a socket is bound.
- Seven new cases. Mutations: 8 of 9 killed. The ninth removes the explicit guard in `_generate_and_write`, and it is equivalent: the argument expression refuses before `generate()` is called. The guard is kept beside the other two, so the order does not rest on argument evaluation.
## CI and review rounds
`validate` is green at every head below, and SonarCloud passed its quality gate. Every thread was answered and resolved, and each change carries a case that its mutation fails.
- **`c27eac35`: 3 threads, all taken in `ea49c424`.**
- r4125556296: symlinks inside the root could lead into a dot-directory. The canonical path now meets the hidden-name rule too.
- r4125556360: `token_env` was ignored. Every declared data-source option is now refused by name, an empty one included.
- r4125556420: an extra "by", in three places.
- The overview's remarks on `display.js` and the plain-documents fixture test are #57's and #53's files. They have no threads here and are flagged, not changed.
- **`ea49c424`: 1 thread, taken in `bfb9c479`.**
- r4125666251: `serve.main`'s `or` turned an explicitly empty `--data-source-url`/`--data-source-github` into `None`. Each option is now handed over as given, and a slug that cannot be composed is refused.
- The overview (no thread) found that `drop` left the active key dangling. That is taken in the same commit.
- **`bfb9c479`: no findings.** The overview (no thread) noted that the unavailable-validator warning described a filesystem search even when nothing is registered for the kind. It is taken in `244d7b7f`: the warning now says which of its two cases happened, and gives the lookup's whole refusal, remedy included.
- **`244d7b7f`: 2 threads, taken in `19c26782`.**
- r4125900060: the writer wrote NaN and Infinity. It now refuses what JSON cannot carry, with `SnapshotNotWritable`, before writing.
- r4125900164: the snapshot arm's query-less path read the active entry twice, for the refusal and for the body. It now resolves the entry once. This race came from openXdox's handlers unchanged.
- **`19c26782`: 2 threads.**
- r4126022918: the source arm resolved its entry twice. It now resolves the entry once and asks for the path by that entry's own pair. Taken in `8c09d74c`.
- r4126022820: T054's `NEUTRAL_FIELDS` default. It is answered with a reproduction, not changed here, and flagged above.
- **`8c09d74c`: 1 thread, taken in `f4ef63d3`.**
- r4126138808: the writer wrote in place, so a concurrent read could see a truncated snapshot. It now writes a temporary sibling and moves it over the target with one `os.replace`, and the boundary still decides the destination.
- **`f4ef63d3`**: `validate` is green, with `selected=2712 passed=2701 skipped=11 failures=0 errors=0`. Copilot's review run there ended with "Copilot encountered an error and was unable to review this pull request", so it posted no verdict.
- **After T049: `8cbb1ea` merges #57's head, and `d7aa9d8c` takes the holder's decision on empty source options** (above). CI is green at `d7aa9d8c`, with `selected=2723 passed=2712 skipped=11`: #57's 4 scaffold cases and these 7.
- **Copilot at `d7aa9d8c`: 1 thread, taken in `687d37bf`.**
- r4136439187: a refresh widened a restricted snapshot. `os.replace` carries the sibling's mode over the target, and the sibling had a new file's ordinary mode.
- Now, where the target exists, its permission bits go onto the sibling (`os.fchmod`) before a byte is written. A new target keeps the ordinary mode.
- If the bits cannot be copied, the write fails and nothing is widened. The copy runs inside the stream's `with`, so the descriptor cannot leak.
- Four new cases, all red against `f4ef63d3`'s writer. Local whole suite: `selected=2727 passed=2716 skipped=11`.
- **Copilot at `687d37bf`: "Changes recommended", 2 threads.** CI is green there, with `selected=2727 passed=2716 skipped=11`.
- r4136585695, taken in `96f18c45`, and taken again without a lock in `e3ef506a` (next round). The source arm asked `resolve_source` for the path by the entry's pair, and `resolve_source` looks the pair up again. So a refresh that re-registered the same key between the two lookups could put another root behind the path.
- `96f18c45` ran both lookups under the registry's own lock, `self.source.registry.atomically()`, the lock `register` and `drop` take.
- Its case ran the refresh on another thread. It was red against `687d37bf`'s arm, and red with the hold removed.
- r4136585637, not taken: it does not reproduce. `_register_baked` sets `baked_repository` (line 560) before it asks `_source_root_for` (line 561), and has done since `c27eac35`.
- Measured with `--repository` omitted: the entry is confined to the served checkout, and `/source/notes-toolshed-inventory.md` answers 200, keyed or not.
- Two existing tests pin the order, and both are red with the two lines swapped: `test_the_source_registers_the_snapshot_it_was_handed` and `test_generate_and_serve_run_with_no_sibling_importable`.
- Local whole suite at `96f18c45`: `selected=2729 passed=2718 skipped=11`, which is +2.
- **Copilot at `96f18c45`: "Changes recommended", 3 threads, all taken in `e3ef506a`.** CI is green there, with `selected=2729 passed=2718 skipped=11`.
- r4136863569: the seam does not declare `atomically()`, so a registry that passes the seam's probe could fail every `/source` request.
- The arm now asks nothing of the registry beyond the one resolution. It confines the path to the resolved entry's own root through `resolve_source_path`, its single entry point and the one the no-registry path already used. That applies the declared per-entry rule, `resolve_within`, as `serve_workbench.py` does for the roots it holds.
- There is no second lookup, so r4136585695's race stays closed with no lock.
- `tests/test_source_core_arm.py` pins the shape: one `resolve`, the entry's own root through `resolve_source_path`, and no `resolve_source` or `atomically` call in the arm. It fails against `687d37bf`'s arm and `96f18c45`'s.
- The race case, now `test_a_refresh_that_replaces_the_key_cannot_move_the_source_arms_root[unkeyed|keyed]`, shows the replacement lands before the path is confined, and the body is still the first entry's file. It is red against `687d37bf`'s arm.
- r4136863481: `get`, `active` and `len()` read without the registry's lock, so a reader could answer from the middle of a block `atomically()` holds.
- All three now read under the lock, as `entries()` and `keys()` already did.
- `test_a_read_waits_for_a_held_read_modify_write[active|resolve|get|len]`: a read on another thread starts while a held block has a session promoted, and it must answer as the block left the registry. Each case is red with its own lock removed.
- openXdox's registry has the same gap, listed for T059 above.
- r4136863311: a registered generator owes the seam only `kind` and an integer `schema_version`, and `_report` indexed `repository` and `generation`, so such a snapshot raised `KeyError` after it was written.
- The report now shows a lacking field, or one in another shape, as `<absent>`. `_stats` counts only a list or a mapping. The verb then goes on to the kind's validator.
- `test_generate_reports_a_snapshot_whatever_else_its_contract_carries`, over a minimal snapshot and one with other shapes. Both are red against `96f18c45`'s report, with `KeyError`.
- Local whole suite at `e3ef506a`: `selected=2735 passed=2724 skipped=11`, which is +6. F4.1's scan is unchanged, at 12.
## After #57 and #58 landed
- `92a9167` merges #57's final head `d7954fc6`, and `814516b7` merges `main` `a691e4e4` (#57), resolving its two add/add conflicts to ours: main's blob is `d7954fc6`'s in each. `c2a8ad9f` merges `main` `8ec08e91` (#58) with no conflict, and what it brings is exactly #58's squash. The validator stand-in stays until T058.
- **Copilot at `c2a8ad9f`: 1 thread, taken in `183b40fc`.** r4146219833: `_regenerate` passed `project_register_source` even when unset. It is now passed only when set, as the seam omits an unset input. `test_an_injected_generator_is_handed_the_register_only_when_one_is_set`, red against `c2a8ad9f`.
- **Copilot at `183b40fc`: 1 thread, not taken, made explicit in `0c946f4e`.** r4146370161 asked for `main` to be restored after an already-active session is regenerated. FR-014a forbids promoting a session, and an entry that was already active is not promoted by its own refresh. The docstring now says so, and `test_a_regenerate_promotes_no_session_and_moves_no_active_key` pins both halves.
- **Copilot at `0c946f4e`: "Needs a closer look", no findings, 0 threads.** CI is green, with `selected=2989 passed=2978 skipped=11 failures=0 errors=0`.
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Plan 034, slice P1-D, task T022. The plan is
specs/034-opendox-standalone-operation/tasks.mdin opensoft/openxFactory, read at #1167's head42f34ab7(landed asa65230f6, unchanged onmainatb5ec3899). The claim is opensoft/openXfactory#656 comment5850371775(both T021 and T022).5817152735.e295b1a9), T021 (LANDED, T021: authoring.py:318 resolves the home corpus through the registered seam #44 →9d13bd16), T016 (LANDED, Register openDox's default at the entry points; a host replaces it only before a build (T016) #42 →19370adc). All landed; all merged into this branch.What it does
Where no host has called
corpus_adapter.register_home(...), openDox's own entry points now register ahome_corpus-shaped factory over its own conformantWorkingTreeCorpus(src/opendox/runtime/local_git_adapter.py, aLocalGitCorpussubclass — see the ruling below) — exactly as the default profile stands in for an unregistered host (Group 3, T016). It starts at bare defaults (required_fields=()); phase 2's T054 sets the neutral fields R1Q13 decides. A bare process that builds nothing still meets 4.2'sADAPTER_NOT_REGISTEREDrefusal (T020, unchanged)._default_home_factorybuilds a freshWorkingTreeCorpus()on every call — no listing cache keyed on HEAD, so there is nothing to invalidate when the working tree changes under it.The seam gains one function, mirroring T016's
domain_profile.register_default(). While authoring this task I found T016's own draft PR (#42, not yet landed) already open, and it puts the "register only where nothing is" check insidedomain_profile.pyasregister_default(profile), socli.build_parser()'s own call is genuinely one line.corpus_adapter.pyhad no such helper (onlyregister_home()/home(), T020), so this task addscorpus_adapter.register_default_home(factory): it callshome()first, and registersfactoryonly on the ONE refusal kind that means "nothing is registered yet" (any otherCorpusRefusedis re-raised, never swallowed). Unlikeregister_default(), there is no after-build refusal to track — box 4.1a asks for nothing like RN-1's after-build semantics for the corpus adapter, so this stays as simple asregister_home()itself.LocalGitCorpus's own factory (_default_home_factory) is duplicated, byte-identical, incli.pyandserve.pyrather than living incorpus_adapter.py: that module cannot importlocal_git_adapterwithout creating the cyclelocal_git_adapter.pyalready has the other way (from opendox.corpus_adapter import …).Four call sites, mirroring T016's four exactly:
cli.build_parser()— the FIRST statement, ahead of the (pre-T016) profile read that can still refuseProfileNotRegisteredtoday.cli.main()— redundant withbuild_parser()'s own call (whichmain()calls next), kept for the same reason T016 keeps its own match: the outermost entry point states the contract on its own.serve.build_server()— the FIRST statement, ahead of the profile read two lines below.serve.main()— redundant withbuild_server()'s own call, same reasoning.Files:
src/opendox/cli.py,src/opendox/serve.py,src/opendox/corpus_adapter.py,src/opendox/runtime/local_git_adapter.py,tests/test_authoring_seam.py.The working-tree ruling:
WorkingTreeCorpusLocalGitCorpus(the conformant local-git adapter RULING C3 asks for) reads via git plumbing at a resolved revision —git ls-tree/git cat-file blobatresolve()'s revision, defaulting to git HEAD. That is the right read for a hosted session bound to a commit, but the wrong one for a standalone default: a standalone user's uncommitted edit would be invisible until they committed it, which is not what "point openDox at my working directory" means to someone editing in their own editor.WorkingTreeCorpus(LocalGitCorpus), appended tolocal_git_adapter.py, overrides exactly the two methods that decide where bytes come from, and nothing else:_list_documents_bound—git ls-files -z --cached --others --exclude-standard(tracked + untracked-but-not-ignored), notgit ls-tree._read_bound—(Path(corpus.location) / document.key).read_bytes()when no explicitrevisionis named, falling back to the parent's commit-based read (super()._read_bound(...)) when the caller DOES name one. An explicit revision still means what it always meant; only the default, no-revision read moved to disk.resolve(),classify()(which reads throughread(), so the override already flows into it),check()andwrite_back()are inherited unchanged —check()'s existing "uncommitted change" divergence semantics are deliberately untouched by this ruling, which is only about where the DEFAULT corpus's bytes come from.The edge case the ruling doesn't mention, and had to be decided anyway: the repository openDox's own "create a repository" act produces is bare (RULING C3, confirmed by
tests_runtime/test_local_git_adapter.py's own fixtures) — no working tree at all.WorkingTreeCorpusrefusesCorpusRefused(CORPUS_UNREADABLE, ...)with a detail naming the reason ("this repository is bare … register a host adapter instead, or point this default at an ordinary checkout") rather than silently falling back to git-HEAD reads or crashing on a missing directory.Falsifier, added to
tests/test_authoring_seam.py:test_an_uncommitted_edit_is_visible_through_the_defaultbuilds an ORDINARY (non-bare) checkout by hand, commits one file, resolves it through the registered default, reads the committed bytes, edits the file on disk WITHOUT committing, reads again through the same resolved corpus object, and asserts the new bytes are visible; then adds a brand-new untracked file and assertslist_documentsincludes it too.Red-checked: temporarily reverting
cli.py's factory back to plainLocalGitCorpus()makes this same test fail withAssertionError: the default served the committed bytes after an uncommitted edit -- it is reading git HEAD, not the working tree— proving the test actually exercises the ruling, not a vacuous assertion. Restored immediately after confirming the failure; the PR's actual head buildsWorkingTreeCorpus().A second, unplanned falsifier this class tripped:
tests_runtime/test_runtime_cli.py's anti-leak walk (an AST scan, run over every module in the runtime package, that aexcept <non-package-exception> as exchandler may not formatexc's text into evidence except through_safe_message/redact_credentials/redact_remote_url— the A25-1 regression class) flagged my first cut of_read_bound'sexcept OSError as failed:branch, which passedstr(failed)straight to_refuse(...). Fixed by routing it through this file's own established idiom for the identical concern (redact_credentials(str(exc)), already used forGitCommandFailed's OS-error path, with the exact same rationale recorded there: "An OS error's text can carry the argv's filename, so it is cleaned where it is composed" — here it is the working-tree file's own path, read byPath.read_bytes(), that could otherwise leak). Confirmed red before the fix (1 failed, 360 passed, the one failure being exactly this finding) and green after (361 passed) intests_runtime's full three-file replay ofvalidate.yml's step 3.Falsifier: the named test -- now genuinely real, T011 has landed
tests/test_authoring_seam.py::test_an_entry_point_registers_the_local_git_corpus_when_no_host_hascallscli.build_parser()with nothing registered, then requirescorpus_adapter.home()to return a factory whose adapter is aWorkingTreeCorpusinstance (updated for the ruling above; wasLocalGitCorpusbefore it).T011 (#46 →
0e88454a), T012 (#47 →2768302) and T016 (#42 →19370adc) have all landed, soopendox.cli/opendox.serveimport cleanly,domain_profile.register_default()runs at the same entry points this task's own registration does, and this whole file runs for real -- the ordinary way, with the root conftest in play, no--noconftest, no shim, no skip:All twelve pass (ten at the T016 merge, plus two more added during the Copilot remediation below: an end-to-end classify-through-the-default falsifier, and the same entry-point coverage for
serve.build_server()). Everytry: cli.build_parser() except domain_profile.ProfileNotRegistered: passtolerance in this file is now genuinely dead code -- T016 landed, sobuild_parser()no longer raises at all -- kept only as a harmless compatibility fallback, and the two stale docstrings/comments that used to describe this as a live "SKIPS today" condition were corrected during the Copilot rounds below.The remaining two cases (
test_register_default_home_leaves_an_existing_registration_alone,test_register_default_home_registers_where_nothing_has) exercisecorpus_adapter.register_default_home()directly, over stand-in factories, and always ran unconditionally -- no shim, no--noconftest, needed neither before this merge nor after.(Historical note, preserved for the record: before this merge, the two
importorskip-gated cases above skipped under both plain and--noconftestruns --8 passed, 2 skipped-- and were verified only under the Group 2 simulation shim,research.md's Appendix, giving10 passed. That shim is no longer needed for anything in this PR and was never committed.)Falsifier: F4.1's scan is unchanged
This task registers a default; it does not remove a deferred reach, and
corpus_adapter/local_git_adaptername neitheropenxdoxnorideation_dashboardnordoc_healthnorcorpus_adapter_openxfactory. Re-run at themain-merged head (8a3625e) againstmain's OWN current tip (9d13bd16, carrying T021+T011+T012 -- T011/T030 and T012 each removed a hit of their own, which is why the absolute count dropped from the 23/24 seen in earlier rounds of this PR to 19 here): bothmainat9d13bd16and this merged head scan to exactly 19, identical hits by identity (same file, same imported name, same enclosing function) -- the only per-line differences are the expected line-number shifts incli.py(610→618) andserve.py(640→647, 2055→2106) from this task's own registration call and_default_home_factorysitting above them. Zero new reaches, zero removed, confirmed by a normalized diff against a fresh worktree atmain's exact merged-in commit.Not re-run against the full scan tool after the T016 merge or the Copilot remediation rounds below, since neither touched an import statement: T016's own two files (
domain_profile.py,cli.py/serve.py's registration lines) are unrelated to this scan's targets, and every file the Copilot rounds touched (local_git_adapter.py,tests_runtime/test_local_git_adapter.py,tests/test_authoring_seam.py) was grepped directly for the same four names at the final head -- the only hits are pre-existing prose inauthoring.py's comments/docstrings (doc_health.corpus...,doc_health.lines..., and thecorpus_adapter_openxfactoryname inside a docstring describing what T021 REMOVED), none of them an actual import or attribute reach.The repository's own checks, replayed locally
validate.yml's three pytest steps are unaffected (no slice editsvalidate.ymlbefore T036; this task's new/changed tests are not in any of its file lists, excepttests_runtime/test_local_git_adapter.py, which IS on theruntime, hermeticstep's list) — replayed at each stage, file lists read directly from the workflow file each time:f6f07ae)d86677c)d6abe60)main+T016 merged in, final (9283278)pytestpytest (S7 residue)pytest (runtime, hermetic)(The
pyteststep's746 → 767climbs further than the earlier745 → 746because several more upstream PRs (T025/T026/T027 and others) merged intomainbetween the earlier checkpoints and this final one, all touching files already on that step's list, none of them this task's own doing -- same reasoning as the earlier745→746, just a larger number of intervening merges by this point. Theruntime, hermeticstep's361 → 372is fully this task's own: 11 new cases added across the Copilot remediation rounds below, all intests_runtime/test_local_git_adapter.py.)(The
pyteststep's745 -> 746is identical to what #44 itself measured post-merge -- not investigated to the single test name, but confirmed NOT this task's doing: this task's own new tests are all intests/test_authoring_seam.py, which is not on this step's file list at all, and the same+1appears on #44's branch, which carries none of T022's changes.tests_runtime's total floats by ±1 across repeated runs at the SAME commit -- a pre-existing, environment-timed flake unrelated to this change, recorded once and not re-investigated at every stage.)*One genuine regression surfaced mid-way, caught before commit, not a flake:
WorkingTreeCorpus's first cut of_read_bound'sexcept OSError as failed:branch putstr(failed)straight into a refusal, andtests_runtime/test_runtime_cli.py's anti-leak walk correctly flagged it (1 failed, 360 passed— see "The working-tree ruling" section above for the fix and the exact failure text). Fixed by routing the text throughredact_credentials(str(failed)), matching this file's own established idiom; every361 passedin the table above (including at this PR's very first, pre-ruling head, where the bug did not yet exist) is genuinely clean.The whole
tests/directory (real conftest throughout at and after themainmerge; the Group 2 shim only for the two earlier, pre-T011 stages):f6f07ae), with shim20 failed, 1242 passed, 13 skipped, 66 errorsd86677c), with shim20 failed, 1245 passed, 13 skipped, 66 errorsd6abe60), with shim20 failed, 1246 passed, 13 skipped, 66 errorsmainmerged in (8a3625e), REAL conftest, no shim18 failed, 1432 passed, 13 skipped, 66 errorsThe
20→18failed and66unchanged errors match #44's own post-merge numbers exactly (both branches merged the samemain). JUnit test-by-test diff (byclassname::name, exact) between the pre-ruling and post-ruling shimmed heads: zero outcomes changed, one new passing test (the working-tree falsifier). The jump to1432passed at the merged head ismain's own T010/T011/T012 tests joining the run for the first time (this PR touches none of them) plus this file's own count going from 6 (T021-only, on the old base) to 10 (all of T022's, all genuinely running now).T016 merged in
Merged
main(carrying T016,19370adc) into this branch atea83200. One real conflict, incli.py/serve.py: both T016'sdomain_profile.register_default(default_profile)and this task's owncorpus_adapter.register_default_home(_default_home_factory)wanted to be the literal first statement inbuild_parser()/main()andbuild_server()/main(). Resolved by keeping T016's call first (it has an immediate downstream read in the same function) and this task's second, with a comment explaining the order; also fixed a now-stale comment inserve.pyleft over from before the merge. A second conflict, intests/test_authoring_seam.py(main's squashed T021 and this branch's pre-squash T021 ancestor carrying the same content by different commit objects, the identical class of conflict the earliermainmerge hit), resolved the same way -- "theirs" contributed nothing, confirmed by an empty post-resolution diff.Copilot's review, in full: eleven rounds, every finding fixed
Per the standing instruction to wait for Copilot's review AT THE HEAD before READY -- and to read the review body, not just trust a green check-run conclusion -- eleven successive rounds of Copilot review each found something real after the T016 merge, every one fixed and verified red-before/green-after before moving to the next. In finding order:
authoring._classify_proposal()staged its input in a plain, non-gitTemporaryDirectory, andWorkingTreeCorpus.resolve()requires a git repository -- every classification call started refusingCORPUS_UNCLASSIFIABLE. Fixed with a_stage_as_a_repository_if_git_is_available()step, gated by the registered adapter's own MODULE NAME (neverisinstance, preserving_classify_proposal's "no privileged direct call" principle) so a host's non-git adapter is never affected._read_bound: a plainPath(corpus.location) / document.keyopen was vulnerable to an absolute-key override,..traversal, and a symlinked intermediate component. Fixed with a new_open_confined()-- a component-by-component,O_NOFOLLOW-at-every-step, descriptor-relative open -- plus name-based rejection of absolute/../.git/NUL keys.read()could not serve: gitlinks, untracked nested checkouts, and tracked-but-deleted files. Fixed with mode-based gitlink filtering, trailing-slash nested-repo filtering, and a per-candidate existence check through the same confined open.CorpusRef.revisionwas silently ignored in favor of current disk bytes. Fixed by also checkingcorpus.ref.revision.git init's ambient environment:GIT_TEMPLATE_DIRwas missing from the shared environment sanitizer, so an ambient template directory could plant a repository-localinfo/excludeinto a staged tree (demonstrated live: a hostile template really does get copied in unsanitized, and doesn't once filtered); a test helper (_init_ordinary_checkout) and this PR's OWN new test for the fix above BOTH separately built their git subprocess environment from a rawos.environcopy instead of the shared sanitizer, the identical hazard found and fixed three times in three different places across this remediation, plus once more in this file's own long-standing shared_GIT_ENVfixture (exposed, not introduced, by this task's first fixture to callgit initon a fresh location).list_documents()'s own existence check down with it. Fixed withO_NONBLOCKon the leaf open plus anS_ISREGcheck.read()exposed files the corpus's own definition excludes: a directly-constructedDocumentIdfor a.gitignored secret (a.env, say) was served, because confinement-to-the-root is not the same guarantee as membership-in-the-corpus. Fixed with a new_tracked_or_not_ignored()check ("tracked always wins" over a later ignore rule; a git failure here isCORPUS_UNREADABLE, never a false "not tracked" -- the eleventh finding, on this fix's own first cut).--noconftest/skip behavior in the present tense after T011 and T016 had already landed on this branch, which would misreport current coverage to a future reader.WorkingTreeCorpusitself (a large new class with zero directtests_runtime/cases before this remediation) and forserve.build_server()'s own registration line (AST-lifted, mirroringtest_profile_registration.py's established technique for the identical problem).Every fix above was verified by first reproducing the exact failure against the pre-fix code (a manual repro script, a temporary revert via
sed/direct text substitution, or a deliberately broken assertion), confirming it failed for the stated reason, fixing it, confirming green, and -- for anything touching a committed file -- confirming the revert-and-restore cycle left the file byte-identical to before. One mistake was caught and fixed within this same remediation, before it shipped: the first cut of finding 7's fix used:(literal)keypathspec magic, whichGitRunner's own pre-existing--literal-pathspecsflag (predating this session) turns from protective into actively wrong -- measured directly, then fixed by passing the bare key.Every threaded finding got a reply citing the exact fixing commit, then was resolved via GraphQL; two "previously missed" findings (9's
WorkingTreeCorpuscoverage gap, and one instance of 5's_GIT_ENVhazard) had no inline thread to reply to at all -- Copilot's overview lists them without a#discussion_rlink -- so their reasoning lives only in the fixing commit's own message. Zero unresolved review threads remain as of the final head.Status: READY
Final head
9283278. Working tree clean, T016/T011/T012 all landed and merged in, all threevalidate.ymlsteps green (767p/2s, 13p, 372p),tests/test_authoring_seam.pyat 12 passed, the anti-leak scan and the home-vocabulary scan both green, zero unresolved Copilot review threads.🤖 Generated with Claude Code