Relationships
#3694 extension_source_add_test globs the real home directory and flakes when a file in ~ disappears mid-walk
Opened by stack72 · 10/21/2026· Shipped 10/21/2026
What happens
src/cli/commands/extension_source_add_test.ts ("extension source add --only: behaviors is persisted as models", swamp-club#3410) failed once in verify-build while verifying swamp-club#3686:
NotFound: No such file or directory (os error 2): stat '~/.claude.json.lock'
at expandGlob (@std/fs expand_glob.ts)
at expandSourcePaths (src/infrastructure/persistence/swamp_sources_repository.ts:121)
at resolveExtensionKindsForSource (src/infrastructure/persistence/swamp_sources_repository.ts:516)The rerun on the same commit passed, and the file passes 5 of 5 locally.
Why
The test adds the unexpanded source ~/swamp-source-add-test-*. resolveExtensionKindsForSource expands that glob against the real home directory, so the walk stats every entry in ~. Any file another process creates and deletes mid-walk (here Claude Code's ~/.claude.json.lock) fails the test. This also breaks the AGENTS.md rule that tests stay out of the real HOME.
Expected
The test points the glob at a path under its temp directory (or mocks HOME through the repo's home-dir seam), so it never reads the real home directory.
Shipped
Click a lifecycle step above to view its details.
Sign in to post a ripple.