Repository navigation
Carve the Status: exemption out of the packet assembler (§ 2.4 OQ-1) - #741
Conversation
…OQ-1) `doxbench_packet.py` did two jobs on opposite sides of the openDox carve. It ASSEMBLES a bounded context packet — generic, and the primitive openDox's own chat-turn route calls — and it READ this corpus's `Status:` header against this corpus's lifecycle vocabulary through `doc_health.lines.split_keepends`, which is openxFactory's and only openxFactory's. design.md § D3 files the whole file under the openxFactory-adapter column, so moving it wholesale would leave openDox's kept-in-tree route depending on an openxFactory-only module: the fork-vs-profile problem `domain-descendant-boundary` forbids one level down. OQ-1 was ruled as recommended, so the file splits along the line it straddles. `_STATUS_RE`, `STATUS_SCAN_LINES`, `EXEMPT_STATUSES`, `_STATUS_DECORATORS`, `lifecycle_status`, `status_word` and `is_compression_exempt` move verbatim — bodies and the `align-status-reader-to-real-lines` comment block byte for byte — into `ideation_dashboard/doxbench_status_exemption.py`, taking the `doc_health` import with them. Everything else stays, `exemption_rail` included: marking a source with whatever status a reader reports is generic, and only the READ is this corpus's. `doxbench_packet.py` now names `doc_health` in no import at all. The seven names stay ANSWERABLE on `doxbench_packet` through a module-level `__getattr__` — PEP 562, the same shape `authoring.__getattr__` uses for `REQUIRED_HEADER_FIELDS` under § 2.3 — so no caller and no existing test needed an edit. It resolves underscore names too, deliberately: `test_doxbench_packet`'s mutation check reads `pk._STATUS_RE` to prove the exotic-separator fixture pins the defect that wide ruling closed. A top-level re-export was rejected because it would put the adapter-column module back into the generic module's import graph, which is the fork this carve exists to prevent; lazily, the dependence on the seam sits at ONE import statement, in `_status_exemption()`. OQ-1'S RECOMMENDED ROUTE THROUGH `classify()` IS NOT AVAILABLE, and this ships the task's stated fallback rather than widening a closed Protocol. `corpus_adapter.Classification` carries kind, required fields, missing fields and an unclassifiable reason — never a status VALUE — and RULING OQ-2 (2026-09-06, NO) bounds `classify` to exactly that. The rail needs the value, and it runs over in-memory strings rather than documents a corpus holds. Both gaps are reported for Brett's word; a test pins the shipped shape so a later ruling has something explicit to move. `NO_IMPLICIT_PUSH_MODULES` is WIDENED to carry the new filename: splitting a swept module is a way of narrowing that negative which no assertion would have caught, since both halves keep passing while half the code walks out of it. Proof: `tests/ideation-dashboard/test_doxbench_status_exemption.py` (52 tests) — neutrality by AST scan with its own negative control, alias closure in both directions plus a parse proving the assignments really are gone, and PARITY against verbatim copies of the pre-split bodies over the fixture corpus, over 80 real documents, and over a whole assembled packet compared as a source tuple and as rendered section bytes. The `align-status-reader-to-real-lines` guards are restated against the carved module directly, so they survive the alias's eventual removal. Six mutations were run and every one was caught. Refs #656 Lane: openxfactory-4-opendox-extraction Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01CHAHvr9zFHRd4kWVnZLK9k
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 refactor appears behavior-preserving with extensive parity/neutrality tests, and the remaining feedback is limited to type-annotation accuracy.
Pull request overview
Splits the Status: header lifecycle-exemption reader out of the generic packet assembler so the assembler can “travel” without importing openxFactory-only doc_health, while preserving behavior via a __getattr__ alias bridge and parity tests.
Changes:
- Added
scripts/ideation_dashboard/doxbench_status_exemption.pycontaining the carved status reader (lifecycle_status,status_word,is_compression_exempt) and related constants. - Updated
scripts/ideation_dashboard/doxbench_packet.pyto resolve the carved reader via a single seam import and to keep backward-compatible attribute access via module-level__getattr__. - Added a new test suite proving neutrality/closure/parity and widened
NO_IMPLICIT_PUSH_MODULESto include the carved module.
File summaries
| File | Description |
|---|---|
| tests/ideation-dashboard/test_doxbench_status_exemption.py | New tests asserting neutrality, alias closure, parity with pre-split behavior, and guard agreement against doc_health. |
| tests/ideation-dashboard/conftest.py | Expands the “no implicit push” sweep to include the new carved module. |
| scripts/ideation_dashboard/doxbench_status_exemption.py | New carved module implementing the status header read and compression-exemption decision. |
| scripts/ideation_dashboard/doxbench_packet.py | Removes direct doc_health dependency; routes status reading through the carved module and preserves legacy symbol access via __getattr__. |
Review details
Suppressed comments (1)
scripts/ideation_dashboard/doxbench_status_exemption.py:136
is_compression_exemptis declared astext: strbut is safe for non-strings becauselifecycle_statusguards withisinstance(text, str). Align the type annotation with the real behavior to avoid incorrect type assumptions at call sites.
def is_compression_exempt(text: str) -> bool:
"""Whether this content is exempt from aggressive compression, read from
its OWN lifecycle status header."""
return status_word(lifecycle_status(text)) in EXEMPT_STATUSES
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Four independent-verifier findings fixed: F1/F7/F13 - __getattr__ now catches ModuleNotFoundError from _status_exemption() (raised when the adapter-column module is absent post-carve) and re-raises AttributeError naming the missing attribute, chained via `from exc`. Three prose sites already claimed AttributeError was what happened; it was actually ModuleNotFoundError, which hasattr()/getattr(default) do not swallow. New test: test_the_carved_away_case_is_an_ordinary_attribute_error_too. F2 - test_no_watch_listed_candidate_is_depended_on_anywhere_in_this_slice (test_doxbench_packet.py) widened to scan doxbench_status_exemption.py: the 72 moved lines left the file this negative covered, so the sweep silently narrowed at the carve. Pure widening, no assertion changed. F3/F8 - test_the_alias_set_cannot_drift_from_what_the_carved_module_defines rewritten to derive the rail's public surface from its AST rather than vars(rail) filtered by a value's reported __module__, which drops any value whose TYPE supplies __module__ (a compiled re.Pattern, e.g. the rail's own _STATUS_RE, reports __module__ == "re"). Verified by mutation: a second re.compile(...) constant added to the rail now reds this test. F4/F9 - PRESERVED_SCANS (test_provider_boundary.py) gained a row for test_doxbench_status_exemption.py::test_the_carved_module_contains_no_forbidden_spelling, the one per-module negative-space scan in the package not yet registered. PR body corrected: "What moved" table's `import re` line cite (65 -> 63), and a "## Fix round" section disclosing all four fixes. Copilot review thread (type annotations on lifecycle_status/ is_compression_exempt) answered by reply only: the annotations moved byte-for-byte from the pre-split code and predate this PR. Lane: openxfactory-4-opendox-extraction Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_019sa33gYhfLF1F1MkS7Xrd6
There was a problem hiding this comment.
🟢 Approval recommended
The carve is well-defended by extensive tests for neutrality and parity, and the only noted issue is a small, non-blocking performance optimization opportunity.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
scripts/ideation_dashboard/doxbench_packet.py:970
exemption_railscans each source’s text twice: once viarail.lifecycle_status(...)and again insiderail.is_compression_exempt(...)(which re-callslifecycle_status). Sincestatusis already computed, derivecompression_exemptfrom that value to avoid a redundant header scan per source.
- Files reviewed: 6/6 changed files
- Comments generated: 0 new
- Review effort level: Lite
…-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
…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)
Realizes
split-opendox-two-layer-product§ 2.4 OQ-1 as ruled:scripts/ideation_dashboard/doxbench_packet.pyis split along the line it straddles, so the generic packet assembler can travel to openDox with the chat-turn route that calls it while this corpus'sStatus:-header read stays in the openxFactory-adapter column. Zero behaviour change to any existing behavioural assertion. The original test-file edit was theconftest.pysweep widening the memo itself mandates; a fix round added three more widenings/repairs to pre-existing negative-space tests, all disclosed in ## Fix round below. Refs #656.Stack note. § 2.4 PR-1 (
#736,scripts/route_extension.py/scripts/subcommand_extension.py) is open in parallel onfeat/split-2-4-extension-points. This PR touches neither of those files and shares no other file with it; it branches frommainand targetsmaindirectly, so the two can land in either order.What moved
Bodies and the
align-status-reader-to-real-linescomment block moved byte for byte (verified bydiffagainstorigin/main); only the enclosing file changed._STATUS_REideation_dashboard/doxbench_packet.py:134ideation_dashboard/doxbench_status_exemption.pySTATUS_SCAN_LINESdoxbench_packet.py:135doxbench_status_exemption.pyEXEMPT_STATUSESdoxbench_packet.py:152doxbench_status_exemption.py_STATUS_DECORATORSdoxbench_packet.py:161doxbench_status_exemption.pylifecycle_statusdoxbench_packet.py:164-172doxbench_status_exemption.pystatus_worddoxbench_packet.py:175-183doxbench_status_exemption.pyis_compression_exemptdoxbench_packet.py:186-189doxbench_status_exemption.pydoxbench_packet.py:118-162doxbench_status_exemption.py, verbatimfrom doc_health.lines import split_keependsdoxbench_packet.py:68doxbench_status_exemption.pyimport redoxbench_packet.py:63_STATUS_REStayed: everything else,
exemption_railincluded. It is the MARKING mechanism (dataclasses.replace(source, status=…, compression_exempt=…)), and marking a source with whatever status a reader reports is a thing any corpus's assembler does. Its positional signature is unchanged.Design decisions taken
doxbench_packet.py(test_doxbench_packet.py:43,:953-958,test_doxbench_blank_reason.py:769-790), andtest_provider_boundary.py:243requires that file's needle scan to survive. Naming the generic half after the file every caller already imports keeps all four pointed at real subjects.__getattr__— PEP 562, the same shapeauthoring.__getattr__uses forREQUIRED_HEADER_FIELDSunder § 2.3. That is what let every behavioural test stay unmodified. A top-levelfrom … importwas rejected: it would put the adapter-column module back into the generic module's import graph, reading as neutral in the AST scan while being a hard dependency in fact.__getattr__serves UNDERSCORE names too. The obviousnot name.startswith("_")guard would silently breaktest_mutation_reverting_lifecycle_status_alone_reproduces_the_divergence, which readspk._STATUS_REon purpose to prove the exotic-separator fixture pins the defect the wide ruling closed. It would have errored rather than failed, in a file nobody edited.exemption_railand__getattr__both resolve through_status_exemption(), so the seam is a single import statement; a test asserts exactly one.exemption_railresolves once per call, not once per source.corpus_adapter_openxfactory/. That package's__all__is closed to two names andtests/corpus-adapter/test_no_privileged_route.pyscan 1 fails any outside importer binding a third; putting the rail there would force widening a ratified closure. A sibling module keeps the column assignment a § 3.1 manifest row.NO_IMPLICIT_PUSH_MODULESwidened, per the memo's rule (§ 3 PR-3, § 6). Splitting a swept module is a way of narrowing that negative which no assertion would catch — both halves keep passing while half the code walks out of it.align-status-reader-to-real-linesguards are restated against the carved module directly. The existing ones reach it through the alias and are untouched; the alias is a bridge scheduled for demolition at the carve, and a ratified wide ruling should not be defended only by a bridge.__getattr__is left unguarded for the post-carve world (decision 2 below): after the carve the names raiseAttributeError, loudly, rather than degrading to a neutral posture. (Fix round:_status_exemption()'s absent-module case actually surfaced asModuleNotFoundError, notAttributeError, until the fix round below caught and translated it — see ## Fix round item 1.)Proof
Counts before/after,
--collect-onlyover the same two suites, from a detached worktree atorigin/mainand from this branch:origin/main+52 exactly, all of them the new file. No existing test's count changed, and no existing behavioural test was edited.
Test files touched: 2.
tests/ideation-dashboard/test_doxbench_status_exemption.pyis new (52 tests).tests/ideation-dashboard/conftest.pygains one tuple entry plus the comment recording why — the widening the memo mandates, which is not an edit of a behavioural assertion.Goldens: none exist over packet output. The parity the slice asks for therefore has no golden to reconcile, and none was regenerated. It is proved instead by copying the pre-split bodies into the test file verbatim and comparing:
Status:, no header, a header past the window, non-strinputs);docs/**.mddocuments the existing drift check reads;assemble_packet(...)through the real path, then every source re-marked from its own text with the pre-split reader:packet.sourcestuple equality,packet_sections()byte equality,declaration_text()equality. Non-vacuity is asserted on both sides of the exemption (ratified/True,draft/False), and a negative control shows a divergent reader would move both the tuple and the bytes.Mutation checks run (6 of 6 caught):
from doc_health.lines import …todoxbench_packet.pytest_the_packet_module_imports_neither_the_checker_nor_the_home_adaptertest_the_dependence_on_the_carved_rail_sits_at_exactly_one_lineSTATUS_SCAN_LINESindoxbench_packet.pytest_the_packet_module_no_longer_defines_the_carved_names_itselftest_the_alias_set_cannot_drift_from_what_the_carved_module_definesstandardfromEXEMPT_STATUSESstr.splitlines()The neutrality scan is AST-parsed, never grepped (
tests/import_scan.py), and carries its own negative control over five spellings of the reintroduced dependency including a lazy function-local one.Not in this PR
scripts/route_extension.py/scripts/subcommand_extension.py— those are Add the route and subcommand extension points behind serve.py and cli.py (split § 2.4, PR 1 of 4: scaffolding, zero behavior change) #736's.openspec/,contracts/,docs/, README,tasks.md— bookkeeping is the orchestrator's.serve.py/cli.pysplit.scripts/doc_health/lines.py:46andscripts/doc_health/corpus.py:193both nameideation_dashboard.doxbench_packet.lifecycle_statusin their sweep records. No test parses them, and doc edits are out of scope — noted for the orchestrator.doxbench_scope, whichdesign.md:284-286files under openXdox rather than openDox. Out ofpkt's scope; worth a § 3.1 manifest note.Fix round
Four independent-verifier findings addressed with a code/test fix; one wording-only PR-body correction folded in above (the
import reline-number cite); one Copilot review thread addressed by reply only (see thread)._status_exemption()'s bareimport ideation_dashboard.doxbench_status_exemptionraisedModuleNotFoundErrorwhen that module is absent — anImportError, notAttributeError— while three prose sites (the__getattr__docstring, the rail comment, and decision 2/8 above) saidAttributeError. The practical gap:hasattr(pk, "lifecycle_status")andgetattr(pk, "lifecycle_status", default)swallowAttributeErrorbut notModuleNotFoundError, so a caller written to the documented contract would have crashed where it was told it would degrade.__getattr__now catchesModuleNotFoundErrorfrom_status_exemption()and re-raisesAttributeErrornaming the missing attribute (chained viafrom exc), restoring the documented semantics. New test:test_the_carved_away_case_is_an_ordinary_attribute_error_too(monkeypatchespk._status_exemptionto raiseModuleNotFoundError, asserts the re-raised type, the chain, and thathasattr/getattr-default now degrade rather than raise).test_no_watch_listed_candidate_is_depended_on_anywhere_in_this_slice(test_doxbench_packet.py) widened to adddoxbench_status_exemption.pyto its scanned-module tuple. The 72 moved lines left the file this negative scanned; without the widening the sweep stayed green while that code walked out of its coverage — a pure widening, no assertion changed.test_the_alias_set_cannot_drift_from_what_the_carved_module_definesrewritten to parse the carved module's syntax tree instead of filteringvars(rail)by a value's reported__module__. That filter drops any rail-level value whose TYPE supplies__module__— a compiledre.Pattern(_STATUS_REitself is one) reports__module__ == "re", so a future regex constant added to the rail and left off the alias set would have passed unnoticed, even though the rail already holds exactly that kind of value. Verified by mutation: appending a secondre.compile(...)constant to the rail now fails this test (previously green); reverted after confirming.PRESERVED_SCANS(test_provider_boundary.py) gained a row fortest_doxbench_status_exemption.py::test_the_carved_module_contains_no_forbidden_spelling— the carved module's own forbidden-spelling scan was the only per-module negative-space scan in the package not yet protected by the registry that exists to stop a later change deleting one and staying green.None of the four is a repoint (no test's assertion target moved to a different file/name); all four are widenings of an existing negative or a new companion test, per RULING (a).
Decisions for Brett
classify()does not exist, and this PR ships the task's stated fallback.corpus_adapter.Classificationcarrieskind,required_fields,missing_fieldsandunclassifiable— never a status VALUE — andcorpus_adapter_openxfactory/classify.py:26-33records RULING OQ-2 (2026-09-06, NO): "Classify answers KIND and REQUIRED FIELDS — nothing else." The rail needs the raw value (PacketSource.statusis rendered verbatim into evidence sections) and the leading status word. Independently,classify(corpus, document)answers about a document a corpus holds, while this rail runs over in-memoryPacketSource.textonce per evidence item per chat turn; the only in-tree way to classify a loose body isauthoring._classify_proposal's corpus-of-one, a tempdir round trip. So the rail moved COLUMN keeping its directdoc_healthimport, and the Protocol was not extended. Either (a) accept that — the task's own fallback, and what is shipped — or (b) overturn OQ-2 and add a status field toClassification, which reopens a closed Protocol (OPERATIONS,tests/corpus-adapter/test_interface_closure.py).test_the_carved_module_still_reaches_doc_health_directlyasserts the shipped shape and assertsClassificationhas no status field, so if (b) is ever ruled, that test is the one line that has to move.pk.lifecycle_statusand friends raiseAttributeErrorat the first assembly — loud, and it breaks openDox's chat turn until openDox supplies its own rail. The alternative is a declared neutral posture (status=None, compression_exempt=False, in the module's ownPOSTURE_REDUCEDidiom), which is a silent-degradation shape this corpus normally refuses. Nothing in § 2.4 forces the choice now; it needs your word rather than an author's judgment, and § 3.1 is where it lands.Asking for your word on this one before anything further happens to it.
🤖 Generated with Claude Code
https://claude.ai/code/session_01CHAHvr9zFHRd4kWVnZLK9k