Skip to content

Naming: a descendant form is a claim that needs a pin; declared role wins otherwise (Brett, 2026-09-02) - #4

Merged
brettheap merged 1 commit into
mainfrom
fix/descendant-needs-a-pin
Sep 2, 2026
Merged

brettheap merged 1 commit into
mainfrom
fix/descendant-needs-a-pin

Conversation

@brettheap

@brettheap brettheap commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

What happened

The first real pilot. From a MedxSoft fork,
./setup.sh --project MedxScribe --visibility private --org MedxSoft --yes
reached step (4) naming policy and step (5) refused:

  MedxScribe: domain-descendant
    MATCH domain-descendant  ^[A-Za-z][A-Za-z0-9]*x[A-Z][A-Za-z0-9]*$
    MATCH project-leg        ^[A-Za-z][A-Za-z0-9]*(?:-spec|-code)?$ (role assembly)
    OVERLAP resolved by precedence: domain-descendant > project-leg/assembly
REFUSED naming-role-mismatch: 'MedxScribe' classifies as domain-descendant, not as the 'assembly' form of a project leg

No opensoft/openScribe exists. MedxScribe is an ordinary project in the Medx
family, not a descendant of anything. Every project in a <Domainx> family org
(MedxSoft: MedxEHR, MedxGlass, …) hits this. The policy was reading a SHAPE OF
CHARACTERS as a FACT ABOUT THE WORLD, and doing it in the one kind of
organisation built to hold many such names.

The ruling

Brett Heap, 2026-09-02:

"Descendant only if it pins open<Product>." A name in <Domainx><Product>
form is classified as a domain descendant ONLY when the project declares a
pin on the matching open<Product> neutral product. Otherwise the scaffold's
DECLARED ROLE wins: the name is a valid assembly root, and the project
manifest records that the name also matches the descendant form. The policy
stays checkable OFFLINE (no GitHub lookup).

The semantics

Two of the four forms are unambiguous by construction and are unchanged.
open<Product> and <X>-Install say what they are in their own characters:
nothing else spells them, so they win outright and need nothing declared.

The descendant form is a CLAIM that needs a REFERENT. Classification order:

  1. neutral-product
  2. install
  3. domain-descendant — only if the derived open<Product> is in the
    project's declared pins
  4. project-leg in the declared role, where the name satisfies it
  5. project-leg residual — the widest form, deliberately last

With no referent, MedxScribe is project-leg/assembly with
also_matches: [domain-descendant]. MedxChart is a descendant, because
MedxChart pins openChart — the contract now says so in example_referents
rather than leaving it to be inferred from spelling.

The overlap is recorded, not discarded. Every classification carries
also_matches, and each leg of a scaffolded project.yaml gets:

  - role: assembly
    repository: MedxSoft/MedxScribe
    path: "."
    naming:
      form: project-leg
      role: assembly
      also_matches: [domain-descendant]
      descendant_referent: openScribe
      referent_declared: false

with one NOTE in the scaffold plan:

NOTE MedxScribe also matches the descendant form; it is not a descendant because no pin on openScribe is declared — declare `contracts/openscribe-pin.yaml` later if it becomes one

It stays offline. The referent is neutral_product_pins: in the project's
own project.yaml plus the pin file beside it — a fact in its own tree. Nothing
asks GitHub whether open<Product> exists, because a rule that needed the
network would be unrunnable in the fork-and-run case this standard exists for.

A claim cannot vouch for itself. neutral_product_pins: is the only
declaration; a leg's referent_declared: is a record checked against it,
never folded into it.

The real refusals survive. A -spec name offered as the assembly root, and
a neutral-product or install form used as any leg, are still refused — a
declared role wins only where the NAME satisfies it.

Changed

file what
contracts/repository-naming.yaml precedence commentary rewritten; requires_referent: true and a referent: block on domain-descendant; example_referents and claim_without_referent_examples keep the data truthful and the pilot case testable from the contract
scripts/repo_shape.py classify(name, declared_role, declared_pins); returns a Classification — a 2-tuple by construction, so no call site changed — carrying also_matches and the reason --explain prints
scripts/validate-repository-naming.py --role, --pins; --project reads the legs' roles and neutral_product_pins:; --explain prints the reasoning
scaffold-project.py the descendant/assembly overlap no longer refuses; writes the naming: block; prints the NOTE
templates/assembly-root/ optional neutral_product_pins: and per-leg naming:; validate-manifest.py checks both and refuses referent_declared: true with no contracts/<referent>-pin.yaml. Both fields OPTIONAL, so schema_version does not move
README.md the naming section; its line cap moves 150 → 172, once, for a rule the standard actually gained

