Skip to content

T021: authoring.py:318 resolves the home corpus through the registered seam - #44

Merged
brettheap merged 2 commits into
mainfrom
build/034-p1d-t021-authoring-seam
Sep 27, 2026
Merged

brettheap merged 2 commits into
mainfrom
build/034-p1d-t021-authoring-seam

Conversation

@brettheap

@brettheap brettheap commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

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

Plan 034, slice P1-D, task T021. The plan is specs/034-opendox-standalone-operation/tasks.md in opensoft/openxFactory. I read it at #1167's head 42f34ab7, which landed as a65230f6, and it is unchanged on main at b5ec3899. The claim is opensoft/openXfactory#656 comment 5850371775.

  • Realizes: 4.1, and 1 of 4.3's 8 reaches into openxFactory.
  • Ruled: R1Q22 (a), comment 5817152735. authoring.py is a moved_with_declared_edit carve row; the manifest records the carve as it arrived, so this arc edit needs no declared-edit act first.
  • After: T020 (LANDED, openDox-code#37 → e295b1a9), T011 (P1-A, still open).

What it does

opendox.authoring._classify_proposal read the publisher's factory by NAME — from corpus_adapter_openxfactory import home_corpus (authoring.py:318) — 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, exactly as that seam's own contract says: adapter, ref = home()(root). With nothing registered, home() refuses CorpusRefused(ADAPTER_NOT_REGISTERED), naming the seam and the remedy (4.2, unchanged, T020). With a factory registered — a host's own, or openDox's LocalGitCorpus default an entry point registers where no host has (4.1a, T022, stacked after this PR) — home() returns it for this function to call.

Files: src/opendox/authoring.py, tests/test_authoring_seam.py. Neither cli.py nor serve.py is touched by this task (that is T022's).

Falsifier 1: F4.1's first block

opendox.authoring, opendox.corpus_adapter and the four siblings' absence — none of this needs opendox.serve/opendox.cli, so this block runs today, with the root conftest out of the way (it is a plain python3 - script, not a pytest run):

$ python -c "import importlib.util as u, sys; sys.exit(any(u.find_spec(m) for m in ('openxdox', 'ideation_dashboard', 'doc_health', 'corpus_adapter_openxfactory')))" && echo "the four siblings are absent"
the four siblings are absent
$ python3 - <<'PY'
import opendox.authoring as a
from opendox import corpus_adapter as ca
try:
    got = a.required_header_fields()
except ModuleNotFoundError as e:
    raise SystemExit(f"FAIL: the deferred reach still imports a publisher module: {e}")
except ca.CorpusRefused as e:
    r = e.refusal
    assert r.kind == ca.ADAPTER_NOT_REGISTERED, f"refused for another reason: {r.kind!r}"
    assert "corpus_adapter" in r.subject, f"the refusal does not name the seam: {r.subject!r}"
    assert "register_home" in r.detail, f"the refusal does not name the remedy: {r.detail!r}"
    print("PASS: F4.1 first block -- CorpusRefused(ADAPTER_NOT_REGISTERED), naming the seam and the remedy")
else:
    raise SystemExit(f"FAIL: nothing is registered, yet the verb answered {got!r}")
PY
PASS: F4.1 first block -- CorpusRefused(ADAPTER_NOT_REGISTERED), naming the seam and the remedy

Falsifier 2: the named test, and red at main

tests/test_authoring_seam.py::test_required_header_fields_come_from_the_registered_adapter registers two distinct stand-in adapters in turn — each with its OWN required_fields tuple — and requires authoring.required_header_fields()'s answer to follow each one, proving the answer comes from the registered adapter and not from a name, a cache, or a coincidence of the first tuple chosen.

Why --noconftest. The named test runs with the root conftest in play, so it needs T011 (analyze evidence/analyze-round-1a.md finding V7, and this task's own After: line). With the root conftest in play today:

$ python -m pytest -q "tests/test_authoring_seam.py::test_required_header_fields_come_from_the_registered_adapter"
...
>   from ideation_dashboard import serve_openxfactory_lanes  # noqa: E402
E   ModuleNotFoundError: No module named 'ideation_dashboard'
src/opendox/serve.py:199: ModuleNotFoundError
1 error in 0.37s

The autouse declared_human_console fixture (tests/session_fixtures.py:397) imports opendox.cli, which imports opendox.serve (cli.py:74), which fails at serve.py:199 — the two import-time reaches T011 removes. So this PR is verified --noconftest, exactly as T020's and T026's own new seam tests were, and is re-verified without the flag once T011 has landed, before READY:

$ python -m pytest -q --noconftest "tests/test_authoring_seam.py::test_required_header_fields_come_from_the_registered_adapter"
1 passed in 0.11s
$ python -m pytest -q --noconftest tests/test_authoring_seam.py
6 passed in 0.07s

Red at main. With this PR's test added but authoring.py left at main's 582ed07 (the unfixed from corpus_adapter_openxfactory import home_corpus):

$ python -m pytest -q --noconftest "tests/test_authoring_seam.py::test_required_header_fields_come_from_the_registered_adapter"
>       from corpus_adapter_openxfactory import home_corpus
E       ModuleNotFoundError: No module named 'corpus_adapter_openxfactory'
src/opendox/authoring.py:318: ModuleNotFoundError
1 failed in 0.11s

Falsifier 3: F4.1's scan

#1144's Group 4 FALSIFIED BY ast block (tools/scan_deferred_reaches.py src/opendox, persisted byte-identical to evidence/remeasure-2026-09-25.md's copy, sha256 fe11620319b02c23dd9a014bc581e1f4867f013f3c26890d43b12dccce5530a0). The whole scan stays red until T089. This task's one hit is gone, and nothing else in the list moved:

$ diff <(scan at main 582ed07) <(scan at this head)
1d0
< src/opendox/authoring.py:318: corpus_adapter_openxfactory  [in _classify_proposal]
25c24
< 24 deferred reaches
---
> 23 deferred reaches

At main (582ed07, T020 and T026 both landed) the scan finds 24 deferred reaches, authoring.py:318 among them. At this head it finds 23, authoring.py no longer appearing anywhere in the list, and every other line unchanged.

The repository's own checks, replayed locally

validate.yml's three pytest steps are UNCHANGED, because no slice edits validate.yml before T036 (which removes its file lists), so this new test is not in any of them yet — the plan's own note (tasks.md § Phase 1: "A new test first runs in the required check there"):

step at main (582ed07) at this head
pytest 745 passed, 2 skipped 745 passed, 2 skipped
pytest (S7 residue) 13 passed 13 passed
pytest (runtime, hermetic) 360 passed, 1 skipped 360 passed, 1 skipped

Identical to T026's own report (openDox-code#39): selected 1121, passed 1118, skipped 3, unchanged.

The whole suite, with the Group 2 shim (research R3's measurement; .[runtime,test] in one venv; shim byte-identical to research.md's Appendix, sha256s e3b0c442… and e00c4c5f…):

tree result
main (582ed07) 20 failed, 1241 passed, 13 skipped, 66 errors
this head 20 failed, 1242 passed, 13 skipped, 66 errors

I compared the two JUnit reports test by test (by classname::name): zero outcomes changed, and exactly one test is new — tests.test_authoring_seam::test_required_header_fields_come_from_the_registered_adapter, passing. The 20 failed / 66 errors are the same red results research R3 recorded, in the same nine files, none of which this PR touches.

Why draft

T011 (P1-A) has not landed. Until it does, opendox.cli/opendox.serve do not import in a lone checkout, so this task's named test cannot be exercised through the ordinary (non---noconftest) suite the required check will eventually run — only --noconftest, as shown above, and under the Group 2 shim for the whole-suite comparison. Once T011 lands, I will merge main in, re-run the named test WITHOUT --noconftest (with the real root conftest, no shim), confirm the whole suite and validate.yml's three steps are still clean, and take this PR to READY.

🤖 Generated with Claude Code

Summary by Sourcery

Route authoring corpus resolution through the registered adapter seam and verify that adapter selection is dynamic.

Bug Fixes:

  • Resolve authoring proposals through the registered corpus adapter instead of importing the publisher-specific factory by name.
  • Prevent authoring from failing with a publisher-module import error when no corpus adapter is registered, allowing the seam to provide its standard refusal.

Tests:

  • Add seam coverage proving authoring follows successive registered adapters and their distinct required header fields.

…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>
Copilot AI lite review requested due to automatic review settings September 26, 2026 22:35
@sourcery-ai

sourcery-ai Bot commented Sep 26, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR removes authoring’s deferred dependency on corpus_adapter_openxfactory and resolves the home corpus through the registered corpus_adapter.home() seam, with a regression test demonstrating that successive adapter registrations control the returned required fields.

Sequence diagram for authoring through the registered corpus seam

sequenceDiagram
    participant Caller
    participant Authoring
    participant Seam as corpus_adapter.home
    participant Adapter

    Caller->>Authoring: required_header_fields()
    Authoring->>Seam: home()
    alt adapter registered
        Seam-->>Authoring: factory
        Authoring->>Adapter: factory(root)
        Adapter-->>Authoring: adapter, ref
        Authoring->>Adapter: resolve(ref)
        Adapter-->>Authoring: resolved
        Authoring->>Adapter: classify(resolved, DocumentId)
        Adapter-->>Authoring: classification
        Authoring-->>Caller: required fields
    else no adapter registered
        Seam-->>Authoring: CorpusRefused(ADAPTER_NOT_REGISTERED)
        Authoring-->>Caller: CorpusRefused
    end
Loading

File-Level Changes

Change Details Files
Route authoring’s home-corpus lookup through the registered corpus adapter seam instead of importing the publisher-specific factory by name.
  • Replace the deferred publisher import with the local corpus_adapter.home() resolver.
  • Preserve the existing resolve/classify flow while allowing host-registered or default adapters to supply the corpus.
  • Document the seam behavior and unregistered-adapter refusal path.
src/opendox/authoring.py
Add a seam-focused regression test proving authoring follows successive adapter registrations.
  • Register two distinct stand-in adapters with different required-field tuples.
  • Assert required_header_fields() reflects each registered adapter and invokes its resolver.
  • Verify each call uses a separate staged root.
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!

Customizing Your Experience

Access your dashboard to:

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

Getting Help

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Normal-suite verification remains pending until T011 lands.

Review effort: Lite
Findings: None

What changed in this PR

Routes proposal classification through the registered corpus adapter seam and adds regression coverage.

Changes:

  • Replaces the publisher-specific factory import with corpus_adapter.home().
  • Tests dynamic adapter registration and replacement.
File Description
tests/​test_authoring_seam.py Verifies adapter-backed header field resolution.
src/​opendox/​authoring.py Resolves the home corpus through the registered seam.

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

Brings in T011 (#46, 0e88454: remove serve.py's two import-time
reaches) and T012 (#47, 2768302: read a checkout's HEAD with openDox's
own reader), plus the T010/T025/T026/T027 merges already folded into
main earlier. opendox.cli and opendox.serve now import cleanly, so
T021's named test can run for real (no shim, no importorskip skip).

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

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings September 27, 2026 02:56
@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

The regression test is not included in any required CI workflow.

Review effort: Lite
Findings: None

@brettheap
brettheap marked this pull request as ready for review September 27, 2026 02:59

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

You can request another review in 1 day and 18 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@brettheap

Copy link
Copy Markdown
Contributor Author

READY at head 35334feb (35334febbd9ff795fb07e15c5e5ef4f83f1bc206).

main merged in (a real merge commit, no rebase, no force-push) now that T011 (#46 -> 0e88454a) and T012 (#47 -> 2768302) have both landed. opendox.cli/opendox.serve import cleanly for real now, so this is the first genuine (non-shimmed, non-skipped) verification of this PR:

  • tests/test_authoring_seam.py, real conftest, no --noconftest, no shim: 6 passed (T021's own tests only -- this branch does not carry T022's later commits).
  • validate.yml's three pytest steps, replayed with the file lists read directly from the workflow file at this head: pytest 746 passed/2 skipped, pytest (S7 residue) 13 passed, pytest (runtime, hermetic) 361 passed.
  • Whole tests/ directory, real conftest: 18 failed, 1428 passed, 13 skipped, 66 errors -- the 66 errors and general shape match every prior baseline exactly (same count observed at plain main before this slice existed), confirming they are pre-existing and unrelated to this change, not a regression from the merge.
  • Copilot's review at this exact head (copilot-pull-request-reviewer, completed, success): zero findings, zero review threads. Its one note ("the regression test is not included in any required CI workflow") is the already-documented, plan-convention state -- validate.yml's file lists are not touched before T036 -- not an action item for this PR.

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

@brettheap
brettheap merged commit 9d13bd1 into main Sep 27, 2026
5 checks passed
@brettheap

Copy link
Copy Markdown
Contributor Author

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

LANDED — lane openxfactory-4, 2026-09-27T03:01:18Z, PR #44 → 9d13bd1 (opensoft/openDox-code main; plain gate)

Brett: land the phase 1 PRs when green

(The holder posted this record by hand: the kit merged, then failed before writing it, because the script was edited while it ran.)

brettheap added a commit that referenced this pull request Sep 27, 2026
main is 9d13bd1, which adds P1-D's T021 (#44) to what the last merge took.
It touches no file of T016's.

Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
brettheap added a commit that referenced this pull request Sep 27, 2026
…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
brettheap added a commit that referenced this pull request Sep 27, 2026
> **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.

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.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`](opensoft/openXfactory#656 (comment)) (both T021 and T022).

- **Realizes**: 4.1a.
- **Ruled**: R1Q3 (a), R1Q22 (a), comment `5817152735`.
- **After**: T020 (LANDED, #37 → `e295b1a9`), T021 (LANDED, #44 → `9d13bd16`), T016 (LANDED, #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 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 *inside* `domain_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.

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: `WorkingTreeCorpus`

`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:

- `_list_documents_bound` — `git ls-files -z --cached --others --exclude-standard` (tracked + untracked-but-not-ignored), not `git ls-tree`.
- `_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:

```
$ python -m pytest -q tests/test_authoring_seam.py
............
12 passed in 0.30s
```

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:

| step | at #44's head (`f6f07ae`) | pre-ruling (`d86677c`) | post-ruling (`d6abe60`) | `main`+T016 merged in, final (`9283278`) |
|---|---|---|---|---|
| `pytest` | 745 passed, 2 skipped | 745 passed, 2 skipped | 745 passed, 2 skipped | 767 passed, 2 skipped |
| `pytest (S7 residue)` | 13 passed | 13 passed | 13 passed | 13 passed |
| `pytest (runtime, hermetic)` | 361 passed | 361 passed | 361 passed\* | 372 passed |

(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):

| tree | result |
|---|---|
| #44's head (`f6f07ae`), with shim | `20 failed, 1242 passed, 13 skipped, 66 errors` |
| #45 pre-ruling (`d86677c`), with shim | `20 failed, 1245 passed, 13 skipped, 66 errors` |
| #45 post-ruling (`d6abe60`), with shim | `20 failed, 1246 passed, 13 skipped, 66 errors` |
| `main` merged in (`8a3625e`), REAL conftest, no shim | `18 failed, 1432 passed, 13 skipped, 66 errors` |

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:

1. **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.
2. **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.
3. **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.
4. **A pinned `CorpusRef.revision` was silently ignored** in favor of current disk bytes. Fixed by also checking `corpus.ref.revision`.
5. **`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).
6. **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.
7. **`read()` exposed files the corpus's own definition excludes**: a directly-constructed `DocumentId` for a `.gitignore`d 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).
8. **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.
9. **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.

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


Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
brettheap added a commit that referenced this pull request Sep 27, 2026
…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>
brettheap added a commit that referenced this pull request Oct 6, 2026
…del and doxchat-untrusted, the census row, and the selector-class pin (plan 038) (#94)

Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Authored by lane openXfactory-3, delegated by lane openxfactory-4 (#656 6021862323)
Arc: neutral-product-standalone-operability

**T104: styles.css rules for the rail's two remedy lines, `doxchat-no-model` and `doxchat-untrusted`, the census row, and the selector-class pin (plan 038)**

There is no `tasks.md` entry for T104 yet: lane 4 records T095 to T104 after T002 (#1251). Its contract here is the slice outline row of `R2-INV-R9` ("T104 openDox-code `styles.css`", means SF), the holder's rulings `6021830531`, and the holder's admission of a third file, `6022291206` (below).

**Realizes:** #1144 requirement 9's declared composed tests (T073, F9.1), by repairing the one composed red that is an openDox defect: openXdox-code `tests/test_renderer.py::test_every_constructed_doxbench_class_has_a_styles_rule` (R2-INV-R9 part B, bucket `opendox-defect`).

**Falsifier:**
1. openDox-code's whole suite green, with the census test (`tests/test_web_boundary.py`) green on the new row. MET (below).
2. The one composed openXdox-code node goes green after the openDox pin chain (T027 then T028) carries this commit. That half is NOT this PR's: it is quoted as "after the pin". It is demonstrated locally below, by installing openDox from this branch in a composed run.

**Ruled:** R9-W7 (#656 `6021830531`): the census chain is T025 (landed, `84f8ed83`), then T104, then T015, T016, T057, with T104 straight after T025. **T104 (`6022096172`) is ruled YES in #656 `6022291206`:** T104's Files gain `tests/test_binding_stylesheets.py`'s selector-class count pin, 572 to 574 for the two rules T104 adds.
**Decisions:** SF is a traced singleton fix and edits no protected file. Rules in the neighbouring register (`.doxchat-unavailable`), never an error colour; `[hidden]` twin as the neighbours carry.

## The defect

`views/doxbench-chat.js` has constructed two classes since T081 (#74): `doxchat-no-model` (16.4's no-model remedy line) and `doxchat-untrusted` (16.3a's trust remedy line). `styles.css` carried no rule for either. The T100 P1-1 tripwire in openXdox-code reads exactly that, and is red in the composed run:

```
AssertionError: constructed classes with ZERO styles.css rules (the T100 P1-1 failure class): ['doxchat-no-model', 'doxchat-untrusted']
```

## The change (three commits, and two merges of main)

1. `f9e7757c`, `src/opendox/web/styles.css`, beside `.doxchat-unavailable`: one rule for the two classes (`font-size: 12px; color: var(--muted); padding: 6px 8px; border: 1px dashed var(--border); border-radius: 6px; overflow-wrap: anywhere`) and one `[hidden]` twin. They are the same quiet inline note as the neighbour, because each is a state with a stated repair, never an error. `overflow-wrap: anywhere` because the text carries commands and the rail is a third of the width. The comment spells the two class names WITHOUT a leading dot on purpose: the tripwire asks whether the text `.<class>` occurs in the file, and a dotted mention would let it pass with the rules gone (a mutant below proved it). And `tests/fixtures/web_boundary_census.yaml`: styles.css `loc` 2520 to 2539, class C's total 12769 to 12788, and the row's note records the step.
2. `f14497c7`, `tests/test_binding_stylesheets.py`: the pinned count of classes `styles.css` declares in selectors, 572 to 574 (`doxchat-no-model`, `doxchat-untrusted`; both are named by openDox's bundle, so neither is an orphan). The test's own message says "if one arrived, re-derive this number and say so". The outline did not name this file; the first commit was red on this one test until the holder admitted it.
3. `d309e083`, `tests/fixtures/web_boundary_census.yaml`, note text only (Copilot r4199454220): the Q7 sentence that said the file "declares" 572 selector classes is past tense and dated to that act, and this slice's step states the current 574. `loc` and the totals are unchanged.

The branch also merges `main` twice, never rebased: `032f4542` (T011, `09b8d44a`) and `4a772b33` (T014, `a7a1c4d3`). Neither touches a file of this PR.

## Falsifier, part 1: openDox-code's whole suite, as CI runs it

- **CI at the final head `4a772b33`** (run 37540426868, all three checks green): `validate` pass, 13m54s, `5524 passed, 11 skipped` (sandbox required, PostgreSQL 16 service); the triple step printed `triple: selected=5535 passed=5524 skipped=11 failures=0 errors=0` against floors `3977 / 3966` and `skipped==11`. `acceptance` pass, SonarCloud Code Analysis pass. The floors are unchanged: this PR adds and removes no test (the count moved only with `main`'s T011 and T014).
- **CI at `f14497c7`** (before the merges): `validate` pass, `5461 passed, 11 skipped`; `triple: selected=5472 passed=5461 skipped=11 failures=0 errors=0`.
- **CI at the first commit `f9e7757c` (the red, as predicted):** `validate` fail, `1 failed, 5460 passed, 11 skipped`; the one failure was `tests/test_binding_stylesheets.py::test_the_design_tokens_and_the_shared_selectors_stayed` (`styles.css declares 574 classes in selectors and this census says 572`). Nothing else was red.
- **Local, at `f14497c7`:** not completed. The local run was stopped at about 50% on the lane's drain order, so there is no local full-suite result at this head, and CI above is the full suite as CI runs it. Local evidence at this head's content: `tests/test_web_boundary.py` and `tests/test_binding_stylesheets.py` read `34 passed` with the pin patch applied (before it was committed).

## Falsifier, part 2: the composed node, red then green (LOCAL demonstration, not the pin)

Form: R1Q23 (a). openXdox-code #44's head `b4993d1` (T020 to T022 composed), openxFactory `92010d3e` with `openDox`, `openXdox` and `openXwallet` initialized recursively, its `scripts/` on `PYTHONPATH`, T022's `scripts/composed_placements.py` placed first and `--remove`d after (status clean), colour variables unset, `TERM=dumb`, short TMPDIR. openDox is installed (non-editable) from a `git archive` of `84f8ed83` for the base and of this branch's first commit for the green run (the second commit changes a test of this repository only). `tests/test_renderer.py` run ALONE:

| | the node alone | the file alone |
|---|---|---|
| base `84f8ed83` | `1 failed` | `25 failed, 25 passed` |
| this branch | `1 passed` | `24 failed, 26 passed` |

The set difference of the two failed lists is exactly the one node (`diff` shows only `test_every_constructed_doxbench_class_has_a_styles_rule`). The 24 left are other slices' (HH 12, DJ+VR 5, CP 3, LI 3, PI 1).

## Mutants

| mutant | where | result |
|---|---|---|
| M1: `doxchat-no-model` removed from both selector lists | composed node | killed: `['doxchat-no-model']` |
| M2: `doxchat-untrusted` removed from both lists | composed node | killed: `['doxchat-untrusted']` |
| M3: census `loc` left at 2520 | `test_web_boundary.py` | killed: `census loc drifted ... [('styles.css', 2520, 2539)]` |
| M4: census class C total left at 12769 | `test_web_boundary.py` | killed: `declared totals disagree with its own rows` |
| M5: the pin left at 572 | `test_binding_stylesheets.py` | killed by the first commit's own red (CI `f9e7757c`, above) |
| M6 (informational): base rule's selectors renamed, `[hidden]` twin kept | composed node | SURVIVES: the tripwire is a substring test and the twin spells the class. Same blind spot as every neighbour; it is openXdox-code's test, not this slice's. The `[hidden]` rule itself has no test (the rule sets no `display`, so the browser's own `[hidden]` already hides the line; it is kept for the neighbours' register). |

## Review

Copilot reviewed `f9e7757c` (one finding, the 572 pin: fixed by the second commit, replied and resolved), `f14497c7` twice (the description still calling the pin file excluded: fixed in the body; then the census note's 572 and 574 read as contradictory: fixed by `d309e083`; each replied and resolved), `d309e083` (**Findings: None**) and **the final head `4a772b33` (Findings: None)**. Threads: 3, all resolved, **0 unresolved** (GraphQL `reviewThreads`, read at the final head).

## Files

`src/opendox/web/styles.css`, `tests/fixtures/web_boundary_census.yaml`, `tests/test_binding_stylesheets.py` (admitted by `6022291206`).

## NOT done

- The openDox pin chain (T027 then T028, or a later pin pair): not this PR's. Until it carries this commit, the composed node stays red in the composed run.

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


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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants