Repository navigation
fix: flush cache writes before tap removes the fixture dir [ci full-matrix] - #1897
Merged
Merged
Conversation
…atrix] RegistryClient.request() hands each response to cache.set(), which writes to disk in the background. Subtests that fetch and return without awaiting cache.promise() race @tapjs/fixture's cleanup: rimraf (native fs.rm, no retries) readdirs the dir, a write lands, and the final rmdir throws ENOTEMPTY. tap reports it as "error thrown in teardown" and rethrows onto the parent test, which is where the duplicated subtests further down the log come from. The slow disks on the arm64 macOS runners make the interleaving common: Test - macOS has failed every release PR run since #1876 landed, 2 of the last 5 pushes to main, and Ubuntu once, each time on a different subtest. tap runs EOF hooks in registration order, so a flush only runs before the cleanup if it is hooked before t.testdir(). A t.teardown() added after t.testdir(), and a parent t.afterEach(), both run once the dir is already gone; registry-client's afterEach flush was not protecting anything. - package-info: the ?stable block's client(t) helper and capabilities' client() hook the flush before t.testdir(), covering every subtest - registry-client: the afterEach flush moves into a teardown hooked before t.testdir() in beforeEach; revalidate-entry gets the explicit await the neighbouring tests already have Co-authored-by: Ruy Adorno <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01W7bVD3WnCopm6LTiLqQMff
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
| Project | vltpkg |
| Branch | fix/flush-cache-before-fixture-cleanup |
| Testbed | ubuntu-latest |
🚨 1 Alert
| Benchmark | Measure Units | View | Benchmark Result (Result Δ%) | Upper Boundary (Limit %) |
|---|---|---|---|---|
| vlt install: vue & lockfile | Latency seconds (s) | 📈 plot 🚷 threshold 🚨 alert (🔔) | 4.17 s(+12.32%)Baseline: 3.72 s | 4.09 s (102.11%) |
Click to view all benchmark results
| Benchmark | Latency | Benchmark Result milliseconds (ms) (Result Δ%) | Upper Boundary milliseconds (ms) (Limit %) |
|---|---|---|---|
| vlt install: vue & cache-lockfile | 📈 view plot 🚷 view threshold | 1,221.38 ms(-10.39%)Baseline: 1,362.99 ms | 1,499.29 ms (81.46%) |
| vlt install: vue & cache-lockfile-node-modules | 📈 view plot 🚷 view threshold | 302.55 ms(-13.41%)Baseline: 349.41 ms | 384.35 ms (78.72%) |
| vlt install: vue & clean | 📈 view plot 🚷 view threshold | 11,293.10 ms(+5.14%)Baseline: 10,741.21 ms | 11,815.33 ms (95.58%) |
| vlt install: vue & lockfile | 📈 view plot 🚷 view threshold 🚨 view alert (🔔) | 4,172.80 ms(+12.32%)Baseline: 3,715.13 ms | 4,086.64 ms (102.11%) |
ruyadorno
approved these changes
Sep 24, 2026
This branch was successfully deployed
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.
What
Test - macOS - 22.xhas been red on everyreleasePR run since Sep 23 (#1894 is the fifth in a row) and on 2 of the last 5 pushes tomain, always with the same shape:A different subtest loses the race each time — 7 distinct ones so far across
package-info/test/{index,capabilities}.tsandregistry-client/test/{index,revalidate-entry}.ts, once on Ubuntu too. It is not a macOS regression and not the release bump:releaseismain+ version strings, and the passingmainrun and the failing #1894 run had the same runner image (macos-26-arm6420260907.0351.1), Node 22.23.3, vlt and lockfile.Why
RegistryClient.request()hands the response tocache.set(), which writes to disk in the background (mkdir→writeFile tmp→rename, tracked inCache#pending;cache.promise()awaits it). The subtest returns without flushing,@tapjs/fixture's cleanup runsrimraf(dir)— nativefs.rmwithmaxRetries: 0— and when a write lands between itsreaddirand the finalrmdir, thermdirthrowsENOTEMPTY. tap rethrows EOF-hook errors onto the parent test, which is where the duplicated subtests and off-by-NmovingRequestsassertions further down the log come from. The slow disks on the arm64 macOS runners just make the interleaving common.#1593 fixed the same thing in the integrity tests in April. #1876 added ~10 subtests that each
client(t)→ fetch → return without flushing, and never ran on macOS before merging (macOS is excluded from the matrix on ordinary PRs).The non-obvious part
Checked against the repo's tap (
@tapjs/core4.5.9,@tapjs/fixture/@tapjs/after/@tapjs/after-each4.3.11): botht.testdir()andt.teardown()wrapt.onEOFby calling the previous hook first, so hooks run in registration order. At.teardown()added aftert.testdir()runs after the dir is already gone, and so does a parentt.afterEach(). That is whyregistry-client/test/index.ts'safterEachflush ("always wait for the cache to resolve before trying to clean up") was not protecting anything — itsforceRevalidate bypasses fresh cache entrieshit the sameENOTEMPTYon the v1.1.1 release PR on Sep 20.Changes
package-info/test/index.ts— the?stableblock'sclient(t)helper hooks the flush beforet.testdir(), covering all of its subtests at once.package-info/test/capabilities.ts— same helper shape;client()now takes the test. The shared-cache test flushes its second client explicitly.registry-client/test/index.ts— theafterEachflush moves into at.teardown()hooked beforet.testdir()inbeforeEach, so it actually runs first.registry-client/test/revalidate-entry.ts— explicitawait rc.cache.promise()in the one test there that didn't have it.[ci full-matrix]in the title so macOS runs on this PR.Verified
tapforpackage-info(291/291) andregistry-client(843/843),tsc --noEmit, eslint and prettier on the touched files — on Linux.testdir()→ dir already removed; teardown beforetestdir()→ dir still present; parentafterEach→ dir already removed.Evidence — macOS job on code that includes #1876
ENOTEMPTYrevalidate-entry.ts› re-requests the representation it was givencapabilities.ts› reset clears the settled document toomacOS:
main3 ✓ / 2 ✗,release0 ✓ / 5 ✗. Unblocks #1894 —release.ymlre-cuts the release branch on the next push tomain.