Skip to content

Commit b075fd9

Browse files
brettheapclaude
andauthored
B-4 as ruled (a): the adapter column reads output_boundary directly instead of the boundary shim — four import lines (split-opendox § 3.1) (#855)
B-4 as Brett Heap ruled it, option (a) (2026-09-09), on his word. Mechanical; no behaviour, signature or public-name change. - The adapter column's three reaches into openDox through `scripts/ideation_dashboard/boundary.py` — the 62-line re-export shim of the already-neutral `scripts/output_boundary.py` — are repointed at `output_boundary` directly: `human_seen.py`, `dashboard_refresh_lane.py`, `nightly_lane.py`, one import line each; likewise the function-local import in `tests/notebooklm/test_workbench_sweep_wiring.py`. Same objects (`boundary.OutputBoundary is output_boundary.OutputBoundary`); the shim stays for its openDox-side readers. - Edges: adapter→openDox −3 and the test-tree reach −1; +4 adapter→neutral; no new forbidden-direction edge. With #852 (B-2 (i′)) landed, the adapter column's only remaining openDox reaches are the ruled `import rewrites at the carve` (`lens_submission.py`). - New `tests/ideation-dashboard/test_b4_boundary_repoint.py` (five-spelling guard, identity assertions, negative control). Independent verification on the PR; Copilot: approval recommended, no threads. Refs #656 (stays OPEN). Lane: openxfactory-4-opendox-extraction Co-Authored-By: Claude Fable 5.1 <[email protected]>
1 parent 89e0734 commit b075fd9

5 files changed

Lines changed: 246 additions & 4 deletions

File tree

‎scripts/ideation_dashboard/dashboard_refresh_lane.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
if str(_SCRIPTS_DIR) not in sys.path:
119119
sys.path.insert(0, str(_SCRIPTS_DIR))
120120

121-
from ideation_dashboard.boundary import OutputBoundary # noqa: E402
121+
from output_boundary import OutputBoundary # noqa: E402
122122

123123
LANE = "ideation-dashboard-refresh"
124124
STATUS_NAME = "refresh-status.json"

‎scripts/ideation_dashboard/human_seen.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
import yaml
4444

45-
from .boundary import OutputBoundary
45+
from output_boundary import OutputBoundary
4646
# The neutral path slug, at its own home rather than through `workbench`
4747
# (openDox under design D3): this module is openxFactory's own engineering
4848
# adapter and STAYS, so the import it used to make is the edge RULING OQ-2

‎scripts/ideation_dashboard/nightly_lane.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@
8585
from ideation_dashboard import register as register_mod # noqa: E402
8686
from ideation_dashboard import snapshot as snapshot_mod # noqa: E402
8787
from ideation_dashboard import snapshot_registry as registry_mod # noqa: E402
88-
from ideation_dashboard.boundary import OutputBoundary # noqa: E402
8988
from ideation_dashboard.generator import generate_snapshot # noqa: E402
89+
from output_boundary import OutputBoundary # noqa: E402
9090

9191
LANE = "ideation-dashboard-snapshot"
9292
DEFAULT_CHECKOUT = "openxFactory" # v1 scope: the pinned openxFactory checkout
Lines changed: 242 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,242 @@
1+
"""B-4's repoint, kept repointed: the adapter column reads the neutral write
2+
guard directly, not through the openDox re-export shim.
3+
4+
`scripts/ideation_dashboard/boundary.py` is a 62-line RE-EXPORT of
5+
`scripts/output_boundary.py` — the guard moved out of the package at
6+
`split-opendox-two-layer-product` § 2.1 (design D2, PR #724) and the shim was
7+
kept so the roughly forty existing `ideation_dashboard.boundary` readers did
8+
not all have to be rewritten inside that change. The shim's column is openDox
9+
(design D3; memo `carve-3-1` § 2.2 files `boundary` 62 as `oD` / `IR`), so
10+
three modules of openxFactory's OWN retained adapter column reaching it were
11+
three `stays -> oD` edges that RULING OQ-2 forbids after the carve, and one
12+
more ran out of the test tree.
13+
14+
Brett Heap ruled on `#656` (2026-09-09, verbatim "rule B-4 a"): they are
15+
repointed at `output_boundary` PRE-CARVE, one import line each, and the shim
16+
stays for its openDox-side readers.
17+
18+
* `human_seen.py:45` `from output_boundary import OutputBoundary`
19+
* `dashboard_refresh_lane.py:121` " (# noqa: E402)
20+
* `nightly_lane.py:89` " (# noqa: E402)
21+
* `tests/notebooklm/test_workbench_sweep_wiring.py:97` (function-local)
22+
23+
WHY A TEST AND NOT A NOTE — the same reason `test_oqb_replumb.py` gives for
24+
B-1 and B-3. Each repoint is one import line whose behaviour is identical by
25+
construction: the shim re-exports the SAME objects, so a "just import it from
26+
`.boundary` like everything else does" edit restores the edge and nothing else
27+
in the suite goes red. The edge is the property, and an edge is only kept by
28+
something that measures it.
29+
30+
PARSED, NOT GREPPED, and the scan resolves all five spellings the tree can
31+
reach the shim by — the two relative forms available inside the package, the
32+
two absolute ones `scripts/__init__.py` makes possible (`ideation_dashboard.X`
33+
and `scripts.ideation_dashboard.X`), and `import ...` — walking the whole tree
34+
so a function-local import is reported exactly like a module-level one. The
35+
sweep-wiring reach WAS function-local, and a lazy import is still an import
36+
and still the edge the carve cannot cross.
37+
38+
Deliberately a NEW file: `test_import_direction.py` polices the direction
39+
between the two top-level packages and `test_oqb_replumb.py` polices OQ-B's
40+
own two re-plumbings, and neither is this one.
41+
"""
42+
43+
from __future__ import annotations
44+
45+
import ast
46+
47+
from conftest import REPO_ROOT
48+
49+
import output_boundary
50+
from ideation_dashboard import boundary as boundary_shim
51+
from ideation_dashboard import dashboard_refresh_lane, human_seen, nightly_lane
52+
53+
PACKAGE = REPO_ROOT / "scripts" / "ideation_dashboard"
54+
SHIM = PACKAGE / "boundary.py"
55+
56+
# The four files RULING B-4 (a) repoints, by path — three in the adapter
57+
# column plus the one in the test tree.
58+
RULED_FILES = (
59+
PACKAGE / "human_seen.py",
60+
PACKAGE / "dashboard_refresh_lane.py",
61+
PACKAGE / "nightly_lane.py",
62+
REPO_ROOT / "tests" / "notebooklm" / "test_workbench_sweep_wiring.py",
63+
)
64+
65+
_ABSOLUTE_ROOTS = ("ideation_dashboard", "scripts.ideation_dashboard")
66+
67+
68+
def boundary_imports(tree):
69+
"""Every reach of the `ideation_dashboard.boundary` shim a parsed file
70+
makes, as `(spelling, lineno)`.
71+
72+
Takes a TREE rather than a path so the negative control at the bottom can
73+
feed the identical scanner a restored-edge source STRING, instead of
74+
writing a file into the package this test polices.
75+
"""
76+
for node in ast.walk(tree):
77+
if isinstance(node, ast.ImportFrom):
78+
if node.level: # relative
79+
if node.module:
80+
if node.module.split(".")[0] == "boundary":
81+
yield "from .boundary import ...", node.lineno
82+
else:
83+
for alias in node.names: # from . import boundary
84+
if alias.name == "boundary":
85+
yield "from . import boundary", node.lineno
86+
continue
87+
if not node.module:
88+
continue
89+
for root in _ABSOLUTE_ROOTS:
90+
if node.module == f"{root}.boundary":
91+
yield f"from {root}.boundary import ...", node.lineno
92+
break
93+
if node.module == root: # from <root> import boundary
94+
for alias in node.names:
95+
if alias.name == "boundary":
96+
yield f"from {root} import boundary", node.lineno
97+
break
98+
elif isinstance(node, ast.Import):
99+
for alias in node.names:
100+
for root in _ABSOLUTE_ROOTS:
101+
if alias.name == f"{root}.boundary":
102+
yield f"import {root}.boundary", node.lineno
103+
break
104+
105+
106+
def _reaches(path):
107+
source = path.read_text(encoding="utf-8")
108+
tree = ast.parse(source, filename=str(path))
109+
return [f"{path.relative_to(REPO_ROOT).as_posix()}:{line} {spelling}"
110+
for spelling, line in boundary_imports(tree)]
111+
112+
113+
# --------------------------------------------------------------------------
114+
# the repoint
115+
# --------------------------------------------------------------------------
116+
117+
def test_the_four_ruled_files_reach_the_guard_at_its_neutral_home():
118+
"""None of the four names the shim, in any spelling, at any nesting.
119+
120+
The three modules are openxFactory's own engineering adapter and STAY
121+
(design D3's third column, RULING DQ-1); `boundary` is openDox. The fourth
122+
is the test-tree reach the same ruling covers."""
123+
offenders = [edge for path in RULED_FILES for edge in _reaches(path)]
124+
assert offenders == [], (
125+
"RULING B-4 (a) (`#656`, 2026-09-09) repointed these at the neutral "
126+
"`scripts/output_boundary.py`; the `boundary` re-export shim is "
127+
"openDox and the adapter column must not reach it. Offending "
128+
f"imports: {offenders}")
129+
130+
131+
def test_each_repointed_name_is_the_neutral_guards_own_object():
132+
"""A repoint, not a fork. Every module binds the SAME class object the
133+
neutral module defines, so `isinstance` checks and
134+
`except BoundaryViolation` handlers behave exactly as they did.
135+
136+
`OutputBoundary` is a class, never interned, so `is` here is real evidence
137+
(the trap `test_oqb_replumb.py` documents for interned ints and strings
138+
does not apply)."""
139+
assert human_seen.OutputBoundary is output_boundary.OutputBoundary
140+
assert dashboard_refresh_lane.OutputBoundary is output_boundary.OutputBoundary
141+
assert nightly_lane.OutputBoundary is output_boundary.OutputBoundary
142+
143+
144+
def test_the_repoint_is_a_no_op_because_the_shim_re_exports_the_same_object():
145+
"""WHY the repoint could be mechanical: the shim never made a copy. Every
146+
name it re-exports is the neutral module's own object, so the four callers
147+
were already using `output_boundary`'s guard and only the import path
148+
changed. If this ever stopped holding, B-4 would have been a behaviour
149+
change and the three edges would need a different answer."""
150+
for name in boundary_shim.__all__:
151+
assert getattr(boundary_shim, name) is getattr(output_boundary, name), (
152+
f"the shim's {name} is not `output_boundary`'s own object — B-4 "
153+
"assumed a pure re-export")
154+
155+
156+
def test_the_sweep_wiring_test_names_the_neutral_module_where_it_used_to_name_the_shim():
157+
"""Non-vacuity for the fourth file. It has no module-level binding to
158+
compare identities on — its import is function-local inside
159+
`_live_manifest` — so the proof of absence above is paired with a proof
160+
that the reach still EXISTS and goes to the neutral home. A file that had
161+
simply stopped constructing a boundary would also pass the scan."""
162+
path = REPO_ROOT / "tests" / "notebooklm" / "test_workbench_sweep_wiring.py"
163+
tree = ast.parse(path.read_text(encoding="utf-8"), filename=str(path))
164+
reaches = [node.lineno for node in ast.walk(tree)
165+
if isinstance(node, ast.ImportFrom)
166+
and not node.level and node.module == "output_boundary"
167+
and any(a.name == "OutputBoundary" for a in node.names)]
168+
assert reaches, (
169+
"the sweep-wiring test must import `OutputBoundary` from "
170+
"`output_boundary`; it imports it from nowhere at all")
171+
172+
173+
def test_the_shim_stays_for_its_opendox_readers():
174+
"""What B-4 deliberately did NOT do. The shim is kept — memo § 2.2 files
175+
it as an openDox module carried at the carve with an `import rewrites`
176+
edit, and the openDox-column and test-tree readers that name it are none
177+
of this change's business. A later edit that deletes `boundary.py` because
178+
"nothing needs it" has to fail here first."""
179+
assert SHIM.is_file(), "scripts/ideation_dashboard/boundary.py was removed"
180+
readers = [p for p in sorted(PACKAGE.glob("*.py"))
181+
if p != SHIM and _reaches(p)]
182+
assert readers, (
183+
"no module in the package reaches the shim any more — if that is "
184+
"true the shim should be retired by its own change, not left "
185+
"unreferenced")
186+
187+
188+
# --------------------------------------------------------------------------
189+
# the negative control
190+
# --------------------------------------------------------------------------
191+
192+
def test_the_scan_would_catch_every_spelling_of_the_import_it_removed():
193+
"""The assertion above is a proof of ABSENCE, so the scanner has to be
194+
shown catching the thing it is meant to catch — through the SAME function,
195+
not a second copy of it, which is how a scanner drifts into passing over a
196+
restored edge.
197+
198+
All five spellings, including the function-local form the sweep-wiring
199+
test actually used, and the `scripts.` prefixed absolute one that
200+
`scripts/__init__.py` makes resolvable."""
201+
restored = (
202+
"from .boundary import OutputBoundary\n"
203+
"from . import boundary\n"
204+
"import ideation_dashboard.boundary\n"
205+
"from scripts.ideation_dashboard.boundary import HumanGate\n"
206+
"from ideation_dashboard import boundary as b\n"
207+
"def make(root):\n"
208+
" from ideation_dashboard.boundary import OutputBoundary as OB\n"
209+
" return OB(root, [])\n"
210+
)
211+
caught = sorted(spelling for spelling, _line
212+
in boundary_imports(ast.parse(restored)))
213+
assert caught == [
214+
"from . import boundary",
215+
"from .boundary import ...",
216+
"from ideation_dashboard import boundary",
217+
"from ideation_dashboard.boundary import ...",
218+
"from scripts.ideation_dashboard.boundary import ...",
219+
"import ideation_dashboard.boundary",
220+
], caught
221+
222+
# And nothing that merely mentions the word is caught: the scan must not
223+
# go off on the neutral import the repoint installed, or on a local
224+
# variable called `boundary_root` (the sweep-wiring test has one).
225+
clean = (
226+
"from output_boundary import OutputBoundary\n"
227+
"boundary_root = repo\n"
228+
"from doc_health import boundary_notes\n"
229+
)
230+
assert list(boundary_imports(ast.parse(clean))) == []
231+
232+
# Non-vacuity for the live scans: they must be looking at real files with
233+
# real import statements in them, so a scan over a missing, empty or
234+
# renamed file cannot pass as a proof of absence.
235+
for path in RULED_FILES:
236+
assert path.is_file(), path
237+
statements = [node for node in ast.walk(
238+
ast.parse(path.read_text(encoding="utf-8"), filename=str(path)))
239+
if isinstance(node, (ast.Import, ast.ImportFrom))]
240+
assert statements, (
241+
f"{path} parses to no import statement at all — the scan lost its "
242+
"subject; check the path before trusting the assertions above")

‎tests/notebooklm/test_workbench_sweep_wiring.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def _live_manifest(root: Path, name: str, alias: str) -> Path:
9494
(<root>/openxFactory/ideation/workbench/)."""
9595
repo = root / "openxFactory"
9696
boundary_root = repo
97-
from ideation_dashboard.boundary import OutputBoundary
97+
from output_boundary import OutputBoundary
9898
w = wb.Workbench.create("openxFactory", name, now="2026-07-14T08:00:00Z")
9999
w.bind_notebook(alias, now="2026-07-14T08:00:00Z")
100100
return wb.save(w, OutputBoundary(boundary_root, [wb.WORKBENCH_DIR]))

0 commit comments

Comments
 (0)