module: do not split a portable compile cache by uid - #65293
Open
codebytere wants to merge 1 commit into
Open
Conversation
A portable compile cache is meant to be reused wherever the same module layout is found, which includes being generated once (at build time, say) and shipped read-only with an application for whoever runs it. On platforms with uids the cache subdirectory is suffixed with the uid of the user who created it, so such a cache is only ever found by that one user. Omit the suffix in portable mode: a user who cannot write to the directory still reads it, and a failed write is only a cache miss.
Collaborator
|
Review requested:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #65293 +/- ##
==========================================
- Coverage 90.32% 90.31% -0.01%
==========================================
Files 751 751
Lines 249960 250031 +71
Branches 47204 47247 +43
==========================================
+ Hits 225774 225823 +49
- Misses 15564 15593 +29
+ Partials 8622 8615 -7
🚀 New features to boost your workflow:
|
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.
A portable compile cache is meant to be reused wherever the same module layout is found. One shape of that is a cache generated once, at build time, and shipped read-only with an application for whoever runs it. On platforms with uids the cache subdirectory is suffixed with the uid of the user who created it (
$NODE_VERSION-$ARCH-$CACHE_DATA_VERSION_TAG-$UID), so such a cache is only ever found by that one user; the split exists so users sharing a writable directory do not trip over each other's file permissions.This omits the uid suffix in portable mode only. A user who cannot write to the directory still reads it, and a failed write is only a cache miss (
Persistalready logs and skips a temp file it cannot create). Non-portable caches keep the suffix.Docs updated for
portableandNODE_COMPILE_CACHE_PORTABLE;test-compile-cache-api-portablenow asserts the tag directory name.Context: an Electron application generating its main-process cache at package time and shipping it beside its
app.asar(module.enableCompileCache({ directory, portable: true })at launch); measured on that app, the shipped cache roughly halves the launch bundle's load time, but with the uid in the tag it is only found by users whose uid matches the build machine's.