Skip to content

Break the doc_health↔ideation_dashboard cycle: OutputBoundary moves to the neutral module (split § 2.1) - #724

Merged
brettheap merged 3 commits into
mainfrom
feat/split-2-1-break-the-cycle
Sep 6, 2026
Merged

brettheap merged 3 commits into
mainfrom
feat/split-2-1-break-the-cycle

Conversation

@brettheap

Copy link
Copy Markdown
Contributor

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

Group 2, task § 2.1 of split-opendox-two-layer-product — "BREAK THE CYCLE
FIRST" — 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, no openspec/, contracts/, README or docs/ edits.
Ticks and records come later.

Refs #656

The cycle, and why it had to go first

scripts/ideation_dashboard/ imports scripts/doc_health/ in twenty-three
places 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:

scripts/doc_health/derive_possibles.py:857     from ideation_dashboard.boundary import OutputBoundary  # lazy: house guard
scripts/doc_health/ideation_readiness.py:1351  from ideation_dashboard.boundary import OutputBoundary  # lazy: house guard

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

  1. scripts/ideation_dashboard/boundary.py → scripts/output_boundary.py,
    body unchanged (a git mv; the diff shows it as a rename). The only edit to
    the moved file is a closing paragraph in its module docstring saying why it
    sits outside both packages.
  2. scripts/ideation_dashboard/boundary.py becomes a re-export, so
    from ideation_dashboard.boundary import OutputBoundary — and every other
    name — keeps working for the ten package modules and thirty test modules
    that use it.
  3. The two doc_health call sites point at output_boundary. After this,
    scripts/doc_health/ imports nothing from scripts/ideation_dashboard/.
  4. tests/doc-health/test_import_direction.py asserts that by parsing, per
    the 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-seam delta. So the
choice was made here, on D2's own terms, and is recorded:

  • Neither package can host it. Hosting it in doc_health or in
    ideation_dashboard recreates 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 are
    imported as bare top-level names (from doc_health import ...,
    from ideation_dashboard import ...) off scripts/, which every entrypoint
    and both test conftests put on sys.path. A module directly under scripts/
    therefore needs no new import machinery and adds no new sys.path
    requirement: wherever ideation_dashboard.boundary resolved before,
    output_boundary resolves now.
  • output_boundary, not boundary. boundary was unavailable, not merely
    less pretty: tests/avatar_runtime/boundary/ is already a live top-level
    boundary package during a full pytest tests/ run (pytest's prepend import
    mode puts tests/avatar_runtime/ on sys.path, and
    scripts/validate-avatar-runtime.py imports boundary.scanner). Two
    different top-level boundary modules on one sys.path resolve by path
    order, silently — the same ambient-name class of failure this repo already
    fought once over conftest. output_boundary names the class D2 names and
    has no occupant anywhere in scripts/ or tests/.
  • The whole 377-line file moves, not the class alone. § D3 assigns
    boundary 377 to the openDox column with the note "its OutputBoundary is
    D2's neutral module"
    , and inside the file 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 being removed for a new one, and would not be the
    byte-for-byte move § 2.1 asks for.
  • The re-export is deliberate, and is asserted to be an alias. Rewriting
    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 isinstance checks, except BoundaryViolation handlers
    and refusal-kind comparisons behave identically whichever path a caller
    imports by — and test_the_re_export_hands_back_the_same_objects pins that,
    because a duplicate definition would make a handler on one side silently miss
    a refusal raised on the other.
  • The imports stay function-local. The old # lazy: house guard comment
    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, so an eager import would
    be 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.
  • The direction test parses rather than greps, and that is load-bearing.
    Four files under scripts/doc_health/ mention ideation_dashboard in PROSE
    and must keep doing so — corpus.py and lines.py name the dashboard
    readers that must agree with doc-health's own 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 make it
    green would be pressure to delete true documentation. The test also covers
    the scripts.ideation_dashboard spelling (scripts/__init__.py exists), and
    carries 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 on
    newline="" reads boundary.__file__ and would have counted zero against
    the 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 the
    two production sites as this package's # lazy: house guard back-reference
    convention. They are no longer that. Its own lazy gate_console import is
    test-only and now says so; it is a test, not scripts/doc_health/, so the
    direction 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 a
    SIBLING openxFactory checkout is reachable from the repo root — an artifact of
    running from a scratchpad worktree rather than the aggregation layout.
    Reproduced identically on unmodified origin/main in a clean worktree, so it
    is 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/notebooklm is included because
    test_workbench_sweep_wiring.py is the only suite outside the two primary
    directories 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 least
    one delta"). Pre-existing on origin/main — reproduced in a clean worktree
    at d153261d; this PR touches no openspec/ path. Noted as a local artifact,
    not addressed here.
  • doc-health --single-repo . on this branch vs a fresh origin/main worktree —
    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-publication skipped that run ("the
    published 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 openxFactory adapter package, § 2.3's
REQUIRED_HEADER_FIELDS → CLASSIFY, § 2.4's serve.py / cli.py extension
points and § 2.5's apply-lane hardening are later tasks. serve.py,
web/dispose.js and web/gate.js are untouched — this lane's PR #718 owns
them. 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

brettheap and others added 3 commits September 6, 2026 06:37
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
Copilot AI lite review requested due to automatic review settings September 6, 2026 10:50

@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.

Hi @brettheap! 👋

Your private repo does not have access to Sourcery.

Please upgrade to continue using Sourcery ✨

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.

🟢 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 OutputBoundary guard module to scripts/output_boundary.py and updated the two doc_health call sites to import it from the neutral module.
  • Converted scripts/ideation_dashboard/boundary.py into a compatibility re-export shim with an explicit __all__.
  • Added/updated tests to (a) assert doc_health imports nothing from ideation_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.

@brettheap

Copy link
Copy Markdown
Contributor Author

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)

@brettheap

Copy link
Copy Markdown
Contributor Author

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)

@brettheap
brettheap merged commit e2b8f62 into main Sep 6, 2026
10 checks passed
@brettheap

Copy link
Copy Markdown
Contributor Author

LANDED — lane openxfactory-4-opendox-extraction, 2026-09-06T11:26Z, PR #724 → e2b8f620 (admin squash at head 5150ea2, 11:26:07Z). § 2.1 realized.

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

brettheap added a commit that referenced this pull request Sep 7, 2026
…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
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