Skip to content

Prevent mutation of paths array in cacheHttpClient#17

Merged
abhijit-hota merged 2 commits into
WarpBuilds:mainfrom
jkelleyrtp:patch-1
Apr 28, 2026
Merged

Prevent mutation of paths array in cacheHttpClient#17
abhijit-hota merged 2 commits into
WarpBuilds:mainfrom
jkelleyrtp:patch-1

Conversation

@jkelleyrtp
Copy link
Copy Markdown

@jkelleyrtp jkelleyrtp commented Apr 10, 2026

This PR adjust the getCacheVersion in the internal warp-cache by preventing mutation of the paths array by using slice() to create a copy.

I discovered this bug while adding warpbuild support to nix-community/cache-nix-action#321

This is important because restoreCacheV2 passes the paths array by reference, and the current impl is modifying that paths array, breaking cache paths on disk, breaking caching altogether when called from other SDKs

Prevent mutation of the paths array by using slice() to create a copy.
@DSharifi
Copy link
Copy Markdown

@abhijit-hota or @darshanime is this something you could review and get merged?

Comment thread packages/warp-cache/src/internal/cacheHttpClient.ts Outdated
@abhijit-hota
Copy link
Copy Markdown
Member

@DSharifi @jkelleyrtp thank you for the fix here! (and sorry for the delay)

i just see a very minor typo in the comment.

@DSharifi
Copy link
Copy Markdown

@DSharifi @jkelleyrtp thank you for the fix here! (and sorry for the delay)

i just see a very minor typo in the comment.

Thanks, hopefully the suggestion can just be applied. This is currently blocking us, https://github.com/near/mpc, from using the warp cache with nix.

Copy link
Copy Markdown
Member

@abhijit-hota abhijit-hota left a comment

Choose a reason for hiding this comment

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

LGTM, thanks again!

@abhijit-hota abhijit-hota merged commit e1ad744 into WarpBuilds:main Apr 28, 2026
7 of 14 checks passed
@abhijit-hota
Copy link
Copy Markdown
Member

Will be releasing this in the next hour or two.

@abhijit-hota
Copy link
Copy Markdown
Member

abhijit-hota commented Apr 28, 2026

We've released the fix in v1.4.11.

@jkelleyrtp @DSharifi Can you please check again if the issue persists?

DSharifi added a commit to DSharifi/cache-nix-action that referenced this pull request Apr 28, 2026
Adds a `warpbuild` option to the `backend` input, vendored as a
submodule from WarpBuilds/toolkit at v1.4.11 (which includes the
upstream paths-mutation fix from WarpBuilds/toolkit#17).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@DSharifi
Copy link
Copy Markdown

DSharifi commented Apr 29, 2026

@abhijit-hota It's working well now. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants