Skip to content

test(project): keep the #1634 scratch repositories' clones off auto-maintenance (#1906) - #1926

Merged
JarryShaw merged 1 commit into
mainfrom
test/1906-scratch-clone-race
Oct 19, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
test/1906-scratch-clone-race

Conversation

@JarryShaw

Copy link
Copy Markdown
Owner

A push to a local path starts receive-pack with GIT_CONFIG_COUNT stripped, so the #1644 maintenance settings never reached origin.git. Its auto-maintenance could then repack while checkout() cloned locally, and the clone failed with ENOENT (git 2.55, builtin/clone.c copy_or_link_directory).

ScratchRepository.setUp now writes a GIT_CONFIG_GLOBAL file before any git command runs. It sets maintenance.auto=false, maintenance.autoDetach=false, gc.auto=0, gc.autoDetach=false and receive.autogc=false, and it replaces the per-class GIT_CONFIG_COUNT overrides.

A new test runs under every subclass and uses GIT_TRACE2_EVENT to assert that no maintenance or gc process starts. It fails without the fix. Under a forced repack on every push, runs went from failing to clean on 2.55.0.

Closes #1906

…aintenance (#1906)

- A push to a local path strips GIT_CONFIG_* from receive-pack's environment,
  so the GIT_CONFIG_COUNT settings two classes applied never reached origin.
  receive-pack there started a detached `git maintenance run --auto`, whose
  git 2.55 geometric repack deleted loose objects while checkout()'s local
  clone copied them ("failed to copy file to ...: No such file or directory").
- ScratchRepository.setUp now points GIT_CONFIG_GLOBAL at a file turning off
  maintenance.auto, gc.auto, both autoDetach switches and receive.autogc,
  before its first git command, so every subclass and every receive-pack
  inherits it; the per-class GIT_CONFIG_COUNT updates are gone.
- test_no_git_here_starts_automatic_maintenance runs under each subclass's
  setUp and asserts from a trace2 log that a commit, pushes and checkout()
  start no maintenance or gc in any repository.

Closes #1906
@JarryShaw JarryShaw added review: running A cross-review is in flight against the current head - no verdict yet test Pull requests that add or correct tests (test: subject prefix) labels Oct 19, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

GOOD TO GO at 474ee695b. A Sonnet cross-review checked the git v2.55.0 source. local_repo_env strips GIT_CONFIG_COUNT from the local push's receive-pack, but not GIT_CONFIG_GLOBAL, and receive.autogc defaults on. On 2.47.3 it confirmed that the old setup still started maintenance run --auto --detach. The new trace2 test fails on every subclass without the fix, asserts that the trace reached receive-pack, and passes with the fix; the file has 85 tests and all pass. The race itself was not reproduced locally, since the local git is 2.47.3. Main's 3.13 re-run of 95caa8b36 passed.

@JarryShaw JarryShaw added review: good-to-go Cross-review at the current head says ready; CI state is separate and removed review: running A cross-review is in flight against the current head - no verdict yet labels Oct 19, 2026
@JarryShaw JarryShaw moved this to In review in PyPCAPKit Oct 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Coverage: 90.07% (unit tier, Python 3.15, 474ee695b, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 2 20 2 96.77%
pcapkit/const 19595 881 2618 867 92.11%
pcapkit/corekit 2504 70 792 36 96.54%
pcapkit/dumpkit 276 3 100 3 98.40%
pcapkit/foundation 2916 164 1016 34 93.59%
pcapkit/interface 138 7 52 5 93.68%
pcapkit/protocols 17411 224 4580 189 98.10%
pcapkit/toolkit 872 177 298 8 77.18%
pcapkit/utilities 522 2 158 4 99.12%
pcapkit/vendor 4431 2341 1018 156 43.64%

Per-file detail: the coverage-html artifact of this run.

@JarryShaw

Copy link
Copy Markdown
Owner Author

Further evidence for this fix. #1929's Python 3.15 leg (job 117914902574) hit #1906 again, in TestTheCountsAreOfTheReleasedTiers. This time the clone failed on fatal: failed to copy file to '.../work/.git/objects/maintenance.lock': No such file or directory. That lock file belongs to the auto-maintenance the local push started on origin.git, which is the mechanism this PR switches off. I re-ran the failed jobs on #1929, and its own diff touches no test infrastructure.

@JarryShaw
JarryShaw merged commit c0c88c6 into main Oct 19, 2026
59 checks passed
@JarryShaw
JarryShaw deleted the test/1906-scratch-clone-race branch October 19, 2026 14:53
@github-project-automation github-project-automation Bot moved this from In review to Done in PyPCAPKit Oct 19, 2026
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test Pull requests that add or correct tests (test: subject prefix)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

test(project): the #1634 scratch repository's local clone can lose a loose object mid-copy

1 participant