Fix stale glob cache causing empty tar archives in CacheStorage#1082
Merged
christiango merged 3 commits intomainfrom Mar 30, 2026
Merged
Fix stale glob cache causing empty tar archives in CacheStorage#1082christiango merged 3 commits intomainfrom
christiango merged 3 commits intomainfrom
Conversation
ecraig12345
approved these changes
Mar 30, 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.
Problem
CacheStorage.put()uploads empty (~1KB) tar archives to Azure Blob cache when a worker thread handles multiple tasks that share the sameoutputGlobandcwd.Root cause:
@lage-run/globbywrapsglobbywith a module-levelMapcache keyed on(patterns, options). This cache never expires. WhenCacheStoragecallsglobAsync(outputGlob, { cwd })and a previous call with the same key already ran (e.g., from an earlier task in the same worker thread), the cached result is returned — even though new files have been written to disk since then.In practice this manifests as:
put()globslib/**→ caches result["lib/a.js"]put()globslib/**→ cache hit returns stale["lib/a.js"](missinglib/b.js)tar-fs.pack(cwd, { entries: staleList })produces an incomplete (or empty) tarFix
globAsyncUncached()andglobUncached()exports to@lage-run/globbythat callglobby/globbySyncdirectly, bypassing the module-level cache.CacheStorage(backfill-cache) to useglobAsyncUncachedin bothgetHashesFor()andput(), since these always need fresh file system reads.The existing cached
globAsync/globexports are left unchanged for callers where caching is beneficial (e.g., target graph resolution).Test
Added
cacheStorageGlobStaleness.test.ts— callsput()twice with the sameoutputGlob + cwdafter writing new files between calls. Fails before fix (secondput()returns stale single-file list), passes after.