Skip to content

T026: the health-check seam -- run_scoped_doc_health resolves the registered check (workbench.py:1407-1409) - #39

Merged
brettheap merged 1 commit into
mainfrom
build/034-p1e-health-check-seam
Sep 26, 2026
Merged

brettheap merged 1 commit into
mainfrom
build/034-p1e-health-check-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-E, task T026. 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 5850107036.

  • Realizes: 4.3, 3 of its 8 reaches into openxFactory.
  • Ruled: R1Q22 (a), comment 5817152735. The carved file needs no declared-edit act.
  • After: T006, which is done. This PR depends on nothing that is still open, so it can leave draft once its checks and review are clean.

What it does

workbench.run_scoped_doc_health imported openxFactory's doc_health package inside its body (workbench.py:1407-1409 at 1e4a57fb). Those are three of the eight deferred reaches into the publisher.

  • The seam. The action now runs the check that a host registered with opendox.workbench.register_health_check(check). unregister_health_check() and health_check_registered() sit beside it. The registration follows opendox.domain_profile's one-registration idiom:
    • registering the same object again does nothing;
    • registering a different one is refused;
    • registering a non-callable raises TypeError.
  • Nothing registered. The action returns not-available and records it. The detail, HEALTH_CHECK_NOT_REGISTERED, names the seam and the registration call, which is 4.2's discipline, and nothing is reported clean. That holds until openDox's own check lands (Group 6, release 2).
  • A registered check is called as check(repo_root, documents, *, repository, as_of, families) and answers a HealthCheckRun(findings, documents_checked).
    • Unchanged from before: the argument defaults, the health/scoped/... reference, the detail string, the action-history record, and the filter that keeps only findings on the scoped documents.
    • An answer that is not a HealthCheckRun is refused. It is never read as a clean scope.
    • The check's own refusals, such as an unknown family, reach the caller unchanged.

Files: src/opendox/workbench.py, and a new tests/test_health_check_seam.py. validate.yml is not touched, because no slice edits it before T036. The module-docstring edit keeps the line count, so session_documents's reach stays at workbench.py:746 for T025.

Falsifier 1: F4.1's scan

This is #1144's Group 4 FALSIFIED BY ast block, run from the checkout as python3 - src/opendox. The whole scan stays red until T089. This task's three hits are gone, and nothing else in the list moved:

$ diff <(scan at main 1e4a57fb) <(scan at this head)
24,26d23
<   src/opendox/workbench.py:1407: doc_health
<   src/opendox/workbench.py:1408: doc_health.families
<   src/opendox/workbench.py:1409: doc_health.runner

At main the scan finds 27 deferred reach(es). At this head it finds 24 deferred reach(es), listed here:

  src/opendox/authoring.py:318: corpus_adapter_openxfactory
  src/opendox/branch_session.py:1568: openxdox
  src/opendox/branch_session.py:1587: openxdox.register
  src/opendox/branch_session.py:2005: openxdox
  src/opendox/branch_session.py:2105: openxdox.snapshot_registry
  src/opendox/branch_session.py:2151: openxdox.snapshot_registry
  src/opendox/branch_session.py:2228: openxdox.snapshot_registry
  src/opendox/branch_session.py:3573: openxdox.snapshot_registry
  src/opendox/cli.py:610: openxdox.snapshot_registry
  src/opendox/doxbench_packet.py:177: ideation_dashboard.doxbench_status_exemption
  src/opendox/serve.py:1993: openxdox.corpus_root
  src/opendox/serve.py:629: openxdox.corpus_root
  src/opendox/serve.py:713: doc_health.corpus
  src/opendox/serve_project.py:246: openxdox.gate_console
  src/opendox/serve_project.py:247: openxdox.kickoff
  src/opendox/serve_wire.py:1369: ideation_dashboard
  src/opendox/serve_workbench.py:1215: openxdox
  src/opendox/serve_workbench.py:1665: openxdox
  src/opendox/serve_workbench.py:2607: openxdox
  src/opendox/serve_workbench.py:347: openxdox
  src/opendox/serve_workbench.py:407: openxdox
  src/opendox/serve_workbench.py:408: openxdox
  src/opendox/serve_workbench.py:544: openxdox
  src/opendox/workbench.py:746: doc_health

Falsifier 2: the seam test

The run is in a fresh venv with pip install ".[test]". It first asserts that the four siblings are absent:

$ 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
$ python -m pytest -q tests/test_health_check_seam.py --noconftest
19 passed in 0.17s

Red at main. With the same file copied onto 1e4a57fb, the run gives 18 failed, 1 passed. The decisive failure is the booby-trapped doc_health package in sys.modules, which main reaches:

AssertionError: the action reached the publisher's package: ['doc_health.DEFAULT_THRESHOLDS', 'doc_health.corpus', 'doc_health.DEFAULT_THRESHOLDS']

The case that passes at main is the negative control: it parses the body this PR replaced and catches its three reaches.

Why --noconftest. The plan requires it (tasks.md § Phase 1). With the root conftest in play, the file errors 19 times on ModuleNotFoundError: No module named 'ideation_dashboard'. The autouse declared_human_console fixture raises it when it imports opendox.cli, and it stops once T011 lands. With the Group 2 shim on the path, which simulates T011, the whole suite runs with the root conftest, and these 19 cases pass there.

The repository's own checks

validate, replayed locally. Its three pytest steps give the same results as main:

step result
pytest 745 passed, 2 skipped
pytest (S7 residue) 13 passed
pytest (runtime, hermetic) 360 passed, 1 skipped

The triple is unchanged: selected 1121, passed 1118, skipped 3. The new file is in none of validate's lists, so it moves no floor. The CI validate check on this PR is the gate.

The whole suite, with the Group 2 shim (research R3's measurement, in a venv with .[runtime,test]):

tree result
main 20 failed, 1217 passed, 13 skipped, 66 errors
this head 20 failed, 1236 passed, 13 skipped, 66 errors

I compared the two JUnit reports test by test. No outcome changed. The 86 red results are the same 86, in R3's nine files, and the 19 new cases pass.

For the tasks downstream

  • T046 (P1-K). The host registers its doc_health check here, once, at start. Its body is the code this PR removed from openDox:

    def scoped_doc_health(repo_root, documents, *, repository, as_of, families):
        from doc_health import DEFAULT_THRESHOLDS, corpus as dh_corpus
        from doc_health.families import FAMILIES
        from doc_health.runner import Context, run_suite
        wanted = set(documents)
        docs = [d for d in dh_corpus.load_docs(repository, repo_root) if d.path in wanted]
        ctx = Context(repo_paths={repository: repo_root}, docs=docs, capabilities={},
                      change_ids={}, git=dh_corpus.RealGit(), thresholds=dict(DEFAULT_THRESHOLDS),
                      as_of=as_of, agg_root=None)
        findings = []
        for fam in families:
            if fam not in FAMILIES:
                raise workbench.WorkbenchError(f"unknown doc-health family {fam!r}")
            findings.extend(run_suite(ctx, fam, set()).findings)
        return workbench.HealthCheckRun(findings=tuple(findings), documents_checked=len(docs))
    
    workbench.register_health_check(scoped_doc_health)
  • T035 (P1-G). tests/test_workbench.py's three scoped doc-health cases (:456-489) run openxFactory's real doc_health, so with this seam they need that check registered. The file is in the root conftest's collect_ignore and in no CI step (research R4), so nothing goes red here. T035 decides where the three cases land.

  • T040 and T041 (P1-I, P1-J). openXdox-code's tests/test_authoring_agent.py:116 calls run_scoped_doc_health and asserts completed. It is one of the 50 files in T041's doc_health exclusion (T005, class A). Any run of that case at the phase-1 pin also needs the host's check registered.

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

🤖 Generated with Claude Code

Summary by Sourcery

Resolve scoped document health through a host-provided registration seam instead of directly importing publisher health-check machinery.

New Features:

  • Add a host-registered health-check seam for scoped document health actions.

Bug Fixes:

  • Prevent scoped health checks from importing publisher-only packages and incorrectly treating unavailable checks as clean results.

Enhancements:

  • Enforce single-check registration with idempotent повтор registration, explicit replacement, callable validation, and typed health-check results.
  • Preserve scoped finding filtering, action recording, defaults, and propagation of check-owned refusals through the new interface.

Tests:

  • Add coverage for registration behavior, unavailable checks, argument passing, result validation, finding scoping, publisher-package isolation, and static deferred-reach detection.

workbench.run_scoped_doc_health imported openxFactory's doc_health package
inside its body (workbench.py:1407-1409 at 1e4a57f): three of the eight
deferred reaches into the publisher that opensoft/openXfactory#1144's task
4.3 routes in phase 1 (plan 034, tasks.md T026).

It now runs the check a host registered with
opendox.workbench.register_health_check(check). With nothing registered it
returns and records not-available, naming the seam and the registration
call, which is 4.2's discipline. It stays so until openDox's own check lands
(Group 6, release 2); the host registers its doc_health check there (T046).
The action's arguments, defaults, reference, detail and scoped-findings
filter are unchanged for a registered check.

tests/test_health_check_seam.py holds the seam to that: not-available
naming its remedy, a booby-trapped doc_health that is never reached, a
registered stand-in answering through the seam, the one-registration
discipline, and an ast check that the seam and the action make no deferred
reach.

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:04
@sourcery-ai

sourcery-ai Bot commented Sep 26, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR removes three deferred imports of the publisher’s doc-health package by introducing a host-owned, single-registration health-check seam, while preserving scoped action behavior and adding comprehensive tests for availability, invocation, validation, registration discipline, and static dependency isolation.

Sequence diagram for the registered scoped health-check run

sequenceDiagram
    participant Host
    participant Workbench
    participant Check
    participant ActionHistory

    Host->>Workbench: register_health_check(check)
    Workbench-->>Host: check
    Workbench->>Workbench: run_scoped_doc_health(repo_root, documents, repository, as_of, families)
    Workbench->>Check: check(repo_root, documents, repository, as_of, families)
    Check-->>Workbench: HealthCheckRun(findings, documents_checked)
    Workbench->>Workbench: filter findings by requested document paths
    Workbench->>ActionHistory: record_action(ACTION_DOC_HEALTH, reference)
    Workbench-->>Host: ActionResult(completed, findings)
Loading

State diagram for health-check registration discipline

stateDiagram-v2
    [*] --> Unregistered
    Unregistered --> Registered: register_health_check(check)
    Registered --> Registered: register_health_check(same check)
    Registered --> Registered: register_health_check(different check) / WorkbenchError
    Registered --> Unregistered: unregister_health_check()
    Unregistered --> Unregistered: register_health_check(non-callable) / TypeError
Loading

File-Level Changes

Change Details Files
Replace the in-process publisher-specific doc-health implementation with a host-registered health-check seam.
  • Add a process-global registration API with callable validation, idempotent same-object registration, conflicting-registration refusal, unregister support, and status inspection.
  • Introduce the HealthCheckRun result contract and invoke the registered check with preserved defaults and scoped arguments.
  • Return a recorded not-available result when no check is registered, without importing publisher packages.
  • Reject malformed check results, preserve check-raised refusals, and retain scoped finding filtering, references, details, and action history behavior.
  • Update the workbench documentation to describe the seam and deferred host ownership.
src/opendox/workbench.py
Add focused behavioral and static tests proving the seam is isolated, correctly governed, and compatible with existing action semantics.
  • Cover unregistered behavior, action-history recording, registered invocation, defaults, filtering, and check refusals.
  • Cover invalid results and registration lifecycle rules.
  • Use trapped publisher modules and AST inspection to verify the action and seam no longer reach deferred foreign packages.
  • Add a negative control demonstrating the static check catches the removed import pattern.
tests/test_health_check_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

@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 new seam test suite is not included in repository CI and must be wired into a pytest step.

Review effort: Lite
Findings: None

What changed in this PR

Introduces a host-registered health-check seam, removing direct publisher imports while preserving scoped execution behavior.

Changes:

  • Adds registration APIs and typed HealthCheckRun results.
  • Handles unavailable and invalid health-check results.
  • Adds seam, scoping, validation, and isolation tests.
File Description
tests/​test_health_check_seam.py Tests registration, validation, scoping, unavailable behavior, and publisher isolation.
src/​opendox/​workbench.py Implements the health-check registration seam and delegated execution.

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

@brettheap

Copy link
Copy Markdown
Contributor Author

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

On Copilot's overview at a17feed4: "The new seam test suite is not included in repository CI and must be wired into a pytest step."

This is deliberate, because the plan says so. Plan 034's tasks.md § Phase 1 (opensoft/openxFactory specs/034-opendox-standalone-operation/, unchanged on main at b5ec3899) says:

No slice edits openDox-code's validate.yml before T036, which removes its file lists. A new test first runs in the required check there.

The rule comes from T006's analyze, finding U2 (evidence/analyze-round-1a.md). Four G1 slices run in parallel, and if each appended its test to validate.yml's one --noconftest list, they would collide on it. T036 then makes the required validate job run the whole suite, with testpaths = ["tests", "tests_runtime"] and no file lists, and that run collects this file.

Until T036 lands, this PR quotes the run the plan asks for (PR body, falsifier 2). In a fresh venv with pip install ".[test]" and the four siblings asserted absent, python -m pytest -q tests/test_health_check_seam.py --noconftest gives 19 passed.

Copilot's review opened no thread ("Findings: None"), so there is nothing to resolve.

@brettheap
brettheap marked this pull request as ready for review September 26, 2026 22:10
@brettheap

Copy link
Copy Markdown
Contributor Author

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

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

@brettheap
brettheap merged commit 582ed07 into main Sep 26, 2026
5 checks passed
@brettheap

Copy link
Copy Markdown
Contributor Author

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

LANDED — lane openxfactory-4, 2026-09-26T22:12:14Z, PR #39 → 582ed07 (opensoft/openDox-code main; plain gate)

Brett: land the phase 1 PRs when green

brettheap added a commit that referenced this pull request Sep 27, 2026
…time verbs (T015) (#38)

## Summary

Plan 034's **T015** (openxFactory `specs/034-opendox-standalone-operation/tasks.md`, slice P1-B), which realizes box **3.1** of the ratified `add-neutral-product-standalone-operability` (#1144).

- **`src/opendox/default_profile.py`** (new) is openDox's default profile for its own domain, documents and ideas. It is a MODULE, so refusals and `/capabilities` name it `opendox.default_profile`. It declares the two facets openDox reads strictly:
  - `SUBCOMMAND_EXTENSIONS = (RuntimeSubcommand(),)`, from this first landing (R1Q4 (a), R1Q5 (a)). So no build ever meets an empty default, which RULED ASK-2 and the packet's design § D5 keep refused. `ProjectSubcommand` is not included: R1Q5 (a) names the runtime verbs alone (plan 034, T006's finding U4).
  - `ROUTE_EXTENSIONS = ()`. openDox's own routes are the core server's fixed dispatch, and the facet is declared because `build_server()` reads it strictly.
- It declares **no `DISPLAY` facet**. That is how its vocabulary is `NEUTRAL_DISPLAY` unchanged (requirement 3's third scenario). The reason is under "The one judgement" below.
- **Importing it registers nothing.** T016 wires the entry-point registration (R1Q3 (a)), and it lands after P1-A's T012.
- **`tests/test_default_profile.py`** (new) holds it to requirement 3. Like `test_profile_registration.py`, it imports neither `opendox.cli` nor `opendox.serve`, since neither imports in a lone checkout until T011.

## Authority

- Ratified packet: openxFactory#656 comment [`5815412869`](opensoft/openXfactory#656 (comment)) (*"ratify #1144"*).
- Rulings carried out, openxFactory#656 comment [`5817152735`](opensoft/openXfactory#656 (comment)) (*"(a) on all eleven, (d) on R1Q6"*):
  - **R1Q4 (a)**: the default contributes openDox's own verbs (the runtime verbs now), with `NEUTRAL_DISPLAY`.
  - **R1Q5 (a)**: `RuntimeSubcommand` is in the default's `SUBCOMMAND_EXTENSIONS`, and `opendox-runtime` stays as an alias.
  - **R1Q22 (a)**: no declared-edit act precedes an arc edit. This PR touches no carved file anyway; both files are created ones.
- **After: T006**, which is done: #1167 landed on openxFactory `main` as `a65230f6`.
- Claim: openxFactory#656 comment [`5850105728`](opensoft/openXfactory#656 (comment)).

## The falsifier, and its run

tasks.md, T015: *"**Falsifier**: the new vocabulary test, and a test that `RuntimeSubcommand` is in the default's `SUBCOMMAND_EXTENSIONS`. F3.1 needs T016's registration, so T016 quotes it. That the default imports with no extra installed is shown by T038's plain-install runs."*

Requirement 3's second scenario, which the vocabulary test holds: *"WHEN a neutral product's default profile names the publishing repository's status taxonomy, its change/spec/delta nouns or its act verbs — THEN the profile is refused under RULING C2 and DIRECTION Q5"*.

What the tests sweep:

- **Every name the default declares**: its command tree walked whole, its route patterns, its view ids and its own registered name.
- **Every help string it contributes**, for all three families, `change` and `changes` included. The one measured use in another sense is exempt by its exact string and for that word alone: `runtime migrate --plan` reads "report what would be applied and change nothing", a verb. Any other use of either word fails the sweep until someone reads it and enters it in `_OTHER_SENSES`, and `test_every_exempt_help_string_is_one_the_default_really_carries` fails once the text an entry names is gone, so a stale entry cannot linger.
- **Every word its display renders.**

The three families are copied, with their source, from openxFactory at `42f34ab7`:
- the eight `Status:` words, plus `projection`;
- the OpenSpec nouns;
- the twenty act ids of `contracts/domain-profiles/openxfactory-engineering.yaml`.

`test_the_sweep_catches_a_profile_that_carries_the_vocabulary` shows that the sweep can fail.

Run from the checkout root at `72ba89fe` (`1d98bfe8` with `main` @ `582ed073`, #37 and #39, merged in), in a venv built as `validate` builds one (`pip install -c constraints-cpython312-linux.txt -e ".[test]"`, Python 3.12.3, pytest 8.4.2), under `--noconftest` as tasks.md § Phase 1 requires until T011:

```
$ python -m pytest -v --noconftest tests/test_default_profile.py
test_runtime_subcommand_is_in_the_defaults_subcommand_extensions PASSED [  5%]
test_the_default_is_never_an_empty_profile PASSED [ 11%]
test_the_default_contributes_the_runtime_command_opendox_runtime_builds PASSED [ 17%]
test_the_default_declares_the_two_facets_the_composition_points_read PASSED [ 23%]
test_the_default_is_named_by_its_module_path PASSED [ 29%]
test_the_default_names_none_of_the_publishers_vocabulary PASSED [ 35%]
test_the_defaults_help_carries_none_of_the_publishers_vocabulary PASSED [ 41%]
test_every_exempt_help_string_is_one_the_default_really_carries PASSED [ 47%]
test_the_default_renders_none_of_the_publishers_vocabulary PASSED [ 52%]
test_the_sweep_catches_a_profile_that_carries_the_vocabulary PASSED [ 58%]
test_the_default_renders_neutral_display_unchanged PASSED [ 64%]
test_the_default_claims_no_design_token_so_dark_mode_keeps_its_palette PASSED [ 70%]
test_importing_the_default_registers_nothing_and_needs_no_sibling PASSED [ 76%]
test_the_default_names_no_sibling_package[openxdox] PASSED [ 82%]
test_the_default_names_no_sibling_package[ideation_dashboard] PASSED [ 88%]
test_the_default_names_no_sibling_package[doc_health] PASSED [ 94%]
test_the_default_names_no_sibling_package[corpus_adapter_openxfactory] PASSED [100%]
============================== 17 passed in 0.15s ==============================
```

**The tests can fail.** Each mutation below was applied to a scratch copy of the module at `1d98bfe8`, and the file re-run. The merge of `main` changed none of the files involved (`git diff --stat 1d98bfe 72ba89f` over `default_profile.py`, `tests/test_default_profile.py`, `runtime/cli.py`, `subcommand_extension.py`, `display_profile.py` and `view_extension.py` is empty):

| mutation of `default_profile.py` | result |
|---|---|
| `SUBCOMMAND_EXTENSIONS = ()` | 4 failed: the `RuntimeSubcommand` test, the never-empty test, the runtime-tree test and the name sweep |
| `DISPLAY = NEUTRAL_DISPLAY` added | 3 failed: the facets test, the neutral-display test and the design-token test |
| `ProjectSubcommand()` added to the tuple | 1 failed: the runtime-tree test (U4) |
| a contributed `kickoff` verb added | 2 failed: the runtime-tree test and the name sweep |
| a contributed verb whose help reads "list each open change" | 2 failed: the runtime-tree test and the help sweep |
| the runtime's `--plan` help reworded (in `runtime/cli.py`) | 1 failed: the stale-exemption test |

## The one judgement: why `DISPLAY` is not declared

The task line says the default's *"`DISPLAY` is `NEUTRAL_DISPLAY` unchanged"*. Setting `DISPLAY = NEUTRAL_DISPLAY` literally would render the same words. It would also publish all four design tokens as the HOST's own. `display_manifest` reports a declared facet's tokens in `declared_tokens`, and `views/display.js`'s `applyTokens` writes exactly those onto `:root` inline, where they outrank every per-theme rule in `styles.css`. `tests/test_display_facet.py::test_only_the_tokens_a_host_declared_are_written_onto_root` exists to forbid that.

I measured it with the real `views/display.js` under node, applying each payload the way that test does:

```
payload                               host_facet  declared_tokens                                  written onto :root
default_profile (no DISPLAY facet)    absent      []                                               {}
DISPLAY = NEUTRAL_DISPLAY (literal)   declared    [captured, organized, proposed, completion]      --st-captured #7A5AD0, --st-organized #0D9488, --st-proposed #B96A1B, --st-completion #3B6FD4
```

So the default declares no facet, and `display_profile`'s named absence renders `NEUTRAL_DISPLAY` word for word. `test_the_default_renders_neutral_display_unchanged` asserts the manifest equals the neutral one, with each word table equal to `NEUTRAL_DISPLAY`'s. `test_the_default_claims_no_design_token_so_dark_mode_keeps_its_palette` asserts that `declared_tokens == []`. `VIEW_EXTENSIONS` is undeclared for the same kind of reason: the default contributes no consumer panel, and the absence answers an empty column, named `absent`.

## The repository's own check

The three pytest steps of `validate.yml`'s required `validate` job, with its "Pin the triple" arithmetic, reproduced locally in the same venv:

| | selected | passed | skipped | failures | errors |
|---|---|---|---|---|---|
| `main` @ `582ed073` | 1121 | 1118 | 3 | 0 | 0 |
| this branch @ `72ba89fe` | 1121 | 1118 | 3 | 0 | 0 |

The counts are unchanged, because no file in the job's lists changed. The new test first runs in the required check at T036, which removes those lists (tasks.md § Phase 1: *"No slice edits openDox-code's `validate.yml` before T036"*).

`tests/test_provider_boundary.py` is off the required list and red on `main` for 16.6's reasons, which T034 repairs. It sweeps every package module for provider needles, and it gives `12 failed, 16 passed` both on `main` @ `582ed073` and on this branch @ `72ba89fe`. None of the failures names `default_profile`.

## Copilot's review

Copilot's overview at `cd70eb3e` noted that the vocabulary sweep could miss the nouns `change` and `changes` in contributed help text. It raised no thread. It was right: the help sweep had left both words out. `1d98bfe8` sweeps them, and exempts only the runtime's one measured verb use, by its exact string. The stand-in in `test_the_sweep_catches_a_profile_that_carries_the_vocabulary` now shows `'change' in 'ratify a change'` caught, and the mutation table above shows a noun in new help text failing the sweep. Copilot's overviews at `1d98bfe8` and at `72ba89fe`, the merge of `main`, both read *"Approval recommended"*, with *"Findings: None"*. No review thread is open.

## Left for the tasks that own them

- **`tests/test_consumer_reach.py`'s `NEUTRAL_MODULES`** asks for every new module to be added to its census. That file is single-writer (T011, then T034, in plan.md's table), so `opendox.default_profile` is not added here. T034 re-derives the file. The claim itself is asserted here instead, in `test_importing_the_default_registers_nothing_and_needs_no_sibling`, which imports the module in a fresh interpreter with the four siblings blocked.
- **The root `conftest.py`** still says *"openDox ships no profile"*, in its comment above `_SuiteProfile`. That file is P1-G's (T035). The registration it performs stays right: an empty suite profile keeps pinning the core surface.
- **`domain_profile.py`'s refusal text** (*"ships no profile of its own"*) and the registration runbook describe the contract T016 changes. T016 corrects them together with the entry-point registration that makes them false.

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

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


Lane: openxfactory-4
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
brettheap added a commit that referenced this pull request Sep 27, 2026
Since this branch was cut, main gained T020 (#37), T026 (#39) and T015
(#38). None of them touches src/route_extension.py, src/opendox/serve.py,
the facet's tests or the profile-registration runbook.

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
brettheap added a commit that referenced this pull request Sep 27, 2026
…check seams

main is a435aec, which carries T015 squashed (#38), T020 (#37) and T026
(#39). The one conflict is src/opendox/default_profile.py, added on both
sides: main holds T015's file byte for byte as its branch left it, and this
branch holds the same file with the one paragraph T016 rewrites (HOW IT IS
REGISTERED). The resolution keeps this branch's file, which is T015's plus
that paragraph and nothing else.

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
…e registered scope (workbench.py:746) (#43)

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

**Plan 034, slice P1-E, task T025.** 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 `79a720a2`. The claim is opensoft/openXfactory#656 comment `5850107036`.

- **Realizes**: 4.3, 1 of its 8 reaches into openxFactory.
- **Ruled**: R1Q9 (a) and R1Q22 (a), comment `5817152735`.
- **After**: both dependencies are on `main`.
  - T020, the home-corpus seam: #37, landed as `e295b1a9`.
  - T026, this slice's earlier `workbench.py` edit: #39, landed as `582ed073`.

  This branch was cut from `main` at `582ed073` and merges `main` at `a435aecf` (T015), so it carries both.

## What it does

`workbench.session_documents` imported openxFactory's `doc_health.corpus` inside its body and applied that corpus's own membership rule, its governed roots plus a declared `Status:` header (`workbench.py:746` at `1e4a57fb`). That was the last of `workbench.py`'s four reaches into the publisher.

- **Membership comes from the registered home corpus.** The function calls the factory that `corpus_adapter.home()` hands back (T020) on the worktree. Its adapter lists that corpus under the scope a host registered, or under `all`, openDox's default, where none is registered.
  - A host registers the scope with `opendox.workbench.register_session_notebook_scope(scope)`, in the same one-registration idiom as T026. The same name again (compared by value) does nothing, a different name is refused, `unregister_session_notebook_scope()` resets it, and `session_notebook_scope()` reads it.
  - openDox's core names no host scope.
  - openxFactory registers its adapter's `documents` scope (T046). At openxFactory `c415c3d1` that scope lists exactly the notebook's 398 documents, where `all` lists 794 (T006).
- **Refusals.** With no home corpus registered, the function refuses as 4.2 does: `CorpusRefused` of kind `ADAPTER_NOT_REGISTERED`, naming the seam and `register_home`. A scope the resolved corpus does not declare refuses `SCOPE_UNKNOWN` before anything is listed, and is never widened to `all`. `branch_session.open_session_notebook` turns either refusal into the FR-042 notice, so a notebook never blocks a session.
- **The bytes are the corpus's.** Each listed document is read through the same adapter (`adapter.read`), never by opening `<worktree>/<key>`, because a `DocumentId.key` is opaque. `corpus_adapter.DocumentId` says a consumer "may compare it, sort it and hand it back, and may not parse it". So the function takes no snapshot of its own, and the notebook carries what the corpus serves at the worktree.
  - Hosted, openxFactory's adapter reads the checkout it is pointed at, file by file, so uncommitted edits and untracked drafts reach the notebook as they did before.
  - `LocalGitCorpus` serves the worktree's `HEAD` instead (see T022 below).

  Copilot's review raised this, and the thread is answered with evidence.
- **The text is unchanged.** Each document is decoded as the reader this replaced read it: `Path.read_text(encoding="utf-8", errors="replace")`, which means UTF-8 with replacement characters and universal newlines. The size bound is measured the same way. So no source's text, and no content hash its re-sync is diffed by, moves.
- **`repository`** is still accepted for the two callers that pass it: `branch_session._session_notebook_documents`, and openxFactory's `sync-notebooklm-books.py`. The registered factory names its own corpus, so the argument no longer selects anything.

Files: `src/opendox/workbench.py`, and a new `tests/test_session_notebook_membership.py`. `validate.yml` is not touched, because no slice edits it before T036.

## Falsifier 1: F4.1's scan

This is #1144's Group 4 `FALSIFIED BY` ast block, run from the checkout as `python3 - src/opendox`. The whole scan stays red until T089. This task's hit is gone, `workbench.py` appears nowhere in the list, and nothing else moved:

    $ diff <(scan at main a435aec) <(scan at this head)
    24d23
    <   src/opendox/workbench.py:746: doc_health

At `main` the scan finds `24 deferred reach(es)`. At this head it finds `23 deferred reach(es)`, listed here:

```text
  src/opendox/authoring.py:318: corpus_adapter_openxfactory
  src/opendox/branch_session.py:1568: openxdox
  src/opendox/branch_session.py:1587: openxdox.register
  src/opendox/branch_session.py:2005: openxdox
  src/opendox/branch_session.py:2105: openxdox.snapshot_registry
  src/opendox/branch_session.py:2151: openxdox.snapshot_registry
  src/opendox/branch_session.py:2228: openxdox.snapshot_registry
  src/opendox/branch_session.py:3573: openxdox.snapshot_registry
  src/opendox/cli.py:610: openxdox.snapshot_registry
  src/opendox/doxbench_packet.py:177: ideation_dashboard.doxbench_status_exemption
  src/opendox/serve.py:1993: openxdox.corpus_root
  src/opendox/serve.py:629: openxdox.corpus_root
  src/opendox/serve.py:713: doc_health.corpus
  src/opendox/serve_project.py:246: openxdox.gate_console
  src/opendox/serve_project.py:247: openxdox.kickoff
  src/opendox/serve_wire.py:1369: ideation_dashboard
  src/opendox/serve_workbench.py:1215: openxdox
  src/opendox/serve_workbench.py:1665: openxdox
  src/opendox/serve_workbench.py:2607: openxdox
  src/opendox/serve_workbench.py:347: openxdox
  src/opendox/serve_workbench.py:407: openxdox
  src/opendox/serve_workbench.py:408: openxdox
  src/opendox/serve_workbench.py:544: openxdox
```

(T027, openDox-code#41, removes `serve_wire.py:1369` and `doxbench_packet.py:177` separately.)

## Falsifier 2: the session-notebook membership test

The test is `tests/test_session_notebook_membership.py`. The two membership cases the plan names:

- `test_with_only_the_default_registered_the_notebook_lists_all`: with only a factory over openDox's `LocalGitCorpus` registered, as T022's entry points will register it, over a real git repository, the notebook lists `all`. That includes a document with no `Status:` header and a non-Markdown file, because openDox's default carries no host rule.
- `test_a_registered_scope_is_the_one_the_notebook_lists`: with `documents` registered over a two-scope stand-in, the notebook lists that scope and nothing else.

Two more cases pin whose bytes the notebook carries:

- `test_the_notebook_carries_what_the_corpus_serves_at_the_worktree` uses a real git worktree holding an uncommitted edit and an untracked draft.
  - A corpus with the host adapter's read semantics serves both.
  - `LocalGitCorpus` serves `HEAD`.
- `test_a_key_is_handed_back_and_never_opened` uses row-id keys over an empty worktree, and they are read in full.

A mutant that opens `<worktree>/<key>` in place of the adapter's read fails 14 of the file's 29 cases, both of these among them.

The run is in a fresh venv with `pip install ".[test]"`. It first asserts that the four siblings are absent:

    the four siblings are absent
    $ python -m pytest -q tests/test_session_notebook_membership.py --noconftest
    29 passed in 0.49s

**Red at `main`.** With the same file copied onto `a435aecf`, the run gives `28 failed, 1 passed`. The decisive failures:

    E       ModuleNotFoundError: No module named 'doc_health'
    E       AssertionError: the notebook reached the publisher's package: ['doc_health.corpus', 'doc_health.corpus', 'doc_health.corpus.load_docs', ...]
    E       AssertionError: a deferred reach into the publisher or the consumer: ...

The first is the 4.2 case: `main` raises a module-not-found error from inside the function, which is the failure requirement 5 retires. The case that passes at `main` is the negative control.

**Why `--noconftest`.** The plan requires it (tasks.md § Phase 1). With the root conftest in play, the file errors 29 times on `ModuleNotFoundError: No module named 'ideation_dashboard'`. The autouse `declared_human_console` fixture raises it when it imports `opendox.cli`, and it stops once T011 lands. With the Group 2 shim on the path, which simulates T011, the whole suite runs with the root conftest, and these 29 cases pass there.

## The repository's own checks

**`validate`, replayed locally.** Its three pytest steps give the same results as `main`:

| step | result |
|---|---|
| `pytest` | `745 passed, 2 skipped` |
| `pytest (S7 residue)` | `13 passed` |
| `pytest (runtime, hermetic)` | `360 passed, 1 skipped` |

The triple is unchanged: selected 1121, passed 1118, skipped 3. The new file is in none of `validate`'s lists, so it moves no floor. The CI `validate` check on this PR is the gate.

**The whole suite, with the Group 2 shim**:

| tree | result |
|---|---|
| `main` `a435aecf` | `20 failed, 1258 passed, 13 skipped, 66 errors` |
| this head | `20 failed, 1287 passed, 13 skipped, 66 errors` |

I compared the two JUnit reports test by test. No outcome changed. The 86 red results are the same 86, and the 29 new cases pass.

## For the tasks downstream

- **T046 (P1-K).** The host makes both registrations once, in its process-start call (`scripts/opendox_host.register_openxfactory()`):

  ```python
  from corpus_adapter_openxfactory import home_corpus
  from corpus_adapter_openxfactory.home import DOCUMENTS   # "documents"
  from opendox import corpus_adapter, workbench
  corpus_adapter.register_home(home_corpus)
  workbench.register_session_notebook_scope(DOCUMENTS)
  ```

  - openxFactory's `scripts/sync-notebooklm-books.py:2091` calls `wb.session_documents(...)` for `--session-ref`, so that script's process needs the same registration.
  - Register `home_corpus` itself, which builds a fresh adapter on every call. `OpenxFactoryCorpusAdapter` caches each listing per `(location, revision, scope)` for as long as the instance lives, and an uncommitted add does not move `HEAD`. So a factory that returned one shared adapter would give a re-sync a stale listing.
  - The `documents` scope has no `Status:` filter of its own; the rule it replaces had one. At `c415c3d1` every governed document carries a `Status:` header, so the two sets are equal (T006: `load_docs` gives 398, and `documents` lists 398). T046's proof that the hosted notebook is unchanged has to hold that equality, or register a scope that carries the filter.
- **T022 (P1-D).** Once an entry point registers the `LocalGitCorpus` factory, the standalone notebook lists `all`: every blob at the worktree's `HEAD`, read at `HEAD`, because `LocalGitCorpus` reads a repository through its history. The host's adapter reads the working tree instead.
  - Copilot's review of this PR raised the difference. The standalone notebook carries the session branch as of its last commit, and not an uncommitted edit.
  - openDox's own flow commits every governed write and creates the notebook right after the first commit, so the two agree when the notebook is created at open.
  - Whether the standalone default should serve the working tree instead is T022's choice of factory, not this task's. I have put it to the lane.
  - Narrowing the standalone set is phase 2's work (T054, R1Q13).
- **T035 (P1-G).** `tests/test_hermeticity.py::test_the_violation_survives_open_session_notebooks_degradation_clause` calls `bs.open_session_notebook(wb.NotebookAdapter(), ...)` directly.
  - After this task, its setup must register a home corpus that lists at least one document. Without one, the create path stops at `ADAPTER_NOT_REGISTERED`, which is swallowed into the FR-042 notice, and never reaches the runner.
  - The module is in the root `conftest.py`'s `collect_ignore` today, so no run shows this. Run by path with the Group 2 shim, the module fails the same 14 cases at `main` `a435aecf` and at this head.
  - Where the registration comes from depends on where T035 sends the module: its own setup here, or the host's registration in openXdox-code's `tests/integration/`. Copilot's overview at `5b4c8774` raised this, and comment `5851370880` answers it.

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

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


Lane: openxfactory-4
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
brettheap added a commit that referenced this pull request Sep 27, 2026
…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>
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