Tests

python3 -m pytest tests -q
137 passed in 22.75s

New: classification units for MedxScribe (no pins → assembly, also_matches
descendant), MedxChart with {openChart} → descendant, MedxChart without →
assembly with the overlap recorded, openScribe → neutral-product regardless,
Foo-Install → install regardless, MedxScribe-spec offered as assembly →
refused; an e2e scaffold of MedxScribe --local-remote-dir asserting success,
the NOTE and the exact naming: block; manifest-validator positive and negative
cases including the missing pin file. No real repository is created anywhere.

Merge note

setup.sh and tests/test_setup_sh.py are untouched, and the README edit is
confined to the naming section, so this should not collide with
fix/setup-org-detection. AGENTS.md is untouched: it does not mention the
refusal.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HGKwdQsmvRZx4fGQESdFGZ

Summary by Sourcery

Make descendant-shaped repository names require an explicit neutral-product pin while preserving their overlaps and allowing valid declared project roles to proceed offline.

New Features:

  • Require a declared neutral-product pin before classifying a <Domainx><Product> name as a domain descendant, allowing the declared project-leg role to resolve unreferenced overlaps.
  • Record naming classifications, alternate matches, and descendant referents in scaffolded project manifests and plans.
  • Add offline naming validation and explanation support through declared roles, pins, project manifests, and --explain.

Bug Fixes:

  • Allow ordinary descendant-shaped project names such as MedxScribe to scaffold successfully when they do not declare a matching neutral-product pin.
  • Preserve refusals for unambiguous neutral-product, install, and mismatched project-leg names.

Enhancements:

  • Validate optional manifest naming records and ensure declared descendant referents are backed by matching pin files without allowing records to self-declare their claims.

Documentation:

  • Document the referent-based descendant naming rule and offline classification behavior in the README.

Tests:

  • Add unit, manifest-validation, CLI, and end-to-end coverage for descendant claims, declared pins, overlap recording, and retained naming refusals.

On the first real pilot, `./setup.sh --project MedxScribe --org MedxSoft`
reached step (4) and step (5) refused:

    REFUSED naming-role-mismatch: 'MedxScribe' classifies as
    domain-descendant, not as the 'assembly' form of a project leg

No `opensoft/openScribe` exists. MedxScribe is an ordinary project in the
Medx family, not a descendant of anything — and every project in a
`<Domainx>` family org (MedxSoft: MedxEHR, MedxGlass, ...) hit the same
wall. Reading `<Domainx><Product>` as a FACT about the world, when it is
only a shape of characters, made an ordinary project unscaffoldable in
the one organisation shaped to have many of them.

Ruled by Brett Heap on 2026-09-02: "Descendant only if it pins
open<Product>." The descendant form is a CLAIM, and a claim needs a
REFERENT. A name classifies as a domain descendant only when the project
declares a pin on the matching `open<Product>`; otherwise the DECLARED
ROLE wins and the name is a valid assembly root. The overlap is not
discarded — it is RECORDED, in the manifest and in `--explain`.

`neutral-product` and `install` are unchanged: `open` in front and
`-Install` behind say what a name is in its own characters, so those two
are unambiguous by construction and win outright. The refusals that were
real stay real: a `-spec` name offered as the assembly root, and a
neutral-product or install form used as any leg, are all still refused.

THE CHECK STAYS OFFLINE. The referent is a pin the project DECLARES —
`neutral_product_pins:` in `project.yaml` and the pin file beside it —
which is a fact in its own tree. Nothing here asks GitHub whether
`open<Product>` exists, because a rule needing the network is unrunnable
in the fork-and-run case this standard is built for.

What moved:

  contracts/repository-naming.yaml   the precedence commentary rewritten;
      the domain-descendant family gains `requires_referent: true` and a
      `referent:` block (split pattern, `open{product}` canonical, the
      x-stem `openx{product}` also accepted because `codexFactory`
      descends from `openxFactory`). Examples stay truthful:
      `example_referents` says MedxChart is a descendant BECAUSE
      MedxChart pins openChart, and `claim_without_referent_examples`
      keeps the pilot case in the data.

  scripts/repo_shape.py              `classify(name, declared_role,
      declared_pins)` in the ruled order: neutral-product -> install ->
      domain-descendant ONLY with a referent -> project-leg by declared
      role -> project-leg residual. It returns a `Classification`, a
      2-tuple by construction so no call site changes, carrying
      `also_matches` and the `reason` --explain prints.

  scripts/validate-repository-naming.py   `--role` and `--pins` for a
      one-off check; `--project` reads the legs' roles and
      `neutral_product_pins:` out of the manifest; `--explain` prints
      "descendant form, no referent pin declared -> assembly root by
      declared role" and the `also_matches` record.

  scaffold-project.py                the descendant/assembly overlap no
      longer refuses. Each leg gets a `naming:` block in project.yaml,
      and the plan prints one NOTE naming the pin that would change the
      answer.

  templates/assembly-root/            project.yaml carries optional
      `neutral_product_pins:` and per-leg `naming:`;
      validate-manifest.py checks form, role, also_matches, the recorded
      referent, and refuses `referent_declared: true` with no
      `contracts/<referent>-pin.yaml` in the tree. Both fields are
      OPTIONAL, so `schema_version` does not move — a manifest written
      before they existed is not thereby wrong.

