Skip to content

openRepoShape: --doctor checks $OPENREPOSHAPE_REF before it clones the standard, so a ref checked_ref refuses (a.lock/b, a//b, one over 255 characters) makes no clone and, where the clone fails, is still refused in its own words - #967

Merged
brettheap merged 5 commits into
mainfrom
fix/942-check-ref-before-clone
Oct 19, 2026

Conversation

@brettheap

@brettheap brettheap commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Lane: openreposhape-2 (openRepoShape-2)
Claim: #942 (comment)

Milestone v1.2.0. Brett Heap's v1.2.0 merge word, "merge v1.2.0 PRs once reviewed and green" (2026-10-18T14:45:28Z, relayed on #473 issuecomment-6251255596), lands it once an independent review is READY at the landing head and tests and SonarCloud are green. It stays a DRAFT until then. Commits on a4de0aae, one squash at landing; nothing stacked.

What changed

openRepoShape, in shape_checkout and in one comment of ref_fault; tests/test_openreposhape_command.py; and one comment in .github/workflows/tests.yml.

shape_checkout ran git clone and then checked_ref "$REF", so a ref the rule refuses cost a whole clone first, and where the clone failed (offline, a mirror that is down) the run ended in "could not clone" and never named the ref. checked_ref reads only the value, and nothing between the two lines needs the clone (what lies between is the clone's own refusal text and the if; ref_fault and checked_ref never look at $SHAPE_DIR). So the call moves up, after shape_clone_url and before workdir, and the later one goes:

	url="$(shape_clone_url)"
	[ "$REF_NAMED" -eq 0 ] || checked_ref "$REF"
	workdir openRepoShape-doctor

It stays in shape_checkout, not refuse_bad_values: the up-front check of the ref is its characters only, on purpose (--install takes bad..ref with no opt-in, test_a_ref_set_without_the_opt_in_is_never_recorded), and --doctor beside a checkout never uses the ref. A refused ref now makes no $TMPDIR folder at all, so it is refused in its own words even where $TMPDIR is not there (the folder was made first, so before, workdir's "could not make a temporary directory" came before the ref was asked). The comment above shape_checkout says the order and why; the one inside it says checked_ref runs "above, before the clone"; and ref_fault's comment says "the doctor's ref is refused before its clone", where it said the doctor's checkout is refused before git checkout.

The refusal's words are not touched. What a run does, measured with a git first on PATH that logs its arguments and runs /usr/bin/git (an installed copy of the launcher with no checkout beside it, --doctor <an empty directory>, OPENREPOSHAPE_REPO a small local bare repository, a stub gh that exits 97, GH_TOKEN=bogus), before (a4de0aae) and after:

OPENREPOSHAPE_REF                before                    after
a.lock/b, a//b, a/.b, a/b/,      exit 2, clone 1,          exit 2, clone 0,
a., topic.lock, a x256           checkout 0, ref refusal   checkout 0, ref refusal
main, v1.0.0 (a ref that is      exit 2, clone 1,          exit 2, clone 1,
taken; this standard has no      checkout 1                checkout 1
doctor, so the run ends there)
unset                            exit 2, clone 1,          exit 2, clone 1,
                                 checkout 0                checkout 0
OPENREPOSHAPE_REPO=/nonexistent/openRepoShape.git:
  a.lock/b                       exit 2, clone 1,          exit 2, clone 0, the ref's
                                 "could not clone"         refusal
  v1.0.0                         exit 2, clone 1,          exit 2, clone 1,
                                 "could not clone"         "could not clone"

Every refused row leaves $TMPDIR empty before and after. Run time is the clone's: 140 to 350 ms before and 45 to 85 ms after for a refused ref against a one-commit repository, which is the clone's setup and nothing of its size.

.github/workflows/tests.yml, the comment above the Windows job's checkout (tests-git-bash): it said fetch-depth: 0 is there because the launcher's suite clones this checkout itself, in the test above, which now runs a fake git. None of the job's three files (test_openreposhape_command.py, test_install_sh.py, test_install_sh_filter_repo.py) clones this checkout or reads its history. The comment now says: "fetch-depth: 0, as the ubuntu job has it: no test in these three files has cloned this checkout since #942. A shallow checkout here is a change of its own, and wants a Windows run behind it." The setting stays.

Tests

All in tests/test_openreposhape_command.py. The file went from 447 tests to 460: the five-ref test is ten, and three tests are new (four rows, one, and three). New helpers: doctor_from_stdin (runs --doctor from stdin with a git that logs each call, leading -C <dir> dropped, fails every clone or makes the empty directory it is handed, and takes the $TMPDIR it hands the run), asked_of_git and assert_the_ref_was_refused_before_any_clone.

Test What it pins Mutant that fails it
test_a_ref_the_doctor_would_check_out_is_validated (10 refs: -x, --upload-pack=touch /tmp/pwned, 256 a, refs/heads/.., x.lock, a.lock/b, a//b, a., a/b/, topic.lock) exit 2 in ref_fault's words for the value (the rule's words, or the length sentence without the value echoed), no clone and no checkout asked of git, no "could not clone", nothing left in $TMPDIR the check moved back below the clone: 10 failed. The call dropped: 10 failed. The REF_NAMED test inverted: 10 failed
test_a_ref_the_doctor_takes_still_clones_once_and_checks_out_once (no ref, main, v1.2.0, release/v1.2.0-rc_1) one clone of https://github.com/acme/x.git, then one checkout --quiet <ref> -- (none with no ref named), and the run reaches the doctor's own "has no shape-doctor.py" the git checkout line dropped: the three named rows fail
test_a_ref_is_refused_where_the_clone_would_have_failed with OPENREPOSHAPE_REPO=/nonexistent/openRepoShape.git, a.lock/b ends in the ref's refusal with no clone asked, and v1.2.0 still ends in "could not clone" after one clone and no checkout the check below the clone, the call dropped, REF_NAMED inverted: each fails it (11 failed with the ten above)
test_a_ref_is_refused_before_a_directory_is_made_for_the_clone (a.lock/b, 256 a, and v1.2.0 as the control) with $TMPDIR a folder that is not there, a refused ref ends in ref_fault's words (exit 2) with git asked nothing, no "could not make a temporary directory" and the folder still not made; a good ref still ends in that refusal, naming the folder as bash spells it (bash_path) checked_ref moved below workdir: 2 failed (the two refused rows); the check below the clone and the base launcher fail them too (13 failed on the file with the rows above)

The ten-ref test no longer clones this checkout: it took 16.2 s for its five cases before (3 s each, a load of about 30; 188 s in the issue's run at a load above 100), and the four groups take 2.5 s for 18 tests.

Not changed

Closes #942

🤖 Generated with Claude Code

Summary by Sourcery

Validate doctor refs before preparing or cloning the standard so invalid values are rejected immediately and consistently.

Bug Fixes:

  • Validate the doctor checkout ref before creating its temporary directory or attempting to clone, preserving the ref-specific refusal even when cloning would fail.

Enhancements:

  • Expand command tests to cover invalid refs, valid ref checkout behavior, clone failures, and temporary-directory ordering.
  • Clarify the Windows workflow checkout comment without changing its full-history setting.

CI:

  • Update the Windows test-job comment to reflect that the test suite no longer clones the workflow checkout.

Tests:

  • Add coverage proving invalid doctor refs trigger no clone or checkout and leave no temporary files.
  • Add coverage ensuring valid refs still perform one clone and checkout, while clone failures retain their original behavior.

…s the standard, so a ref `checked_ref` refuses (`a.lock/b`, `a//b`, one over 255 characters) makes no clone and, where the clone fails, is still refused in its own words, and the test that names the order pins it with a `git` that logs what it is asked (#942)

`shape_checkout` ran `git clone` and then `checked_ref "$REF"`, so a ref the
rule refuses cost a whole clone first, and where the clone failed (offline,
a mirror that is down) the run ended in "could not clone", never naming the
ref. `checked_ref` reads only the value, and nothing between the two lines
needs the clone, so the call now comes first, after `shape_clone_url` and
before `workdir`: `[ "$REF_NAMED" -eq 0 ] || checked_ref "$REF"`. It stays
in `shape_checkout`, not `refuse_bad_values`, whose check of the ref is its
characters only on purpose (`--install` takes `bad..ref` with no opt-in, and
`--doctor` beside a checkout never uses the ref). A refused ref now leaves
no directory in `$TMPDIR` at all. The comment above the function says the
order and why.

`test_a_ref_the_doctor_would_check_out_is_validated` named this order in its
docstring and did not pin it: it passed with the call above or below the
clone, and each of its five cases made a real clone of this checkout. It
runs with a `git` first on `$PATH` that logs what it is asked and fails
every clone, over ten refs (its five, and `a.lock/b`, `a//b`, `a.`, `a/b/`,
`topic.lock`): exit 2 in `ref_fault`'s words for the value, no clone and no
checkout asked of git, nothing left in `$TMPDIR`. Two tests are new: a
good ref (and no ref) still clones once and checks out once, and a bad ref
with `OPENREPOSHAPE_REPO=/nonexistent/...` ends in the ref's refusal, not
"could not clone", while a good ref there still meets the clone's. The
five-ref test no longer clones: seconds, not 188.

Lane: openreposhape-2 (openRepoShape-2)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@brettheap brettheap added this to the v1.2.0 milestone Oct 18, 2026
@sourcery-ai

sourcery-ai Bot commented Oct 18, 2026

Copy link
Copy Markdown

Reviewer's Guide

--doctor now validates $OPENREPOSHAPE_REF before creating a work directory or cloning the standard, preventing invalid refs from incurring clone cost and ensuring their specific refusal remains visible even offline. The tests add command tracing and coverage for invalid, valid, absent, and clone-failure scenarios while preserving existing refusal text and checkout behavior.

File-Level Changes

Change Details Files
Validate the named doctor ref before attempting the standard checkout clone.
  • Move the conditional checked_ref "$REF" call ahead of workdir and shape_checkout's clone path, while preserving the REF_NAMED guard.
  • Keep validation in shape_checkout so it checks ref characters without changing install-time or recorded-ref behavior.
  • Document why validation precedes cloning and retain the existing refusal messages.
openRepoShape
Expand command tests to verify validation ordering, successful-ref behavior, and clone-failure precedence.
  • Add a git stub and helpers that record clone/checkout requests and isolate temporary-directory effects.
  • Cover invalid refs including option-like, malformed, lockfile, trailing-dot/slash, and overlong values; assert refusal before any clone and no temporary artifacts.
  • Confirm valid or absent refs still perform exactly one clone and, when named, one checkout.
  • Verify invalid refs are refused even when cloning would fail, while valid refs still report the clone failure.
tests/test_openreposhape_command.py

Assessment against linked issues

Issue Objective Addressed Explanation
#942 Validate a named $OPENREPOSHAPE_REF with checked_ref before shape_checkout clones, so refused refs cause no clone and are reported as invalid even when the repository cannot be cloned. ✅
#942 Add tests that pin the ordering: refused refs make no clone or checkout, while accepted refs still clone and check out as appropriate; update the test docstring to describe the new order. ✅

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@brettheap

Copy link
Copy Markdown
Contributor Author

(lane openRepoShape-2, 2026-10-18T18:39:41Z) Independent review of #967 (#942) at 3a703d34, for lane openRepoShape-2: READY

Reviewer rv967 (opus), who wrote none of the PR. Its report was stamped 2026-10-18T18:36:29Z. Lane 2 sends the SHOULDs and NITs below to its writer as one fix round, and asks the same reviewer to re-check the new head before the PR leaves DRAFT.

SHOULD 1. openRepoShape:840-841 and tests/test_openreposhape_command.py:1718-1847: no test holds the check above workdir, and none holds the body's "A refused ref now makes no $TMPDIR folder at all".

  • The mutant that survives (R1): swap lines 840 and 841, so checked_ref runs just after workdir openRepoShape-doctor.
    • All 457 tests in tests/test_openreposhape_command.py still pass.
    • The clone count stays 0. The EXIT trap removes the empty folder, so assert list(temporary.iterdir()) == [] holds either way.
  • The mutant behaves differently in practice. Run with $TMPDIR missing and OPENREPOSHAPE_REF=a.lock/b:
    • R1 and the base both end in REFUSED: could not make a temporary directory under /nonexistent-tmp.
    • The head ends in ref_fault's refusal of the ref.
    • That is the issue's third line again, with mktemp where the clone was.
  • Fix: one case.
    • Let doctor_from_stdin take the $TMPDIR it hands the run.
    • Give test_a_ref_is_refused_where_the_clone_would_have_failed a row whose TMPDIR does not exist.
    • Assert: a.lock/b ends in ref_fault's words, the stderr has no "could not make a temporary directory", and git is asked nothing.
    • A scratch test of that shape (refs a.lock/b and 256 a) passed 2 of 2 at 3a703d34. It failed 2 of 2 on R1 and 2 of 2 on the base launcher.
  • The squash message misstates the change. It says "A refused ref now leaves no directory in $TMPDIR at all". That was also true before: the trap removed the clone, and both the issue's table and this PR's probe show $TMPDIR empty before. What changed is that it "makes no directory".

SHOULD 2. .github/workflows/tests.yml:212-215: this PR makes the comment false.

  • The comment says that fetch-depth: 0 is there "because the launcher's suite clones this checkout itself (OPENREPOSHAPE_REPO in test_a_ref_the_doctor_would_check_out_is_validated)". That test now runs a fake git with OPENREPOSHAPE_REPO=acme/x.
  • Measured:
    • At a4de0aae, the only clone of this checkout in the Windows job's three files was tests/test_openreposhape_command.py:1735 ("OPENREPOSHAPE_REPO": bash_path(REPO)).
    • At 3a703d34, none of test_openreposhape_command.py, test_install_sh.py and test_install_sh_filter_repo.py uses REPO except to read files (REPO / <name>).
    • None of the three runs git log, rev-list, describe or a shallow check.
  • Ruling: reword the comment in this PR. This PR made it false, and the fix is three comment lines.

NIT 1. tests/test_openreposhape_command.py:1765: the helper's docstring names a case it does not handle.

  • It says "The over-long and control-character refusals do not echo the value back". The helper has no control-character branch, so such a ref would fail its shape assertion.
  • No such ref reaches shape_checkout anyway. refuse_bad_values refuses it first: with an ESC or U+202E in the ref, the probe shows 0 clones before and after.
  • Suggested wording: "The over-long refusal does not echo the value back; the shape refusal does, having passed the length and character checks."

NIT 2. openRepoShape:887-888: ref_fault's comment undersells the new order.

  • It says "the doctor's checkout is refused before git checkout". That is still true, but the ref is now refused before the clone, which is the stronger statement.
  • Suggested wording: "the doctor's ref is refused before its clone".

Checked and true

  • Every line of openRepoShape: --doctor's shape_checkout runs git clone before checked_ref, so a ref it refuses (a.lock/b, a//b, one over 255 characters) costs a whole clone first, and where the clone fails the ref's refusal is never reached #942 is fixed as the issue asks:
    • the check sits above the clone at openRepoShape:840, and the second call is gone;
    • a refused ref makes no clone;
    • where the clone fails, the ref's own refusal is reached;
    • refuse_bad_values still checks only the ref's characters;
    • the test pins the order, and its docstring says so.
  • The PR's new tests fail on the base launcher, apart from the controls: 11 failed and 4 passed (the 4 good-ref rows).
  • Every path into shape_checkout, probed before and after, 47 rows each.
    • The probe used a logging git that runs /usr/bin/git and refuses :// and scp URLs, plus GIT_SSH_COMMAND=false, GIT_CONFIG_GLOBAL=/dev/null, a dead proxy, the gh stub, GH_TOKEN=bogus and env -i.
    • In 42 of the 47 rows, stderr is byte-identical apart from temp paths. The 5 that differ are the intended changes: offline a.lock/b; offline 256 a; the default https repository with a.lock/b; offline a.lock/b on stdin; and a.lock/b with $TMPDIR missing.
    • No ref named (unset or empty): clone 1 and checkout 0, before and after.
    • No ref the launcher used to take is now refused. main, v1.0.0, feature/x, a 40-hex sha, HEAD and 255 b each give clone 1 and checkout 1, with the same words, before and after.
    • Refused refs (a.lock/b, a//b, a/.b, a/b/, a., topic.lock, -x, --upload-pack=touch …, refs/heads/.., x.lock, a b, a@{1}, café, 256 a):
      • clone 1 before, clone 0 after, with the same refusal;
      • the --upload-pack file was never made.
    • A recorded ref (v1.0.0, also through a symlink):
      • clone 1 and checkout 1, before and after;
      • a bad record is refused by read_recorded_ref's fault with 0 clones, before and after;
      • $OPENREPOSHAPE_REF wins over the record both ways.
    • A script on stdin behaves the same as the installed copy.
    • --doctor beside a checkout runs the doctor with no git call for every ref, before and after.
  • The writer's mutants reproduce exactly: M1 below the clone (11 failed), M2 call dropped (11), M3 REF_NAMED inverted (11), M4 checkout dropped (3).
    • The reviewer's own, killed:
      • checkout -- "$REF" (3 failed);
      • the clone assertion dropped, with M1 applied: 11 failed, because "could not clone" and the refusal's words still catch it;
      • the fake git logging nothing (5 failed);
      • asked_of_git always returning [] (5 failed);
      • the clone always made, with M1 applied (11 failed).
    • Two survivors that behave the same in practice:
      • the REF_NAMED guard dropped: an unnamed ref is always main, which passes;
      • the check keyed on $OPENREPOSHAPE_REF alone: a recorded ref is already held to ref_fault as it is read, in the same process.
  • The logging git is offline and free of the runner's environment. It is /bin/sh with printf and mkdir, and never runs a real git, so the git version cannot change it.
    • The 15 tests still pass with OPENREPOSHAPE_REF, OPENREPOSHAPE_REPO, OPENREPOSHAPE_RECORD_REF, GIT_DIR, GIT_CONFIG_PARAMETERS, LC_ALL=C and TMPDIR set to hostile values in the runner.
  • Sonar's rules:
    • no 4-line window of the added lines repeats in tests/*.py (0 of 119 windows);
    • no composite assert;
    • cognitive complexity is at most 3 in each new helper.
  • Merges: clean with 450279ca, and clean with 2f5cabf5 (current main). On the second, the tree differs from main only in the PR's two files, and 936 tests pass in the six files run (the launcher's, the trio, test_install_sh.py and test_openreposhape_package.py).
  • Docs: no doc states the order. The v1.1.1 note's "refused before the clone" is about setup.sh's --shape-ref (setup-project.py: a passed-through --dry-run makes none of the preflight's offers and --shape-ref is held to git's rule part by part, so a rehearsal no longer writes git's global config and a.lock/b is refused before the clone (#857) #873).

Could not verify

Lane: openreposhape-2 (openRepoShape-2)

…efused `$OPENREPOSHAPE_REF` is held to be refused above `workdir`, so it is named even where `$TMPDIR` is not there; the Windows job's `fetch-depth: 0` comment no longer says a test clones this checkout; two comments say the ref is refused before the clone (#942)

Review round 1 on #967 (rv967's READY, two SHOULDs and two NITs).

SHOULD 1. Nothing held `checked_ref` above `workdir`: swapped below it,
all 457 tests of the file still passed, because the clone count stays 0
and the EXIT trap removes the empty folder. With `$TMPDIR` missing the
swap, like the old code, ends in "could not make a temporary directory"
and never names the ref. `doctor_from_stdin` takes the `$TMPDIR` it hands
the run, and a new test runs `a.lock/b` and 256 `a` against one that does
not exist: exit 2 in `ref_fault`'s words, git asked nothing, no "could not
make a temporary directory", and the folder still not made; a good ref
there still ends in that refusal. It fails on the swap and on the launcher
at `a4de0aae`, and passes at the head. The helper looks for what is in
`$TMPDIR` with `glob`, which a missing folder does not break.

The first commit's message said a refused ref "leaves no directory in
`$TMPDIR` at all", which was true before too: the trap removed the clone.
What changed is that a refused ref makes none.

SHOULD 2. The Windows job's comment said `fetch-depth: 0` was there
because the launcher's suite clones this checkout itself, in the test
this change makes run a fake `git`. None of its three files (the
launcher's, `test_install_sh.py`, `test_install_sh_filter_repo.py`) clones
it or reads its history now. The comment says so, as the ubuntu job has
the setting, and the setting stays: a shallow Windows checkout is a change
of its own and wants a Windows run behind it.

NIT 1. The helper's docstring named a control-character refusal it does
not handle, and none reaches `shape_checkout` (`refuse_bad_values` refuses
it first). NIT 2. `ref_fault`'s comment says the doctor's ref is refused
before its clone, not before `git checkout`.

Lane: openreposhape-2 (openRepoShape-2)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@brettheap

Copy link
Copy Markdown
Contributor Author

(lane openRepoShape-2, 2026-10-18T19:03:31Z) Delta re-check of #967 (#942) at d5d2152c, for lane openRepoShape-2: NOT READY

Reviewer rv967 (opus), the same reviewer as issuecomment-6253648449. Its report was stamped 2026-10-18T18:59:46Z. The re-check covers one new commit on 3a703d34, w942's fix round 1: three files, +43/−12.

Lane 2's notes:

New findings

MUST 1. tests/test_openreposhape_command.py:1876-1877: the good-ref row of the new test fails in the Windows Git Bash job (tests-git-bash), which runs this file.

  • What is wrong: the row expects f"REFUSED: could not make a temporary directory under {missing}.". That puts the native Windows path in the expected text (D:\a\...\not-there).
  • What the launcher prints: $base, which is ${TMPDIR:-/tmp} as bash sees it.
  • Under Git Bash that is /d/a/.../not-there. conftest.bash_path's own docstring (Git Bash on Windows: run the launcher and install.sh tests under Git Bash in the Windows job, so the one-line install is tested there (follow-up to #564) #585) says so: "the spelling Git Bash gives $HOME, $TMPDIR, PATH and pwd".
  • No other test in the file puts a $TMPDIR path in its expected text. The existing tests only check that the folder is empty, and that holds under either spelling.
  • Fix: write under {bash_path(missing)}., as the file already does in expected text elsewhere (for example bash_path(tmp_path) at line 350). On Linux bash_path returns the path unchanged, so nothing changes there.

SHOULD 3. The PR body is stale in three places after the fix round.

  • Line 8 is current. It names the tests.yml comment.
  • Line 42 is stale. It still says "The file went from 447 tests to 457" with two new tests. The file now has 460 tests and three new ones.
  • The tests table lacks the new test. Add its row, with mutant R1 (2 failed).
  • "Not changed" contradicts the commit. Its bullet still says the tests.yml comment is "left for the reviewer to rule on", but this commit changes that comment.
  • Fix: update all three places, and name ref_fault's comment change.
  • The squash message is already right. It says "makes no directory", and it describes the third test and the tests.yml comment.

Earlier findings: all fixed

  • SHOULD 1 (the check above workdir was not held by any test): fixed.
    • test_a_ref_is_refused_before_a_directory_is_made_for_the_clone covers a.lock/b and 256 a. Each ends in the ref's own refusal, git is asked nothing, $TMPDIR is never made, and the stderr has no "could not make a temporary directory".
    • doctor_from_stdin(temporary=) makes nothing when it is handed a path.
    • The helper's temporary.glob("*") handles a missing folder: it returns [], where iterdir would raise. It also still sees dotfiles (measured on Python 3.12), so it loses nothing against iterdir.
    • The squash message now says "makes no directory in $TMPDIR".
  • SHOULD 2 (.github/workflows/tests.yml:212-215): fixed. The comment no longer names the old test, says no test in the three files has cloned this checkout since openRepoShape: --doctor's shape_checkout runs git clone before checked_ref, so a ref it refuses (a.lock/b, a//b, one over 255 characters) costs a whole clone first, and where the clone fails the ref's refusal is never reached #942, and keeps fetch-depth: 0.
  • NIT 1 (tests/test_openreposhape_command.py:1768-1769): fixed, in the suggested words.
  • NIT 2 (openRepoShape:888): fixed. It now reads "the doctor's ref is refused before its clone".

Runs (one pytest process at a time, gh stub first on PATH)

Run Result
tests/test_openreposhape_command.py at d5d2152c 460 passed (457 + the 3 new rows)
R1 (check moved after workdir) on that file killed: 2 failed, 458 passed. The two failures are [a.lock-b] and [a-x256] of the new test; the [a-good-ref] control passes as it should. At 3a703d34, R1 passed all 457.
The trio plus tests/test_release_workflow.py and tests/test_workflow_concurrency.py 221 passed (81 + 23 + 47 + 56 + 14)
tests/test_openreposhape_command.py and tests/test_openreposhape_package.py on the merge with 5f62ea48 638 passed

Merges (git merge-tree --write-tree of d5d2152c)

  • With 2f5cabf5: clean, tree 9f5fa8e6.
  • With 5f62ea48: clean, tree 99fba53c. That commit edits src/openreposhape/standard.py, tests/conftest.py and tests/test_openreposhape_package.py, which is why the reviewer ran the last row above.
  • Both merges differ from their main only in this PR's three files.

Lane: openreposhape-2 (openRepoShape-2)

…`$TMPDIR` test expects the folder as bash spells it, so it passes under Git Bash as well as on Linux (#942)

`test_a_ref_is_refused_before_a_directory_is_made_for_the_clone[a-good-ref]`
expected "could not make a temporary directory under {missing}." with the
native path, and the launcher prints `$TMPDIR` as bash spells it: under
Git Bash `/d/a/.../not-there`, where the native one is `D:\a\...`. The
`tests-git-bash` job failed that one row (1 failed, 337 passed, 410
skipped at d5d2152). The expected text goes through `bash_path`, which
returns the path unchanged off Windows. No other expected text in the
file's new tests holds a native path: the others name a ref, a URL, a
fixed word or a `git` subcommand.

Lane: openreposhape-2 (openRepoShape-2)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@brettheap

Copy link
Copy Markdown
Contributor Author

(lane openRepoShape-2, 2026-10-18T20:25:33Z) Delta re-check of #967 (#942) at 4f83eaf5, for lane openRepoShape-2: READY

Reviewer rv967 (opus), the same reviewer as issuecomment-6253648449 and issuecomment-6253889845. Its report was stamped 2026-10-18T20:24:24Z. This round is one new commit on d5d2152c, w942's fix round 2. It touches only tests/test_openreposhape_command.py, +2/−2.

Findings

  • MUST 1 (tests/test_openreposhape_command.py:1876-1877): fixed.
    • The good-ref row now expects "REFUSED: could not make a temporary directory under " f"{bash_path(missing)}.". That is the spelling the launcher prints $TMPDIR in under Git Bash.
    • On Linux bash_path returns the path unchanged, and the row passes there.
    • CI's tests-git-bash passed at 4f83eaf5, after failing [a-good-ref] at d5d2152c.
  • SHOULD 3 (stale PR body): fixed. The body on GitHub since 20:11:20Z was checked against the three points:
    • Line 44 now says the file "went from 447 tests to 460", with three new tests.
    • The tests table has a row for test_a_ref_is_refused_before_a_directory_is_made_for_the_clone, which names R1 ("checked_ref moved below workdir: 2 failed").
    • "Not changed" no longer says the tests.yml comment is left for the reviewer; it keeps only fetch-depth: 0. Line 8 names both the ref_fault comment and the tests.yml comment.
  • SHOULD 1, SHOULD 2, NIT 1 and NIT 2: fixed at d5d2152c, and unchanged by this commit.
  • No new findings.

Run: tests/test_openreposhape_command.py at 4f83eaf5, one pytest process: 460 passed, in 37.6 s.

Merge: git merge-tree --write-tree of 4f83eaf5 with main 702cc23d is clean, tree aae65036. The merged tree differs from main only in this PR's three files: .github/workflows/tests.yml, openRepoShape and tests/test_openreposhape_command.py.

Lane 2's note: #967 leaves DRAFT once its tests run at 4f83eaf5 is green. It then asks for a turn after #935.

Lane: openreposhape-2 (openRepoShape-2)

@sonarqubecloud

Copy link
Copy Markdown

@brettheap
brettheap marked this pull request as ready for review October 19, 2026 11:57
@sourcery-ai

sourcery-ai Bot commented Oct 19, 2026

Copy link
Copy Markdown

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 12 hours and 5 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@brettheap
brettheap merged commit ae63d45 into main Oct 19, 2026
5 checks passed
@brettheap
brettheap deleted the fix/942-check-ref-before-clone branch October 19, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant