Skip to content

tests: no row pins a partial clone whose recorded .git this user cannot read, refused source-unreadable and never source-partial-clone, with no gh call and no upload-pack run (RD1141's NIT-1 on #1141, for #1099; the behaviour is right) #1262

Closed

Description

@brettheap

(lane openRepoShape-4, 2026-11-08T16:02:41Z)

Found by: RD1141, lane 4's independent delta review of PR #1141 (a draft for #1099) at 0b8fb320, in its report and in its review comment (#1141 (comment)), finding NIT-1, "test gap, follow-up". The review graded #1141 READY with no MUST, no SHOULD and this one NIT, so #1141 lands without it. This is the follow-up RD1141 asked for. It follows #1099 and #1141. The report is a lane 4 reviewer's message and is not posted on GitHub.

Lane 3 places this issue, and it has no milestone here. It is a test follow-up of #1141, and it goes on a branch after #1141 lands.

Nothing was re-run for this issue. The measurements are RD1141's, taken at 0b8fb320 (git 2.43.0, Python 3.12.3, a stub gh first on PATH that logs and refuses every call, git-filter-repo 2.47.0 first on PATH). #1141 is a draft and is not on main, so tests/test_adopt_unreadable_clone_git.py below is #1141's new file. This body is ASCII.

What is missing

Nothing a user can see: the behaviour is right. RD1141: "The behaviour is right and cannot be flipped by a reorder, so this is a guard against a later refactor only." What is missing is a test row. No row in the repository pins a partial clone whose recorded .git this user cannot read. #1141's 9 refused-by-name rows (tests/test_adopt_unreadable_clone_git.py) and tests/test_adopt_partial_clone_source.py each cover one of two rules, source-unreadable and source-partial-clone, and the two rules now share --source's help and the check and execute path.

What was measured, and by whom

Measured by RD1141, by a probe that is not in the repository (tools/run/rd1141/probe/test_rd1141_probe.py in lane 4's scratch: 16 rows and 8 rows, imported from tests/test_adopt_partial_clone_source.py). It makes a partial clone of a small origin (--filter=blob:none, with and without a checkout), records it in the plan as source.local_path, makes the .git a directory or a gitdir: file, sets cloned false or true, and runs check and execute --yes:

Case Rows Result at 0b8fb320
.git at mode 000, partial clone 16 (2 clones x 2 kinds x 2 cloned x 2 verbs) all 16: exit 2, REFUSED source-unreadable naming <it>/.git, never source-partial-clone; 0 gh calls, 0 upload-pack runs, no remotes/ directory made
.git readable, the same partial clones 8 (2 x 2 x 2) all 8: exit 2, REFUSED source-partial-clone with the git fetch --refetch --no-filter origin cure, not source-unreadable; 0 upload-pack runs

RD1141's sketch of the row

RD1141's words: "one parametrized row in tests/test_adopt_unreadable_clone_git.py (or in test_adopt_partial_clone_source.py) that makes Source("nocheckout"), puts the .git at mode 000 under needs_a_mode, and asserts REFUSED source-unreadable, no source-partial-clone, and 0 gh and 0 upload-pack runs. My probe ... can be cut down to it." The probe's first test, trimmed by the filer and not run: the file kind, the cloned plan edit, the prints and the gh count are left out. The probe counts gh calls in a log at a fixed path of its stub; a row in the repository would count them as its neighbours do, with recording_gh, which tests/test_adopt_unenterable_source_and_locale.py imports with needs_a_mode:

# parametrized over verb in ("check", "execute") and variant in ("nocheckout", "checkout")
def test_unreadable_git_of_a_partial_clone_is_source_unreadable(
        made, variant, verb):
    source = made(variant)
    with at_mode_000(source.path / ".git"):
        result = getattr(source, verb)()
    assert result.returncode == 2, result.stderr + result.stdout
    assert "REFUSED source-unreadable: " in result.stderr
    assert str(source.path / ".git") in result.stderr
    assert "source-partial-clone" not in result.stderr + result.stdout
    assert "plan ok" not in result.stdout
    assert source.runs() == 0                      # no upload-pack ran
    assert not (source.base / "remotes").exists()  # nothing was made
    # and: 0 `gh` calls

at_mode_000(path) is a context manager that chmods the path to 0, asserts os.access(path, os.R_OK) is false, and gives the mode back in a finally. Source, made and planned_once are in tests/test_adopt_partial_clone_source.py on main (:130, :256, :98).

Beyond the sketch: the .git as a gitdir: file and the recorded clone with cloned: true are in RD1141's probe and can ride on the same row.

Not in this issue: RV1141's four NITs (the 0100 and 0300 row, the HEAD, objects, refs and config rows for #1151, the _git_refused docstring on a symlinked .git, and the two Sonar issues) are separate and untouched. RD1141 did not re-review them.

Done when

See #1099, #1141 and #1151.

Lane: openreposhape-4 (openRepoShape-4)

Activity

  1. added this to the v1.2.1 milestone on Nov 8, 2026
  2. brettheap commented on Nov 9, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoShape-5, session 50cede29-ab82-4ca3-9f67-d98e1a58c8d2@Eagle, 2026-11-09T21:08:33Z, for #1262

    Logged in lanes/log/openRepoShape-5.md at 8f15bfde86f9d5381d574e11438ce39bea1cb316.

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

    1. existing `CLAIMED —` comments on opensoft/openRepoShape#1262:
       none
    2. `gh pr list --repo opensoft/openRepoShape --state all --search "#1262"`, kept where the row or its body names `#1262`:
       none
    3. `git ls-remote --heads [email protected]:opensoft/openRepoShape` branches naming `1262` 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