Repository navigation
fix(cache): resolve .. before checking that a tracked path is in the workspace - #940
Merged
Merged
Conversation
…` isn't cached A case for a task that writes outside the workspace through a relative path with `..`, like `cp -r dist ../site` publishing a build next to the workspace. In `write_outside_workspace_through_dotdot`, the task makes `../site` and writes `../site/index.html` through `vtt fs`; `..` is the folder holding the staged workspace, which the harness removes. Today fspy reports the write as `<workspace>/../site/index.html`. That passes the check that a tracked path is in the workspace and becomes the output `../site/index.html`, so every run fails to update the cache with `paths in archives must not have ..`. The case runs on Unix only for now. On Windows, `..` is resolved before fspy reports the path, so the write is outside the workspace and the task is already cached there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…workspace On Unix, fspy reports a relative path as the working directory joined with it, `..` included, so a task that writes `../site/index.html` from the workspace root, like `cp -r dist ../site`, is tracked as writing `<workspace>/../site/index.html`. vt stripped the workspace root from that path before resolving `..`, so it passed as `../site/index.html`, and with automatic output tracking, archiving it failed the run with `Cache update failed: paths in archives must not have ..`. A file read that way became an input outside the workspace. vt now resolves `.` and `..` lexically, as before, but before stripping the workspace root, so such a path is outside the workspace and skipped like any other. A path that stays inside, like `packages/sub-pkg/../shared/dist/output.js`, is still `packages/shared/dist/output.js`, and one that leaves the workspace and comes back, like `<workspace>/../<workspace folder>/a`, is now `a`. `vt_path` gets `clean_and_strip_path_prefix`, which fspy's `IpcPath` offers next to `strip_path_prefix`. `write_outside_workspace_through_dotdot` now runs on Windows too. There `..` is resolved before fspy sees the path, so the task was cached already, and the case now has the same result on every platform. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
wan9chi
force-pushed
the
fix/cache-dotdot-paths
branch
from
November 5, 2026 08:53
5c87b9e to
827bef8
Compare
fspy benchmarklinuxmacoswindows |
wan9chi
added a commit
that referenced
this pull request
Nov 5, 2026
## Motivation Follow-ups to the rebuildable-inputs stack (#913–#919, #940, #941), now merged: - The real-world case for files renamed into place (#916) used Vitest's `fsModuleCache`, which renames cache entries rather than outputs. - #919's e2e cases test a listing entry like any other, so they add no coverage of their own. - The stack added eight changelog entries, most of them for what users see as one feature. - Socket flagged Astro 6.4.8, which #917 added for its real-world case: critical advisory GHSA-26w7-cxv4-gfx2 (remote code execution through AVIF image optimization), fixed in Astro 7.2.8. ## Changes - New case `next_build_moved_pages`: Next.js 15's `next build` renders each static page (`index.html`, `404.html`, `500.html`) into `.next/export` and renames it into `.next/server/pages`. After `.next` is removed, the next run is a cache hit that restores the pages. The build log is redacted, since its progress lines, sizes and chunk hashes vary. It replaces `vitest_fs_module_cache`, along with the SHA-1 redaction only that case used. `next`, `react` and `react-dom` join `packages/tools`. - `dist_appears_in_listed_folder` and `oxlint_dist` are removed. - The changelog entries of #913–#918 are combined into one **Added** item for rebuildable inputs; #919 (`dist` in listings) and #941 (input exclusions apply to listings) stay their own short items, and so does #940's fix. - On Windows CI, the e2e harness stages fixtures in `RUNNER_TEMP`, on the checkout's drive: the staged workspaces resolve `node_modules` into the checkout, and Next.js builds its client entry from a path relative to the project, which can't cross drives. - Astro 6.4.8 → 7.3.8, the newest release that still supports the repo's Node 22.19. Astro 7 needs upstream Vite 8, so its scoped override now points at Vite 8.3.2. `astro_empty_collections` passes unchanged; its comment now says Astro 7 stats the project root rather than listing it. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Test harness, changelog, and dependency catalog changes only; no changes to task caching or file-tracking behavior in this diff. > > **Overview** > Follow-up after the rebuildable-inputs stack lands: **no runtime cache logic changes**—mostly release notes, snapshot tests, and toolchain bumps. > > The **changelog** folds the former #913–#918 narrative into one **Added** “rebuildable inputs” entry and shortens the #919 / #941 **Changed** bullets; #940 stays separate. > > **E2E snapshots** swap coverage: **`next_build_moved_pages`** (Next.js 15 renaming `.next/export` → `.next/server/pages`, cache hit after deleting `.next`) replaces **`vitest_fs_module_cache`**; **`dist_appears_in_listed_folder`** and **`oxlint_dist`** are dropped as redundant with listing behavior elsewhere. Snapshot **redaction** drops SHA-1 normalization (Vitest-only). On **Windows CI**, fixtures stage under **`RUNNER_TEMP`** so Next’s client entry paths stay on the checkout drive. > > **Deps**: catalog adds **Next 15**, **React 19**, bumps **Astro 6 → 7.3.8** (security advisory), and scopes **`astro>vite`** to upstream **Vite 8.3.2**. The Astro empty-collections fixture comment reflects Astro 7 **stat**-ing the project root instead of listing it. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 4c8f40c. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
Motivation
On Linux and macOS, a task that writes outside the workspace through a relative path with
.., likecp -r dist ../sitepublishing a build next to the repo, fails with✗ Cache update failed: paths in archives must not have ... fspy reports a relative open as the working directory joined with the path,..included, so the write is<workspace>/../site/index.html. vt stripped the workspace root before resolving.., so the path passed the check that it's in the workspace and became the output../site/index.html, which the archive rejects. A file read that way became an input outside the workspace, unlike the same file read through an absolute path.Changes
Tracked paths have
.and..resolved lexically, as before, but before the workspace root is stripped, so such a path is outside the workspace and dropped like any other. A path that stays inside, likepackages/sub-pkg/../shared/dist/output.js, is stillpackages/shared/dist/output.js.vt_pathgetsclean_and_strip_path_prefix, and fspy'sIpcPatha method of the same name next tostrip_path_prefix, which is unchanged. Windows resolves..before fspy sees the path, so it wasn't affected. A unit test covers the order, and the malformed Windows drive path that the cleaning after the strip used to catch.E2E case:
write_outside_workspace_through_dotdot(synthetic,vtt fs mkdir ../site write ../site/index.html hi, where..is the harness's folder holding the staged workspace). Both runs fail today; after, the first is cached and the second hits. The first commit runs it on Unix only, since Windows already caches it.A standalone fix for main. The stack that lets automatic tracking cache tasks which read their own outputs and list the folders holding them, so they also hit on a clean checkout, sits on it and no longer checks for
..itself.🤖 Generated with Claude Code
Note
Medium Risk
Changes how automatic file-access tracking classifies workspace inputs/outputs, which directly affects cache keys and archive contents; behavior is covered by new unit and e2e tests but touches core caching logic.
Overview
On Linux and macOS, cached tasks that write outside the repo via relative paths like
../site(e.g.cp -r dist ../site) no longer fail withCache update failed: paths in archives must not have ... The second run can cache hit instead.Tracked path normalization now lexically resolves
.and..before stripping the workspace root, so paths such as<workspace>/../site/index.htmlare treated as outside the workspace and dropped from inputs/outputs (same as absolute paths outside the repo). In-workspace paths likepackages/sub-pkg/../shared/dist/output.jsstill normalize topackages/shared/dist/output.js.Adds
vt_path::clean_and_strip_path_prefixandIpcPath::clean_and_strip_path_prefix, wired throughtracked_workspace_path; the old strip-then-clean()flow is removed. Unit tests cover ordering and the Windows malformed-path case; an e2e fixture asserts a../sitedeploy task caches on repeat run.Reviewed by Cursor Bugbot for commit 827bef8. Bugbot is set up for automated code reviews on this repo. Configure here.