Repository navigation
test_adopt_partial_clone_source.py: a partial clone whose recorded .git this user cannot read is pinned source-unreadable in check and execute, never source-partial-clone, with no gh call and no upload-pack run (#1262) - #1289
Conversation
…git` this user cannot read is pinned `source-unreadable` in `check` and `execute`, never `source-partial-clone`, with no `gh` call and no `upload-pack` run (#1262) No row built a partial clone whose recorded `.git` is at mode 000 (RD1141's NIT-1 on #1141, for #1099): #1141's rows and this file's each covered one of the two rules, and the two now share `--source`'s help and the `check` and `execute` path. 16 rows (2 clones x 2 verbs x `cloned` false and true x a `.git` directory and a `gitdir:` file) put the `.git` at mode 000 under `needs_a_mode` and assert exit 2, `REFUSED source-unreadable` naming that `.git` with its cure, no `source-partial-clone`, no `plan ok`, no `gh` call (`recording_gh`), no `upload-pack` run, `objects/` as it was and no remotes directory. 8 control rows give the same clones a readable `.git`: refused `source-partial-clone` with its cure, never `source-unreadable`. `Source` takes `apart` (the git directory beside a `.git` file) and `objects_dir` finds its `objects/` through that file, `check` and `execute` take an `env`, and `recorded_as_a_clone` is `at_the_side_commit`'s `cloned` edit made alone; no existing row changes, and `tests/test_adopt_plan_partial_clone.py`, which reuses `Source`, keeps its outcomes. Before #1141 (26cc80b^, production files) the 16 rows fail: the 8 `given` rows with `git-failed`, the 8 `cloned` rows with `source-unclonable` after `gh repo clone` was asked; the 8 control rows pass. With the guard removed (`refused = None`) 16 fail; with it asked after the `cloned: false` branch has read the clone, the 8 `given` rows fail. Closes #1262 Lane: openreposhape-5 (openRepoShape-5) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Reviewer's GuideTestsAdd parameterized unreadable-
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Independent review of #1289 (#1262) for lane openRepoShape-5, by rv1289 (opus), at 2e0d2d2: READY The PR meets every point of #1262's "Done when". I found no MUST and no SHOULD, and there are two NITs. I wrote nothing to the PR, the branch or GitHub. The PR head read back as Setup: detached trees 1. The rows against "Done when"24 new ids collected: 16 rows
2. The helper changes
3. Failing beforeI swapped in
4. MutantsEach was applied alone to
5. Gates at 2e0d2d2Logs are
6. Merge-treesHeads read fresh at 21:48Z, 39 open PRs (
None of those PRs changes 7. The body
Findings
My notes and logs are in Lane: openreposhape-5 (openRepoShape-5) |
|
|
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 4 days and 7 hours by commenting |



Goal
Pin, in
tests/test_adopt_partial_clone_source.py, that a partial clone whose recorded.gitthis user cannot read is refusedsource-unreadable, naming that.git, and neversource-partial-clone, incheckandexecutealike, with noghcall, noupload-packrun and no remotes directory made. RD1141's NIT-1 on #1141 (for #1099) asked for it, and #1262 is that follow-up.This is a test gap only, and the behaviour is right. The PR changes one file,
tests/test_adopt_partial_clone_source.py(+117 -15). No production file, refusal code, remediation or doc changes. Milestone v1.2.1, as #1262.What held on main
Plan._recorded_source(reached throughopen_source) asks_git_refused(path)ahead of everything that reads the clone (adopt-project.py:7064at4552efa6a), incheckandexecutealike, and_refuse_a_partial_clone_shortruns after the source is opened. #1141's 9 refused-by-name rows (tests/test_adopt_unreadable_clone_git.py) build a plain clone, and this file's rows build partial clones with a readable.git: no row built a partial clone whose.gitis at mode 000. RD1141's probe (not in the repository) measured 16 such rows at0b8fb320, allREFUSED source-unreadablenaming<it>/.git, nonesource-partial-clone, with 0ghcalls and 0upload-packruns. RD1141 measured why a reorder cannot flip that answer: through a.gitat mode 000_promisor_remotesis[]and_objects_lackingisNone, where they are['origin']and 28 while it is readable, so the partial-clone rule's own questions see nothing there. What no row pinned is a change that left such a clone to that rule.The rows
In
tests/test_adopt_partial_clone_source.py, reusingSource,madeandplanned_once, andneeds_a_mode,recording_gh,at_mode_000,the_refusalandCURESfrom the files that own them (functions only, no fixture is imported):test_a_partial_clone_whose_recorded_git_is_unreadable_is_source_unreadable: 16 rows,[nocheckout|checkout]-[check|execute]-[given|cloned]-[directory|file]. Each makes a--filter=blob:noneclone (with a checkout, and with--no-checkout;source.lacking() > 0is asserted), records it as the plan'ssource.local_path(clonedfalse, orsource.cloned: truewith asource.repository), makes its.gita directory or agitdir:file (git clone --separate-git-dir), and puts that.gitat mode 000 for thewith(at_mode_000: the mode is asserted to bite and is given back in afinally). It skips as root and on Windows (needs_a_mode). It asserts:the_refusal(...)in stderr:REFUSED source-unreadable: the .git in the plan's source.local_path, <path>/.git: cannot be read (Permission denied), so ... cannot be told, with the cure for a directory or for a file (CURES[kind]);source-partial-clonein neither stream, and noplan ok;ghlog fromrecording_ghempty (noghcall);source.untouched(): noupload-packran, andobjects/hashes as it did before.test_the_same_partial_clones_with_a_readable_git_are_source_partial_clone: 8 control rows,[nocheckout|checkout]-[given|cloned]-[directory|file],checkonly. The same clones with a readable.gitare refusedsource-partial-clonewith its cure, neversource-unreadable, with noghcall and nothing fetched. They show the 16 rows read the.git's mode and not a clone the rule would let by. They run as root and on Windows too.The helpers, none of which changes an existing row:
Sourcetakesapart(the git directory beside a.gitfile);objects_dir(path)findsobjects/through that file (a function of the path alone, becausetests/test_adopt_plan_partial_clone.pycallsSource.store(SimpleNamespace(path=...)));checkandexecutetake anenv;recorded_as_a_cloneis theclonededitat_the_side_commitmade inline, made alone and called from there.tests/test_adopt_plan_partial_clone.pyreusesSource,madeandplanned_once, and keeps its outcomes (run G below). No assert joins conditions withandoror.The rows failing before #1141
The detached tree
n1262-mutat main4552efa6a, this branch's test file,adopt-project.pyanddocs/cli.md(#1141's two production files) taken from26cc80bd2^, then restored and compared by sha256 (adopt-project.pyeb5f181b...at the base,a8f76e66...before #1141).-k "unreadable or readable_git", git 2.43.0: 16 failed, 8 passed.givenrows (2 clones x 2 verbs x 2 kinds)REFUSED git-failed(git rev-parse --is-inside-git-dirsays not a git repository), noghcallclonedrows (the same 8)gh repo clone testorg/Elsewhereasked,REFUSED source-unclonable.git)This is what RD1141 measured for the same 16 rows on main
b66d8f0cc.The mutants
Each applied alone to
adopt-project.pyinn1262-mutat4552efa6a, the 24 rows run, and the file restored and compared by sha256 each time (scriptmutate.py; the control rows pass in every run).refused = _git_refused(path) if there else Nonebecomesrefused = Nonecloned: falsebranch has read the clone_not_a_whole_clonegivenrows (git-failedfrom_top_level); theclonedrows still reach the guard.gitfile left unguardeda_file = Falsein_git_refusedfilerowsource.clonedis nottrueclonedrowNo survivor. The two named in #1262 are killed, and each axis of the 16 rows (directory or file, given or cloned) carries a mutant of its own.
The runs
Head
2e0d2d237, Python 3.12.3, git-filter-repo 2.47.0 (tools/venv247), throughrun10.sh(a stubghfirst on PATH that refuses and logs every call,GH_TOKEN=bogus-l5, an emptyGH_CONFIG_DIR,GIT_SSH_COMMAND=false,GIT_CONFIG_GLOBAL=/dev/null), at most 100 tests a run,-rsalone. Each ran on git 2.43.0 and on git 2.47.1 (tools/git247/bin/git,git --versionprinted first in each log):test_adopt_partial_clone_source.py,test_adopt_unreadable_clone_git.py,test_adopt_unenterable_source_and_locale.pytest_adopt_partial_clone_source.pyandtest_adopt_plan_partial_clone.pyin one pytest (the second imports the first's fixtures)test_agents_md_codes.py,test_cli_reference.pytest_pinned_copy_text.pytest_no_auto_maintenance.pytest_path_guard_hygiene.pyin two halvestest_repo_hygiene.pyin two halvesThe only skips, named:
tests/test_no_auto_maintenance.py:222x2 on each git, "the session began with GIT_CONFIG_GLOBAL set, and its file includes that one". Run G first failed 10 rows on an earlier headcd8b4f3fe(agit_dirattributeSource.store(SimpleNamespace(path=...))does not have);objects_dirreplaced it and every run above was repeated at2e0d2d237.Pre-test of the merge: the predicted merge of the head into main
9cb156a98(85f8744b4, a local commit never pushed), git 2.43.0: G 77 passed, andtest_adopt_unreadable_clone_git.pywithtest_adopt_unenterable_source_and_locale.py31 passed.Refreshed on 2026-11-10 at 12:19Z as
305021ef3: one merge of main3add78e1cinto the reviewed head2e0d2d237, made bygh pr update-branch. The old head'stestsrun had failed only on #1189's 13 rows intests/test_adopt_symlink_target_bytes.py, which #1293 fixed on main. A re-run would have tested the stale merge again. CI'stestsruns on the refreshed head, and lane 5's pilot gates the predicted squash again at this PR's turn.Merges
git merge-tree --write-treeat the refreshed head305021ef3, heads read fresh at 12:23Z (27 open PRs). No other open PR touchestests/test_adopt_partial_clone_source.pyortests/test_adopt_plan_partial_clone.py. Against the PR's base the head changes one file,tests/test_adopt_partial_clone_source.py(+117/-15).3add78e1c8327064c7, the head's own tree (the head holds main)791106c2b, 16th)00f6a02acfix/1129-github-name-limits,906172b41, 17th)b0eac8e04fix/1196-paths-spelled-locale-and-env,13a2c58cb)tests/test_adopt_plan_paths_spelled.py, a file this PR does not touch; the same conflict arises between #1209 and main aloneThe earlier rows (main
3ee5bb4d9and9cb156a98, and #1282, which has landed asb607223b4) are superseded by this table (rv1289's NIT 1).Closes #1262
Lane: openreposhape-5 (openRepoShape-5)
🤖 Generated with Claude Code
Summary by Sourcery
Strengthen partial-clone adoption tests to pin unreadable recorded
.gitsources tosource-unreadablewithout side effects.Enhancements:
.gitpaths are classified assource-unreadablebefore partial-clone handling, for bothcheckandexecute..gitlayouts, checkout variants, and sources recorded as given or cloned, while preserving controls for readable partial clones.Documentation:
.gitis unreadable.Tests:
upload-packruns and leave source objects unchanged.