test(scenario): disable automatic git maintenance - #324
Merged
reuben olinsky (reubeno) merged 1 commit intoAug 26, 2026
Merged
Conversation
Dynamic scenario repositories are copied into containers immediately after they are created. Automatic Git maintenance can create a transient maintenance.lock while AddDirRecursive snapshots the repository, then remove it before the container copy opens the file. Repository maintenance is artificial for these short-lived test fixtures, so disable it to eliminate the race and keep scenario setup deterministic. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 229a102b-9849-43cd-a78a-88775ac9cc47
Contributor
There was a problem hiding this comment.
Pull request overview
This PR makes scenario test repositories deterministic by disabling Git’s automatic maintenance in dynamically generated fixture repos, eliminating a race where transient .git/objects/maintenance.lock files can appear during container copy.
Changes:
- Add
git config maintenance.auto falseduring scenario repo initialization to prevent auto-maintenance from creating transient lock files. - Document the motivation inline near the git setup commands to clarify the race being avoided.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
reuben olinsky (reubeno)
approved these changes
Aug 26, 2026
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.
Summary
.git/objects/maintenance.lockfiles from racing with the recursive container copyWhy
Dynamic scenario repositories are copied into containers immediately after creation. Automatic maintenance can create a transient lock while
AddDirRecursivesnapshots the repository and remove it before testcontainers opens the registered file. Repository maintenance is artificial for these short-lived fixtures, so disabling it removes the race without affecting the behavior under test.Validation
mage fix allscenariopackage, includingTestRenderWithPatchSidecar, passed undermage scenarioAlreadyExistsrace