Skip to content

fix(core): validate native file cache size before applying it#33683

Merged
AgentEnder merged 3 commits intomasterfrom
fix/validate-native-file-cache
Jan 9, 2026
Merged

fix(core): validate native file cache size before applying it#33683
AgentEnder merged 3 commits intomasterfrom
fix/validate-native-file-cache

Conversation

@AgentEnder
Copy link
Member

@AgentEnder AgentEnder commented Dec 2, 2025

Current Behavior

We dont validate the size of the native file cache after copying it, which sometimes fails and corrupts the data. This failure results in a different size, so we can detect it. In certain situations, the corruption causes node to hang instead of throw.

Expected Behavior

We detect the corruption

Related Issue(s)

Fixes #30653
Fixes #31300

@vercel
Copy link

vercel bot commented Dec 2, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
nx-dev Ready Ready Preview Jan 9, 2026 11:05pm

@netlify
Copy link

netlify bot commented Dec 2, 2025

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit 5779b5f
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/6961886ae0e8ca0008de93ea
😎 Deploy Preview https://deploy-preview-33683--nx-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@nx-cloud
Copy link
Contributor

nx-cloud bot commented Dec 2, 2025

View your CI Pipeline Execution ↗ for commit 5779b5f

Command Status Duration Result
nx affected --targets=lint,test,test-kt,build,e... ✅ Succeeded 16m 2s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 2m 52s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 11s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-01-09 23:21:18 UTC

Comment on lines +133 to +135
if (attempt < maxRetries) {
// Will retry
continue;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the continue

// Then rename to the final location
renameSync(tmpTmpFile, tmpFile);
// Retry copying up to 3 times, validating after each copy
const maxRetries = 3;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this to the module level

- Validate file size after copying to detect corruption
- Retry up to 3 times if validation fails
- Fall back to loading from original location if all retries fail
- Clean up malformed temp files between retries

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@AgentEnder AgentEnder force-pushed the fix/validate-native-file-cache branch from 4076afb to e0c30a3 Compare January 9, 2026 22:34
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
@AgentEnder AgentEnder merged commit 42a8a44 into master Jan 9, 2026
20 checks passed
@AgentEnder AgentEnder deleted the fix/validate-native-file-cache branch January 9, 2026 23:29
FrozenPandaz pushed a commit that referenced this pull request Jan 14, 2026
## Current Behavior
We dont validate the size of the native file cache after copying it,
which sometimes fails and corrupts the data. This failure results in a
different size, so we can detect it. In certain situations, the
corruption causes node to hang instead of throw.

## Expected Behavior
We detect the corruption

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #30653
Fixes #31300

(cherry picked from commit 42a8a44)
@github-actions
Copy link
Contributor

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

21.1.1 postinstall hangs on Windows 11 Failures with nx postinstall script in CI

2 participants