Skip to content

Move the openDox column out of serve.py (split § 2.4, PR 2 of 4) - #748

Merged
brettheap merged 6 commits into
mainfrom
feat/split-2-4-pr2-opendox-columns
Sep 7, 2026
Merged

brettheap merged 6 commits into
mainfrom
feat/split-2-4-pr2-opendox-columns

Conversation

@brettheap

@brettheap brettheap commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

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

This realizes split-opendox-two-layer-product § 2.4 PR 2 of 4: the openDox column moves out of serve.py into serve_workbench.py and serve_project.py, with the wire vocabulary both columns and the core share landing in a third module, serve_wire.py. It is a pure move — every one of the 142 moved symbols is byte-identical to its previous text, the routes stay fixed core arms of _route/do_POST rather than becoming contributed ones, and no behaviour changes. Refs #656.

Stack note: this PR targets main directly and does not stack on anything. PR-1 (#736, a83eb93a) is already on main; origin/main moved to 04a6e107 mid-run and is merged in.

What moved

serve.py 6,914 → 2,473 lines. The three new modules total 4,776.

Symbol From To
_handle_workbench_thread serve.py DashboardHandler serve_workbench.py WorkbenchRoutes
_handle_workbench_model_catalog ″ ″
_handle_workbench_model_intake_surface ″ ″
_handle_workbench_model_intake ″ ″
_handle_workbench_model_approval ″ ″
_handle_workbench_chat_turn ″ ″
_handle_workbench_document_abstract ″ ″
33 further workbench members — _workbench_model_port, _indexed_sources, _knowledge_service_and_coverage, _thread_plane, _thread_capability_absence, _session_worktree_for, _is_live_session_ref, _read_thread, _document_threads, _thread_gate, _mirror_turn_into_sidecar, _write_thread_after_mirror_failure, the four _doxbench_* static/classmethods, _workbench_declaration_store, _intake_console_refusal, _intake_refusal, _intake_query_facts, _send_error_or_intake, _approval_binding, _wire_valid_turn_id, _refuse_turn, the three parse helpers, _refuse_abstract, _deadline_bound_dispatch, and the MAX_INDEXED_SOURCES / MAX_CREDENTIAL_BYTES / INTAKE_QUERY_FIELDS class attributes ″ ″
_serve_project_register serve.py DashboardHandler serve_project.py ProjectRoutes
_handle_notebook_action, _run_notebook_action, _log_action_failure ″ ″
_handle_edit_action ″ ″
_launch_editor, _listed_source_paths, _edit_request_fields, _resolved_listed_edit_entry serve.py module level serve_project.py module level
JSON_CTYPE, JSON_OBJECT_BODY_REQUIRED, AGENT_INVOCATION_REFUSAL, _MAX_BODY_BYTES, _MAX_REFUSED_DRAIN_BYTES, _drain_refused_body, _CredentialStream, the whole DOXBENCH_* catalog and _DOXBENCH_MSG_* prose, the _ABSTRACT_REASON_* set, and the doxbench_*_body / doxbench_*_status builders incl. doxbench_context_packet — 93 module-level names serve.py module level serve_wire.py module level

Composed back as class DashboardHandler(serve_workbench.WorkbenchRoutes, serve_project.ProjectRoutes, http.server.SimpleHTTPRequestHandler). All 108 DashboardHandler members still resolve, with staticmethod/classmethod descriptors intact, and every moved module-level name is imported back into serve.py by name so serve.X resolves for every reader that already had it.

Design decisions taken

  1. Mixins, not moved-out functions or a moved class. @staticmethod/@classmethod survive a mixin untouched (test_doxbench_routes.py calls DashboardHandler._doxbench_invalid_turn_message as a classmethod), the unbound-call idiom handler._workbench_model_port(handler) used at 18 test sites keeps working through the MRO, and per-test attribute overrides still take. The mixins precede SimpleHTTPRequestHandler so do_GET resolution is unchanged.
  2. A third module, serve_wire.py, rather than a bottom-import or a late-bound _serve.X rewrite. The columns need ~60 module-level names that lived in serve.py, and serve.py needs the columns — a cycle. Hoisting the shared vocabulary makes the graph a DAG (serve_wire ← serve_workbench/serve_project ← serve). It is genuinely shared, not openDox-only: _handle_gate_action (openXdox, PR-3) already reads doxbench_error_body/_status and DOXBENCH_MAX_REQUEST_BYTES, so parking it in serve_workbench.py would have made the core depend on the openDox column — backwards for the carve.
  3. CAPABILITIES_ROUTE handling stays inline in _route, against the memo's § 2, which assigns it to serve_project.py. Two green tests forbid the move: test_extension_point_parity.py's ROUTE_ARMS pins that arm's reached names exactly, and test_bullseye_widget.py:1674 asserts the block's contents between two literal route comparisons in serve.py. PR-2 registers no capabilities change.
  4. _session_repository stays in serve.py core, also against the memo's § 2. The memo's own § 1 lists it among the central gating primitives; it is called by the pinned CAPABILITIES arm and by _handle_gate_action, which is PR-3's column. § 1 wins.
  5. _make_adapter stays in serve.py even though _handle_notebook_action moved: _session_notebook (openXdox/gate) also calls it, and test_session_notebook.py calls handler._make_adapter(handler) directly.
  6. _route and do_POST are byte-identical and stay literally inside class DashboardHandler in serve.py, as test_extension_point_parity._method() requires — it looks for them as FunctionDefs inside that class node. build_server's signature, its type("BoundDashboardHandler", …) construction and the resolve_handlers call are untouched.
  7. Absolute imports only in the three new modules (D12). serve.py runs as a plain script, so a from . import … anywhere it reaches would 500 a route in production while module-invoked tests stayed green.
  8. NO_IMPLICIT_PUSH_MODULES widened by all three filenames. serve_workbench.py is required — it carries the TURN, which is exactly that rule's scope, and a list left at "serve.py" would have let a file move evade the absence silently. serve_project.py and serve_wire.py carry no turn, save, compaction or scheduled task and are added anyway, recorded in the conftest comment: a sweep over three of four files is a sweep with a seam in it.

Test repoints

Under the standing ruling for this slice: a test that pins WHERE code lives may be repointed to the module that now holds it — same assertion, same strength, wider file set. Nothing is weakened, deleted, skipped or made vacuous; behavioural tests (those driving routes and asserting responses) are untouched. The new conftest.serve_surface_source() / serve_surface_paths() readers span serve.py + serve_wire.py + serve_workbench.py + serve_project.py, so every scan below sees strictly more code than before, never less.

# Test Old target New target Why Mutation proving it still bites
1 test_doxbench_bound_buffer.py::test_the_route_reads_the_declared_binding_rather_than_an_adjacent_field serve.py source serve surface the bound_buffer_key=bound_buffer_key literal is inside _handle_workbench_chat_turn rewrote it to =active_document_path in serve_workbench.py → FAILED
2 test_doxbench_bound_buffer.py::test_no_runtime_module_stores_a_bound_buffer_on_the_envelope serve.py + doxbench_turns.py serve surface + doxbench_turns.py this one had gone hollow — serve.py now contains zero occurrences of bound_buffer; all 40 are now on the surface (36 in serve_workbench.py, 4 in serve_wire.py), so the negative kept passing while asserting nothing about the code it is named for added bound_buffer: str | None to serve_workbench.py → FAILED
3 test_doxbench_knowledge_service.py::test_the_route_reads_the_declaration_and_never_selects_a_backend serve.py source serve surface doxbench_knowledge.build_backend(declaration) is inside _knowledge_service_and_coverage rewrote it to build_backend(payload) → FAILED
4 test_doxbench_routes.py::test_the_v1_canonical_form_is_untouched_by_the_reorder_fix serve.py source serve surface both pinned literals are inside _handle_workbench_chat_turn rewrote canonical_buffer_order = turn_buffers to = list(turn_buffers) → FAILED
5 test_doxbench_thread_wiring.py::test_the_liveness_question_has_ONE_spelling_and_it_normalises_refs serve.py source serve surface doxbench_scope.is_live_session_ref( is inside _is_live_session_ref rewrote it to live_session_branches( → FAILED
6 test_doxbench_blank_reason.py::test_f5_no_str_coercion_survives_on_the_posture_path serve.py source serve surface it slices the source between def doxbench_turn_v2_success_body( and the next def; the builder moved to serve_wire.py inserted str(context_posture) into that function → FAILED
7 test_doxbench_blank_reason.py::test_a_builder_refusal_answers_on_the_routes_fixed_400_shape monkeypatch.setattr(serve_mod, …) monkeypatch.setattr(serve_workbench, …) the route now binds doxbench_turn_v2_success_body in its own module globals, so a patch on serve no longer reaches it — the test would have driven the real builder and proven nothing. The assertion is unchanged. reverted the target to serve_mod → FAILED (i.e. the retarget is load-bearing, not cosmetic)
8 test_doxbench_blank_reason.py::test_the_builder_call_site_is_inside_a_packet_error_handler one AST walk of serve.py one AST walk per serve-surface file the only call site moved to serve_workbench.py; assert calls would have failed outright rewrote the call to globals()['doxbench_turn_v2_success_body']( so no ast.Name call remains → FAILED on "the builder is never called"
9 test_doxbench_bridge.py::test_the_de_facto_adapter_surface_is_declared_even_though_the_ban_is_not serve.py source serve surface silent weakening, green either way — all seven getattr(port, …) sites moved, so duck_typed would compute the empty set and the subset assertion would be vacuously true. Measured: against serve.py alone duck_typed == ∅; against the surface it is {conversation_key, dereference, dispatch, for_conversation, mirror}. added getattr(port, "shake") to serve_workbench.py → FAILED
10 test_doxchat_model_intake.py::test_a_turn_naming_the_affordance_refuses_through_the_existing_refusal serve.py source serve surface an absence assertion; the turn route it is about now lives elsewhere, so it was an absence with three holes in it added the __doxchat_intake__ literal to serve_workbench.py → FAILED
11 test_repo_selector.py::test_serve_module_uses_no_relative_imports serve.py lines every serve-surface file the D12 hazard is a property of the script, and a relative import in a module the script imports 500s the same route. One of the scanned files is still serve.py. added from . import doxbench_scope to serve_workbench.py → FAILED
12 test_session_snapshot.py::test_the_hosted_session_arrival_path_is_recorded_and_not_built serve.py source (the apply_lane absence clause only) serve surface the comment says "no apply-lane binding exists anywhere in the serve", but the assertion still read only serve.py — 36% of the surface this PR created. The positive anchors in the same test (the hosted_ref_refused( marker, its count, and the three route-body checks) stay pinned to serve.py on purpose: they are POSITIVES that will go red, not hollow, when PR-3 moves _handle_refresh_action — already forward-flagged below for PR-3, unchanged by this fix. added an apply_lane literal to serve_workbench.py → FAILED
13 test_repo_selector.py::test_serve_module_uses_no_relative_imports (second mechanism) SERVE_PY.read_text() for three positive import anchors (notebook_action, workbench, gate_routes) serve surface disclosure, not a new edit — row 11 describes only the offenders scan in this same test; the three anchor assertions two lines below were widened in the same original edit and left off the table. Of the three, only notebook_action actually moved (now serve_project.py only); workbench and gate_routes still resolve in serve.py at their pre-split lines, so the widening was harmless — under-disclosed, not hollow. n/a (disclosure only; both mechanisms already covered by row 11's own mutation)

Rows 2, 9 and 12 were not in the slice's original repoint list: they are silent weakenings found while verifying (row 12 in the fix round below), and all three are widened rather than left green-and-hollow. Row 13 is a disclosure of an already-widened, harmless assertion found in the same fix round.

conftest.py's NO_IMPLICIT_PUSH_MODULES is widened only (decision 8); test_doxbench_share.py's own widen-never-narrow self-assertion over that tuple passes untouched.

Proof

  • python3 -m pytest -q tests/ideation-dashboard tests/doc-health — see the run recorded below; the only tolerated failure is the known environmental test_snapshot.py::test_find_validator_locates_pinned_checkout.
  • OPENSPEC_TELEMETRY=0 openspec validate --all --strict → 96 passed, 1 failed, the failure being only the known disposition-codexfactory-declared-renames artifact.
  • Targeted first pass, before the full suite: 742 passed across test_doxbench_routes.py, test_edit_action.py, test_doxbench_document_abstract.py, test_extension_point_parity.py, test_doxbench_bound_buffer.py, test_doxbench_blank_reason.py, test_doxbench_bridge.py, test_doxbench_knowledge_service.py, test_doxbench_thread_wiring.py, test_repo_selector.py, test_doxchat_model_intake.py, test_doxbench_share.py, test_bullseye_widget.py, test_notebook_action.py, test_project_aggregates.py.
  • Pure-move proof, mechanical: an AST comparison of every symbol in the new modules against its text at the parent commit reports 142 identical, 0 differing. The same script reports no old DashboardHandler member and no old module-level name unaccounted for, and no symbol left in serve.py changed — the sole difference in serve.py's remainder is the class DashboardHandler base list.
  • Namespace proof: all 173 module-level names old serve.py exposed still resolve on the module, except six imports used only by moved code (os, subprocess, threading, time, doxbench_threads, states_something); a repo-wide grep confirms nothing reads any of them off serve. All 108 DashboardHandler members resolve, and the eight staticmethod/classmethod descriptors are still those kinds.
  • --help golden byte-identical: tests/ideation-dashboard/fixtures/cli-help-tree.golden.txt does not appear in the diff against main at all. No golden was regenerated; none needed to be.
  • Import graph is a DAG: no new module imports serve, and none uses a relative import (verified by AST, not grep).
  • Counts: serve.py 6,914 → 2,473; serve_workbench.py 3,146; serve_wire.py 1,316; serve_project.py 314.

Fix round (Sonnet)

Verified findings from independent review, fixed:

  • Decision 1's ordering claim, checked rather than taken on faith. "The mixins precede SimpleHTTPRequestHandler so do_GET resolution is unchanged" was a claim nothing enforced — today the 46 mixin members share zero names with the whole http.server chain, so the order is currently unobservable, but a later member colliding with send_head/list_directory/log_message/etc. would silently lose to http.server. Added three tests to test_extension_point_parity.py: one pins DashboardHandler.__mro__[:4], one asserts WorkbenchRoutes/ProjectRoutes share no member name with the SimpleHTTPRequestHandler MRO, and a negative control proves the collision check fires on a real shared name (send_head). Both positive tests mutation-checked: inverting the base list and adding a colliding method each turned the respective test red.
  • serve_surface_source()'s docstring overstated its guarantee (conftest.py; also Copilot's first review comment on this PR). It claimed a multi-line literal "can never match across a file boundary that does not exist"; in fact each file already ends in \n and the join adds one more, leaving \n\n at every boundary — which defeats a single-newline literal but not a pattern containing a blank line. Corrected the docstring to say exactly what is guaranteed. No caller of serve_surface_source() uses a blank-line pattern today, so no behaviour changed.
  • The apply_lane absence in test_session_snapshot.py was narrower than the serve it names. test_the_hosted_session_arrival_path_is_recorded_and_not_built's comment says "no apply-lane binding exists anywhere in the serve", but the assertion still read serve.py alone — 36% of the surface this PR created. Repointed just that negative clause to serve_surface_source() (row 12); mutation-checked by adding an apply_lane literal to serve_workbench.py, which turned it red.
  • The relative-import guard regex missed parent-relative imports (test_repo_selector.py::test_serve_module_uses_no_relative_imports; also Copilot's second review comment on this PR). \s*from\s+\.\w*\s+import\b matches from . import x / from .pkg import x but not from .. import x / from ..pkg import x, which fail identically once serve.py runs as a plain script. Widened to \.+\w* and added test_the_relative_import_guard_catches_every_dot_depth, parametrized over dot depths 1–3.
  • Row 2 of the repoint table understated the bound-buffer move — it said "all 26 [occurrences] are in serve_workbench.py"; measured, serve.py base had 40, and head has 0/36/4/0 across serve.py/serve_workbench.py/serve_wire.py/serve_project.py. Row 2 corrected above.
  • Row 11's own second, undisclosed widening — the same edit that widened the offenders scan also widened three POSITIVE import anchors (notebook_action, workbench, gate_routes) to serve_surface_source(); only notebook_action had actually moved, so workbench/gate_routes were widened without needing to be. Harmless (nothing is hollow either way), but undisclosed — added row 13 and an inline comment at the assertion.
  • Dead SERVE_PY constant removed from test_doxbench_bound_buffer.py — no reader remained after its own two repoints (rows 1 and 3 above).

Both Copilot review threads on this PR are addressed above (the docstring correction and the regex widening, respectively) and replied to inline. Nothing was weakened, deleted, skipped or made vacuous; no behavioural test changed. Re-ran targeted suites plus the full validators:

  • python3 -m pytest -q tests/ideation-dashboard tests/doc-health → 6,550 passed, 31 skipped, 2 failed — the two failures are the pre-existing tolerated test_snapshot.py::test_find_validator_locates_pinned_checkout and test_session_gates.py::test_archived_exact_origin_releases_cleanup_after_the_tile_disappears, the latter an order-dependent flake in the full run (untouched by this PR, passes in isolation — confirmed).
  • OPENSPEC_TELEMETRY=0 openspec validate --all --strict → 96 passed, 1 failed, the known disposition-codexfactory-declared-renames artifact only.

Fix round 2 (Sonnet)

Two new Copilot review threads at 27ad5a86, plus one carried-over LOW and one WORDING item from re-verification, fixed:

  • SERVE_SURFACE_MODULES's order contradicted its own docstring (conftest.py:178, Copilot). serve_surface_paths() claims the tuple is "in import-graph order," but it started ("serve.py", "serve_wire.py", "serve_workbench.py", "serve_project.py") — serve.py is the module that imports the other three (serve.py imports serve_project, serve_workbench and serve_wire; serve_workbench.py and serve_project.py each import from serve_wire; serve_wire.py imports no sibling), so the real dependency-first order is the reverse. Reordered to ("serve_wire.py", "serve_workbench.py", "serve_project.py", "serve.py") and documented in the docstring why no reader of serve_surface_paths() / serve_surface_source() depends on the order (every consumer is a per-file loop, a joined-source substring/absence check, or an .index() search that resolves within one file's own content).
  • The relative-import guard regex missed multi-segment relative imports (test_repo_selector.py:642, Copilot). Round 1's widening (\.+\w*) caught parent-relative imports (from .. import x) but still stopped at the first dot for the module path, so from .pkg.sub import x and from ..pkg.sub import x slipped through — both fail identically once serve.py runs as a plain script. Widened to \.+[\w.]*.
  • The pinning test for that guard didn't guard the production regex (re-verification LOW). test_the_relative_import_guard_catches_every_dot_depth re-stated the pattern as its own independent literal rather than exercising test_serve_module_uses_no_relative_imports's actual regex, so narrowing the production pattern would have left the test green. Hoisted a shared module-level RELATIVE_IMPORT_RE constant used by both the production scan and the test (renamed to test_the_relative_import_guard_catches_every_dot_and_segment_depth, with the two multi-segment cases added to its parametrize list). Mutation-verified: narrowing RELATIVE_IMPORT_RE back to the round-1 pattern now turns both the production-scan test and 5 of the 7 parametrized cases red; a from ..pkg.sub import x probe planted in serve_project.py is caught by the widened production scan and missed by the round-1 pattern.
  • "45 mixin members" (re-verification WORDING). Measured: WorkbenchRoutes and ProjectRoutes contribute 41 and 5 non-common-dunder members respectively, a union of 46, not 45 (45 was len(vars(WorkbenchRoutes)) alone, including its own dunders). Corrected above in the decision-1 bullet; no code changed, the assertion was already correct either way.

Both new Copilot threads replied to and resolved (commit 42934b8d).

Catch-up merge: origin/main had advanced to include #741 (§ 2.4 OQ-1), which widens the same conftest.py NO_IMPLICIT_PUSH_MODULES tuple this PR also widens (this PR adds serve_workbench.py/serve_project.py/serve_wire.py, #741 adds doxbench_status_exemption.py). Merged origin/main in (git merge, not a rebase) — commit 686706a0; the one resulting conflict, confined to that tuple, resolved by keeping both sides' additions and both comment blocks. Nothing else conflicted.

Re-ran the targeted tests (test_doxbench_share.py::test_no_implicit_path_reaches_a_push, test_extension_point_parity.py) and the full validators at 686706a0:

  • python3 -m pytest -q tests/ideation-dashboard tests/doc-health → 6,607 passed, 31 skipped, 1 failed (957.78s) — the only failure is the known environmental test_snapshot.py::test_find_validator_locates_pinned_checkout.
  • OPENSPEC_TELEMETRY=0 openspec validate --all --strict → 97 passed, 1 failed, the known disposition-codexfactory-declared-renames artifact only.

Not in this PR

  • PR-3 (openXdox + openxFactory-adapter columns, through the route-extension point) and PR-4 (cli.py, Split cli.py by column behind the subcommand seam (§ 2.4, PR 4 of 4) #742).

  • Forward flags for PR-3 — two currently-green tests that PR-3's moves will break, flagged now rather than discovered then:

    • test_session_snapshot.py::test_the_hosted_session_arrival_path_is_recorded_and_not_built counts hosted_ref_refused( in serve.py and inspects _handle_refresh_action's body (the fix round above already widened this test's separate apply_lane absence clause to the surface — see row 12 — but these two positive checks are untouched and still pinned to serve.py); PR-3 moves that handler.
    • test_intent_plane_boundary.py:568 requires _serve_committed_intents as a FunctionDef in serve.py; PR-3 moves it to serve_openxfactory_lanes.py.

    Both are safe today and both will need the same widening treatment.

  • No openspec/, contracts/, docs/, README or tasks.md edits; no change to scripts/route_extension.py or scripts/subcommand_extension.py.

Decisions for Brett

  1. Rows 2 and 9 of the repoint table are outside the slice's original list. Both were green-and-hollow rather than red, so leaving them would have shipped two assertions that no longer bite. I widened them on the same ruling as the rest; if you would rather they had been left alone and filed as findings, say so and I will split them out.
  2. Decisions 3 and 4 contradict the § 2.4 memo (CAPABILITIES_ROUTE and _session_repository were assigned to serve_project.py). I kept both in the core on the scout's evidence. Worth a nod if you want the memo's § 2 corrected to match before the § 3.1 carve manifest is drafted.

This one is ready for your word — it is not merged and I have not enabled auto-merge.

🤖 Generated with Claude Code

https://claude.ai/code/session_017guxvApq5jqB1QXukJUsTQ

brettheap and others added 2 commits September 6, 2026 22:24
`serve.py` (6,914 lines) carried the doxBench workbench surface, the
project/notebook/edit routes and the shared wire vocabulary in one file.
This is the pure move that separates them, ahead of the openDox carve:

  * `serve_workbench.py` — the seven workbench route handlers and their
    private helpers, composed back as the `WorkbenchRoutes` mixin.
  * `serve_project.py` — `_serve_project_register`, `_handle_notebook_action`
    and `_handle_edit_action`, composed back as `ProjectRoutes`.
  * `serve_wire.py` — the wire vocabulary and body bounds the core AND both
    columns read, so the import graph is a DAG rather than a cycle.

Every moved symbol is byte-identical to its previous text (142 of them,
verified by an AST comparison against the parent commit); the only edits are
the mechanical import and binding lines the shape requires. Mixins precede
`SimpleHTTPRequestHandler`, so `_route` and `do_POST` stay literally inside
`class DashboardHandler` in `serve.py`, the CAPABILITIES arm stays inline, and
`build_server` and its `BoundDashboardHandler` construction are untouched.
Every moved module-level name is imported back by name, so `serve.X` resolves
for every reader that already had it.

Ten source-level tests are repointed from `serve.py` to the whole serve
surface — same assertion, strictly more code scanned — and one monkeypatch
follows its name to the module that now resolves it. Each is disclosed in the
PR body with the mutation that proves it still bites.

Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019sa33gYhfLF1F1MkS7Xrd6
Copilot AI lite review requested due to automatic review settings September 7, 2026 02:45

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

🟡 Changes recommended

The new serve-surface test helper’s boundary claim is incorrect (risking false-positive source matches) and the relative-import guard regex misses from ..-style imports, weakening the intended protection.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR continues the §2.4 “split serve.py by column” work by extracting the openDox-facing route handlers and shared wire vocabulary out of scripts/ideation_dashboard/serve.py into three new modules, and then widening source-level test assertions to scan the full “serve surface” (now four files) instead of just serve.py.

Changes:

  • Split the dashboard server implementation into serve_wire.py (shared wire vocabulary/bounds), serve_workbench.py (doxBench workbench routes), and serve_project.py (project/notebook/edit routes), while composing them back via mixins in DashboardHandler.
  • Add “serve surface” helpers in tests/ideation-dashboard/conftest.py so tests can scan all serve modules consistently.
  • Repoint multiple tests that previously read only serve.py source to instead read/scan the full serve surface.
File summaries
File Description
scripts/ideation_dashboard/serve.py Composes DashboardHandler from the new route mixins while retaining the core routing spine.
scripts/ideation_dashboard/serve_workbench.py Hosts the extracted doxBench workbench route handlers as a mixin.
scripts/ideation_dashboard/serve_project.py Hosts the extracted project/notebook/edit route handlers and helpers.
scripts/ideation_dashboard/serve_wire.py Hosts shared wire vocabulary/constants and shared request/response helpers to avoid import cycles.
tests/ideation-dashboard/conftest.py Adds serve_surface_paths() / serve_surface_source() and widens NO_IMPLICIT_PUSH_MODULES.
tests/ideation-dashboard/test_repo_selector.py Widens the “no relative imports” check to scan all serve-surface modules.
tests/ideation-dashboard/test_doxbench_* / test_doxchat_model_intake.py Update source-scanning assertions to use serve_surface_source() / serve_surface_paths().
Review details
  • Files reviewed: 11/13 changed files
  • Comments generated: 2
  • Review effort level: Lite

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

Comment thread tests/ideation-dashboard/conftest.py Resolved
#748)

Fixes verified findings from independent review of § 2.4 PR-2 (serve.py
openDox-column extraction):

- F1: decision 1's "mixins precede SimpleHTTPRequestHandler" ordering
  claim was never checked. Added test_extension_point_parity.py tests
  pinning DashboardHandler.__mro__ and asserting WorkbenchRoutes/
  ProjectRoutes share no member name with the http.server chain, plus a
  negative control; both mutation-verified.
- F2/Copilot: serve_surface_source()'s docstring overstated its
  boundary guarantee (a "\n\n" join defeats a blank-line pattern, not
  just a single-newline one). Corrected the docstring.
- F3: test_session_snapshot.py's apply_lane absence was still narrowed
  to serve.py alone after this PR made the serve four files; repointed
  that negative clause to serve_surface_source() (positives stay
  pinned to serve.py, forward-flagged for PR-3). Mutation-verified.
- Scope-lens (wf24b r12.json): corrected row 2's bound-buffer counts
  (40 total: 0/36/4/0 across the surface, not "26 in
  serve_workbench.py"); disclosed row 11's second, undisclosed
  widening of three positive import anchors; removed the now-dead
  SERVE_PY constant in test_doxbench_bound_buffer.py.
- Copilot: widened the relative-import guard regex (test_repo_selector.py)
  from `\.\w*` to `\.+\w*` so it also catches parent-relative imports
  (`from .. import x`); added a parametrized test over dot depths 1-3.

Nothing weakened, deleted, skipped or made vacuous; all repoints
disclosed. Full suite + validators re-run green (one pre-existing
environmental failure plus one confirmed unrelated flake, both
disclosed in the PR body).

Refs #656

Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019sa33gYhfLF1F1MkS7Xrd6
Copilot AI review requested due to automatic review settings September 7, 2026 13:38

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.

🟡 Changes recommended

The updated relative-import guard regex still misses valid multi-segment relative imports (e.g. from .pkg.sub import x), weakening the safety net intended to prevent script-mode 500s.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (1)

tests/ideation-dashboard/test_repo_selector.py:673

  • test_the_relative_import_guard_catches_every_dot_depth currently only exercises 0 or 1 module segment after the leading dots, so the same regex bug (missing .pkg.sub style imports) could regress without a failing test. Add nested-module cases and update the regex to match them.
@pytest.mark.parametrize("line", [
    "from . import x",
    "from .pkg import x",
    "from .. import x",
    "from ..pkg import x",
    "  from ... import x",
])
def test_the_relative_import_guard_catches_every_dot_depth(line):
    """A prior version of this guard's regex (`\\.\\w*`, one dot only) matched
    `from . import x` and `from .pkg import x` but silently missed a
    PARENT-relative import (`from .. import x`, `from ..pkg import x`) —
    which fails identically once serve.py runs as a plain script. Pinned here
    so a future narrowing of the regex is caught by a red test, not by a
    production 500."""
    assert re.match(r"\s*from\s+\.+\w*\s+import\b", line), (
        f"the relative-import guard does not match {line!r}")
  • Files reviewed: 13/15 changed files
  • Comments generated: 2
  • Review effort level: Lite

Comment thread tests/ideation-dashboard/conftest.py Resolved
brettheap and others added 2 commits September 7, 2026 10:39
…mport guard (PR #748)

Two open Copilot review threads:
- conftest.py:178 — SERVE_SURFACE_MODULES claimed "import-graph order" but
  started with serve.py (the module that imports the other three). Reordered
  to serve_wire.py -> serve_workbench.py -> serve_project.py -> serve.py,
  matching the actual import DAG, and documented in the docstring why no
  reader depends on the order.
- test_repo_selector.py:642 — the relative-import guard regex (\.+\w*)
  matched a single module segment only, so `from .pkg.sub import x` and
  `from ..pkg.sub import x` slipped through. Widened to \.+[\w.]*.

r9 LOW: test_the_relative_import_guard_catches_every_dot_depth restated the
guard's pattern as an independent literal copy rather than exercising the
production regex, so narrowing the production pattern would have left the
test green. Hoisted a shared RELATIVE_IMPORT_RE module-level constant used by
both the production scan and the (renamed, now segment-depth-covering)
parametrized test; mutation-verified that narrowing the shared constant now
turns both red.

Both threads replied to and resolved separately after push.

Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_017guxvApq5jqB1QXukJUsTQ
…-columns

One real conflict, in tests/ideation-dashboard/conftest.py's
NO_IMPLICIT_PUSH_MODULES tuple: this branch widens it by
serve_workbench.py/serve_project.py/serve_wire.py (§ 2.4 PR 2), main's #741
widens it by doxbench_status_exemption.py (§ 2.4 OQ-1). Resolved by keeping
both sides' additions and both comment blocks. Nothing else conflicted.

Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_017guxvApq5jqB1QXukJUsTQ
Copilot AI review requested due to automatic review settings September 7, 2026 14:54

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 changes are a structural refactor with supporting test widenings to prevent vacuous source-level assertions, and the only noted adjustment is a small robustness tweak to the new collision test.

Review details
  • Files reviewed: 13/15 changed files
  • Comments generated: 1
  • Review effort level: Lite

The mixin-vs-SimpleHTTPRequestHandler collision check subtracted a fixed
list of five dunder names from the intersection. WorkbenchRoutes already
carries __annotations__ (from INTAKE_QUERY_FIELDS's class annotation),
and a future stdlib release could add a dunder to the http.server chain
that the hand-listed set doesn't name -- making the test fail for a
reason unrelated to what it guards.

Both the real check and its negative control now filter dunders by the
general name.startswith("__") and name.endswith("__") rule via a shared
_non_dunder() helper, applied to both the mixin side and the chain side
before intersecting, so the assertion's strength (no shared non-dunder
member between the mixins and the whole http.server MRO chain) is
unchanged. Added a non-vacuity floor asserting the mixin member set is
non-empty, so a reader bug that resolves to the wrong classes can't pass
by producing an empty set on both sides.

Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_017guxvApq5jqB1QXukJUsTQ
Copilot AI review requested due to automatic review settings September 7, 2026 16:06

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.

🔵 Needs a closer look

The updated relative-import guard can still miss a valid backslash-continued from .pkg \\\n import x form, leaving a loophole in the intended “no relative imports” safety net.

Review details

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

tests/ideation-dashboard/test_repo_selector.py:652

  • test_serve_module_uses_no_relative_imports scans each file line-by-line, so it can miss a valid relative import split with a backslash continuation (e.g. from .pkg \\n import x). That would still break when serve.py runs as a plain script, but it would not be reported as an offender here.

Consider expanding the offenders scan to also check backslash-continued from ... lines (or switch to an AST-based check) so the guard can’t be bypassed by formatting.

  • Files reviewed: 13/15 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@brettheap
brettheap merged commit 7f7ce75 into main Sep 7, 2026
10 checks passed
brettheap added a commit that referenced this pull request Sep 7, 2026
…3-extension-columns

Six conflicts, all from the squash-merge identity problem (#748/#742 landed
as squash commits, so git treats PR-3's pre-existing work against them as a
fresh collision rather than a fast-forward):

- scripts/ideation_dashboard/profile_openxfactory.py (add/add): the only
  real splice. Kept the shared module docstring (#742's landed header,
  which already anticipated PR 3 adding ROUTE_EXTENSIONS), rewrote the
  "Relative, like the core's own imports..." comment to speak for both
  verbs and routes, and kept BOTH extension tuples: SUBCOMMAND_EXTENSIONS
  (#742/main) alongside ROUTE_EXTENSIONS + `from . import serve_gate,
  serve_openxfactory_lanes, serve_projection` (this branch).

  DISCOVERED WHILE RUNNING THE FULL SUITE, not part of either side's
  original text: a plain top-level `from . import cli_gate` (#742's own
  spelling) turned into a regression the moment ROUTE_EXTENSIONS joined it
  in the same module. `serve.py`'s `build_server` imports
  `profile_openxfactory` on every startup, hosted included, to reach
  ROUTE_EXTENSIONS; `cli_gate` pulls in `authoring` -> `workbench` -> PyYAML,
  which the hosted image deliberately does not carry
  (`test_repo_selector.py::test_hosted_posts_do_not_load_notebook_only_dependencies`,
  green on `main` and on this branch's pre-merge tip, red after a naive
  splice). Fixed by resolving `SUBCOMMAND_EXTENSIONS` and the `cli_gate`
  submodule attribute lazily, via a module-level `__getattr__` (PEP 562) —
  the same pattern `authoring.py` already uses for `REQUIRED_HEADER_FIELDS`
  and for the same reason (a shared module should not carry a dependency
  only one caller needs). `cli.py`'s read of `SUBCOMMAND_EXTENSIONS`, the
  `len(...)==1`/`isinstance(...)` pins in `test_cli_column_split.py`, and
  the `profile.cli_gate is gate` identity check in
  `test_a_library_caller_gets_the_columns_of_its_own_core` (module
  `__getattr__` still answers through `sys.modules`, so identity holds)
  all still pass — verified by re-running the full targeted suite.

- scripts/ideation_dashboard/serve.py (7 hunks): resolved by keeping our
  side throughout, verified hunk by hunk rather than assumed:
  * `import traceback` (main) dropped — the only caller of the module
    (`_log_gate_failure`, T092 defect-3 logging) already lives in
    `serve_gate.py` on this branch, which imports `traceback` itself; the
    name would be dead/unused in `serve.py` after the extraction.
  * the split docstring + import block, the `serve_projection` import +
    widened `serve_wire` import list, the `fresh_ledger_events`/
    `hosted_index`/`hosted_ref_refused` import line, and the
    `DashboardHandler` mixin base list: our side is a strict superset of
    main's (main's text is a subset written before PR 3 added its three
    columns).
  * the `_handle_dtn_seed`/`_handle_staging_seed`/`_handle_apply_register_edits`/
    `_handle_refresh_action`/`_run_refresh` block and the
    `_read_snapshot`/`_serve_snapshot`/`_hosted_entry_refused`/`_serve_index`/
    `_serve_committed_intents`/`_keyed_source`/`_serve_source` block: main
    still carries these as fixed core methods; this branch already moved
    them (byte-diffed to confirm) into `serve_openxfactory_lanes.py` and
    `serve_projection.py` respectively, so keeping our side (empty) is the
    correct resolution, not a loss.

- scripts/ideation_dashboard/serve_wire.py (add/add, 3 hunks): our side
  only — the hosted-plane confinement paragraph, the `HOSTED_SESSION_REFUSAL`/
  `hosted_ref_refused`/`hosted_index` additions and the `snapshot_registry`
  import are PR-3-only content; main's side of every hunk was empty.

- tests/ideation-dashboard/conftest.py (3 hunks), test_extension_point_parity.py
  (3 hunks), test_session_snapshot.py (1 hunk): our side throughout — each
  is the "seven files"/five-mixin widened version of an assertion main still
  states at PR 2's "four files"/two-mixin count; no assertion was dropped,
  every one got strictly broader (NO_IMPLICIT_PUSH_MODULES and
  SERVE_SURFACE_MODULES tuples are the union, in dependency-first order).

Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UyynFBwGMQNeNU8D8qhQBW
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