From 9226b864eb807a0ccd8dcc40db25f711991ff0e3 Mon Sep 17 00:00:00 2001 From: wan9chi Date: Mon, 9 Nov 2026 20:00:18 +0800 Subject: [PATCH] test(run): fix the order of remote requests in unknown_after_remote_hit `dry_run_json::unknown_after_remote_hit` failed on main's macOS CI and on #984's Windows job. Its first step ran `vt run after-emit`, which runs `emit` first. Once `emit` finishes, its upload starts in the background at the same time as `after-emit`'s fetch, and the e2e proxy logs each request when its response finishes. So the backend log read `fetch, store, fetch, store` as often as the expected `fetch, fetch, store, store`. `VP_RUN_INTERNAL_HIDE_PENDING_UPLOADS` hides the upload's progress, but doesn't delay it. Each dependency now runs in its own step first: `vt run emit`, then `vt run after-emit`, and `vt run build` before `vt run after-build`. Each step then makes at most one fetch followed by one upload. The dry runs that the case checks are unchanged. Co-Authored-By: Claude Opus 5.5 --- .../fixtures/dry_run_json/snapshots.toml | 36 ++++++++++++++++++- .../snapshots/unknown_after_remote_hit.md | 36 ++++++++++++++----- 2 files changed, 63 insertions(+), 9 deletions(-) diff --git a/crates/vt_bin/tests/e2e_snapshots/fixtures/dry_run_json/snapshots.toml b/crates/vt_bin/tests/e2e_snapshots/fixtures/dry_run_json/snapshots.toml index 465d5fcec..19a5b0bab 100644 --- a/crates/vt_bin/tests/e2e_snapshots/fixtures/dry_run_json/snapshots.toml +++ b/crates/vt_bin/tests/e2e_snapshots/fixtures/dry_run_json/snapshots.toml @@ -285,6 +285,23 @@ steps = [ "remote-cache-server", "start", ], + { argv = [ + "remote-cache-server", + "run", + "--github-actions", + "vt", + "run", + "emit", + ], envs = [ + [ + "VP_REMOTE_CACHE", + "read-write", + ], + [ + "VP_RUN_INTERNAL_HIDE_PENDING_UPLOADS", + "1", + ], + ], comment = "`emit` runs first, on its own, so its upload doesn't overlap `after-emit`'s fetch." }, { argv = [ "remote-cache-server", "run", @@ -302,6 +319,23 @@ steps = [ "1", ], ] }, + { argv = [ + "remote-cache-server", + "run", + "--github-actions", + "vt", + "run", + "build", + ], envs = [ + [ + "VP_REMOTE_CACHE", + "read-write", + ], + [ + "VP_RUN_INTERNAL_HIDE_PENDING_UPLOADS", + "1", + ], + ], comment = "`build` runs first, on its own, so its upload doesn't overlap `after-build`'s fetch." }, { argv = [ "remote-cache-server", "run", @@ -318,7 +352,7 @@ steps = [ "VP_RUN_INTERNAL_HIDE_PENDING_UPLOADS", "1", ], - ], comment = "`after-build` runs the same command as `after-emit`, so that step hits the entry the first run stored." }, + ], comment = "`after-build` runs the same command as `after-emit`, so that step hits the entry `after-emit`'s run stored, and nothing is fetched." }, [ "vt", "cache", diff --git a/crates/vt_bin/tests/e2e_snapshots/fixtures/dry_run_json/snapshots/unknown_after_remote_hit.md b/crates/vt_bin/tests/e2e_snapshots/fixtures/dry_run_json/snapshots/unknown_after_remote_hit.md index fac7c4d20..c99dfdd2e 100644 --- a/crates/vt_bin/tests/e2e_snapshots/fixtures/dry_run_json/snapshots/unknown_after_remote_hit.md +++ b/crates/vt_bin/tests/e2e_snapshots/fixtures/dry_run_json/snapshots/unknown_after_remote_hit.md @@ -7,28 +7,50 @@ As after a local hit, the steps after a remote hit are `unknown` only if it rest ``` ``` -## `VP_REMOTE_CACHE=read-write VP_RUN_INTERNAL_HIDE_PENDING_UPLOADS=1 remote-cache-server run --github-actions vt run after-emit` +## `VP_REMOTE_CACHE=read-write VP_RUN_INTERNAL_HIDE_PENDING_UPLOADS=1 remote-cache-server run --github-actions vt run emit` + +`emit` runs first, on its own, so its upload doesn't overlap `after-emit`'s fetch. ``` $ vtt write-file dist/out.txt built +[remote-cache] POST /fetch 404 +[remote-cache] POST /store 200 +``` + +## `VP_REMOTE_CACHE=read-write VP_RUN_INTERNAL_HIDE_PENDING_UPLOADS=1 remote-cache-server run --github-actions vt run after-emit` + +``` +$ vtt write-file dist/out.txt built ◉ cache hit, replaying + $ vtt print checked checked --- -vt run: 0/2 cache hit (0%), 2/2 successful. (Run `vt run --last-details` for full details) -[remote-cache] POST /fetch 404 +vt run: 1/2 cache hit (50%), 2/2 successful. (Run `vt run --last-details` for full details) [remote-cache] POST /fetch 404 [remote-cache] POST /store 200 +``` + +## `VP_REMOTE_CACHE=read-write VP_RUN_INTERNAL_HIDE_PENDING_UPLOADS=1 remote-cache-server run --github-actions vt run build` + +`build` runs first, on its own, so its upload doesn't overlap `after-build`'s fetch. + +``` +$ vtt print-file a.txt b.txt +a +b + +[remote-cache] POST /fetch 404 [remote-cache] POST /store 200 ``` ## `VP_REMOTE_CACHE=read-write VP_RUN_INTERNAL_HIDE_PENDING_UPLOADS=1 remote-cache-server run --github-actions vt run after-build` -`after-build` runs the same command as `after-emit`, so that step hits the entry the first run stored. +`after-build` runs the same command as `after-emit`, so that step hits the entry `after-emit`'s run stored, and nothing is fetched. ``` -$ vtt print-file a.txt b.txt +$ vtt print-file a.txt b.txt ◉ cache hit, replaying a b @@ -36,9 +58,7 @@ $ vtt print checked ◉ cache hit, replaying checked --- -vt run: 1/2 cache hit (50%), 2/2 successful. (Run `vt run --last-details` for full details) -[remote-cache] POST /fetch 404 -[remote-cache] POST /store 200 +vt run: 2/2 cache hit (100%), 2/2 successful. (Run `vt run --last-details` for full details) ``` ## `vt cache clean`