Skip to content

Descendant referent follows the declared pin chain (#40) - #42

Merged
brettheap merged 1 commit into
mainfrom
change/descendant-referent-pin-chain
Sep 5, 2026
Merged

brettheap merged 1 commit into
mainfrom
change/descendant-referent-pin-chain

Conversation

@brettheap

@brettheap brettheap commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

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

RULING — Brett Heap, 2026-09-05, verbatim: "elect the shape for both, follow the pin chain, no family yet" — recorded on opensoft/openXfactory#656 (opensoft/openXfactory#656 (comment)). This PR is the part of that ruling that lands in this repository.

The defect

descendant_referents() derives the referent from the NAME alone, so validate-repository-naming.py --explain codexDox says a CLAIM: needs a declared pin on openDox or openxDox. Under the ratified split-opendox-two-layer-product (openxFactory, ceb6dc9e) and its ruling OQ-2 there is ONE pin chain: descendants pin openXdox, openXdox pins openDox, and no direct openDox pin exists inside the family. What answers today is a case-folding coincidence — openXdox casefolds onto the accepted x-stem spelling openxDox — which holds for this family's spelling and for no other. LedgerxWallet -> openXwallet -> openWallet is the same latent gap, and openWallet has no repository at all yet.

The design

  • OFFLINE, still (2026-09-02). Nothing here asks a host whether anything exists.
  • The chain is RECORDED, never inferred. The descendant's own manifest carries naming.referent_chain: [openXdox, openDox]. Its first entry must be in its neutral_product_pins: (the pin this project actually holds); its last must be a referent the name could have.
  • A direct pin stays sufficient. This is an ADDITION. MedxChart answers exactly as it did on 2026-09-02, and a broken chain recorded beside a direct pin is a warning to repair, never an answer taken away.
  • Verified when reachable, declared-unverified when not. A link beyond the first is a declaration in ANOTHER tree. Where that tree is on the disk — --link-source [PRODUCT=]PATH, SHAPE_PIN_SOURCE_<PRODUCT>, or a checkout beside the root, the lookup order validate-pins.py already uses — the link is VERIFIED against its own neutral_product_pins:. Where it is not, the link is reported declared-unverified: a WARNING, no exit code, and the name STILL classifies as a descendant. Failing there would make the answer depend on which trees happen to be on the disk, which is the network dependency wearing a different coat.
  • Broken names the link. A reachable link that declares something else breaks the chain: the residual assembly-root reading wins, the overlap is recorded, and the message says openInk declares openQuill, not openScribe rather than "the chain is invalid".
  • The rule is DATA, in contracts/repository-naming.yaml beside the existing referent rule: referent.chain: (record_field, link_declared_by, max_length, unverified_status) and referent.example_chains:.

Worked cases

descendant pins reaches
codexDox openXdox openDox
LedgerxWallet openXwallet openWallet

Both are in the contract file as example_chains: and both are exercised from that data by the suite. Neither asserts that anything exists.

--explain codexDox now names both ways a referent may be reached: a CLAIM: needs a declared pin on openDox or openxDox, or a declared chain (naming.referent_chain) of pins ending in one of them.

What changed

contracts/repository-naming.yaml (the rule as data) · scripts/repo_shape.py (ReferentResolution, resolve_referent(), chain_rule(), chain-aware classify(), the offline link readers; pin_source_env_name moves here from validate-pins.py because one checkout answers both questions about a product) · scripts/validate-repository-naming.py (--referent-chain, --link-source; --project reads the chain from each leg) · scaffold-project.py (--referent-chain, checked before anything is created) · templates/assembly-root/project.yaml + scripts/validate-manifest.py (the field documented where it is written, and the project's own gate reading it — referent_declared: true is answered by the FIRST LINK's pin file, because that is the pin the project holds) · README.md § "A descendant form is a claim; a claim needs a referent" · tests 435 -> 468.

Nothing else in the standard moves; the shape still confers nothing.

Sibling disclosure

Lane codex-intake-shape's PR #37 landed first (a48d1f3), so this branch was rebased onto it and merged, as disclosed on #40: the README paragraph sits in the descendant section, away from #37's hunks, and the one real overlap — the README line cap in tests/test_repo_hygiene.py — was resolved by keeping #37's history entries and appending this change's (700 -> 725). The openxFactory doctrine sentence in docs/project-repo-schema.md § the same title is amended in the openxFactory amendment PR, not here.

Closes #40
Refs opensoft/openXfactory#656

🤖 Generated with Claude Code

https://claude.ai/code/session_011z8xpxRKZXyN3jLzFHoxj1

Summary by Sourcery

Follow explicitly recorded neutral-product pin chains when resolving descendant referents while preserving direct-pin behavior and offline validation.

New Features:

  • Support resolving descendant referents through explicitly recorded chains of neutral-product pins, including verification from locally available link repositories.
  • Add chain-aware naming validation, project scaffolding, manifest recording, and command-line explanations with offline verification and warnings for unreachable links.

Bug Fixes:

  • Correct descendant referent resolution for layered products such as codexDox and LedgerxWallet instead of relying on case-folding coincidences or requiring a direct referent pin.

Enhancements:

  • Keep direct referent pins backward compatible while reporting broken recorded chains with the specific contradictory link and preserving overlap information.
  • Move shared pin-source lookup support into the repository-shape utilities so pin validation and chain verification use the same local checkout resolution.

Documentation:

  • Document recorded referent chains, offline verification behavior, and the updated descendant classification rules in the README, contract, and project templates.

Tests:

  • Expand coverage for direct pins, verified and unverified chains, broken chains, scaffolded manifests, CLI behavior, and chain-link source discovery.

RULING — Brett Heap, 2026-09-05, verbatim: "elect the shape for both,
follow the pin chain, no family yet" — recorded on opensoft/openXfactory#656
(opensoft/openXfactory#656 (comment)).

THE DEFECT. `descendant_referents()` derives the referent from the NAME
alone, so `validate-repository-naming.py --explain codexDox` says *a CLAIM:
needs a declared pin on openDox or openxDox* — and under the ratified
split-opendox-two-layer-product (openxFactory, ceb6dc9e) and its OQ-2 there
is ONE pin chain: descendants pin `openXdox`, `openXdox` pins `openDox`, and
no direct `openDox` pin exists inside the family. What answers today is a
case-folding coincidence — `openXdox` casefolds onto the accepted x-stem
spelling `openxDox` — which holds for this family's spelling and no other.
`LedgerxWallet -> openXwallet -> openWallet` is the same latent gap.

THE RULE. A `<Domainx><Product>` name classifies as a domain descendant when
its declared pins REACH the matching `open<Product>` through a chain of
declared neutral-product pins. The chain is RECORDED, never inferred: the
descendant's own manifest carries `naming.referent_chain: [openXdox,
openDox]`, whose first entry must be in its `neutral_product_pins:` and whose
last must be a referent the name could have. A DIRECT pin stays sufficient —
this is an addition, and every name that classified on 2026-09-02 classifies
the same way. The check stays OFFLINE (2026-09-02): a link whose tree is
reachable is VERIFIED against that tree's own declaration; a link whose tree
is not reachable is `declared-unverified`, a warning that never changes the
classification; a reachable link that declares something else BREAKS the
chain, the residual assembly-root reading wins, the overlap is recorded, and
every message NAMES the link that broke.

WHAT CHANGED
- contracts/repository-naming.yaml: the rule as data beside the existing
  referent rule — `referent.chain:` (record_field, link_declared_by,
  max_length, unverified_status) and `referent.example_chains:` carrying both
  worked cases, plus `codexDox` in the examples.
- scripts/repo_shape.py: `ReferentResolution` (none/direct/verified/
  declared-unverified/broken), `NamingPolicy.resolve_referent()`,
  `chain_rule()`, chain-aware `classify()`, and the offline link readers
  (`declared_neutral_pins`, `resolve_link_source`, `link_pins_from_trees`).
  `PIN_SOURCE_ENV_PREFIX`/`pin_source_env_name` move here from
  validate-pins.py: one checkout answers both questions about a product.
- scripts/validate-repository-naming.py: `--referent-chain` and
  `--link-source [PRODUCT=]PATH`; `--project` reads the chain from each leg's
  `naming.referent_chain:`; `--explain` now names BOTH ways a referent may be
  reached; warnings print and change no exit code.
- scaffold-project.py: `--referent-chain`, checked before anything is
  created, and recorded in the manifest it writes.
- templates/assembly-root/project.yaml + scripts/validate-manifest.py: the
  field is documented where it is written, and the project's own gate reads
  it — one reading of the chain for both the leg's classification and its
  `naming:` record, and `referent_declared: true` is answered by the FIRST
  LINK's pin file, because that is the pin the project holds.
- README § "A descendant form is a claim; a claim needs a referent": two
  paragraphs quoting the ruling and citing openxFactory#656.
- tests: 413 -> 446. Direct pin unchanged, two-link chain verified, link tree
  unreachable -> declared-unverified and still a descendant, four ways to
  break a chain (unpinned first entry, wrong last entry, cycle, over-length),
  a broken chain never taking away a direct pin, `LedgerxWallet ->
  openXwallet -> openWallet` as the second worked case, every
  `example_chains:` row exercised from the contract, the link readers, the
  CLI, the manifest gate, and the scaffold end to end.

Nothing else in the standard moves; the shape still confers nothing.

Closes #40
Refs opensoft/openXfactory#656

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

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_011z8xpxRKZXyN3jLzFHoxj1
Copilot AI lite review requested due to automatic review settings September 5, 2026 16:22

@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 5 days and 9 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Sep 5, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR extends descendant referent resolution from direct pins to explicitly recorded neutral-product pin chains, validating reachable links offline while treating unavailable links as non-failing warnings; it propagates the result through classification, CLI and manifest gates, scaffolding, generated metadata, documentation, and comprehensive regression tests.

Entity relationship diagram for recorded referent chains

erDiagram
    DESCENDANT_MANIFEST {
        string repository
        string referent_chain
        string neutral_product_pins
    }
    LINK_MANIFEST {
        string product
        string neutral_product_pins
    }
    REFERENT_PIN_CONTRACT {
        string product
        string commit
        string tree_digest
    }
    DESCENDANT_MANIFEST }o--o{ LINK_MANIFEST : records_chain_to
    LINK_MANIFEST }o--o{ REFERENT_PIN_CONTRACT : declares_pin_on
Loading

Flow diagram for recorded descendant referent-chain resolution

flowchart TD
    A[Descendant name] --> B[Read naming.referent_chain]
    B --> C{Direct referent pin?}
    C -->|Yes| D[Classify as descendant]
    C -->|No| E{Recorded chain valid?}
    E -->|No| F[Use residual assembly-root reading]
    E -->|Yes| G[Verify each link locally]
    G -->|All links agree| D
    G -->|Link unavailable| H[Classify as descendant]
    H --> I[Emit declared-unverified warning]
    G -->|Link disagrees| F
Loading

File-Level Changes

Change Details Files
Add recorded, offline referent-chain resolution for descendant names while preserving direct-pin behavior.
  • Define chain metadata, examples, maximum length, and unverified semantics in the naming contract.
  • Resolve chains by validating the first held pin, final candidate referent, cycles, length, and reachable link declarations.
  • Classify valid chains as descendants, keep unreadable links as warnings, and fall back to residual assembly-root handling for broken chains.
  • Expose resolution details and shared local-source lookup helpers for validators and pin validation.
contracts/repository-naming.yaml
scripts/repo_shape.py
scripts/validate-pins.py
Integrate chain declarations into command-line validation, project-manifest validation, and scaffolding.
  • Add --referent-chain and --link-source options and read per-leg chains from project manifests.
  • Verify reachable link manifests offline; distinguish declared-unverified warnings from broken-chain findings and preserve exit-code semantics.
  • Validate chains before scaffold creation and write referent_chain into generated assembly naming metadata.
  • Require the first chain entry's local pin contract for referent_declared checks, rather than the terminal referent's contract.
scripts/validate-repository-naming.py
scaffold-project.py
scripts/shape_materialize.py
templates/assembly-root/project.yaml
templates/assembly-root/scripts/validate-manifest.py
Document the chain-based descendant rule and expand regression coverage.
  • Document recorded chains, offline verification, broken-link behavior, and worked codexDox/LedgerxWallet cases.
  • Add policy, manifest-validator, CLI, source-resolution, and scaffold end-to-end tests for verified, unverified, broken, malformed, and legacy direct-pin scenarios.
  • Raise the README hygiene line cap to accommodate the new explanation.
README.md
tests/test_naming_policy.py
tests/test_manifest_validator.py
tests/test_scaffold_pin_and_reuse.py
tests/test_repo_hygiene.py

Assessment against linked issues

Issue Objective Addressed Explanation
#40 Implement chain-aware descendant referent resolution so a domain descendant can reach its referent through a recorded neutral-product pin chain, while preserving direct-pin behavior, offline operation, verification warnings, and broken-chain residual classification. ✅
#40 Record and document the referent-chain rule in the repository naming contract, assembly-root template, manifest validation, README, scaffolding, and command-line interfaces. ✅
#40 Add coverage for direct pins, two-link chains, unverified and broken chains, the codexDox and LedgerxWallet examples, manifest validation, and scaffolding behavior. ✅

Possibly linked issues


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

sonarqubecloud Bot commented Sep 5, 2026

Copy link
Copy Markdown

@brettheap

Copy link
Copy Markdown
Contributor Author

LANDING — lane openxfactory-4-opendox-extraction (formerly openxfactory-opendox), session 011z8xpxRKZXyN3jLzFHoxj1, 2026-09-05T16:26Z, PR #42 into openRepoShape main at head 1b3b0e3 on Brett Heap's word "merge 42" (2026-09-05T16:26Z) under his 2026-09-05T14:52Z ruling "follow the pin chain" (opensoft/openXfactory#656).

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

@brettheap
brettheap merged commit c2cc9e2 into main Sep 5, 2026
4 checks passed

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

There are correctness/documentation inconsistencies in chain link-source resolution and contract example data that should be addressed to avoid mis-verifying chains and confusing worked-case semantics.

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

Pull request overview

This PR updates openRepoShape’s naming policy and validators so a domain-descendant’s referent can be resolved offline via an explicitly recorded neutral-product pin chain (e.g., codexDox pins openXdox, which pins openDox), while preserving the existing “direct referent pin is sufficient” behavior.

Changes:

  • Add chain-as-data to contracts/repository-naming.yaml and implement chain-aware referent resolution + offline link verification/warnings.
  • Extend the naming CLI, manifest validator, and project scaffolder to read/record naming.referent_chain and to surface declared-unverified vs broken-chain behavior.
  • Update templates/docs and expand tests to cover direct pins, verified/unverified chains, and broken chains.
File summaries
File Description
tests/test_scaffold_pin_and_reuse.py Adds end-to-end scaffold tests for chain-based descendants and refusal cases.
tests/test_repo_hygiene.py Raises README line cap to accommodate new referent-chain documentation.
tests/test_naming_policy.py Adds unit tests for chain resolution, offline link reading, and CLI behavior.
tests/test_manifest_validator.py Adds manifest-gate tests for chain reachability, warnings, and broken-chain findings.
templates/assembly-root/scripts/validate-pins.py Moves shared pin_source_env_name logic into repo_shape.
templates/assembly-root/scripts/validate-manifest.py Validates recorded referent chains; emits warnings for unread links without changing exit code.
templates/assembly-root/project.yaml Documents how referent_chain is recorded and verified offline.
scripts/validate-repository-naming.py Adds --referent-chain / --link-source, reads chains from manifests, and prints chain/warnings in --explain.
scripts/shape_materialize.py Writes referent_chain into scaffolded naming: blocks and updates plan notes to reflect chain support.
scripts/repo_shape.py Implements ReferentResolution, chain-aware classify(), and offline link-manifest readers.
scaffold-project.py Adds --referent-chain, validates recorded chains pre-scaffold, and prints offline warnings.
README.md Documents the “referent reached through a recorded pin chain” rule and offline verification semantics.
contracts/repository-naming.yaml Encodes the chain rule as contract data (referent.chain.*) and adds worked-case example chains.
Review details

Suppressed comments (1)

contracts/repository-naming.yaml:237

  • LedgerxWallet is listed in both referent.chain.example_chains (implying it pins openXwallet) and example_referents (implying it pins openWallet directly). This contradicts the surrounding comments/tests that say an example should declare either a direct referent pin or a chain, and it can mislead readers about the worked-case facts. Consider removing LedgerxWallet from example_referents so it is exercised only through example_chains.
    example_referents:
      MedxChart: openChart
      LedgerxWallet: openWallet
      codexFactory: openxFactory
  • Files reviewed: 13/13 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 scripts/repo_shape.py
Comment on lines +1303 to +1306
for path, how in candidates:
if link_manifest_path(path) is not None:
return path, how
return None, None
@brettheap

Copy link
Copy Markdown
Contributor Author

LANDED — lane openxfactory-4-opendox-extraction, session 011z8xpxRKZXyN3jLzFHoxj1, 2026-09-05T16:27Z: PR #42 squash-merged into openRepoShape main as c2cc9e25 (2026-09-05T16:26:49Z) at head 1b3b0e3. #40 closes with it. Owed downstream: openxFactory's contracts/openreposhape-pin.yaml re-pin to a commit at or past c2cc9e2 before group 7 (codexDox) scaffolds with a referent chain.

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

brettheap added a commit that referenced this pull request Sep 5, 2026
…) (#45)

Ruled by Brett Heap on 2026-09-05: "elect the shape for both, follow the pin
chain, no family yet" (openxFactory#656), for openDox and openXdox. The
scaffold refused both: accepts_role() admitted only project-leg/<role> and a
declared domain-descendant/assembly, and the project-leg/assembly overlap the
classifier computed for open<Product> was discarded.

The neutral-product family now ADMITS the declared assembly role as data
(admits_declared_role, the descendant family's own mechanism), and classify
carries that role where the name also satisfies the leg form, consuming
(neutral-product, None) so project-leg/assembly survives in also_matches: the
form still wins, the overlap is recorded, not resolved. accepts_role admits
("neutral-product", "assembly"). install is admitted into no role, and could
not be. Electing confers nothing, so openDox mounting openDox-spec and
openDox-code is a fact about layout, not a claim about neutrality.

496 tests (+28). Referent-chain logic from #42 untouched.

Lane: xfactory-2 (xFactory-2)

Co-authored-by: Claude Fable 5.1 <[email protected]>
@brettheap
brettheap deleted the change/descendant-referent-pin-chain branch September 11, 2026 20:05
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.

Descendant referent follows the declared pin chain (ruled by Brett Heap 2026-09-05)

2 participants