fix: include dotfiles in cache output glob matching#1074
Merged
christiango merged 3 commits intomainfrom Mar 26, 2026
Merged
Conversation
dannyvv
approved these changes
Mar 26, 2026
christiango
added a commit
that referenced
this pull request
Mar 27, 2026
This reverts commit 4718b38.
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.
Related previous PRs: https://github.com/microsoft/backfill/pull/551/changes
Problem
Dotfiles and dotfolders (e.g.
.vite/,.next/,.env) in build output directories are silently dropped when lage caches task outputs. A fresh build produces these files correctly, but restoring from cache omits them entirely.This happens because the glob calls that collect output files for caching use the default
dot: falseoption fromglobby/fast-glob. Patterns likereleaseDeployment/**/*ordist/**/*don't match paths containing dot-prefixed segments (e.g.releaseDeployment/public/.vite/manifest.json).Root Cause
Three glob call sites were missing
dot: true:CacheStorage.put()— the glob that matchesoutputGlobpatterns to determine which files to store in cachegetHashesFor()— the glob used by incremental caching to enumerate all files for hash comparisongetOutputFiles()— the server-mode function that collects output files for the cache-aware runnerLocalCacheStorage._fetch()already useddot: truewhen reading files back from cach, but since dotfiles were never stored, there was nothing to restore.Fix
Add
dot: trueto all three glob call sites:packages/backfill-cache/src/CacheStorage.tsgetHashesFor(){ cwd, dot: true }packages/backfill-cache/src/CacheStorage.tsput(){ cwd: this.cwd, dot: true }packages/cli/src/commands/server/getOutputFiles.tsgetOutputFiles(){ cwd: target.cwd, gitignore: false, dot: true }Tests
Added 4 new tests across 2 test files — all fail before the fix and pass after:
cacheStorage.test.ts (unit):
caches dotfiles in subdirectories matched by outputGlob— verifiesdist/**/*matches.vite/manifest.jsoninsidedist/public/caches dotfiles when outputGlob uses **/*— verifies**/*matches.envat root levelLocalCacheStorage.test.ts (round-trip put/fetch):
will cache and restore dotfiles inside output directories— full cycle withdist/.vite/manifest.jsonwill cache and restore dotfiles when using releaseDeployment/**/*— full cycle matching the exact pattern used by consumers like LoopHow It Was Found
In an internal repo Vite build produces
.vite/manifest.jsoninsidereleaseDeployment/public/. After running vite the file exists in the right place. But deletingreleaseDeployment/and re-runningyarn bundle --to bebop(which restores from lage cache) produces output missing the.vite/directory. This causes downstream issues since the manifest is needed at runtime.