Skip to content

Commit 5f5ce6e

Browse files
authored
ci: warm-up monorepo cache test under npm (#1649)
## Summary - Test-side band-aid for #1638: under npm, `vp run ready` requires three invocations before reaching 100% cache hit. The `Verify cache (monorepo only)` step previously asserted on what was effectively the second run and failed on the `vp create monorepo (npm)` matrix entry. - The preceding `Verify project builds` step already invokes `vp run ready` once (it's the monorepo template's `verify-command` at line 125 of this file), so we add **one** extra warm-up under npm — that lands the assertion on the third invocation, the first to reach 100%. pnpm/yarn/bun keep the original single-run assertion since they already pass. - On assertion failure, dump `vp run --last-details` so per-task cache-miss reasons surface directly in the CI log. ## Why npm only Under npm with full hoisting, `packages/utils/node_modules/` does not exist until run #1 — vitest's deps optimizer + tsdown's temp dir create it. Two distinct vite-task bugs then trip on run #2: 1. Directory-listing fingerprint of `packages/utils/` sees `node_modules` as an added entry. 2. fspy classifies vitest's reads/writes inside `node_modules/.vite/` as a read-write overlap → `CacheNotUpdatedReason::InputModified`, no cache entry written. pnpm/yarn/bun pre-create per-package `node_modules/` during install, so neither bug triggers there. This is the "test-side band-aid" path called out in #1638. The proper vite-task fix (ignore `node_modules` in directory fingerprints + filter `node_modules/.vite{,-temp}/` and `node_modules/.cache/` from fspy tracking) can be filed as a new follow-up issue if/when desired. ## Test plan - [ ] `test-vp-create` matrix: `vp create monorepo (npm)` turns green - [ ] pnpm / yarn / bun monorepo jobs stay green (single-run assertion unchanged) - [ ] On a deliberately-broken cache, the failure log shows `vp run --last-details` output with the per-task cache-miss reasons Closes #1638
1 parent be0d8dc commit 5f5ce6e

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

.github/workflows/test-vp-create.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,10 +322,24 @@ jobs:
322322
if: matrix.template.name == 'monorepo'
323323
working-directory: ${{ runner.temp }}/test-project
324324
run: |
325+
# Under npm, `vp run ready` reaches 100% cache hit only on the
326+
# third invocation (#1638): vite-task's directory-listing
327+
# fingerprint and fspy read/write tracking surface false-positive
328+
# misses on run #2 because `packages/utils/node_modules/` is born
329+
# during run #1. pnpm/yarn/bun pre-create per-package
330+
# `node_modules/` at install time and reach 100% on run #2.
331+
# The preceding `Verify project builds` step already invoked
332+
# `vp run ready` once (verify-command for monorepo), so one
333+
# extra warm-up here is enough under npm.
334+
if [ "${{ matrix.package-manager }}" = "npm" ]; then
335+
vp run ready >/dev/null 2>&1
336+
fi
325337
output=$(vp run ready 2>&1)
326338
echo "$output"
327339
if ! echo "$output" | grep -q 'cache hit (100%)'; then
328-
echo "✗ Expected 100% cache hit on second run"
340+
echo "✗ Expected 100% cache hit"
341+
echo "--- vp run --last-details (cache-miss diagnostics) ---"
342+
vp run --last-details || true
329343
exit 1
330344
fi
331345
echo "✓ 100% cache hit verified"

0 commit comments

Comments
 (0)