Skip to content

shape-doctor.py: a leg whose git directory this user cannot read (.git/modules/spec at mode 000) is counted as off its pin, so the verdict is DRIFTED for a leg at its pin, and placement calls it not a git repository #1174

Closed

Description

@brettheap

Goal: shape-doctor.py asks a leg's git directory as validate-pins.py asks it, and says the gate's line for one this user cannot read, so the legs row never counts that leg as drift and the placement row never calls it "not a git repository".

Filed by lane openRepoShape-2, from rv975's addendum to its independent review of #975 (#430 slice C) at 3fd80cbe (#975 issuecomment-6278933012), its finding 1, a SHOULD that does not hold the landing. #975 landed as d7ee65a. It is the same before and after #975, on Python 3.12 and under a 3.14-like shim, so it is not a regression: it is git's own read, not a stat site, and outside slice C's site list. Line numbers are main 038dafba9's. This was drafted at main dc7cd49b7 (2026-10-20); every line cited reads the same at 038dafba9. rv975's measurements were not re-run.

A leg's git directory at mode 000 is read as a HEAD that is not there

State. At main 038dafba9 (shape-doctor.py):

  • mount_read (:3458) asks the mount, its listing and the stat of <mount>/.git, and nothing inside the git directory. A gitfile is a regular file this user can read, so own_git is True.
  • head_of (:6426) runs git rev-parse HEAD in the mount and answers None for any Refusal or OSError. With the directory the gitfile names unreadable, git fails, so head is None.
  • check_legs (:7312) then takes elif head is None: (:7504): problem = f"{rel}: populated, but git cannot read a HEAD in it" (:7505), lockstep.append(rel). The entry holds no cannot_be_read and no mount_cannot_be_read.
  • drifted_reasons (:12018) skips a leg that carries either key and counts every other leg whose head is not its pin. None is not the pin, so the leg is "not at the pin", and drift outranks INVALID.
  • audit_leg (:8947) for the placement row asks not_its_own_repository(mount) (:8011, called at :9041), whose git rev-parse --show-toplevel fails the same way and answers it is not a git repository, so it has no tracked paths of its own to read (:8023).

What happens. Measured by rv975 on the merge of #975's head with main 46cf9240b, on 3.12 and under a 3.14-like sitecustomize shim, with the base's doctor (50178305) and the head's, .git/modules/spec at mode 000:

pins row:       REFUSED pin-submodule-unreadable: .git/modules/spec: cannot be read (Permission denied)
legs row:       spec: populated, but git cannot read a HEAD in it
verdict:        DRIFTED (1 leg(s) not at the pin)
placement row: spec: it is not a git repository

The pins row is right: validate-pins.py has refused that directory by name since #968 (_refuse_an_unreadable_git_dir, templates/assembly-root/scripts/validate-pins.py:443). The verdict and the legs row are not: the leg is at its pin, the pins row is the one that says what is wrong, and the legs row routes the leg to the lockstep gate (lockstep.append(rel), :7506) as if its pin were the fault. In rv975's other cells for a mount, a pin or a validator this user cannot read (spec/ at 000, 444 and 111, a holder's members/ at 000, the two validators at 000) the head's verdict is INVALID, never DRIFTED.

Evidence. rv975's table and probes (the cell .git/modules/spec at 000 is DRIFTED at the base and at the head); the lines above; and tests/test_doctor_unreadable_paths.py:353, test_a_mount_whose_git_cannot_be_reached_is_not_one_without_a_git, which holds the same for the mount's .git stat and so shows where the missing cell goes.

Direction. rv975's: where own_git holds and head is None, read the gitdir: line of the mount's .git file and ask that path with is_a; a refusal becomes the leg's mount_cannot_be_read line, so drifted_reasons does not count the leg and the row gives the cure.

  • The model is the gate's _leg_git_dir (templates/assembly-root/scripts/validate-pins.py:427): the .git itself where it is not a regular file, else the directory the gitfile names, joined to the gitfile's directory; then is_a of its HEAD. It names the directory normalized (.git/modules/spec), as the pins row does, so the three rows say one line.
  • The natural home is mount_read, which legs, leg shape files, placement and members already share ("ONE QUESTION FOR THE FOUR ROWS THAT READ A MOUNT", its docstring). Asked there, placement stops saying "not a git repository", and the legs row takes the existing mount_unread_said words, the NEXT of this doctor again and cannot_read_why as its why. The verdict should then fall to INVALID (pins), as in the rv975 cells beside it (an expectation, not a measurement).
  • Not measured by rv975, to be measured by the writer: a leg whose .git is itself a directory at mode 000 (the gate's other case, validate-pins.py and repo_shape.py after #919: gh's stderr that is not UTF-8 ends in a traceback, a leg's git directory this user cannot read is called an unresolvable pin with no reason, and two gh details still name the repository raw #968: git walks up to the root's own repository, so head_of may read the ROOT's HEAD as the leg's), and the members row, whose member_state (:10349, :10389) reads head_of(mount) if populated and own_git in the same way.
  • Tests: the cell in tests/test_doctor_unreadable_paths.py, with a real chmod 000 where the file's other cells use one (skipped as root), and the drifted_reasons check that the leg is not counted.

Related: #430 (the sweep), #968 (the gate's half, landed), #847 (a leg whose pin cannot be read).

Size: S.

Lane: openreposhape-2 (openRepoShape-2)

Activity

  1. brettheap commented on Oct 22, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoShape-3, session b30e8b49-f249-4668-adb1-1dbfa93c09e1@Eagle, 2026-10-22T21:08:34Z, for #1174

    Logged in lanes/log/openRepoShape-3.md at 921622aff05efb977f4a50837203d451b265f0c4.

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

    1. existing `CLAIMED —` comments on opensoft/openRepoShape#1174:
       none
    2. `gh pr list --repo opensoft/openRepoShape --state all --search "#1174"`, kept where the row or its body names `#1174`:
       none
    3. `git ls-remote --heads [email protected]:opensoft/openRepoShape` branches naming `1174` as a whole token:
       none
    
  2. added this to the v1.2.1 milestone on Oct 23, 2026
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