Skip to content

generator: the exclusion check reads its status vocabulary from the registered DomainProfile, not doc_health's TAXONOMY (RULING C2; § 4.4 follow-up) - #16

Merged
brettheap merged 1 commit into
mainfrom
fix/generator-status-vocabulary-from-profile
Sep 12, 2026
Merged

brettheap merged 1 commit into
mainfrom
fix/generator-status-vocabulary-from-profile

Conversation

@brettheap

@brettheap brettheap commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

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

Refs opensoft/openXfactory#656

The defect (register item)

Register item from § 4.4's LANDED note, openxFactory#656 comment 5640381252 (raised by Copilot on #14 at generator.py:361/:83): src/openxdox/generator.py's _document_exclusion_reason still validated a document's status against a module-level LIFECYCLE_STATUSES = TAXONOMY imported from doc_health — a hardcoded status source (RULING C2, tasks.md § 4.4: "a hardcoded status word is a defect under domain-mapping-declaration") and a declared cross-column reach (pyproject.toml names doc_health as "a BUILD-arc cross-column reach ... not this PR's to resolve"). § 4.4 (#14 → 3840c167) moved every OTHER status site in this module to read the registered DomainProfile; this PR finishes the job at this one remaining site.

What changed

src/openxdox/generator.py:

  • Line 66: from doc_health import TAXONOMY, corpus -> from doc_health import corpus (narrows the import; corpus itself is still needed, see "Residue" below).
  • Lines 79-83 (old numbering): removed the LIFECYCLE_STATUSES = TAXONOMY module constant and its explanatory comment.
  • New helper _document_status_vocabulary() (added just above _document_exclusion_reason, in the # --------------------------- per-document degradation --------------------------- section): profile.statuses(kind=profile.kind_declaring("demote")) — the same kind _declared_origin_kind (this module) and gate_console._draft_status already resolve through, named by the act rather than a hardcoded kind string, per this module's existing idiom (_picked_register_state, _declared_origin_kind).
  • _document_exclusion_reason now calls _document_status_vocabulary() instead of testing against LIFECYCLE_STATUSES. Behavior is unchanged for the doc.status is None arm; the "unrecognized status" arm now reads from the registered profile.
  • A process with no profile registered gets DomainProfileNotRegistered, propagated straight out of domain_profile.current() (no catch/re-raise) — the same "refuses, never falls back" contract every other profile-reading site in this module and in gate_console.py already honours.

Tests (tests/test_generator.py)

Four new tests, added directly after test_exclusion_reporting_is_opt_in, calling _document_exclusion_reason/_document_status_vocabulary directly (a SimpleNamespace(status=...) stand-in is enough, since status is the only field read) rather than through the full generate_snapshot pipeline:

  1. test_exclusion_reason_accepts_every_status_the_profile_declares — every word _document_status_vocabulary() returns is accepted.
  2. test_exclusion_reason_rejects_a_status_the_profile_does_not_declare — "in-progress" is rejected with the existing message shape.
  3. test_exclusion_reason_refuses_before_registration — uses the unregistered_profile fixture (added by § 4.4 code half: the lifecycle engine reads its vocabulary, terminal statuses and immutability point from a registered DomainProfile (RULING C2; ASK-4 5634195861) #14 in tests/conftest.py); asserts DomainProfileNotRegistered.
  4. test_a_renamed_status_word_needs_no_engine_change — loads a copy of the vendored fixture profile with governance-document's draft renamed to triaged (vocabulary id + both transitions endpoints), registers it for the duration of the test only (restored in finally), and proves the engine now accepts "triaged" and rejects the old word "draft" with no code change.

Verification

  • CI's exact invocation is green, unchanged: python -m pytest -q tests/test_leg_shape.py tests/test_dependency_direction.py tests/test_domain_profile.py tests/test_no_hardcoded_status_words.py --noconftest -> 122 passed (matching § 4.4 code half: the lifecycle engine reads its vocabulary, terminal statuses and immutability point from a registered DomainProfile (RULING C2; ASK-4 5634195861) #14's own recorded figure exactly — this PR does not move that number).
  • import openxdox.generator at this leg: still raises ModuleNotFoundError: No module named 'doc_health', now at the narrowed line 66 (from doc_health import corpus). This is the residue below, not a regression.
  • Also verified, locally only, never committed: with the real doc_health (fetched from opensoft/openxFactory's own origin/main via the API — never the stale local ~/projects/xFactory checkout) placed on PYTHONPATH in a throwaway venv, import openxdox.generator succeeds, and all four new tests plus the pre-existing test_unrecognized_status_value_is_also_excluded/test_headerless_document_is_excluded_not_emitted_with_stage_null/test_exclusion_reporting_is_opt_in pass. (A handful of other, unrelated test_generator.py tests still fail in that throwaway environment for reasons that have nothing to do with this change — a missing rfc3339-validator optional dependency and a missing contracts/schemas/ideation-dashboard-snapshot.schema.yaml file that only exists in the openxFactory repo, plus a separate pre-existing opendox.serve -> ideation_dashboard import-time gap this repo's own test_dependency_direction.py already discloses as "owed a later act" and unrelated to doc_health/TAXONOMY.) CI itself does not run tests/test_generator.py at all today (RULED Q-L8 (b'), stated in .github/workflows/validate.yml), so none of this is a CI change.

Test-count / reach-table impact: NONE, and here is why

  • tests/test_no_hardcoded_status_words.py (the AST guard, "eighteen ... over sixteen lines"): unmoved. LIFECYCLE_STATUSES = TAXONOMY was a name-to-name assignment, never a watched string literal (WATCHED_WORDS) — the guard only counts ast.Constant string literals. Removing it changes nothing the guard measures, and this PR introduces no new literal status word (the new code reaches the vocabulary through kind_declaring("demote"), an act name, exactly like the two existing sites _picked_register_state/_declared_origin_kind).
  • tests/test_dependency_direction.py's DOC_HEALTH_SURFACE table: unmoved. It counts doc_health import statements per module (_census), not names-per-statement. generator.py had 3 import-time doc_health import statements before this PR (from doc_health import TAXONOMY, corpus; from doc_health.corpus import RealGit; from doc_health.lines import split_keepends) and still has exactly 3 after (only the first statement's imported names narrowed) — "src/openxdox/generator.py": (3, 0) stands, confirmed by the still-122-passed run above.

Residue: doc_health is still reached elsewhere in this module (not this PR's to resolve)

Per the task scope, generator.py still needs doc_health for reasons unrelated to the status taxonomy:

  • doc_health.corpus.Doc (type annotation only, several sites), doc_health.corpus.load_docs (_project_documents callers: generate_snapshot, live_topic_health, live_tile_scopes), and doc_health.corpus.STATUS_SCAN_LINES (HEADER_SCAN_LINES = corpus.STATUS_SCAN_LINES, module level) — the whole corpus-scanning surface this module builds on.
  • doc_health.corpus.RealGit — RealGitDates.__init__'s real-git fallback (tests inject FakeGit instead).
  • doc_health.lines.split_keepends — _header_value's header-window line splitting.

This is the same residue pyproject.toml already documents ("a BUILD-arc cross-column reach ... not this PR's to resolve") and the same one tests/test_dependency_direction.py's DOC_HEALTH_SURFACE table already enumerates for generator.py ((3, 0)). Resolving it is wider BUILD-arc work (making the whole corpus/git/line-splitting surface importable at this leg), not a status-vocabulary defect, so it stays a register item.

🤖 Generated with Claude Code

Summary by Sourcery

Validate document statuses against the registered DomainProfile so profile vocabulary changes require no generator code changes.

Bug Fixes:

  • Make document exclusion validation use the registered domain profile's status vocabulary instead of the hardcoded doc_health taxonomy.

Enhancements:

  • Remove the generator's module-level lifecycle status vocabulary and resolve the profile vocabulary at call time, refusing when no profile is registered.

Tests:

  • Add coverage for profile-declared statuses, unrecognized statuses, missing profile registration, and renamed profile status values.

…egistered DomainProfile, not doc_health's TAXONOMY

RULING C2 / § 4.4 follow-up (register item, openxFactory#656 comment
5640381252, raised by Copilot on #14 at generator.py:361/:83).
`_document_exclusion_reason` compared `doc.status` against
`LIFECYCLE_STATUSES`, a module-level alias of `doc_health.TAXONOMY` —
a hardcoded status source inside the domain-neutral engine, and the
one generator.py site § 4.4's code half (#14, 3840c16) deliberately
left standing as a BUILD-arc follow-up.

`_document_exclusion_reason` now asks the registered `DomainProfile`
for the vocabulary via a new `_document_status_vocabulary()` helper:
`profile.statuses(kind=profile.kind_declaring("demote"))` — the same
kind `_declared_origin_kind` and `gate_console._draft_status` already
resolve through the identical way, named by the act rather than by a
hardcoded kind string. A process with nothing registered gets
`DomainProfileNotRegistered`, propagated from `domain_profile.current()`
exactly like every other profile-reading site in this module — never a
hardcoded fallback.

`LIFECYCLE_STATUSES` and its explanatory comment are removed; the
import narrows from `from doc_health import TAXONOMY, corpus` to
`from doc_health import corpus`. `doc_health.corpus`,
`doc_health.corpus.RealGit` and `doc_health.lines.split_keepends`
stay: `corpus.Doc`/`corpus.load_docs`/`corpus.STATUS_SCAN_LINES` back
the whole corpus-scanning surface (`_project_documents`,
`generate_snapshot`, `live_topic_health`, `live_tile_scopes`), `RealGit`
backs `RealGitDates`'s real-git fallback, and `split_keepends` backs
`_header_value`'s header-window parsing — none of that is the status-
taxonomy defect this slice fixes, and `pyproject.toml` already carries
this residue as a declared, not-this-PR's-to-resolve cross-column
reach. `import openxdox.generator` still raises `ModuleNotFoundError:
No module named 'doc_health'` at this leg (now at the narrowed line 66)
because of that residue — confirmed locally, and also confirmed the
module imports cleanly once `doc_health` is resolvable (verified
against the real doc_health fetched from openxFactory's own origin/main,
in a throwaway venv, never committed).

Tests (tests/test_generator.py): four new direct tests of
`_document_exclusion_reason`/`_document_status_vocabulary` — accepts
every status the registered profile declares, rejects one it does not,
refuses before registration (`unregistered_profile` fixture), and a
status word renamed on a copy of the fixture profile (draft -> triaged)
needs no engine change. Verified passing locally (real doc_health +
a throwaway ideation_dashboard stub standing in for the pre-existing,
disclosed opendox.serve/ideation_dashboard gap that already blocks all
of test_generator.py in this environment — RULED Q-L8 (b'), unrelated
to this change) — CI itself does not run test_generator.py yet, by the
same disclosed narrowing `validate.yml` already states.

The AST guard's recorded literal count (test_no_hardcoded_status_words.py,
"eighteen ... over sixteen lines") is unmoved: `LIFECYCLE_STATUSES =
TAXONOMY` was a name-to-name assignment, never a watched string literal,
so removing it changes nothing the guard measures. The dependency-
direction reach table (test_dependency_direction.py DOC_HEALTH_SURFACE)
is unmoved too: it counts `doc_health` IMPORT STATEMENTS per module, and
`generator.py` still carries exactly the same three (now narrower)
import-time statements it had before — `generator.py: (3, 0)` stands.
CI's exact four-file invocation (tests/test_leg_shape.py,
tests/test_dependency_direction.py, tests/test_domain_profile.py,
tests/test_no_hardcoded_status_words.py, --noconftest) is green: 122
passed, matching #14's own recorded figure exactly.

Lane: openxfactory-4-opendox-extraction
Refs opensoft/openXfactory#656

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 12, 2026 00:03
@sourcery-ai

sourcery-ai Bot commented Sep 12, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR completes the § 4.4 follow-up by making document exclusion checks read status vocabulary from the registered DomainProfile at call time rather than doc_health.TAXONOMY, while preserving missing-status behavior and adding focused coverage for registration and vocabulary changes.

Sequence diagram for profile-driven document status exclusion

sequenceDiagram
    participant Caller
    participant Generator
    participant DomainProfile
    participant Document

    Caller->>Generator: _document_exclusion_reason(doc)
    Generator->>Document: status
    alt status is None
        Generator-->>Caller: missing or unparseable Status: header
    else status is present
        Generator->>DomainProfile: current()
        DomainProfile-->>Generator: registered profile
        Generator->>DomainProfile: kind_declaring(demote)
        DomainProfile-->>Generator: declaring kind
        Generator->>DomainProfile: statuses(kind)
        DomainProfile-->>Generator: registered vocabulary
        alt status is in vocabulary
            Generator-->>Caller: None
        else status is not recognized
            Generator-->>Caller: unrecognized lifecycle status
        end
    end
Loading

File-Level Changes

Change Details Files
Replaced the generator’s hardcoded doc_health status vocabulary with live resolution from the registered DomainProfile.
  • Removed the TAXONOMY import and LIFECYCLE_STATUSES alias.
  • Added a late-resolved helper using the profile’s kind_declaring("demote") and statuses() APIs.
  • Updated exclusion validation to propagate DomainProfileNotRegistered instead of falling back.
src/openxdox/generator.py
Added focused tests covering profile-derived status validation and dynamic profile changes.
  • Verified all registered statuses are accepted and undeclared statuses are rejected.
  • Verified exclusion checks refuse execution without a registered profile.
  • Verified renaming draft to triaged changes accepted vocabulary without engine changes, with registration restored afterward.
tests/test_generator.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sonarqubecloud

Copy link
Copy Markdown

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

Profile-only statuses can pass exclusion validation while producing snapshots rejected by the pinned schema.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Updates document-status exclusion checks to use the registered DomainProfile vocabulary instead of doc_health.TAXONOMY.

Changes:

  • Removes the hardcoded lifecycle status vocabulary.
  • Resolves statuses from the registered profile at runtime.
  • Adds coverage for custom, invalid, unregistered, and renamed statuses.
  • Requires alignment with the snapshot schema for renamed profile statuses.
File summaries
File Summary
src/openxdox/generator.py Uses profile-declared statuses, but may emit profile-only values rejected by the pinned snapshot schema.
tests/test_generator.py Tests profile-driven validation and renamed status behavior.
Review details
  • Files reviewed: 2/2 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.

Comment thread src/openxdox/generator.py Resolved
@brettheap
brettheap marked this pull request as ready for review September 12, 2026 00:08

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

Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 2 days and 17 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@brettheap
brettheap merged commit 17384c0 into main Sep 12, 2026
4 checks passed
brettheap added a commit that referenced this pull request Sep 13, 2026
…bytes as package data, the assembly seam (#18)

Lane: openxfactory-4-opendox-extraction

Refs opensoft/openXfactory#656 (stays OPEN). CLAIM: 5648073924.

**§ 3.4 slice S5, leg A — the gate loop leaves openDox's bundle and becomes a
contribution openXdox supplies.** openDox-spec `docs/front-end-package-boundary.md`
§ 5 row S5 @ `7d12428c`; the contract is openXdox-spec
`docs/gate-loop-view-contract.md` @ `d73767b7`, whose § 8 Q1–Q12 were RULED by
Brett Heap on 2026-09-12 at opensoft/openXfactory#656 — comments `5648044785`
(Q5, Q1, Q3), `5648049748` (Q2, Q4, Q7, Q8), `5648065587` (Q9–Q12), with the
counterpart-Q6 correction at `5649094228`.

SIX ViewBindings, not four: `gate.js:mountGateBar`, `gate-lens.js:mountLensGate`,
`gate-projects.js:mountProjectCommissions`, `dispose.js:mountRefusalPanel`,
`swb-create.js:mountCreateAffordance` and `swb-session.js:mountSessionAffordances`
— slice S4's two new class-B modules say in their own headers that they leave the
bundle here, and leaving them would have left their `gate.lens` / `gate.projects`
entries in openDox's CORE arm. Every binding names a **`shell`** region, so RULED
Q1's generic `dom` mount pass never reaches them; RULED Q3's ONE signature
`mount(host, snapshot, ctx)` is applied to all six and **the gate bar's declared
exception ends here**; RULED Q2's `exports` namespace names `isGateBearing` and
`firstEditTransport`; RULED Q4's `requires` are dotted `/capabilities` paths,
argued per binding; RULED Q8 makes `page-overlay` the declared page-level host, so
no `document.body` survives in `dispose.js`; RULED Q12's four computed routes are
declared as their LITERALS. Seventeen routes in all — § 1.2(c)'s thirteen constants
plus Q12's four — every one under this column's own `serve_gate.ACTIONS_GATE_PREFIX`.

RULED Q5's assembly seam: `openxdox.web_assets.install_view_modules(web_dir)` copies
the six modules into the one `<web_dir>/views/` that `opendox.serve.build_server`
serves, shipped as `[tool.setuptools.package-data]`, with
`serve_views.ViewModuleRoutesExtension` as the fallback. It REFUSES rather than
creating a `web_dir` or a `views/` that is not there — a bundle with no openDox in
it is an assembly error, not a partial install to continue past.

**Pairs with opensoft/openDox-code#20** (the shell half). Neither leg lands alone:
the shell stops shipping these six modules in the same act that this column starts
shipping them.

**The annotation this leg was owed has LANDED FIRST, as RULING Q-L1 requires:**
opensoft/openXfactory#1023 → `ee251d6c54b7e16728f2648c71faa90d6be76496`, carrying the
FOUR RE-DESTINATIONS under the form RULED Q6 (`gate.js`, `dispose.js`,
`swb-create.js`, `swb-session.js` from `opendox_code` to `openxdox_code`, each row's
own `destination` untouched), the seven `created:` admissions this column needed, and
sixteen declared-edit entries over eleven rows. Measured from that landed main against
this head: `verify-carve-arrival.py --destination openxdox_code --phase B` answers
**OK — 96 rows arrived, 9 digests verified, 83 declared-edit rows within their lines,
123 files with NONE undeclared, 4 rows RE-DESTINED HERE (RULED Q6), 22 declared
admissions used** — once the three PRE-EXISTING `arrival-undeclared-edit` rows that
predate this slice (`gate_console.py`, `generator.py`, `tests/ideation-dashboard/
test_generator.py`, openXdox-code #14's § 4.4 code half and #16's RULING-C2 follow-up)
are remedied in a SCRATCH manifest, never the repository's. They are listed, not
absorbed, and they still owe an annotation of their own.

Register, carried forward rather than passed over:
* **The `opendox` pin bump is owed.** This leg pins `opendox @ a99eba03`, which
  predates the view registry, so the three materialization assertions SKIP — never
  fail — until the pin names an openDox carrying § 3.4 slice S5.
* **`profile_openxfactory.py` owes one line** at openxFactory: `VIEW_EXTENSIONS =
  view_extensions.VIEW_EXTENSIONS` beside its `ROUTE_EXTENSIONS` tuple. The
  assembly's act, not this leg's.
* **The gate column's transport-failure handling is a defect this slice cannot take.**
  Copilot found, correctly, that a rejected `fetch` escapes the write path in four of
  the six modules; four of those are ARRIVED files whose flagged lines are
  byte-identical to the carve commit, and normalizing a rejection into
  `{ok: false, message}` is new BEHAVIOUR, which is in none of RULING OQ-1's three
  declared-edit classes. RULED BY THE LANE, 2026-09-13: out of S5's scope. Five
  threads resolved on that word and REGISTERED on #656 for a later declared act.
* **RULED Q7's CSS extraction is owed** for the same reason: "a stylesheet block
  leaves for another leg" is in none of OQ-1's three classes.

Copilot rounds 1–3, all fifteen threads answered and resolved. The sharpest finding
was its own correction of this PR's first shape: `gate.dispose` declared
`requires: ["actions.gate"]`, which made `resolveView` answer `null` on every HOSTED
intent plane and deleted the refusal tray the declaration was meant to describe —
fixed at `2ca488a` with a test that states the reason. Round 3 took two more: a built
`firstEditTransport` now keeps the model it validated instead of reading the
module-level install (it is the one export reached through the REGISTRY rather than a
mount, so it outlives the call that built it, and a second mount would have shaped one
editor's Save with another's model), and `tests/test_gate_console.py`'s three
expectations were repointed to `src/opendox/cli.py` — lines the carve row already
declares at `[58, 1627, 1785, 1786]`, so no new declaration was owed.

Gate evidence: destination gate above; `validate` SUCCESS at `7b86350a` (run
34727512041), the one required check; 15 review threads / 0 unresolved; Sourcery
review skipped (budget) = advisory.
brettheap added a commit that referenced this pull request Sep 24, 2026
…tree (split-opendox § 8.9 residue (i)-(iii)) (#28)

Lane: openxfactory-4 (openXfactory-4-openDox_extraction)

## What this repairs

The archived openxFactory `split-opendox-two-layer-product` booked three carve defects in this leg's snapshot validation at `tasks.md` § 8.9 (amendment #6, RULED Q-P3 (a), openxFactory #656 comment `5728856581`), "owed to a follow-up act with its own claim". The box took its `[~]` DEFERRED marker at the archive, by RULED `5778397686`. This PR is that act.

RULED at openxFactory #656 comment [5815412869](opensoft/openXfactory#656 (comment)) (item 3, **C3**, all (a)) and claimed at [5815613524](opensoft/openXfactory#656 (comment)):
- **Q-XDV1 (a):** `CONTRACTS_DIR` comes from the environment. The assembly root's export of it is a separate openRepoShape act, not this PR.
- **Q-XDV4 (a):** the two new suites stay OFF `validate.yml`'s named list.

The three defects:
- **(i)** `scripts/validate-ideation-dashboard-contracts.py`: `SCHEMAS_DIR` resolved to `ROOT / "contracts" / "schemas"`, a directory this leg does not have, "so as carved the validator cannot run from anywhere".
- **(ii)** `src/openxdox/snapshot.py`: `VALIDATOR_RELPATH` named `openxFactory/scripts/validate-ideation-dashboard-contracts.py`, which openxFactory shed at `cc4ae9d3`.
- **(iii)** `find_validator` walked every parent of its start (or of the cwd) and adopted whatever enclosing checkout still carried a pre-shed copy: "a reader adopting its enclosing tree".

**This lands AFTER opensoft/openXfactory#1153** (RULED Q-L1, `5642758731`: the row annotation for an edit to an arrived file lands first). **#1153 LANDED** as `1d14fee6`. Against openxFactory `main` at `1d14fee6`, `verify-carve-arrival.py --destination openxdox_code --phase B` with the six replicas answers **OK** for this head `3f32cb5d`: 96 rows arrived, 87 declared-edit rows within their lines, 3 unapplied, 135 files with none undeclared, 34 declared admissions used. Before #1153, `main`'s manifest refused this leg with `arrival-digest-mismatch` at `src/openxdox/snapshot.py`.

**Land it by squash, the way #16–#27 landed.** Both admissions' `since:` is `45825ff7`, this branch's first commit, which introduced both suites (`git log --diff-filter=A` on this branch). That stays true through a squash, as it does for the 17 existing admissions that name a pre-squash branch commit. It would stop being true only if this branch's history were rewritten, so it must not be.

**This does NOT discharge openxFactory#1144 (`add-neutral-product-standalone-operability`) task 7.3.** That box's FALSIFIED BY asks the INSTALLED distribution to find its own validator from a `start` outside the product. This PR's `find_validator` answers `None` for such a start. So when phase 2 realizes 7.3, it revisits `tests/test_snapshot_validator_home.py::test_a_start_outside_the_product_is_refused_not_walked`, and the holder is taking that tension to Brett as a phase-2 question.

The arrived `tests/test_snapshot_validation_launch.py` belongs to the same revisit (Copilot, round 2). It still writes its stub validator at `aggregation / VALIDATOR_RELPATH` and launches from the corpus root outside this product, so under this confinement its launch would report validation SKIPPED. It cannot be collected in this repository at the base or at this head: the pinned openDox-code `5c137a90`'s `serve.py` imports `ideation_dashboard`, which is not installed here. It is also not among `validate.yml`'s named files, so no gate's outcome moves.

Nothing changes for openDox-code's two live callers of `find_validator`, which are `workbench.validate_manifest` → `find_validator(path.parent)` and `cli._locate_validator` → `find_validator(written.parent) or find_validator(repo_root)`. Both pass a start outside this product. Both already get `None` at `main`, because the old relpath names the shed path. They still get `None` here.

## Before → after (re-cut on `main` `626f2c8d`; the four files are byte-identical to the helper bank's first cut `d3a90748` on `ab04453d`, and `#26`/`#27` touched none of them)

| | before (`626f2c8d`) | after |
| --- | --- | --- |
| (ii) `VALIDATOR_RELPATH` | `openxFactory/scripts/validate-ideation-dashboard-contracts.py` (absent everywhere since `cc4ae9d3`) | `scripts/validate-ideation-dashboard-contracts.py`, relative to this product's root |
| (iii) the product nested under a pre-shed openxFactory checkout | adopts the parent's validator | never looks up: the validator used is always the product's own. A dangling-edge snapshot is `not-conformant`, and `validate_or_raise` raises |
| (i) validator in the openXdox assembly root (`2f3f857d`, `code` at the test tree), `CONTRACTS_DIR=$PWD/spec/contracts` | rc=2 in every case: `ERROR harness failure: … code/contracts/schemas/ideation-dashboard-snapshot.schema.yaml` not found | snapshot example rc=0; `negative/snapshot-dangling-document-edge` rc=1 (1 error); `snapshot-index` example rc=0 |
| (i) the same without `CONTRACTS_DIR` | rc=2, as above | rc=2, now naming the channel: `… is not carried under …/code/contracts/schemas (this tree carries no contracts/ and CONTRACTS_DIR is not set; export it as the spec leg's contracts directory)` |
| the arrived, unedited `tests/test_snapshot.py`, in that assembly root with `CONTRACTS_DIR` | 3 failed / 14 passed | **17 passed** |

## How

- **(ii) and (iii).**
  - `product_root()` is fixed `parents[2]` arithmetic on the module's own path, confirmed by an explicit marker: the `src/openxdox/` layout and a `pyproject.toml` naming `openxdox`.
  - `find_validator(start=None)` keeps its signature, because openDox's `consumer_reach` binds it by name. It now CONFINES: a `start` outside the product answers `None`, a `scripts/` link that resolves out of the tree is refused, and neither the cwd nor the snapshot's own directory is a search root any more.
  - A validator from anywhere else must be passed explicitly (`validator=`).
- **(i).**
  - A resolved `schemas/` that carries NONE of the ten, or none at all, is refused before any mode runs: harness failure, exit 2 (`87e627c`, Copilot round 2). Otherwise an empty registry let a directory sweep that met no recognized instance exit 0 having loaded no schema.
  - An own `contracts/` or `contracts/schemas/` that resolves OUT of the tree is refused before any directory is chosen, whatever it reaches: a directory with `schemas/`, one without, or nothing, since a dangling link counts too (`3f32cb5d`, Copilot round 3). Otherwise a valid `CONTRACTS_DIR` let such a link pass unread.
  - The validator reads this tree's own `contracts/` when the tree carries `contracts/schemas/`. That covers the pre-shed layout and openxFactory's `doxbench_contracts._composed_validator` farm, both unchanged.
  - Otherwise it reads the directory **`CONTRACTS_DIR`** names. That is the channel the assembly root's `AGENTS-shape.md` declares for a contract the code reads but does not own: "the code leg's tooling now takes `CONTRACTS_DIR` from the environment … rather than each script guessing at `../`".
  - Nothing above the script's own root is read by position.
  - The registry loads the family schemas the resolved directory carries; three of the ten live in openXdox-spec since the carve. An instance of any other kind is refused with exit 2 and never passed. The refusal names the missing schema and the directory it read. For a possibles-register section, whose kernel stays with openxFactory, it is the registry's own `Unresolvable` naming that schema.

openXdox's root `Makefile` is a digest-pinned copy of openRepoShape's scaffold template. It does not export `CONTRACTS_DIR` today, so in the assembly root the validator still refuses by default, but it now says which variable supplies the contracts. Whether the root should carry that export is a shape question for openRepoShape (Q-XDV1 (a)), not this PR.

## Tests

Two created suites, both `--noconftest`-safe, each copying the REAL module or script into a `tmp_path` layout:

- `tests/test_snapshot_validator_home.py`, 12 tests.
  - (ii): the relpath and the own-tree answer.
  - (iii): none of these is ever adopted: an enclosing pre-shed validator, a pre-shed corpus, the cwd, a `start` outside the product, an installed copy, a `pyproject.toml` naming another distribution, and an escaping `scripts/` link.
  - The signature is kept.
- `tests/test_validator_schema_home.py`, 12 tests:
  - runs with `CONTRACTS_DIR` (exit 0);
  - a dangling edge is a finding (exit 1);
  - an uncarried kind is refused by name (exit 2);
  - both carved path constants follow the declared directory;
  - the refusal names the channel;
  - a declared directory without `schemas/` is refused;
  - an enclosing assembly root is never read by position;
  - a composed family's own tree still wins over `CONTRACTS_DIR`;
  - an own `contracts/` that is a LINK out of the tree is refused, with or without `CONTRACTS_DIR` (added at `0a1963f8` on Copilot's review);
  - a real `contracts/schemas/` of LINKED files (openxFactory's composed farm) is still the tree's own (a guard, same round);
  - no mode passes having loaded no schema: both sweeps, `--transition` and the default, with nothing resolved or with a `schemas/` of unrelated files, all exit 2 (added at `87e627c` on Copilot's review; it fails at `0a1963f8`, where the empty sweep exits 0);
  - an escaping own link is refused whatever it reaches: `contracts/` dangling, `contracts/` to an outside directory without `schemas/`, and `schemas/` dangling out of a real `contracts/`, each with and without `CONTRACTS_DIR` (added at `3f32cb5d`; it fails at `87e627c`, where the dangling link with `CONTRACTS_DIR` exits 0).

| measurement (python 3.12.3, pytest 8.4.2; venv from `pip install -e ".[test]"` as `validate.yml` installs, plus a second venv adding rfc3339-validator where noted) | `626f2c8d` | this head (`3f32cb5d`) |
| --- | --- | --- |
| **the required check replicated**: the 16 named files, `--noconftest`, no rfc3339-validator, as on the runner | 564 selected / 558 passed / 6 skipped / 0 / 0, **pin HOLDS** (floors ≥564, ≥558, ==6) | 564 / 558 / 6 / 0 / 0, **pin HOLDS** |
| the two created suites, with rfc3339-validator | 21 failed / 3 passed (the residues, the two link cases, the no-schema guard and the new marker's API; the 3 passes are guards) | **24 passed** |
| the two created suites, CI venv (no rfc3339-validator) | 11 failed / 1 passed / 1 skipped | 12 passed / 1 skipped (`test_validator_schema_home.py` skips at module level) |
| whole `tests/`, `--noconftest`, `--continue-on-collection-errors`, per-test JUnit diff | 174 F / 830 P / 10 S / 128 E of 1142 (with the two suites copied in) | 152 F / 852 P / 10 S / 128 E of 1142. **22 outcomes change, all fail → pass**: the 21 new-suite tests that fail on the base and `tests/test_snapshot.py::test_find_validator_locates_pinned_checkout`. **0 regressions.** The 128 collection errors (`No module named 'ideation_dashboard'` / `'doc_health'`) are carve residue on both sides |

## Not in this PR

- **The named list** (Q-XDV4 (a)). Both suites exercise carved modules, which RULED Q-L8 (b′) keeps off `validate.yml`'s list. `test_validator_schema_home.py` would also report as one module-level skip on a runner without rfc3339-validator (+1 against `EXPECT_SKIPPED == 6`).
- **rfc3339-validator is not declared** in `pyproject.toml`, yet the validator exits 2 at its FormatChecker guard without it. That is reported here, not fixed.
- **`tests/test_validate_ideation_dashboard_contracts.py`** keeps openxFactory's `parents[2]`, so it names the directory above this repository. That is another row's path constant, reported and not fixed.
- **The pin moves**, which are separate owed acts in the forced order:
  - first, the openXdox root's code pin (the `code` gitlink, `contracts/code-pin.yaml` `commit:` and `tree_sha256`, `contracts/manifest.yaml` and CHANGELOG, in the shape of openXdox#17/#18) at this PR's LANDED sha;
  - then openxFactory's openXdox pin, with the consumer updates it makes due (`test_dashboard_source_seal.py` asserts the old walk; `nightly_lane.py` calls `find_validator(agg_root)`).

## Review rounds

- **Round 1** (Copilot at `45825ff7`), fixed at `0a1963f8`. An own `contracts/` or `contracts/schemas/` that is a LINK out of the tree is refused with exit 2, with or without `CONTRACTS_DIR`. A real directory of linked schema files is still the tree's own.
- **Round 2** (Copilot at `0a1963f8`), fixed at `87e627c`. With no schema carried, a directory sweep that met no recognized instance exited 0 having loaded nothing. `build_registry` now refuses first. This also corrects my round-1 answer, which called that exit 0 pre-existing: measured, the base `626f2c8d` exits 2 there. The launch-harness finding is answered in its thread; it belongs to the #1144 task 7.3 revisit described above, and is not a change here.
- **Round 3** (Copilot at `87e627c`), fixed at `3f32cb5d`. The escaping-link check used to run only when `contracts/schemas/` was a directory, so a dangling link, or a link to an outside directory without `schemas/`, passed unread whenever `CONTRACTS_DIR` was valid. Both names are now checked as they resolve, before any directory is chosen. All eight probe cases exit 2; the composed farm still exits 0.
- **No round moves openxFactory#1153's window.** Against the carve blob, the diff still touches exactly lines 14, 15, 16, 115, 116, 224, 225, 226, 230 and 1822, plus insertions beside 94 and 237. `verify-carve-arrival.py --phase B`, with the six replicas, answers `OK` for `3f32cb5d` against the LANDED `main` `1d14fee6` (87 declared-edit rows within their lines, 34 admissions used). The two admissions' `since` stays `45825ff7`, the suites' introducing commit.


Lane: openxfactory-4
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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