Skip to content

scripts/repo_shape.py resolve_link_source (:2401-2402) and scripts/validate-repository-naming.py _link_sources_from_args (:408): a bare --link-source <path> answers for EVERY chain link that has no more specific source, so in a chain of three or more links one tree is read as two links' declarations and a correct chain is reported broken, a FINDING (exit 1) for a name that holds no direct pin on its referent #441

Closed

Description

@brettheap

Lane: openreposhape-5 (openRepoShape-5)

(lane openRepoShape-5, 2026-10-12T17:59:09Z)

What is wrong. A --link-source value with no LINK= before the path is a bare PATH. _link_sources_from_args keeps the last one as default_source (scripts/validate-repository-naming.py:408), and resolve_link_source appends it as the LAST candidate for every link it is asked about (scripts/repo_shape.py:2401-2402, rule 4: "applies to whichever link has no more specific answer"). link_pins_from_trees (:2409) asks once per link of the recorded chain and hands each the same default_source. A link with no keyed source, no SHAPE_PIN_SOURCE_<LINK> and no checkout beside the project therefore falls through to the one bare tree.

That is right for a chain with ONE holder link, the ordinary two-link openXdox → openDox, where the bare tree is that holder's. In a chain of three or more links, one tree cannot be the declaration of two links. With the chain openXdox → openYdox → openInk and a bare path that is openXdox's tree:

  • openXdox is answered from it, correctly (it declares openYdox);
  • openYdox is answered from the SAME project.yaml, which declares openYdox and not openInk, so _chain_link_findings (scripts/repo_shape.py:1242) says "openYdox declares openYdox, not openInk" about a tree nobody read, and the chain is BROKEN.

For a name that holds no direct pin on its referent, that is FINDING codexInk: the declared chain ... is broken, exit 1, for a chain that holds. For codexDox it is the same text as a WARNING, exit 0, because its pin on openXdox is also a direct pin on the referent openxDox (openXdox is the x-stem spelling), so the finding is hidden by an accident of the name. On the #338 branch the bookkeeping makes it worse: its LinkSources counts the one bare value as USED for both links, so nothing says a single tree answered twice.

Found by lane 5's review of fix/link-source-values at 40762ca (the fix for #338), as its F2, and listed by that fix's writer as a candidate follow-up. It is pre-existing: the output below is the same on origin/main 1f90a0f and on that branch (run on both, 2026-10-12T16:15Z). Not claimed.

# $U: a checkout of openRepoShape. Nothing here touches a network or `gh`.
D=$(mktemp -d)
mkdir -p "$D/work/codexInk" "$D/trees/openXdox" "$D/trees/openYdox"
printf 'neutral_product_pins:\n  - openYdox\n' > "$D/trees/openXdox/project.yaml"   # openXdox pins openYdox
printf 'neutral_product_pins:\n  - openInk\n'  > "$D/trees/openYdox/project.yaml"   # openYdox pins openInk
cat > "$D/work/codexInk/project.yaml" <<'YML'
neutral_product_pins:
  - openXdox
legs:
  - repository: testorg/codexInk
    path: "."
    role: assembly
    naming:
      referent_chain: [openXdox, openYdox, openInk]
YML
cd "$D/work/codexInk"
python3 "$U/scripts/validate-repository-naming.py" --project project.yaml --link-source "$D/trees/openXdox"; echo "exit $?"
python3 "$U/scripts/validate-repository-naming.py" --project project.yaml \
        --link-source "openXdox=$D/trees/openXdox" --link-source "openYdox=$D/trees/openYdox"; echo "exit $?"

Observed on origin/main 1f90a0f and on 40762ca, Python 3.12.3:

the run result
one bare --link-source <openXdox's tree> FINDING codexInk: the declared chain openXdox → openYdox → openInk is broken (openYdox declares openYdox, not openInk), the name classified project-leg/assembly, exit 1
each link keyed (openXdox=, openYdox=) codexInk classified domain-descendant/assembly, nothing else, exit 0
no --link-source two declared-unverified WARNINGs, one per link, exit 0

Nothing shipped passes --link-source: make validate and validate.yml run --project project.yaml alone (templates/assembly-root/Makefile:47, templates/assembly-root/.github/workflows/validate.yml:187). Only a person who types one bare tree for a chain of three or more links reaches it, which is why it is a follow-up and not a blocker for #338.

What it should do. The author decides; the one thing that cannot stand is a tree answering for a link it is not:

  • a bare value counts only for the FIRST link of the chain (the pin the project actually holds, and the only link a person has a tree for in the ordinary case), or only where exactly one link of the chain is a holder, and says so in --help; or
  • a bare value is refused, with a message naming the links it cannot answer for and the LINK=PATH spelling that can, when more than one holder link would take it; or
  • a link read from a bare tree is accepted only when that tree says it is that link (its project.yaml names the repository), which needs a decision about what a link's manifest must carry.

Whichever it is, the bookkeeping (LinkSources.used) must stop counting one value as the answer for two links without saying so, and --help and the module docstring (rule 4) must say what a bare value means in a longer chain.

How to test. In tests/test_naming_policy.py, beside the --link-source tests (CHAIN_ARGS, naming_from and _tree there are #338's; before it lands, run_script(VALIDATOR, ...) and _tree serve), add the run above: --project with a three-link chain, one bare tree, codexInk (no direct pin, so the broken chain is a FINDING), asserting the exit and the text under the chosen rule; and the keyed-both run still exiting 0. Run it from a tmp_path directory of its own, as the neighbouring tests do, so no checkout beside it answers. Reverting the fix fails it.

Not in this issue.

Related: #338 and the PR that fixes it (fix/link-source-values).

Activity

  1. added this to the v1.1.0 milestone on Oct 14, 2026
  2. brettheap commented on Oct 14, 2026

    @brettheap
    ContributorAuthor

    v1.1.0 (triage of 2026-10-14): #442 can ride along (backlog); it is the empty-path half of the same argument parsing.

  3. brettheap commented on Oct 14, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoShape-5, session 50cede29-ab82-4ca3-9f67-d98e1a58c8d2@Eagle, 2026-10-14T22:34:59Z, for #441

    Logged in lanes/log/openRepoShape-5.md at 9c129701876bc4c90b2d171265b246b7ab05ad31.

    The three reads (lane-collision-protocol Rule 1):

    1. existing `CLAIMED —` comments on opensoft/openRepoShape#441:
       none
    2. `gh pr list --repo opensoft/openRepoShape --state all --search "#441"`, kept where the row or its body names `#441`:
    557	shape-doctor.py: a validator's verdict is a printed `FINDING` or `REFUSED` and any other non-zero exit is a crash, so a gate killed by a signal, ended by `os._exit(1)`, holding conflict markers or failing argparse no longer "reports a finding", a crash of the standard's own naming script is CANNOT ANSWER instead of `INVALID (naming)`, and a pass that printed `WARNING` or `  note ` lines is a `note` quoting them while a red row quotes its finding and never a warning (#410, #448)	fix/doctor-validator-verdicts	OPEN
    453	validate-repository-naming.py, repo_shape.py: a `--link-source` value is `PRODUCT=PATH` only when its key names a chain link, and a link source that cannot be entered is a WARNING with the system's reason, not a traceback (#338)	fix/link-source-values	MERGED
    3. `git ls-remote --heads [email protected]:opensoft/openRepoShape` branches naming `441` as a whole token:
       none
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions