Repository navigation
Fix flaky ignore overlay tests from shared artifact dir - #6854
Merged
Merged
Conversation
Every Processor in a process shared $TMPDIR/toolhive/overlays/thvignore-<pid> as its artifact directory, yet Cleanup removes that directory as if it owned it. When one processor cleaned up between another's MkdirAll and MkdirTemp, the MkdirTemp failed, the error was logged at debug level, and the directory overlay was silently dropped. This made TestGetOverlayPaths flaky in CI and would leave an ignored directory unmasked if it happened outside tests. Add a per-process sequence number to the workload ID so each processor owns a distinct directory, and add a concurrent stress test that reproduces the dropped overlay on the old code. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6854 +/- ##
==========================================
- Coverage 79.73% 79.72% -0.01%
==========================================
Files 819 819
Lines 83667 83667
==========================================
- Hits 66711 66707 -4
- Misses 16951 16955 +4
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
3 of 10 tasks
devin-ai-integration Bot
pushed a commit
to jstar0/toolhive
that referenced
this pull request
Nov 23, 2026
Address review feedback: rebase on main so the per-processor artifact directory from stacklok#6854 is used, extend TestGetOverlayMountsConfinedToMount with wildcard directory cases (file skip, symlink inside and outside the mount, pattern beyond the mount), and drop the standalone test.
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
TestGetOverlayPathsfailed intermittently in CI (run) with the.sshdirectory overlay missing while the.envfile overlay was present.Why: every
ignore.Processorin a process used the same artifact directory,$TMPDIR/toolhive/overlays/thvignore-<pid>, butCleanup()removes that directory as if the processor owned it. When a parallel test'sCleanup()ran between another processor'sMkdirAll(artifactDir)andMkdirTemp(artifactDir, "dir-*"), theMkdirTempfailed with ENOENT.createOverlayMountlogs that at debug level and returns nil, so the directory overlay was silently dropped. File overlays useos.CreateTemp("")instead, which is why only directory overlays were affected.What:
thvignore-<pid>-<n>), so each processor owns its own artifact directory andCleanup()only removes storage it created.TestGetOverlayMountsConcurrentCleanup, which runs 16 goroutines that each create, use, and clean up processors against the same source tree. Before the fix it dropped the overlay hundreds of times per run; with the fix it passes.Type of change
Test plan
go test -race -count=50 ./pkg/ignore/...passes; the new test fails on the old code (416 dropped overlays across-count=5)./pkg/ignore/..., 0 issues$TMPDIR/toolhive/overlaysafter the test runsDoes this introduce a user-facing change?
No. Overlay artifact directories for ignored paths are now nested under
thvignore-<pid>-<n>instead ofthvignore-<pid>; nothing outsidepkg/ignorereferences that path.Special notes for reviewers
pkg/container/docker/client.go) creates one processor per mount and never callsCleanup(), so the race is not reachable there today. The fix is in the code rather than the test because a dropped overlay fails open, leaving an ignored directory such as.sshvisible in the container.dir-*subdirectories, so the added cost is one directory per processor.🤖 Generated with Claude Code