Repository navigation
Break the doc_health↔ideation_dashboard cycle: OutputBoundary moves to the neutral module (split § 2.1) - #724
Conversation
The two packages imported each other. `ideation_dashboard` imports `doc_health` in twenty-three places, which is lawful and stays — under RULING Q4 that direction becomes the adapter's openXdox-side implementation surface. The back-edge was one class: `doc_health` reached into `ideation_dashboard.boundary` for `OutputBoundary` at exactly two lazy, function-local call sites. A seam cannot be drawn through a cycle, so design D2 puts the guard in "a small module BOTH sides import" and makes it the FIRST thing to land: nothing else in the arc can start while the cycle holds, and this relocation pays for itself even if the carve never happens. The whole 377-line file moves, not the class alone. Design D3 assigns `boundary` 377 to the openDox column with the note "its `OutputBoundary` is D2's neutral module", and `Refusal`, `BoundaryViolation`, `_norm_prefix` and the refusal-kind constants are `OutputBoundary`'s own parts while `HumanGate` is a wrapper that constructs one. Splitting them would trade the edge we are removing for a new one and would not be a byte-for-byte move. The body is unchanged; the only edit is a paragraph at the end of the module docstring saying why the module sits where it does. Named `output_boundary`, not `boundary`, and placed at the top of `scripts/`. Neither package can host it without recreating the cycle in one direction or the other, and `scripts/` is the one place both already resolve from — both are imported as bare top-level names off it, and every entrypoint puts it on `sys.path`, so this asks for no new import machinery. `boundary` was unavailable: `tests/avatar_runtime/boundary/` is already a live top-level `boundary` package during a full pytest run (`scripts/validate-avatar-runtime.py` imports `boundary.scanner`), and two top-level `boundary` modules on one `sys.path` would resolve by path order, silently. `ideation_dashboard/boundary.py` stays as a re-export so the public path keeps working: ten modules in the package and thirty test modules name it, and the re-exported names are the SAME objects, so `isinstance` checks and `except BoundaryViolation` handlers behave identically whichever path a caller imports by. Lane: openxfactory-4-opendox-extraction Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_014E8Yr24V2TUSpcD8ixK1HJ
… dashboard The two lines named in tasks § 2.1 — `derive_possibles.make_boundary` and `ideation_readiness.make_boundary`. With the guard neutral, both ask for `output_boundary` and `scripts/doc_health/` now imports NOTHING from `scripts/ideation_dashboard/`. The imports stay function-local. Their old comment read `# lazy: house guard`, and the laziness was doing two jobs: keeping a cross-package import off the module-import path, and not building a write guard for a pass that may never persist. The first job is gone — `output_boundary` depends on nothing and importing it eagerly would be correct — but the second still holds, and hoisting it would be a change of behaviour dressed up as tidying. What the comment says is what changed: it now records where the guard lives and which test keeps it there, so the next reader is not left inferring a house rule from the word "lazy". `ideation_readiness`'s module docstring called the guard "the landed ideation-dashboard house guard", which this makes false; it now names the neutral module. Lane: openxfactory-4-opendox-extraction Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_014E8Yr24V2TUSpcD8ixK1HJ
Tasks § 2.1 asks for the proof in those words, and the reason is in the shape of the bug it closes: both back-edge imports were LAZY, so the cycle never fired at import time, no test went red, and the only symptom was that the seam could not be cut. Nothing but a standing assertion keeps it removed. `test_import_direction.py` walks the syntax tree of every `*.py` under `scripts/doc_health/` and fails on any import naming `ideation_dashboard` (or `scripts.ideation_dashboard` — `scripts/__init__.py` exists, so that spelling would reintroduce the same edge by a route a one-spelling test would miss). Parsed rather than grepped because four files there mention the package in PROSE and must keep doing so: `corpus.py` and `lines.py` name the dashboard readers that must agree with doc-health's header scan, `pin_class.py` and `pin_sentinels.py` name dashboard modules as the subjects of findings. A substring grep would call all four violations, and the pressure to go green would be pressure to delete true documentation. Three assertions rather than one, because the headline assertion is a proof of ABSENCE and those fail quietly: a scan-count floor so a scan that lost its subject cannot pass vacuously; a negative control that feeds the exact two removed lines back through the same parser and requires both to be caught; and a check that the neutral guard itself imports neither package, since a guard that reached back would put the cycle one level down and would not survive the carve to openDox. `test_boundary.py`'s textual pin on `newline=""` read `boundary.__file__`, which now resolves to the re-export and counts zero — it reads the guard's own file. Two tests are added there for the re-export itself: that it hands back the SAME objects (a duplicate definition would make `except BoundaryViolation` silently miss refusals raised on the other side), and that it covers every public name the guard defines, so a name added and not re-exported cannot break the old import path for that name alone. `test_status_reader_real_lines.py`'s docstring cited the two production sites as this package's back-reference convention. They are no longer that; its own lazy import is test-only and says so. Lane: openxfactory-4-opendox-extraction Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_014E8Yr24V2TUSpcD8ixK1HJ
There was a problem hiding this comment.
Hi @brettheap! 👋
Your private repo does not have access to Sourcery.
Please upgrade to continue using Sourcery ✨
There was a problem hiding this comment.
🟢 Approval recommended
The change cleanly removes the only confirmed back-edge by relocating the guard to a neutral module and pins the import direction/aliasing behavior with targeted tests.
Pull request overview
This PR breaks the historical doc_health ↔ ideation_dashboard import cycle by relocating the OutputBoundary “write guard” into a neutral, top-level scripts/output_boundary.py module that both sides can import without introducing cross-package dependencies. It preserves backward compatibility by keeping ideation_dashboard.boundary as a pure re-export and adds tests that parse imports to prove the forbidden direction stays absent.
Changes:
- Moved the
OutputBoundaryguard module toscripts/output_boundary.pyand updated the twodoc_healthcall sites to import it from the neutral module. - Converted
scripts/ideation_dashboard/boundary.pyinto a compatibility re-export shim with an explicit__all__. - Added/updated tests to (a) assert
doc_healthimports nothing fromideation_dashboard, and (b) pin that the re-export is identity-preserving (same objects, not duplicate definitions).
File summaries
| File | Description |
|---|---|
| tests/ideation-dashboard/test_boundary.py | Updates newline-pin test to read the guard’s new source file and adds re-export identity/surface coverage assertions. |
| tests/doc-health/test_status_reader_real_lines.py | Updates docstring/comment to reflect that the lazy cross-import convention is now test-only (not production). |
| tests/doc-health/test_import_direction.py | New parsing-based test enforcing “no doc_health → ideation_dashboard imports,” including negative controls and neutrality check for output_boundary. |
| scripts/output_boundary.py | New neutral home for the boundary/guard implementation (docstring updated to explain placement). |
| scripts/ideation_dashboard/boundary.py | Replaces the former implementation with a re-export shim to preserve legacy import paths. |
| scripts/doc_health/ideation_readiness.py | Updates make_boundary to import OutputBoundary from output_boundary and refreshes module doc text accordingly. |
| scripts/doc_health/derive_possibles.py | Updates make_boundary to import OutputBoundary from output_boundary (removing the back-edge). |
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
RULING — WORD — Brett Heap, 2026-09-06T11:25Z, in session (lane openxfactory-4-opendox-extraction, session 01WoVQPAyEUXZf9S779gRVbo), verbatim: "merge 724 when green" — § 2.1 PR #724 (break the doc_health↔ideation_dashboard cycle; OutputBoundary → scripts/output_boundary.py) lands once green with no unresolved threads; not an openspec/changes/ path, so a landing note rather than a Rule 6 window; admin squash because brettheap-authored PRs cannot self-clear the code-owner review. Lane: openxfactory-4-opendox-extraction (formerly openxfactory-opendox) |
|
LANDING (record only — no openspec/changes/ path, so no Rule 6 window) — lane openxfactory-4-opendox-extraction, session 01WoVQPAyEUXZf9S779gRVbo, 2026-09-06T11:25Z, PR #724 into openxFactory main on Brett Heap's word "merge 724 when green"; head 5150ea2, all checks SUCCESS, 0 unresolved threads, 0 closing refs, no file overlap with main's two newer commits. Lane: openxfactory-4-opendox-extraction (formerly openxfactory-opendox) |
…idence; record the § 2 carried items (#769) split-opendox-two-layer-product group-2 bookkeeping: tick § 2.1 (#724 e2b8f62), § 2.2/2.2a (#725 ea4e6ff), § 2.3 (#728 1a2ea82), § 2.4 (#736 a83eb93, #741 75467fe, #748 7f7ce75, #742 421b52d, #761 7992b87), § 2.6 (gate re-run on the branch: 6681 passed, the environmental snapshot test and the tolerated disposition artifact identical on main); § 2.5 stays open (Path A D-2). Records the twelve § 2 carried items for the § 3.1 carve manifest; repoints two doc_health sweep-record strings to doxbench_status_exemption. Landed under a Rule 6 window on Brett Heap's word "merge 769 when green" (2026-09-07). Refs #656. Lane: openxfactory-4-opendox-extraction Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q8CkMMAdcUZCqAUTgNjsPy
Lane: openxfactory-4-opendox-extraction (formerly openxfactory-opendox)
Group 2, task § 2.1 of
split-opendox-two-layer-product— "BREAK THE CYCLEFIRST" — realized against design § D2 ("The corpus-adapter seam: four
operations, one neutral module, one way") and its § D3 column assignment.
Doc-only scope beyond that is nil: no interface, no adapter package, no
serve.py/cli.py, noopenspec/,contracts/, README ordocs/edits.Ticks and records come later.
Refs #656
The cycle, and why it had to go first
scripts/ideation_dashboard/importsscripts/doc_health/in twenty-threeplaces across twelve modules. That direction is lawful and stays — under
RULING Q4 it becomes the adapter's openXdox-side implementation surface, code
that legitimately imports doc-health in the repository where doing so is
lawful (design D2: "what must not survive is the direction, not the calls").
The back-edge was one class, at exactly two lines:
Both were lazy, function-local imports, and that is precisely how the cycle
survived review as long as it did: it never fired at import time, no test ever
went red, and its only symptom was that the seam openDox/openXdox has to be cut
along could not be cut. A note in a design document would not have kept it
gone.
What landed
scripts/ideation_dashboard/boundary.py→scripts/output_boundary.py,body unchanged (a
git mv; the diff shows it as a rename). The only edit tothe moved file is a closing paragraph in its module docstring saying why it
sits outside both packages.
scripts/ideation_dashboard/boundary.pybecomes a re-export, sofrom ideation_dashboard.boundary import OutputBoundary— and every othername — keeps working for the ten package modules and thirty test modules
that use it.
doc_healthcall sites point atoutput_boundary. After this,scripts/doc_health/imports nothing fromscripts/ideation_dashboard/.tests/doc-health/test_import_direction.pyasserts that by parsing, perthe task's own words: "proven by a test that greps for the direction rather
than by inspection."
Design decisions taken
The module's name and location are not fixed by the packet. § D2 describes
the destination — "a small module BOTH sides import" — and names no path;
neither do tasks.md, proposal.md or the
corpus-adapter-seamdelta. So thechoice was made here, on D2's own terms, and is recorded:
doc_healthor inideation_dashboardrecreates the cycle in one direction or the other. D2's"BOTH sides import" only has one reading.
scripts/is the one place both already resolve from. Both packages areimported as bare top-level names (
from doc_health import ...,from ideation_dashboard import ...) offscripts/, which every entrypointand both test conftests put on
sys.path. A module directly underscripts/therefore needs no new import machinery and adds no new
sys.pathrequirement: wherever
ideation_dashboard.boundaryresolved before,output_boundaryresolves now.output_boundary, notboundary.boundarywas unavailable, not merelyless pretty:
tests/avatar_runtime/boundary/is already a live top-levelboundarypackage during a fullpytest tests/run (pytest's prepend importmode puts
tests/avatar_runtime/onsys.path, andscripts/validate-avatar-runtime.pyimportsboundary.scanner). Twodifferent top-level
boundarymodules on onesys.pathresolve by pathorder, silently — the same ambient-name class of failure this repo already
fought once over
conftest.output_boundarynames the class D2 names andhas no occupant anywhere in
scripts/ortests/.boundary377 to the openDox column with the note "itsOutputBoundaryisD2's neutral module", and inside the file
Refusal,BoundaryViolation,_norm_prefixand the refusal-kind constants areOutputBoundary's ownparts while
HumanGateis a wrapper that constructs one. Splitting themwould trade the edge being removed for a new one, and would not be the
byte-for-byte move § 2.1 asks for.
forty import sites would be a large mechanical diff inside a change whose
whole point is the single edge it removes. The re-exported names are the
same objects, so
isinstancechecks,except BoundaryViolationhandlersand refusal-kind comparisons behave identically whichever path a caller
imports by — and
test_the_re_export_hands_back_the_same_objectspins that,because a duplicate definition would make a handler on one side silently miss
a refusal raised on the other.
# lazy: house guardcommentwas doing two jobs: keeping a cross-package import off the module-import path,
and not building a write guard for a pass that may never persist. The first
job is gone (
output_boundarydepends on nothing, so an eager import wouldbe correct); the second still holds, so hoisting them would be a behaviour
change dressed as tidying. The comments now record where the guard lives and
which test keeps it there.
Four files under
scripts/doc_health/mentionideation_dashboardin PROSEand must keep doing so —
corpus.pyandlines.pyname the dashboardreaders that must agree with doc-health's own header scan,
pin_class.pyandpin_sentinels.pyname dashboard modules as the subjects of findings. Asubstring grep would call all four violations, and the pressure to make it
green would be pressure to delete true documentation. The test also covers
the
scripts.ideation_dashboardspelling (scripts/__init__.pyexists), andcarries a scan-count floor plus a negative control, because its headline
assertion is a proof of absence and those fail quietly.
Also touched, and why it is not scope creep
tests/ideation-dashboard/test_boundary.py— its textual pin onnewline=""readsboundary.__file__and would have counted zero againstthe re-export. It reads the guard's own file now. Two tests added for the
re-export itself (identity, and full coverage of the guard's public surface).
tests/doc-health/test_status_reader_real_lines.py— its docstring cited thetwo production sites as this package's
# lazy: house guardback-referenceconvention. They are no longer that. Its own lazy
gate_consoleimport istest-only and now says so; it is a test, not
scripts/doc_health/, so thedirection test does not and should not police it.
Checks
All run locally in a worktree off
origin/main@d153261d.pytest tests/doc-health/test_import_direction.py tests/ideation-dashboard/test_boundary.py— 31 passed
pytest tests/ideation-dashboard tests/doc-health— 6327 passed, 31 skipped,1 failed in 24m37s. The failure is
test_snapshot.py::test_find_validator_locates_pinned_checkout, which asserts aSIBLING
openxFactorycheckout is reachable from the repo root — an artifact ofrunning from a scratchpad worktree rather than the aggregation layout.
Reproduced identically on unmodified
origin/mainin a clean worktree, so itis not this change; CI runs in the aggregation layout where it passes.
pytest tests/notebooklm tests/sequenced_after tests/proposal-support—457 passed, 39 subtests passed.
tests/notebooklmis included becausetest_workbench_sweep_wiring.pyis the only suite outside the two primarydirectories that imports the guard, and it does so by the old path — so it also
exercises the re-export.
OPENSPEC_TELEMETRY=0 openspec validate --all --strict— 95 passed, 1 failed:change/disposition-codexfactory-declared-renames("Change must have at leastone delta"). Pre-existing on
origin/main— reproduced in a clean worktreeat
d153261d; this PR touches noopenspec/path. Noted as a local artifact,not addressed here.
--single-repo .on this branch vs a freshorigin/mainworktree —ZERO delta (byte-identical reports after normalising the repo-identity
string). Worth stating how that was reached: the FIRST baseline run differed by
one info finding, because
release-tag-publicationskipped that run ("thepublished refs for contract-v1.25 could not be consulted") and ran on the next
— a remote-ref availability artifact of the family, not a content difference.
Re-running the baseline made the two reports identical. This change touches no
document, so a real delta was never expected; the first run is recorded because
a reader comparing runs of that family should know it moves on its own.
Not done here, on purpose
The § 2.2 interface, the § 2.2a
openxFactoryadapter package, § 2.3'sREQUIRED_HEADER_FIELDS→ CLASSIFY, § 2.4'sserve.py/cli.pyextensionpoints and § 2.5's apply-lane hardening are later tasks.
serve.py,web/dispose.jsandweb/gate.jsare untouched — this lane's PR #718 ownsthem. No tick, no record, no
openspec/edit.This PR is offered for Brett Heap's word; landing is the orchestrator's act.
🤖 Generated with Claude Code
https://claude.ai/code/session_014E8Yr24V2TUSpcD8ixK1HJ