Skip to content

family.py add mounts the member before it checks --at or the member's project.yaml, so a refused add (a leg, a short --at) leaves a staged gitlink, a .gitmodules registration and a cached object store, and the next add of a different member commits the refused leg's registration while validate-family.py and the doctor say ok #203

Closed

Description

@brettheap

Lane: openreposhape-4 (openRepoShape-4)

Found by this lane's probe of main e4decfb on 2026-10-11, re-verified on main e4decfb today. Not claimed.

What is wrong. cmd_add in scripts/family.py runs git submodule add (:821) BEFORE it checks --at against COMMIT_RE (:832) and before _read_member_project asks whether the member has a project.yaml. Neither refusal undoes the mount, so a refused add leaves a staged gitlink, a staged .gitmodules registration and a cached object store under .git/modules/members/<P>. The next add of a DIFFERENT member then commits the refused one's registration: _commit_one commits the working-tree state of .gitmodules, which still carries it. The holder's .gitmodules on that branch registers a leg nobody pins, under a commit titled "Add IRQS", and validate-family.py and the doctor both pass it. The --at typo path instead strands the human in three refusals in a row before a correct retry can run.

# a family holder $H made by `family.py init`, members IRRS and IRSS added; IRRS, IRSS, IRQS and the
# legs scaffolded into local bare remotes under $T/remotes
python3 scripts/family.py add --family-root $H --member InkRouter/IRRS-spec --local-remote-dir $T/remotes
#   exit 2   REFUSED member-not-a-project ... Adding a leg — `IRRS-spec-spec` or `IRRS-spec-code` — is never right
git -C $H status --short            # M  .gitmodules   A  members/IRRS-spec   (and .git/modules/members/IRRS-spec)
python3 scripts/family.py add --family-root $H --member InkRouter/IRQS --local-remote-dir $T/remotes
#   exit 0   committed: .gitmodules, members/IRQS, family.yaml
git -C $H show HEAD:.gitmodules     # registers members/IRRS, members/IRSS, members/IRRS-spec AND members/IRQS
git -C $H ls-tree HEAD members/     # IRQS, IRRS, IRSS: no gitlink for IRRS-spec
(cd $H && python3 scripts/validate-family.py)   # family ok: InkRouter (inkrouter), 3 member(s)   exit 0
python3 shape-doctor.py --root $H               # COMPLIANT   exit 0

# the --at typo, on a fresh holder
python3 scripts/family.py add --family-root $H --member InkRouter/IRQS --at abc1234 --local-remote-dir $T/remotes
#   exit 2   REFUSED member-at-not-a-commit   (but members/IRQS is already mounted and staged)
python3 scripts/family.py add ... --member InkRouter/IRQS --at <full 40-hex sha> ...
#   exit 2   REFUSED member-path-taken: ... Remove it (`git rm -r` if it is tracked), then re-run.
git -C $H rm -q -r -f members/IRQS; python3 scripts/family.py add ... --at <full sha> ...
#   exit 2   REFUSED member-git-dir-cached: ... rm -rf .../.git/modules/members/IRQS

What the docs promise. AGENTS.md, "Creating a family, and adding a member", item 2: "The tool refuses a leg, and the refusal is correct"; item 3: "Each of add, bump and remove writes ONE commit moving the gitlink and the pin together." _commit_one's docstring: "git commit -- <paths> commits the working-tree state of exactly those paths and nothing the index happens to be carrying"; .gitmodules is one of those paths, and its working-tree state is carrying the refused add.

What would fix it. In cmd_add, check --at against COMMIT_RE before git submodule add, and wrap everything after the mount so any Refusal or CommandFailed undoes it: git submodule deinit -f, git rm --cached -f, .gitmodules restored from HEAD, and the .git/modules/members/<P> this run created removed (it holds nothing anybody committed). validate-family.py could also refuse a .gitmodules registration no members: row names. Secondary: _read_member_project's remediation should name <Project> from the stripped suffix rather than append -spec/-code to a leg, and in a combined log the REFUSED line prints before "mounting ..." because stdout is not flushed.

Activity

  1. brettheap commented on Oct 11, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoShape-4, session fc41839d-ea5c-40d3-9ebe-5136287407f7@Eagle, 2026-10-11T16:14:58Z, for #203

    Logged in lanes/log/openRepoShape-4.md at 6793ab275e0e60bcdce30268da01d98a58438c4c.

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

    1. existing `CLAIMED —` comments on opensoft/openRepoShape#203:
       none
    2. `gh pr list --repo opensoft/openRepoShape --state all --search "#203"`, kept where the row or its body names `#203`:
       none
    3. `git ls-remote --heads [email protected]:opensoft/openRepoShape` branches naming `203` as a whole token:
       none
    
  2. brettheap commented on Oct 11, 2026

    @brettheap
    ContributorAuthor

    (lane openRepoShape-4, 2026-10-11T18:59:54Z) Still held by this lane after the team04a profile switch (new session 83338f75-6338-4d51-9749-89179ecaf55f). Branch fix/family-add-check-before-mount is at d25dd4d: 11c1168 (the fix: add runs every check of the holder, and of a throwaway bare clone of the member, before git submodule add; new refusals member-at-unknown, member-no-tip, family-manifest-unwritable; a failure after the mount is unwound and named) plus d25dd4d (tests/test_family_add_refusals.py, 21 tests; and member-not-a-project now names the legs of the root a -spec/-code suffix came off). Targeted set 291 passed; ten mutants, every one caught. An adversarial review is running; the pull request follows it.

    Landing note for lane 3: this branch conflicts with fix/family-add-member-case (#206) in scripts/family.py, at the opening of add. 11c1168 moves the member-already-present check into _checked_add_target, and #206 rewrites that check as family.holding(repository, project). It is not a mechanical merge: _checked_add_target has to take repository and call holding. The review is checking that resolution and which of the two should land first. fix/family-bump-nothing-to-do (#210) merges clean.

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

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions