Repository navigation
Derive the dashboard's required header fields from the adapter's classify (split § 2.3) - #728
Conversation
…sify `split-opendox-two-layer-product` § 2.3: `authoring.py`'s `REQUIRED_HEADER_FIELDS` — a constant co-authoritative with `doc_health.corpus.STATUS_SCAN_LINES` — becomes a CLASSIFY response (design § D2). The create gate no longer authors the field block and no longer scans for it: `missing_required_headers` returns the `missing_fields` of the home adapter's `classify` response, asked through `home_corpus()` and the interface's own operations. The block itself moves to the corpus's shape (`corpus_adapter_openxfactory/home.py`), because the direction has to invert for the consumer to derive rather than restate; `authoring.py` therefore stops importing `doc_health` altogether, and stops being one of the readers `doc_health.lines` enumerates as having to agree about a header window. `REQUIRED_HEADER_FIELDS` survives as a lazily resolved alias (PEP 562) so `completeness.GOVERNANCE_HEADER_FIELDS`'s existing cross-check keeps working — and now measures that deliberate restatement against the corpus's own answer. Tests pin that the alias is derived and not authored: authoring.py is parsed for an assignment that must not exist, and a different table answered through the same interface must change the gate. Parity: the migrated gate's answer is identical to the frozen pre-migration one over all 679 governed documents; the adapter's own header parity now measures against that frozen oracle rather than against the caller it fed. Refs #656 Lane: openxfactory-4-opendox-extraction Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01MDVAo41VtZqJQpuawwJeYC
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 migration is coherent end-to-end (shape → classify → gate), preserves behavior via an external oracle, and the tests prevent regressions and reintroduction of co-authoritative constants.
Pull request overview
This PR completes §2.3 of split-opendox-two-layer-product by making the ideation-dashboard “required header fields” come from the corpus adapter’s classify response (and therefore from the adapter’s declared corpus shape) rather than from a dashboard-owned constant, while keeping a lazy compatibility alias for REQUIRED_HEADER_FIELDS.
Changes:
- Move the authoritative required header field tuple into
scripts/corpus_adapter_openxfactory/home.py(HEADER_FIELDS) and wireHOME_SHAPE.required_fields_by_kindto it. - Update
scripts/ideation_dashboard/authoring.pysomissing_required_headers(text)andrequired_header_fields()derive fromclassifyby staging a “corpus of one” underideation/and querying viahome_corpus(). - Add a frozen pre-migration oracle plus strong parity/mutation tests to ensure behavior is byte-for-byte unchanged and the value is truly derived (not re-authored).
File summaries
| File | Description |
|---|---|
| tests/ideation-dashboard/test_authoring_classify_derivation.py | New end-to-end parity + mutation-control tests proving the gate’s answer is derived from classify and unchanged over the governed corpus. |
| tests/header_contract_oracle.py | New frozen pre-§2.3 oracle for header completeness to avoid tautological comparisons post-migration. |
| tests/corpus-adapter/test_openxfactory_adapter.py | Update adapter parities to measure required fields against the oracle and assert the authoring alias reflects the adapter table. |
| scripts/ideation_dashboard/completeness.py | Comment update clarifying the cross-check now measures the restatement against the corpus answer. |
| scripts/ideation_dashboard/authoring.py | Replace local header-scan logic with classify-derived answers; add lazy REQUIRED_HEADER_FIELDS alias via PEP 562 __getattr__. |
| scripts/corpus_adapter_openxfactory/home.py | Author HEADER_FIELDS and OBLIGED_PREFIX in the adapter home shape and remove imports from the dashboard package. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
RULING — WORDS — Brett Heap, 2026-09-06T23:03Z, in session (lane openxfactory-4-opendox-extraction, session 01MDVAo41VtZqJQpuawwJeYC), verbatim: "merge 727 and 728 when green" — Path A PR-4 #727 (boundary suite) and § 2.3 #728 (classify-derived header fields) land once green with no unresolved threads and their verifiers passed; landing notes (no openspec/changes/ path); admin squash because brettheap-authored PRs cannot self-clear the code-owner review. Lane: openxfactory-4-opendox-extraction (formerly openxfactory-opendox) |
|
LANDING (record only — no openspec/changes/ path) — lane openxfactory-4-opendox-extraction, session 01MDVAo41VtZqJQpuawwJeYC, 2026-09-06T23:09Z, PR #728 into openxFactory main on Brett Heap's words "merge 727 and 728 when green"; head 87c2c10, all nine checks SUCCESS, 0 unresolved threads, 0 closing refs, MERGEABLE, no file overlap with main. Lane: openxfactory-4-opendox-extraction (formerly openxfactory-opendox) |
…idence; record the § 2 carried items (#769) split-opendox-two-layer-product group-2 bookkeeping: tick § 2.1 (#724 e2b8f62), § 2.2/2.2a (#725 ea4e6ff), § 2.3 (#728 1a2ea82), § 2.4 (#736 a83eb93, #741 75467fe, #748 7f7ce75, #742 421b52d, #761 7992b87), § 2.6 (gate re-run on the branch: 6681 passed, the environmental snapshot test and the tolerated disposition artifact identical on main); § 2.5 stays open (Path A D-2). Records the twelve § 2 carried items for the § 3.1 carve manifest; repoints two doc_health sweep-record strings to doxbench_status_exemption. Landed under a Rule 6 window on Brett Heap's word "merge 769 when green" (2026-09-07). Refs #656. Lane: openxfactory-4-opendox-extraction Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q8CkMMAdcUZCqAUTgNjsPy
Lane: openxfactory-4-opendox-extraction (formerly openxfactory-opendox)
What
split-opendox-two-layer-product§ 2.3: "authoring.py'sREQUIRED_HEADER_FIELDS— today co-authoritative withdoc_health.corpus.STATUS_SCAN_LINES— becomes a CLASSIFY response rather than a constant", the operationdesign.md§ D2 names ("what KIND is this document, and which fields does its kind require").The dashboard's create gate now asks openxFactory's own corpus adapter:
authoring.missing_required_headers(text)returns themissing_fieldsof aclassifyresponse, andauthoring.required_header_fields()returns itsrequired_fields— both reached throughhome_corpus()and the interface's six operations, no other route.corpus_adapter_openxfactory/home.py, the one module permitted to name this repository's own layout). The direction has to invert for the consumer to derive rather than restate: before this PRhome.pyimported the block fromauthoring.py, so leaving it there would make the dashboard's answer its own answer, laundered through the adapter.authoring.pyconsequently stops importingdoc_healthaltogether and stops being one of the readersdoc_health/lines.pyenumerates as "readers of a lifecycle header that must agree". It cannot drift from the corpus's reader because it no longer reads.Why this shape (design decisions taken)
1. A proposal is classified as a corpus of one.
classifyanswers about documents a corpus holds — it reads throughread, so an unlisted identity refuses. A create gate's whole question is about a body that is not in the corpus yet. So_classify_proposalstages the body in a throwaway tree, under the same prefix the create path writes into, and resolves it throughhome_corpus(location)like any other location. The alternative — importing the package'sclassify_textand calling it on a string — is precisely the private doorcorpus-adapter-seamrequirement 4 forbids, andtest_no_privileged_route.pyfails the build for it. The gate binds exactly one name out of the package (home_corpus), asserted in the new test file as well as by the estate-wide scan.2.
REQUIRED_HEADER_FIELDSis KEPT, as a lazily resolved alias (PEP 562 module__getattr__), not as a constant. Every in-tree production consumer is migrated — after this PR nothing underscripts/reads the name at all. It is kept becausecompleteness.GOVERNANCE_HEADER_FIELDSdeliberately RESTATES the block to keepcompleteness.py's import graph free of anything that touches the filesystem, andtest_completeness.pycross-checks the two so they cannot drift. Keeping the name turns that existing cross-check into a check against the CORPUS's answer — strictly stronger than what it checked before; deleting it would either delete the cross-check or force intocompleteness.pythe import it was written not to have. It is lazy rather than a module-level assignment because an eagerREQUIRED_HEADER_FIELDS = required_header_fields()would ask the corpus at import time — a filesystem read during an import, and an ordering hazard between the two packages.Two tests pin that the alias is derived, not authored:
authoring.pyis parsed for an assignment (and for the six-name literal under any name) that must not exist, and a different required table — the real adapter class and the real classifier over a mutated shape, substituted throughhome_corpus— must change both the alias and the gate's answer. A constant left in place passes every parity trivially; these are what make that impossible.3.
obliged_prefixesis now authored inhome.pytoo, and pinned equal toauthoring.IDEATION_PREFIX. They answer two different questions over one tree — which tree the header block obliges, and which tree a create may write into (a gate that exists whether or not any header is obliged there). Importing one from the other would put back the edge § 2.3 removes. The existing parity assertion holds them equal and is no longer vacuous, the same treatmentscan_rootsgets againstcorpus_root.SCANNED_ROOTSunder RULING OQ-4.4. The parities measure against a frozen oracle, never against the migrated caller.
tests/header_contract_oracle.pyholds the pre-§ 2.3 algorithm verbatim, with its own copy of the field block and its own window — deliberately not derived, since a derived oracle follows the change it exists to detect.test_openxfactory_adapter.py::test_classify_agrees_with_the_corpus_own_header_readersused to compareclassifywithauthoring.missing_required_headers; since that function is this call now, it was about to become a function compared with itself, so it measures against the oracle instead. One oracle, read by both suites, because hand-copying it would reintroduce inside the tests the pattern this change removes from the code.Behaviour is byte-for-byte. The signature of
missing_required_headersis unchanged (no new parameter): the gate is path-agnostic exactly as before, which is why the proposal is staged under the obliged tree rather than at the caller's own key.render_scaffoldis untouched; its rendered skeleton is still asserted header-complete through the migrated gate.Validation
python3 -m pytest -q tests/corpus-adapter tests/ideation-dashboard/test_authoring_classify_derivation.py tests/ideation-dashboard/test_authoring_agent.py tests/ideation-dashboard/test_completeness.py tests/ideation-dashboard/test_header_value_readers.py→ 153 passed;tests/corpus-adapter+ the new file alone → 29 passed. The fullpython3 -m pytest -q tests/corpus-adapter tests/ideation-dashboard tests/doc-health→ 6557 passed, 31 skipped, 1 failed in 868s, the one failure being the pre-existing environmentaltest_snapshot.py::test_find_validator_locates_pinned_checkout(it looks for a sibling openxFactory checkout, which a scratch worktree has no parent for). The direction test (tests/doc-health/test_import_direction.py) and all four no-privileged-route scans are green.test_the_migrated_gate_answers_identically_over_the_whole_governed_corpuscompares the migrated gate with the frozen oracle over 679 governed documents (both scopes:iter_doc_paths∪iter_lifecycle_paths), with a floor assertion so a walk that lost its subject cannot pass, and a companion test asserting the population exercises both the complete and the incomplete answer.HOME_SHAPE's table turned 7 tests red across both suites — including the whole-corpus parity, the order test, and the adapter's own header parity — and restoring it returned them to green. The in-suite control (test_a_different_classify_answer_changes_the_gate) does the same thing throughmonkeypatch, so it runs on every CI run rather than having been true on the day it was checked.OPENSPEC_TELEMETRY=0 openspec validate --all --strict→ 97 passed, 1 failed; the one failure ischange/disposition-codexfactory-declared-renames, a local untracked artifact that fails identically in a cleanorigin/mainworktree (verified side by side).--single-repodelta vs a freshorigin/mainworktree: ZERO. Both runs exit 0 with byte-identical output once the checkout directory name is normalised.pytest-suite.yml's exactEXPECT_SKIPPED: "21"is unaffected;MIN_SELECTED/MIN_PASSEDare floors and only rise.Scope
Touched:
scripts/corpus_adapter_openxfactory/home.py,scripts/ideation_dashboard/authoring.py, one comment inscripts/ideation_dashboard/completeness.py,tests/corpus-adapter/test_openxfactory_adapter.py, and two new test files. Not touched, deliberately:serve.py/cli.py(§ 2.4),doc_healthinternals,openspec/**,contracts/**,docs/**, README.doc_health/lines.py's reader enumeration is left as it stands — its closing claim ("every one of the readers named above now scans through THIS module") stays true, since the gate's answer is still computed bysplit_keependsinsideclassify; the enumeration is historical, and editing doc-health prose is out of this PR's scope.Offered for Brett Heap's word — nothing here is merged, ratified or landed on my own initiative.
Refs #656
🤖 Generated with Claude Code
https://claude.ai/code/session_01MDVAo41VtZqJQpuawwJeYC