Skip to content

Resolve the snapshot validator and its schemas in this product's own tree (split-opendox § 8.9 residue (i)-(iii)) - #28

Merged
brettheap merged 4 commits into
mainfrom
fix/snapshot-validator-carve-residue
Sep 24, 2026
Merged

brettheap merged 4 commits into
mainfrom
fix/snapshot-validator-carve-residue

Conversation

@brettheap

@brettheap brettheap commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

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 (item 3, C3, all (a)) and claimed at 5815613524:

  • 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:

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.

Summary by Sourcery

Constrain snapshot validation to the product’s own validator and declared schema sources while failing closed when validation assets are unavailable.

Bug Fixes:

  • Resolve snapshot validation schemas from the product’s own contracts tree or the explicitly declared CONTRACTS_DIR, with clear failures when required schemas are unavailable.
  • Prevent validator discovery from adopting validators in enclosing, corpus, installed, or symlink-escaped trees.
  • Update snapshot validation to use the product-local validator path and preserve explicit validator overrides.

Enhancements:

  • Fail closed when no recognized family schema is available and report missing schema sources and channels clearly.

Tests:

  • Add coverage for product-local validator discovery, confinement boundaries, schema-source resolution, missing-schema failures, and symlink handling.

🤖 Generated with Claude Code

…tree (split-opendox § 8.9 residue (i)-(iii))

The carve left openxdox's snapshot validation broken in three ways. They are
registered at openxFactory split-opendox-two-layer-product tasks.md § 8.9
(amendment #6, RULED Q-P3 (a), openxFactory#656 comment 5728856581; the box
was deferred at the archive by RULED 5778397686). This commit is the
follow-up act that residue is owed to. It was RULED at openxFactory#656
comment 5815412869 (C3, Q-XDV1 to Q-XDV4 all option a) and claimed at
comment 5815613524.

(i) scripts/validate-ideation-dashboard-contracts.py: SCHEMAS_DIR resolved
    to ROOT/contracts/schemas, a directory this leg does not have, so the
    validator could not run from anywhere. It now reads this tree's own
    contracts/ when the tree carries one (the pre-shed layout, and
    openxFactory's composed validator, both unchanged), and otherwise reads
    the directory CONTRACTS_DIR names. That is the channel the assembly
    root's AGENTS-shape.md declares for a contract the code leg reads but
    does not own ("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 that directory
    carries: three of the ten are in this product's spec leg 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 error naming that schema.

(ii) src/openxdox/snapshot.py: VALIDATOR_RELPATH named
    openxFactory/scripts/validate-ideation-dashboard-contracts.py, which
    openxFactory shed at cc4ae9d3. It now names
    scripts/validate-ideation-dashboard-contracts.py relative to this
    product's own root, where the carve manifest placed the validator.

(iii) find_validator walked every parent of its start (or of the cwd) and
    adopted whatever enclosing checkout still carried a pre-shed copy. It
    now answers only this product's own validator. The root is fixed
    arithmetic on the module's own path plus an explicit marker (the src
    layout and a pyproject.toml naming openxdox). A start outside the tree
    answers None, the cwd and the snapshot's own directory are no longer
    search roots, and a scripts/ link that leaves the tree is refused. The
    signature is unchanged, because openDox's consumer_reach binds it by
    name. openDox-code's two callers already pass a start outside this
    product and already get None at main, because the old relpath names the
    shed path, so nothing changes for them.

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,
which is the opposite of the confinement above. So when phase 2 realizes
7.3 it will revisit
tests/test_snapshot_validator_home.py::test_a_start_outside_the_product_is_refused_not_walked.

Tests: two created suites, 20 tests. On the base commit 626f2c8, 17 fail
(16 on the three residues and 1 on the new marker's API) and the 3 guards
pass. On this commit all 20 pass. The required check's triple is unchanged,
because neither suite is on its named list (RULED Q-XDV4 (a)): 564 selected,
558 passed, 6 skipped, 0 failures, 0 errors, on the base and on this commit.

Lane: openxfactory-4
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@sourcery-ai

sourcery-ai Bot commented Sep 24, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR relocates snapshot-validator discovery into openXdox's own source tree, eliminates parent-checkout adoption, and makes schema resolution explicit via local contracts or CONTRACTS_DIR with named fail-closed errors, backed by focused validator-home and schema-home tests.

Sequence diagram for confined snapshot validator discovery

sequenceDiagram
    participant Caller
    participant Snapshot as openxdox.snapshot
    participant Root as product_root()
    participant Validator as scripts/validate-ideation-dashboard-contracts.py

    Caller->>Snapshot: validate_snapshot(path, search_from)
    Snapshot->>Root: product_root()
    Root-->>Snapshot: product root or None
    alt start is outside product root
        Snapshot-->>Caller: VALIDATOR_UNAVAILABLE
    else product source tree is valid
        Snapshot->>Snapshot: find_validator(search_from)
        Snapshot->>Validator: check root/scripts/validate-ideation-dashboard-contracts.py
        alt validator is inside product tree
            Validator-->>Snapshot: validator path
            Snapshot-->>Caller: validate snapshot
        else missing or escaping symlink
            Snapshot-->>Caller: VALIDATOR_UNAVAILABLE
        end
    end
Loading

Flow diagram for explicit snapshot schema resolution

flowchart TD
    A[Start validator] --> B{Own contracts/schemas exists?}
    B -- Yes --> C[Use this tree's contracts]
    B -- No --> D{CONTRACTS_DIR is set?}
    D -- Yes --> E[Use CONTRACTS_DIR]
    D -- No --> F[Exit 2 with channel and missing path]
    C --> G[Load carried family schemas]
    E --> G
    G --> H{Requested schema is carried?}
    H -- Yes --> I[Validate instance]
    H -- No --> J[Exit 2 naming missing schema and source]
    I --> K{Findings exist?}
    K -- Yes --> L[Exit 1]
    K -- No --> M[Exit 0]
Loading

File-Level Changes

Change Details Files
Resolve contract schemas through the product tree or an explicit environment channel, with fail-closed diagnostics for missing schema families.
  • Prefer the product's own contracts/schemas directory and otherwise use CONTRACTS_DIR.
  • Load only schemas present in the resolved directory and reject unsupported kinds by schema name.
  • Update examples and error messages to identify the resolved source and missing contract channel.
scripts/validate-ideation-dashboard-contracts.py
Constrain snapshot validation to this product's own source checkout instead of searching enclosing repositories.
  • Point VALIDATOR_RELPATH at the product-local validator.
  • Identify the root from the module layout and openxdox distribution marker.
  • Reject outside starts, installed copies, and escaping symlinks; preserve the find_validator signature and explicit validator override.
src/openxdox/snapshot.py
Add focused coverage for validator ownership, confinement, and source-tree markers.
  • Verify stale enclosing validators, corpora, cwd, installed layouts, wrong distributions, and escaping links are never adopted.
  • Verify the product-local validator is selected and validator-unavailable results explain the confinement.
tests/test_snapshot_validator_home.py
Add subprocess coverage for contract-directory resolution and fail-closed schema handling.
  • Verify CONTRACTS_DIR enables validation and produces normal findings.
  • Verify missing schemas, unsupported kinds, absent CONTRACTS_DIR, and assembly-root traversal return named harness errors.
  • Verify a complete product-local schema family takes precedence over CONTRACTS_DIR.
tests/test_validator_schema_home.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

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.

Copilot review overview

🟡 Changes recommended

Critical schema-path escape and moderate empty-registry handling issues remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
What changed in this PR

This PR confines snapshot validation to the product’s own validator and declared schema sources.

Changes:

  • Restricts validator discovery to the product tree.
  • Resolves schemas locally or through CONTRACTS_DIR.
  • Adds regression tests for confinement and schema resolution.
File Summary
tests/​test_validator_schema_home.py Tests schema-source selection and fail-closed behavior.
tests/​test_snapshot_validator_home.py Tests product-local validator confinement.
src/​openxdox/​snapshot.py Implements product-root validator discovery.
scripts/​validate-ideation-dashboard-contracts.py Handles schema resolution; needs fixes for escaping symlinks and empty registries.

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

…a real directory still count

Copilot's review of this PR found a real gap in the "this tree's own
contracts/ first" rule. It trusted `is_dir()` through a symlink, so a code
leg whose `contracts/` (or `contracts/schemas/`) is a LINK to the spec leg
beside it would read that leg by position, under this tree's own name. That
is the § 8.9 (iii) class the rest of this change closes, and the case
`find_validator` already refuses for an escaping `scripts/` link.

The validator now resolves ROOT/contracts/schemas and refuses (harness exit
2, naming the link and the directory it resolves to) when it leaves ROOT.
It refuses with or without CONTRACTS_DIR. The check is on the DIRECTORY
only: openxFactory's doxbench_contracts._composed_validator builds a REAL
contracts/schemas/ whose entries are links to the pinned files, and that
farm keeps working.

Two tests, in tests/test_validator_schema_home.py:
- test_an_own_contracts_link_out_of_the_tree_is_refused fails on the
  previous commit (the link was read) and passes here;
- test_a_real_schemas_directory_of_linked_files_is_still_its_own_tree is
  a guard that passes on both.

The carve-commit lines this file touches are unchanged, so openxFactory#1153's
declared window still covers it. The same arrival-verifier algorithm gives
[14, 15, 16, 115, 116, 224, 225, 226, 230, 1822] plus the inserts after 94
and after 237.

Lane: openxfactory-4
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings September 24, 2026 14:55
@brettheap

Copy link
Copy Markdown
Contributor Author

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

Two answers to the review overview (review 5306049765), one per finding.

1. "Critical schema-path escape". Fixed in 0a1963f8. The thread has the details and is resolved.

2. "Moderate empty-registry handling". No thread was posted for this one, so here it is answered by measurement. A CONTRACTS_DIR whose schemas/ carries none of the ten family schemas never produces a pass. I measured it at 0a1963f8 by running the script from a clean cwd with CONTRACTS_DIR naming a contracts directory whose schemas/ is empty:

mode rc what it says
default, the spec leg's examples present 2 ERROR harness failure: demotion-execution-receipt.schema.yaml is not carried under …/schemas (CONTRACTS_DIR=…)
default, no examples directory 1 [examples-missing] …/examples/ideation-dashboard not found, 1 error
single file, the snapshot example 2 ideation-dashboard-snapshot.schema.yaml is not carried under …
directory sweep over a directory holding a snapshot 2 the same refusal
--transition 1 2 errors

The mechanism is build_registry(): it skips a schema file the directory does not carry, and doc_validator() then refuses BY NAME the first instance that needs it, so an empty registry validates nothing and says so. A missing schemas/ directory is refused earlier, by run_default and by test_a_declared_directory_without_schemas_is_refused_by_name.

One behaviour predates this PR and is unchanged by it: a directory sweep over a directory holding no recognized instance at all reports 0 recognized instance(s) checked and exits 0, whatever the registry holds.

No code change for (2).

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.

Copilot review overview

🟡 Changes recommended

Unresolved critical and moderate findings affect fail-closed validation and validator launch behavior.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity · 1 Medium severity

Open (2)
Resolved since last review (1)

Comment thread src/openxdox/snapshot.py Resolved
…f the family

This answers Copilot's review of openXdox-code#28 at 0a1963f. Since
build_registry skips each schema the resolved directory does not carry, an
empty registry was possible, and two modes then reached a verdict having
loaded no schema. Measured at 0a1963f on a copy of the validator with no
contracts resolved:

- --path <empty dir> exited 0 with "0 recognized instance(s) checked";
- --path <dir of unrecognized YAML> also exited 0;
- with CONTRACTS_DIR naming a schemas/ that carries none of the ten, the
  empty sweep exited 0 as well and the default mode exited 1, a verdict.

The leg's base 626f2c8 exited 2 in every one of those cases. It could not
read a schema at all, so the fail-open was this fix's own.

build_registry now raises when SCHEMAS_DIR carries none of the ten. main()
reports that as "ERROR harness failure: <dir> carries none of the family's
10 schemas (<channel>)" and exits 2. The same seven probes now all exit 2. A
partial registry, which is the carve's own shape, is unchanged.

The guard and its docstring paragraph sit inside the carve lines this row
already declares (224-226). The diff against the carve blob still touches
exactly 14, 15, 16, 115, 116, 224, 225, 226, 230 and 1822, with the
insertions beside 94 and 237, so openxFactory#1153's window is unchanged.

tests/test_validator_schema_home.py gains
test_no_mode_passes_having_loaded_no_schema. It covers four modes (both
sweeps, --transition and the default) against two ways the ten can be
missing. It fails at 0a1963f (the empty sweep exits 0) and passes here. The
two created suites give 23 passed.

Lane: openxfactory-4
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings September 24, 2026 15:36

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.

Copilot review overview

🟡 Changes recommended

Fix the critical escaping ROOT/contracts symlink handling before approval.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
Resolved since last review (2)

brettheap added a commit to opensoft/openXfactory that referenced this pull request Sep 24, 2026
…fest (Q-L1 form; RULED 5815412869 C3) (#1153)

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

## What this is

This is the row annotation RULED Q-L1 requires to land **FIRST**, for the leg PR opensoft/openXdox-code#28 (`fix/snapshot-validator-carve-residue`, `45825ff7`, re-cut on that leg's `main` `626f2c8d`). That PR's head is now `87e627c`, after two review rounds of its own. Neither round moves this window (see *Measured*). That PR takes the three snapshot-validator defects the archived `split-opendox-two-layer-product` booked at `tasks.md` § 8.9 (amendment #6, RULED Q-P3 (a), #656 comment `5728856581`; the box was DEFERRED at the archive by RULED `5778397686`):

- **(i)** the validator's `SCHEMAS_DIR` resolves to an absent directory;
- **(ii)** `snapshot.py`'s `VALIDATOR_RELPATH` names the path this repository shed at `cc4ae9d3`;
- **(iii)** `find_validator`'s parent walk adopts an enclosing pre-shed checkout.

RULED at #656 comment [5815412869](#656 (comment)) (item 3, **C3**, all (a)) and claimed at [5815613524](#656 (comment)). Two of the four rulings bind this PR:
- **Q-XDV2 (a):** both new entries are filed under `path constants`;
- **Q-XDV3 (a):** this annotation lands first, then openXdox-code.

Q-L1's binding clause (`5642758731`): *"an edit to an ARRIVED file … outside its declared lines is an undeclared movement — each slice that edits such a file pairs its leg PR with an openxFactory row-annotation PR (the ASK-7 pattern) that lands FIRST"*.

**This does NOT discharge #1144 task 7.3.** 7.3's FALSIFIED BY asks the INSTALLED openXdox distribution to find its own validator from a `start` outside the product. The leg PR deliberately answers `None` for such a start. So phase 2's realization of 7.3 will revisit `tests/test_snapshot_validator_home.py::test_a_start_outside_the_product_is_refused_not_walked`. The holder is taking that tension to Brett as a phase-2 question. It does not block this act.

The arrived leg test `tests/test_snapshot_validation_launch.py` belongs to the same revisit (Copilot, openXdox-code#28 round 2). It launches from the corpus root, outside the product, so under the confinement it would report validation SKIPPED. It cannot be collected in that repository at the base or at the head, because the pinned openDox-code's `serve.py` imports `ideation_dashboard`, and it is not in that repository's required check.

## The window

| row | before | after |
| --- | --- | --- |
| `scripts/ideation_dashboard/snapshot.py` → `openxdox_code` `src/openxdox/snapshot.py` | `moved_verbatim` | `moved_with_declared_edit`, `path constants` [13, 24, 29, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 133, 163, 167] — 16 |
| `scripts/validate-ideation-dashboard-contracts.py` → `openxdox_code` | the carve's own entry [114, 115, 116, 909, 1800], never applied | plus a second `path constants` entry [14, 15, 16, 94, 224, 225, 226, 230, 237, 1822] — 10 |

The line numbers are the CARVE COMMIT's. They were computed with `verify-carve-arrival.py`'s own algorithm (`carve_lines.text_records` + `difflib` opcodes, as `_check_declared_lines` reads them) against the re-cut leg head. They are identical to the helper bank's measurement against the first cut, because the four fix files are byte-identical and `openXdox-code` #26/#27 touched none of them. `docs/opendox-carve-admissions.yaml` admits the leg's two created suites (`tests/test_snapshot_validator_home.py`, `tests/test_validator_schema_home.py`, `since: 45825ff7…`).

## The figures, summed rather than transcribed

- Declared lines 2717 → **2743** (`path constants` 246 → 272).
- Rows carrying `edits:` 176 → **177**.
- `moved_verbatim` 143 → **142**; `moved_with_declared_edit` 175 → **176**; `not_moved` 138, unchanged.
- The runbook's `openxdox_code` row goes from `9 / 83 | 917` to `8 / 84 | 943`.
- The per-destination sum goes from 2715 to 2741, and the two replica lines make 2743.

Moved with them:
- runbook § 2's tables and history;
- the README index entry;
- three script docstrings;
- the aggregate pins in `tests/carve_manifest` and `tests/carve_arrival`;
- the Q7 disposition digest (`2c48fa07…` → `4c4aecf1…`), moved beside its conversion record as its own failure message asks.

A new test, `test_the_real_manifest_carries_the_snapshot_validator_residue_declared_edits`, pins the window by row, class and line. Main's manifest has not moved since the bank measured it at `2e222d98`: no commit since then touches any carve file.

## Measured

- `scripts/validate-carve-manifest.py`: `OK … 142 moved_verbatim, 176 moved_with_declared_edit, 138 not_moved; 318 digest(s) recomputed`, rc=0.
- `scripts/verify-carve-arrival.py --destination openxdox_code --phase B`, with the leg's six declared replicas:
  - **leg `45825ff7` vs THIS manifest: OK.** 96 rows arrived, 8 digests verified, 87 declared-edit rows within their lines, 3 unapplied, 34 declared admissions used.
  - **leg `45825ff7` vs main's manifest: refused.** `arrival-digest-mismatch` at `src/openxdox/snapshot.py`, so the annotation is required.
  - **leg head `87e627c` (after openXdox-code#28's two review rounds) vs THIS manifest at `9248478c`: OK.** 87 declared-edit rows within their lines, 3 unapplied, 34 declared admissions used, rc=0. Against the carve blob, the leg's diff still touches exactly lines 14, 15, 16, 115, 116, 224, 225, 226, 230 and 1822 of the validator row, plus insertions beside 94 and 237. Every one is declared.
  - **leg `626f2c8d` (today's pin) vs THIS manifest: OK.** 85 within, 5 unapplied, and the two new admissions are reported `STALE (declared but not needed)` until the leg lands. So this PR lands ahead of the leg without reddening anything.
  - **The window is tight.** A copy without `:1822` refuses `arrival-undeclared-edit … [1822]`.
- `pytest tests/carve_manifest tests/carve_arrival`: **408 passed on `main` → 409 passed here** (the new window test).
- **The PR gates, `main` `dd2466ad` vs this branch at `9248478c`** (local, same-kind full clones at `…/openxFactory`, pinned CI lock, OpenSpec CLI 1.12.0, decision core `b21f0100`):

  | gate | `main` | this branch |
  | --- | --- | --- |
  | the PR gates' scripts (`verify-openxwallet-pin`, `validate-clearing-dispatch`, `verify-openxdox-pin`, `verify-opendox-pin`, `validate-release-tag-gate`, `validate-signed-execution-chain --require-pinned-wallet-vocabulary`, `wallet-yaml-syntax-gate`, `validate-openxwallet`, `validate-factory-identity`, `validate-openspec-cli-pin --all --no-cache`, `validate-openreposhape-pin`, `validate-carve-manifest`, `validate-sequenced-after`) | all rc=0 | all rc=0 |
  | `validate-former-id-arrival.py --base dd2466a --head HEAD` | — | passed |
  | `openxdox-consumer-gate` pin suites | 105 / 105 / 0, HOLDS | 105 / 105 / 0, HOLDS |
  | `openxdox-consumer-gate` `tests/ideation-dashboard` | 1137 / 1137 / 0, HOLDS | 1137 / 1137 / 0, HOLDS |
  | `pytest-suite` in CI (the required check) | 8857 / 8851 / 6 (`main`'s test tree, from #1151's run) | **8858 / 8852 / 6**, freshness and vector replay passed ([job 107696117836](https://github.com/opensoft/openxFactory/actions/runs/36018216905/job/107696117836)); +1 is the new window test |
  | `pytest-suite` locally, per test case | 8446 cases | 8447 cases: the one added is the window test, which passed |
  | doc-health `--single-repo --as-of 2026-09-24` | 31 critical / 25 error / 52 warning / 20 info | identical. The one delta is the draft-age info line, where min goes 2 → 0 because the cutover runbook is edited |

  In the local per-test diff, the only outcome changes are three environment-bound `tests/doc-health/test_pin_reachability.py` cases, which depend on whether the retention ref namespace can be consulted from a local clone. Both local runs share two failures: a `test_validator_cli.py` subprocess timeout while several suites ran at once, and `test_snapshot_equivalence.py::test_a_prefix_whose_path_cannot_be_resolved_is_replaced_not_raised_on`. CI is green.

## Touches

Nothing under `openspec/changes/`, and not the README OpenSpec Records block (only the cutover-runbook doc-index line), **so no Rule 6 landing window**.

## Landing order (forced)

1. **This PR**, on a plain gate.
2. opensoft/openXdox-code#28. It stays DRAFT until this one lands. Its commit `45825ff7` is what both admissions' `since:` name.
3. OWED, separate PRs:
   - the openXdox root's code-pin bump, in the shape of openXdox#17/#18;
   - then this repository's openXdox pin bump, in the shape of #1146/#1148. It carries the consumer updates the fix makes due: `tests/ideation-dashboard/test_dashboard_source_seal.py::test_the_sealed_layout_is_the_one_find_validator_walks_up_to` asserts the old walk, and `scripts/ideation_dashboard/nightly_lane.py` calls `find_validator(agg_root)`, a start outside the product that answers `None` under the fix.

## Review round

- **Copilot at `580e4684` (🟡), answered at `9248478c`.**
  - Both threads asked for the two admissions to be pinned by path AND `since`. The committed-admissions test gains a THIRTEENTH BUMP block, and the window test compares a path→`since` mapping. Moving one `since` to the later leg tip fails both (2 failed).
  - The overview's "stale count explanation" was the admissions test's ordinal sequence. It now reads "#1091 and #1153, thirteen amendments, ten of which bump `opendox_code`", recomputed from `git log --first-parent`.
  - `tests/carve_manifest` + `tests/carve_arrival`: 408 passed on `main` → 409 passed.
- **Copilot at `9248478c`: 🟢 Approval recommended.**


Lane: openxfactory-4
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…oosing a directory

This answers Copilot's review of openXdox-code#28 at 87e627c. The
escaping-link check ran only when contracts/schemas/ was a directory. A link
that dangled, or that reached an outside directory with no schemas/, was
therefore never examined. With a valid CONTRACTS_DIR the run then validated
against the declared directory and left the escaping link silently in place.

Measured at 87e627c on a copy of the validator, with CONTRACTS_DIR naming a
spec leg that carries the snapshot schema. Each of these exited 0:
- contracts/ as a dangling link out of the tree;
- contracts/ as a link to an outside directory with no schemas/;
- a real contracts/ whose schemas/ is a dangling link out of it.

Both names, contracts/ and contracts/schemas/, are now checked as they
resolve, before any directory is chosen: a symlink or an existing path that
resolves outside ROOT fails with the same harness error, exit 2. All eight
probe cases now exit 2: the three shapes plus the link that reaches schemas/,
each with and without CONTRACTS_DIR. A real directory of linked schema files,
openxFactory's composed farm, is unchanged and still validates, exit 0.

The block sits in the lines this row already declares around carve 114-116.
The diff against the carve blob still touches exactly 14, 15, 16, 115, 116,
224, 225, 226, 230 and 1822, plus the insertions beside 94 and 237, so the
landed annotation's window holds.

tests/test_validator_schema_home.py gains
test_an_escaping_own_link_is_refused_whatever_it_reaches. It covers the three
shapes, each with and without CONTRACTS_DIR. It fails at 87e627c (the
dangling link with CONTRACTS_DIR exits 0) and passes here. The two created
suites give 24 passed.

Lane: openxfactory-4
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings September 24, 2026 15:59
@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.

Copilot review overview

🔵 Needs a closer look

Validator discovery and schema resolution span multiple boundary conditions and require final human review.

Review effort: Lite
Findings: None

Resolved since last review (1)

@brettheap
brettheap marked this pull request as ready for review September 24, 2026 16:05

@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 18 hours and 3 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@brettheap

Copy link
Copy Markdown
Contributor Author

READY #28 @3f32cb5d

Lane: openxfactory-4

@brettheap
brettheap merged commit e28930b into main Sep 24, 2026
4 checks passed
@brettheap

Copy link
Copy Markdown
Contributor Author

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

LANDED — lane openxfactory-4, 2026-09-24T16:10:03Z, PR #28 → e28930b (opensoft/openXdox-code main; plain gate)

Brett: land the ratification record when green / (a) on C1–C5

brettheap added a commit to opensoft/openXdox that referenced this pull request Sep 24, 2026
… validator's § 8.9 residue) (#19)

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

**C3's PR 3 in the forced order.** C3 was RULED at `opensoft/openXfactory#656` comment [5815412869](opensoft/openXfactory#656 (comment)) (item 3, **C3**, all (a)) and claimed at [5815613524](opensoft/openXfactory#656 (comment)). The forced order:
1. the openxFactory annotation, [opensoft/openXfactory#1153](opensoft/openXfactory#1153), **LANDED** `1d14fee6`;
2. the leg, [opensoft/openXdox-code#28](opensoft/openXdox-code#28), **LANDED** `e28930bf` (squash, 2026-09-24T16:10:03Z);
3. **this root pin**;
4. openxFactory's `openXdox` pin, with the consumers the leg makes due.

#28 closes the archived `split-opendox-two-layer-product` § 8.9 residue (i)–(iii) in the code leg. The validator and its schemas now resolve in the product's own tree, from its own `contracts/` or the directory `CONTRACTS_DIR` names. `find_validator` confines its search to the product and no longer adopts an enclosing checkout. It does NOT discharge openxFactory#1144 task 7.3. That box's installed-distribution falsification is phase 2's, and it revisits `tests/test_snapshot_validator_home.py::test_a_start_outside_the_product_is_refused_not_walked`.

## The lockstep, in one commit

| site | before | after |
| --- | --- | --- |
| `code` gitlink | `626f2c8d` | **`e28930bf`** |
| `contracts/code-pin.yaml` `commit:` | `626f2c8d55a8…` | **`e28930bf052febff0c7bdd0463a72ce3c4f5e8fe`** |
| `contracts/code-pin.yaml` `digests.tree_sha256` | `f46e5740…bae6` | **`9b687616f6d46a1cfb293267619085b48ed78ccc17c37fa9df663f820ef1ff69`** |

No `.github/workflows/*.yml` names the code leg by `@<sha>` (as at #17 and #18), so the README's third site does not exist here.

**What the leg advance carries.** `626f2c8d..e28930bf` is ONE first-parent commit, #28's squash, and it touches four files:
- **edited:** `scripts/validate-ideation-dashboard-contracts.py` and `src/openxdox/snapshot.py`;
- **added:** `tests/test_snapshot_validator_home.py` and `tests/test_validator_schema_home.py`.

The two added suites stay off the leg's `validate.yml` named list (Q-XDV4 (a)), so the leg's floors do not move (564 / 558 / 6). The landed tree equals #28's final head tree (`e28930bf^{tree}` = `3f32cb5d^{tree}` = `9608a84b`). So openxFactory's arrival verification of that head, **OK** against openxFactory `main` `1d14fee6`, is a verification of this commit.

## The digest, three ways

`sorted-ls-tree-r-v1` over the 149 records of `git ls-tree -r -z e28930bf`:

- `scripts/repo_shape.py` `tree_digest`: `9b687616…ff69`
- an independent `ls-tree` + `sha256` re-implementation: `9b687616…ff69`
- `repo_shape.tree_digest_from_gh` (the forge's own tree listing): `9b687616…ff69`

Control: the same method recomputes the old recorded `f46e5740…bae6` at `626f2c8d` (147 records).

## Prose kept true in the same commit

- **`contracts/manifest.yaml`.** "THE CODE LEG CONTRIBUTES NO ENTRY" is re-measured at `e28930bf`: no `contracts/` path among its 149 paths. None of the five entries moves, and the three earlier readings are kept.
- **`contracts/CHANGELOG.md`, `## Unreleased — 2026-09-23`.** It records the third advance beside #26's and #27's. It also states the one thing this root does not yet do: its `Makefile` does not export `CONTRACTS_DIR` (0 hits). Q-XDV1 (a) leaves that export to openRepoShape, so in this assembly root the validator still refuses by default, and the refusal names the variable. The closing sentence is true again as written: both legs' `main` are exactly the commits this root pins. No contract byte moves.
- **No tag moves.** `xdox-v1.0` stays over `2073e3a9` (code `ab04453d`, spec `f088b097`).

## Validators, as `validate.yml` runs them (at `c6c25edf`)

| check | result |
| --- | --- |
| `python3 scripts/validate-repository-naming.py --project project.yaml` | exit 0 |
| `python3 scripts/validate-manifest.py` | exit 0: `manifest ok: openXdox (openxdox), 3 legs` |
| `python3 scripts/validate-pins.py` | exit 0: `ok  code: gitlink == contracts/code-pin.yaml commit e28930bf052f`, `ok  code: tree digest recomputes (9b687616f6d4…)`, `ok  contracts/shape-pin.yaml: 10 copied shape file(s) match their digests`, `ok  openDox: pin commit dc7aa08fe48c digest recomputes`, `pins ok` |

## Cannot red openxFactory

`verify-opendox-pin.py` check 5 reads this root's `contracts/opendox-pin.yaml` as a blob, at whatever commit openxFactory's `openXdox` gitlink names. This PR does not touch that file, and its `commit:` stays `dc7aa08f`. openxFactory keeps reading `2f3f857d` until step 4 moves its gitlink.

Step 4 carries the consumer updates the leg makes due. A simulation of the bump alone reddens exactly one openxFactory test, `tests/ideation-dashboard/test_dashboard_source_seal.py::test_the_sealed_layout_is_the_one_find_validator_walks_up_to`. `scripts/ideation_dashboard/nightly_lane.py` also calls `find_validator(agg_root)`, a start outside the product.

## Landing

Plain gate: this repository has no `openspec/changes/`, so there is no Rule 6 window. If this PR is squash-merged onto an unmoved `main` (`2f3f857d`), the squash commit's tree equals this head's tree. Step 4 then re-points openxFactory's gitlink and `commit:` to the landed sha, and records that tree's digest. **This PR is not merged by the actor that opened it.**


Lane: openxfactory-4
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
brettheap added a commit that referenced this pull request Sep 30, 2026
…tion (7.3) (plan 034) (#36)

Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Arc: neutral-product-standalone-operability

Plan 034 **T061** (P2-C), in openxFactory `specs/034-opendox-standalone-operation/`: **#1144 7.3, the consumer's half.**

> "openXdox's validator and its three schemas (7.1's openXdox-spec three) are located through the INSTALLED openXdox distribution, and no parent walk remains." (RULED R1Q14 (a))

As T007's batch I amends it (R1Q27 (a), opensoft/openXfactory#656 comment 5851950767), the validator validates:
- its own three kinds from its installed distribution, wherever it runs;
- the family's other seven kinds only where the running tree supplies them, reading that tree's own `contracts/` first.

**Based on `main`. Every gate this PR named has landed:**
- **#35 (T059)** landed as `839492d9`, a squash of its head `aa0a2c5d`. The holder retargeted this PR to `main` first. `main` is merged in at `8d891652` (see "The merge from main" below).
- **T007's batch K** landed as openxFactory#1210 → `39f19145`. It records the ten reworded cases, and F5.2's `--chains` step, in #1144.
- **T062** landed as openDox#16 → `d5098297`. It pins openDox-code `047bb4fa`, and #35 carried this leg's pin to that commit, so this branch has it through the merge.

This PR stays DRAFT until the holder marks it READY.

**The merge from main.** A plain merge met T059's files twice: once as this branch's own history of them (it was stacked on `4feb8009`) and once as #35's squash. That gave add/add and content conflicts in twelve files. The merged tree is therefore the three-way merge of this branch and `aa0a2c5d`, with `4feb8009` as the base (`git merge-tree --merge-base=4feb8009`), and it merges cleanly:
- this branch's side of every T059 file it had already changed;
- `main`'s side of all that #35 added after `4feb8009`: the `047bb4fa` re-pin with its re-measured comments, the `VALIDATORS` respelling, and the give-back of displaced defaults.

The merge commit's parents are this branch and `main`.

## What changes

**1. The validator and its own three schemas ship as package data** (`openxdox.contracts`, new).
- `schemas/`: the three schemas, byte copies of opensoft/openXdox-spec at `f088b097`. That is the commit the openXdox root pins, through its `spec` gitlink and `contracts/spec-pin.yaml` at `main` 57e2b8f2.
- `copies.yaml`: records each copy's sha256. These are the digests the root's `contracts/manifest.yaml` records.
- `validate-ideation-dashboard-contracts.py`: byte for byte the same as `scripts/validate-ideation-dashboard-contracts.py`. A test holds the two equal.
- A copy is read only after its digest is checked against the record. The pattern mirrors openDox's T057 (openDox-code#58).
- The `pyproject.toml` package-data line ships the record, the three copies and the validator, and nothing else. I measured this by building a wheel with and without the line. Without it, the wheel carries only the package's two `.py` files, and neither the record nor any copy.

**2. The validator finds each schema in one of three places, in this order.**
- First, the running tree's own `contracts/schemas/`, as before. openxFactory's farm composes the whole family that way. The packaged validator also finds its copies this way, since they sit beside it.
- Second, for the three only: the installed distribution, found through `importlib.util.find_spec("openxdox.contracts")`, never by position.
- Third, for the other seven only: `CONTRACTS_DIR`. It never supplies the three.

A copy that differs from its record is refused by name with a harness error (exit 2) and is never read.

**2a. A packaged copy is held to its record, fail closed.**
- The packaged layout is recognized by where the script sits, inside the `contracts/` it reads, never by whether `copies.yaml` is present. A missing record or copy there is refused with exit 2.
- The script checks the whole record against the same contract as `openxdox.contracts.record()` before it takes any digest.
- An installed validator that links out of its package is never run, in both `snapshot._packaged_validator` and `contracts.validator_path`. That follows Copilot's review.

**3. `find_validator` ignores `start`.**
- It keeps its declared signature, because openDox's `consumer_reach` binds it by name.
- From this product's source tree, it answers the tree's `scripts/` validator. That is the path openxFactory's lanes read.
- From an install, it answers the packaged copy.
- An enclosing tree's validator is never adopted.
- A start outside the tree is validated. Before, it was confined to None. This supersedes split-opendox 8.9 residue (iii) (#28) for the start.
- `GovernedValidator.locate` asks once, with no start.

**4. The runtime dependencies gain `referencing>=0.28.4` and `rfc3339-validator>=0.1.4`.** Brett ruled "Keep as runtime deps" at opensoft/openXfactory#656 comment 5916000030.
- The package now ships a validator that imports `referencing` at module level.
- The validator refuses to run without `rfc3339-validator`, because jsonschema registers its `date-time` checker only when that package is importable.
- Without both, a plain install would carry a validator it cannot run.
- **Proof, from F7.1's own fresh environment:** with `rfc3339-validator` left undeclared, F7.1 goes red. `test_the_validator_is_the_installed_consumers_own` reads `validator-unavailable`: "ERROR jsonschema is missing its date/date-time format checkers; install rfc3339-validator".
- `referencing>=0.28.4` is the floor that `jsonschema>=4.18` itself requires (checked on PyPI), so declaring it adds nothing to an install.
- `rfc3339-validator` leaves the `test` extra.
- `tests/test_dependency_direction.py` now names each `.py` under `src/` that is not a module, and holds its imports to the declared dependencies.

**5. The allow-list check (batch C's, which T059 wired) learns two things.**
- **An added test** (batch F's rule). Where the named test is absent before the landing, `new` must be `old`, then that test's whole definition and blank lines, and nothing else.
- **A chain of entries**, for F5.2's call alone. This follows the holder's decision under Brett's ruling at comment 5916000030, which batch K records.
  - One landing that edits one suite in several tests enters each edit as its own entry. The entries apply in list order, each to the text the one before it leaves.
  - The first entry's `before_blob` is the suite before the landing, and the last entry's `after_blob` is the suite at it. Each entry in between records the git blob id of the text it leaves.
  - Each entry holds on its own texts, inside its own test, and all of them name one landing.
  - The flag is `--chains`. F5.2's call passes it; 12.5's call does not, and keeps one entry per suite per landing.
  - Neither of the two suites is among 12.5's sixteen governed files. I checked with `git grep -l -e open-pr -e open_pr -e FakePullRequests -- 'tests/test_*.py'` at `main` and at this head: the same 16 files both times.
  - A new case shows 12.5's call refusing a chain that F5.2's call admits.

## The protected edits, each in its own commit, each an allow-list entry

| commit | suite :: test | admitted by |
|---|---|---|
| `3dc4a4c` | `tests/test_snapshot.py::test_the_validator_is_the_installed_consumers_own` (**added**) | batch F (R1Q14 (a)) |
| `08b03b9` | `tests/test_snapshot_validator_home.py::test_a_start_outside_the_product_is_refused_not_walked` (its answer is now 7.3's) | batch F |
| `5c2ef23` | the nine tests of `tests/test_snapshot_validation_launch.py` | batch K (Brett, comment 5916000030) |
| `8a89bc7` | `tests/test_snapshot.py::test_a_missing_validator_is_unavailable_not_a_verdict` | batch K |

In the ten batch K cases the real assertions stay. Those are: SKIPPED on stderr naming both roots, the pip remedy, `--strict` fatal, a non-conformant snapshot blocked and blamed, and UNAVAILABLE rather than a verdict. Only the walk premise changes.
- Each stub is now planted as the distribution's own validator: `product_root` is None and `_packaged_validator` is the stub, both set with `monkeypatch`, and the real `find_validator` answers it.
- "No validator" is now a distribution that carries none of its own.
- **One expected answer inverts**, as C3's did under batch F: `test_a_run_dir_beside_a_checkout_still_uses_that_one_first`. The validator beside the run dir is never adopted. Its name is kept, because an entry admits an edit inside one named test.
- The launch suite's helper `_corpus_with_a_reachable_validator` sits outside every test, so no entry can admit an edit to it. It is unchanged, and its docstring's "where `find_validator` expects it" is now stale. That is recorded here rather than edited.

The allow-list entries themselves are in the commit after the PR number was known. There are twelve:
- batch F's two;
- batch K's ten, as a chain of two for `tests/test_snapshot.py` and a chain of nine for the launch suite.

## The declared exclusion: 66 → 65

`tests/test_snapshot.py` leaves, and its reason, `consumer-schemas` (R1Q25 (b), "until 7.3 finds them through the installed distribution"), leaves with it. The suite now passes alone, 18 of 18.
- `tests/test_snapshot_validation_launch.py` keeps its `doc_health` entry. Alone, all nine of its tests fail for `doc_health` only. Composed, the suite goes from 5 failed and 4 passed to 9 passed.
- The root conftest's table of admitted reasons keeps R1Q25 (b)'s row. A reason leaves the declaration, not the record of what the rulings admitted.

**Single-writer order of `tests/declared_exclusion.yaml`: T044 → T059 → T061.**
- T044 wrote the doc_health skips into a declared file.
- T059 removed `seam_assembly` (67 → 66).
- T061 removes `tests/test_snapshot.py` (66 → 65).

No other open PR touches the file.

## For T008: excluded files that validate a kind the narrowed validator gives up

In a lone checkout, with no `contracts/` of its own and no `CONTRACTS_DIR`, the validator now validates only its three kinds. These files validate one of the other seven kinds. I measured the first two with a temporary trace of the validator's calls, whole suite and composed; the trace has been reverted. I read the rest from content.

| file | declared reason | kind(s) given up |
|---|---|---|
| `tests/test_notebook_action.py` | doc_health | `ideation-workbench` |
| `tests/test_register_edit_lane.py` | doc_health | `project-register` |
| `tests/test_validate_ideation_dashboard_contracts.py` | openxfactory-contracts | `workbench-model-catalog`, `workbench-chat-turn-v2` |
| `tests/test_project_action_contracts.py` | openxfactory-contracts | `gate-intent` |
| `tests/test_wheel_action_contracts.py` | openxfactory-contracts | `gate-intent` |
| `tests/test_project_schema_election.py` | openxfactory-contracts | `project-register` |
| `tests/test_doxbench_blank_reason.py` | doc_health, openxfactory-contracts | `workbench-chat-turn-v2` |

Also:
- `tests/test_aggregation_register_instance.py` is not excluded. It validates `project-register` and **skips** alone; those are the four `EXPECT_SKIPPED` cases.
- The other declared validator users validate only the three kinds, so the narrowing gives up nothing there: `test_generator`, `test_generated_at_anchor`, `test_snapshot_determinism`, `test_snapshot_registry`, `test_doxbench_share`, `test_kickoff` and `test_session_records`.

## Falsifiers, before and after

**F7.1, exactly as #1144 writes it:**
- The block ran verbatim: a fresh venv, `pip install ".[test]"`, the planted pre-shed tree, and both named tests.
- The host has no `python`, so a shim maps it to `/usr/bin/python3` 3.12.3 for the block's first line. After activation, `python` is the venv's.
- **Before, at #35's head `4feb8009`:** rc 1, `AssertionError: the consumer found no validator of its own`. The two named tests do not exist yet (pytest rc 4).
- **After:** rc 0, `2 passed`. The install is non-editable (`direct_url` `dir_info {}`). `find_validator()` answers `site-packages/openxdox/contracts/validate-ideation-dashboard-contracts.py`, and `product_root()` is None.

**F5.2 whole, exactly as #1144 writes it with no deselect, in batch G's environment,** at the merged tree (`e3985b91`). The simulated history is `main` with #35's real landing `839492d9`, then this PR squash-landed. The results equal those at the earlier tree (`34dc603`, openDox-code `814516b7`).
- The environment: a fresh venv, then `pip install ".[test]"`, then openDox-code `047bb4fa` force-reinstalled, with openxFactory `91e4685f` `scripts/` on `PYTHONPATH`.
- Suites: `test_generator` 45/45, `test_snapshot` 18/18, `test_snapshot_determinism` 6/6, `test_snapshot_registry` 40/40, `test_snapshot_validation_launch` 9/9 and `test_snapshot_validator_home` 12/12.
- `test_session_snapshot` is 20 passed, 3 failed. The 3 are exactly the holder's ruled pre-arc reds ("red at both pins; pre-arc carve residue; not the arc's"), left open for F5.2 whole at T063: `test_a_new_serve_process_re_registers_the_session_at_startup`, `test_a_session_key_is_validated_against_the_roster_before_url_composition` and `test_the_hosted_session_arrival_path_is_recorded_and_not_built`.
- Every deselect T059's F5.2 run needed besides those 3 is now gone. Those were test_snapshot's 2 and the 7 reds that failed at both pins in test_generator, test_snapshot_determinism and test_snapshot_registry.
- **The arc check:** F5.2's step (`--chains`) runs over the arc's landings. It admits all four protected suites: `839492d9` (#35's real landing) for test_session_snapshot by entry 3, and this PR's simulated landing for test_snapshot by the chain 4, 5, for test_snapshot_validator_home by entry 6, and for the launch suite by the chain 7-15. It exits 0. The entries needed no re-recording, because #35 does not touch these three suites.
- 12.5's call, without `--chains`, exits 0 over its governed set.
- F5.2's call without `--chains` refuses both chains (exit 1).

**Whole suite alone (CI's command):**
- `validate` run 36759713758 at `708cdd27` read selected 1076, passed 1072, skipped 4, failures 0, errors 0. The floors were set to 1076 and 1072, on that reading (`71187f7`).
- At the merged head `8d891652`, with openDox-code `047bb4fa`, run 36784210624 reads the same triple. So the floors stand, and the floor paragraph records it (`5c2b134`).
- The declared exclusion is 65 files.

**Composition,** 38 suites (the protected 23, the 12.5 set, and every validator user), each run alone with openxFactory `scripts/` on `PYTHONPATH`, #35's head against this one: **0 newly red, 24 newly green.** It was measured at openDox-code `814516b7`, and measured again at `047bb4fa` as `main` (`839492d9`'s tree) against the merged head, with the same result. The newly green cases include test_generator's 4, test_snapshot_determinism's 1 and test_snapshot_registry's 2 (the reds at both pins), test_snapshot's 2 schema cases, the launch suite's 4, and the validator users in test_doxbench_share, test_kickoff, test_session_records and test_generated_at_anchor.

**Mutants of the new checks: 29 of 29 killed** at `29f058e`, and again at the merged head `8d891652`. They cover:
- the lookup: C3's confinement back, the pre-shed walk back, no packaged validator, a packaged validator linking out, and `locate` reading the roots;
- the validator: digest not compared, `CONTRACTS_DIR` supplying the three, no distribution lookup, the packaged layout told by its record, and the record's spec leg, row path and fourth kind;
- `openxdox.contracts`: five record and digest checks, and `validator_path` following a link;
- the package-data line, and `referencing` undeclared;
- a hyphenated module hiding from the census;
- the added-test rule (three mutants) and the chain (five mutants).

The mutant that drops `rfc3339-validator` from the dependencies survives the unit suite. F7.1 kills it, as shown above.

**The review rounds:**
- **SonarCloud's gate** failed at `8015a565` on 63.1% duplication and a C security rating, both from the packaged validator copy. `.sonarcloud.properties` now excludes that copy, so the validator is analysed once, at `scripts/`, and this PR's own smells are taken. The gate has been green since `bbe17165`.
- **Copilot**, at five heads. What was taken:
  - the entries were entered;
  - the packaged layout now fails closed when its record or a copy is missing;
  - an installed validator that links out of the package is refused, in `find_validator` and in `validator_path`;
  - the script holds `copies.yaml` to the package's full contract, with every one of the package's 15 record refusals run through the installed validator;
  - two stale docstrings, in the launch suite and `build_registry`, and one diagnostic were corrected.
  - All threads are resolved.

## Owed elsewhere

**T064's `created:` admissions** (openxFactory's carve manifest records what leaves openxFactory; these files were created here, RULED OQ-C):
- `src/openxdox/contracts/__init__.py`, `copies.yaml`, `schemas/*.schema.yaml` (3) and `validate-ideation-dashboard-contracts.py`;
- `tests/test_packaged_validator.py`;
- together with T059's (`src/openxdox/projection_contributions.py`, `scripts/protected_suites.py`, `tests/test_projection_contributions.py`, `tests/test_protected_suite_check.py`, `tests/test_governed_registry_and_writer.py`) and the allow-list, `tests/protected_suite_respellings.yaml`.

**Not changed:** `tests/conftest.py::find_openxfactory_validator` keeps its fallback walk. It is a test helper, not 7.3's lookup, and here it always returns the tree's own `scripts/` validator first, so the walk is never reached.

🤖 Generated with [Claude Code](https://claude.com/claude-code)


Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <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