A `naming:` record cannot vouch for its own descent: the declaration is
`neutral_product_pins:` alone, and `referent_declared:` is checked
against it rather than folded into it.

The README naming section is rewritten and its line cap moves 150 -> 172,
once, for a rule the standard actually gained.

python3 -m pytest tests -q -> 137 passed in 22.75s

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

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

@sourcery-ai

sourcery-ai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Reviewer's Guide

Updates repository naming so <Domainx><Product> is treated as a descendant only when the project declares a matching neutral-product pin; otherwise the declared project-leg role wins, the overlap is recorded in generated manifests, and all checks remain offline with validation and test coverage.

Sequence diagram for offline descendant-form validation

sequenceDiagram
    participant User
    participant Validator as NamingValidator
    participant Manifest as project.yaml
    participant Policy as NamingPolicy
    participant PinFile as PinFile

    User->>Validator: validate MedxChart with --project
    Validator->>Manifest: Read legs and neutral_product_pins
    Manifest-->>Validator: role and declared pins
    Validator->>Policy: classify(name, role, pins)
    Policy->>Policy: derive openChart referent
    Policy-->>Validator: domain-descendant plus overlap data
    Validator->>PinFile: Check contracts/openchart-pin.yaml
    PinFile-->>Validator: Pin file exists
    Validator-->>User: Valid manifest
Loading

Entity relationship diagram for naming claims and referents

