Repository navigation
fix(test): skip .git in placeholder scans to dodge background repack - #1816
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes the intermittent
FileNotFoundErroron a.git/objects/path in the placeholder-scan integration tests. Seen on PR #1812, run 37247340361.Root cause (full RCA in #1815 comment):
install.shscaffold commit spawns a detachedgit maintenance run --auto.geometricstrategy, that job sometimes repacks and deletes every loose object ~200–400 ms after the commit, depending on content.rglob("*")walks into.git/objects/.Type of Change
feat-- New featurefix-- Bug fixdocs-- Documentation onlychore-- Maintenance task (deps, config, etc.)refactor-- Code restructuring (no behavior change)test-- Adding or updating testsci-- CI/CD pipeline changesbuild-- Build system or dependency changesrevert-- Reverts a previous commitstyle-- Code style (formatting, whitespace)Modifiers
!) -- This change breaks backward compatibilityChanges Made
tests/conftest.py: newscaffold_files(root, excluded_dirs=())returns a sorted list of the workspace's regular files and skips.git/. Git internals never hold a placeholder, and the materialized list means no caller iterates a live walk.tests/test_install_script.py:test_install_replaces_placeholdernow uses the helper.test_install_replaces_org_name_placeholderis deleted; it duplicated the parametrized{{ORG_NAME}}case, and it was the test that failed.tests/test_integration.py:test_placeholders_replacednow uses the helper (keeping its.pre-commit-cache/.ruff_cacheexclusions). Its workspace also gets commits, so it was exposed to the same race.tests/test_scaffold_files.py: unit tests for the helper. They run in Project Tests, so the guard does not depend on the image-backed jobs.install.shis unchanged. The background repack is correct for real consumer repos.Changelog Entry
No changelog needed: test-only change with no user-visible impact.
Testing
just test)Manual Testing Details
tests/test_scaffold_files.pycommitted RED first (ImportError), then GREEN (2 passed).uv run pytest tests/test_install_script.py tests/test_integration.py::TestPlaceholdersagainst the local:devimage: 19 passed.objects/17/goes from 162 loose / 0 packs to 0 loose / 1 pack within 400 ms. The race itself is nondeterministic, so it has no deterministic red test; the helper's.gitexclusion is the regression guard.just precommit(full suite): green.Checklist
docs/templates/, then runjust docs)CHANGELOG.mdin the[Unreleased]section (and pasted the entry above)Additional Notes
Not done: disabling maintenance in the fixtures (
-c maintenance.auto=false). Skipping.gitalready removes the race, and the fixtures keep real-install behaviour.Refs: #1815