erDiagram
    PROJECT_MANIFEST ||--o{ PROJECT_LEG : contains
    PROJECT_MANIFEST ||--o{ NEUTRAL_PRODUCT_PIN : declares
    PROJECT_LEG ||--o| NAMING_RECORD : records
    NAMING_RECORD }o..|| NEUTRAL_PRODUCT_PIN : may_reference

    PROJECT_MANIFEST {
        string neutral_product_pins
    }
    PROJECT_LEG {
        string role
        string repository
    }
    NAMING_RECORD {
        string form
        string also_matches
        string descendant_referent
        boolean referent_declared
    }
    NEUTRAL_PRODUCT_PIN {
        string product
        string pin_file
    }
Loading

Flow diagram for offline repository-name classification

flowchart TD
    A[Repository name] --> B{Matches neutral-product or install?}
    B -->|Yes| C[Classify as unambiguous form]
    B -->|No| D{Matches domain-descendant form?}
    D -->|Yes| E{Matching neutral-product pin declared?}
    E -->|Yes| F[Classify as domain-descendant]
    E -->|No| G{Declared project-leg role matches?}
    D -->|No| G
    G -->|Yes| H[Classify as declared project-leg role]
    G -->|No| I[Classify as residual project-leg]
    F --> J[Record also_matches]
    H --> J
    I --> J
Loading

File-Level Changes

Change Details Files
Make descendant-form classification depend on an explicitly declared neutral-product pin while preserving declared-role handling for unpinned overlaps.
  • Added referent metadata, canonical and alternate referent derivation, example pins, and claim-without-referent cases to the naming contract.
  • Extended classification with declared roles and pins while retaining tuple compatibility, recording unresolved overlaps in also_matches, and exposing reasoning.
  • Added CLI support for --role, --pins, manifest-derived declarations, and explanatory output.
  • Kept neutral-product and install forms authoritative and existing role-mismatch refusals intact.
contracts/repository-naming.yaml
scripts/repo_shape.py
scripts/validate-repository-naming.py
Allow scaffolded descendant-shaped project roots to proceed as declared assembly legs and record the resolved naming decision in generated manifests.
  • Changed scaffolding to classify names using declared roles and empty initial pin declarations.
  • Generated per-leg naming records with overlap, referent, and declaration status fields.
  • Added a plan NOTE explaining that an unpinned descendant claim is not a descent.
scaffold-project.py
templates/assembly-root/project.yaml
Validate optional naming records and neutral-product declarations offline against the project manifest and pin files.
  • Added validation for naming form, role, overlap, referent, and referent declaration consistency.
  • Required an existing contracts/<referent>-pin.yaml when a manifest records a declared referent.
  • Kept new manifest fields optional without changing schema_version.
templates/assembly-root/scripts/validate-manifest.py
Document the claim-and-referent rule and add coverage for classification, CLI behavior, scaffolding, manifest validation, and preserved refusals.
  • Documented offline pin-based descendant semantics and overlap recording in the README.
  • Added unit, CLI, manifest-validator, and end-to-end tests for pinned and unpinned descendant forms, alternate referent spelling, and invalid role/form combinations.
  • Adjusted the README line-cap hygiene assertion for the expanded naming section.
README.md
tests/test_naming_policy.py
tests/test_manifest_validator.py
tests/test_scaffold_e2e.py
tests/test_repo_hygiene.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

sonarqubecloud Bot commented Sep 2, 2026

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

There are confirmed correctness issues in pin normalization/type-handling and a potential IndexError in classify() when policy data diverges from split parsing.

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

Pull request overview

This PR updates the repository naming policy so that <Domainx><Product> names are treated as descendant claims that only classify as domain-descendant when the project explicitly declares a matching neutral-product pin, while otherwise allowing the declared project-leg role to win and recording overlaps for offline traceability.

Changes:

  • Extend naming-policy classification to consider declared roles and declared neutral-product pins; record overlaps (also_matches) and explanations (reason).
  • Update scaffold + templates to write per-leg naming: records (and emit a NOTE for descendant-shaped overlaps) while keeping validation offline.
  • Add/expand unit + e2e + manifest validation tests and update README naming semantics.
File summaries
File Description
contracts/repository-naming.yaml Makes domain-descendant require a declared referent pin and adds referent metadata/examples to keep the policy testable offline.
scripts/repo_shape.py Implements classify(name, declared_role, declared_pins) returning a Classification with also_matches and reason.
scripts/validate-repository-naming.py Adds --role/--pins, reads declared roles/pins from manifests, and improves --explain output for overlaps/claims.
scaffold-project.py Relaxes descendant/assembly overlap refusal, writes naming: blocks into project.yaml, and prints a descendant overlap NOTE.
templates/assembly-root/project.yaml Adds optional neutral_product_pins: and per-leg optional naming: records to the scaffolded manifest template.
templates/assembly-root/scripts/validate-manifest.py Validates optional naming: records and referent pin-file presence while keeping checks offline.
README.md Documents the updated “descendant is a claim needing a referent” semantics and the offline declaration mechanism.
tests/test_naming_policy.py Adds unit coverage for claim-without-referent behavior, pin-driven descendant classification, and CLI explain output.
tests/test_manifest_validator.py Adds validation coverage for optional naming: blocks, overlap correctness, and referent pin-file checks.
tests/test_scaffold_e2e.py Adds an end-to-end pilot-case scaffold test ensuring overlap recording and validator agreement.
tests/test_repo_hygiene.py Updates README line-cap to accommodate the new naming rule documentation.
Review details
  • Files reviewed: 11/11 changed files
  • Comments generated: 3
  • 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 +688 to +710
claimed = "domain-descendant" in by_family
referents = self.descendant_referents(name) if claimed else ()
declared = next((r for r in referents if r.casefold() in pins), None)
if claimed and (declared or not self.requires_referent("domain-descendant")):
return answer(
"domain-descendant", by_family["domain-descendant"][0],
f"descendant form with a declared pin on {declared} → domain "
"descendant" if declared else
"descendant form (this policy does not require a referent)")

leg_roles = [r for r in (by_family.get("project-leg") or []) if r]
chosen = None
if declared_role is not None and declared_role in leg_roles:
chosen, how = declared_role, "by declared role"
elif leg_roles:
chosen, how = leg_roles[0], "by its residual project-leg form"
if chosen is not None:
if claimed:
reason = (f"descendant form, no referent pin declared (it would "
f"need {referents[0]}) → {chosen} root {how}")
else:
reason = f"project leg, {chosen} {how}"
return answer("project-leg", chosen, reason)
`validate-manifest.py` against this list; reading it as a declaration here
would let a claim vouch for itself.
"""
return {str(pin) for pin in (data.get("neutral_product_pins") or []) if pin}
a `naming:` block assert its own descent, which is a claim promoting
itself to a referent: exactly the move the 2026-09-02 ruling forbids.
"""
return {str(pin) for pin in (manifest.get("neutral_product_pins") or []) if pin}
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