Skip to content

Commit b33983e

Browse files
claudebranchseer
authored andcommitted
test: add plan cases to existing cache fixtures to verify resolved cache
The task graph now stores per-task cache config without applying the global kill switch. Add plan test cases to verify cache is correctly resolved to null at plan time when the global config disables caching. Updated fixtures (commands changed from echo to print-file to produce Spawn nodes with visible cache_metadata in plan snapshots): - cache-tasks-disabled: verify tasks/scripts not cached with cache.tasks: false - cache-scripts-default: verify scripts not cached by default - cache-scripts-task-override: verify tasks cached, scripts not cached by default - cache-true-no-force-enable: verify per-task cache: false respected with cache: true https://claude.ai/code/session_01AYbt3E5j8Adk9NB7Sprkah
1 parent 3faa872 commit b33983e

25 files changed

Lines changed: 754 additions & 22 deletions
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@test/cache-scripts-default",
33
"scripts": {
4-
"build": "echo building",
5-
"test": "echo testing"
4+
"build": "print-file package.json",
5+
"test": "print-file package.json"
66
}
77
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Verifies default behavior: scripts are not cached without explicit cache.scripts
2+
3+
# Script should not be cached by default
4+
[[plan]]
5+
name = "script not cached by default"
6+
args = ["run", "build"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
source: crates/vite_task_plan/tests/plan_snapshots/main.rs
3+
expression: "&plan_json"
4+
info:
5+
args:
6+
- run
7+
- build
8+
input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-default
9+
---
10+
[
11+
{
12+
"key": [
13+
"<workspace>/",
14+
"build"
15+
],
16+
"node": {
17+
"task_display": {
18+
"package_name": "@test/cache-scripts-default",
19+
"task_name": "build",
20+
"package_path": "<workspace>/"
21+
},
22+
"items": [
23+
{
24+
"execution_item_display": {
25+
"task_display": {
26+
"package_name": "@test/cache-scripts-default",
27+
"task_name": "build",
28+
"package_path": "<workspace>/"
29+
},
30+
"command": "print-file package.json",
31+
"and_item_index": null,
32+
"cwd": "<workspace>/"
33+
},
34+
"kind": {
35+
"Leaf": {
36+
"Spawn": {
37+
"cache_metadata": null,
38+
"spawn_command": {
39+
"program_path": "<tools>/node_modules/.bin/print-file",
40+
"args": [
41+
"package.json"
42+
],
43+
"all_envs": {
44+
"NO_COLOR": "1",
45+
"PATH": "<workspace>/node_modules/.bin:<tools>/node_modules/.bin"
46+
},
47+
"cwd": "<workspace>/"
48+
}
49+
}
50+
}
51+
}
52+
}
53+
]
54+
},
55+
"neighbors": []
56+
}
57+
]

crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-default/snapshots/task graph.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-de
1616
"package_path": "<workspace>/"
1717
},
1818
"resolved_config": {
19-
"command": "echo building",
19+
"command": "print-file package.json",
2020
"resolved_options": {
2121
"cwd": "<workspace>/",
2222
"cache_config": {
@@ -45,7 +45,7 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-de
4545
"package_path": "<workspace>/"
4646
},
4747
"resolved_config": {
48-
"command": "echo testing",
48+
"command": "print-file package.json",
4949
"resolved_options": {
5050
"cwd": "<workspace>/",
5151
"cache_config": {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@test/cache-scripts-task-override",
33
"scripts": {
4-
"build": "echo building",
5-
"test": "echo testing"
4+
"build": "print-file package.json",
5+
"test": "print-file package.json"
66
}
77
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Verifies default cache behavior: tasks cached, scripts not cached
2+
3+
# Task should be cached (tasks default to true)
4+
[[plan]]
5+
name = "task cached by default"
6+
args = ["run", "build"]
7+
8+
# Task with explicit command should be cached
9+
[[plan]]
10+
name = "task with command cached by default"
11+
args = ["run", "deploy"]
12+
13+
# Script not wrapped by a task should not be cached
14+
[[plan]]
15+
name = "script not cached by default"
16+
args = ["run", "test"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
source: crates/vite_task_plan/tests/plan_snapshots/main.rs
3+
expression: "&plan_json"
4+
info:
5+
args:
6+
- run
7+
- test
8+
input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-task-override
9+
---
10+
[
11+
{
12+
"key": [
13+
"<workspace>/",
14+
"test"
15+
],
16+
"node": {
17+
"task_display": {
18+
"package_name": "@test/cache-scripts-task-override",
19+
"task_name": "test",
20+
"package_path": "<workspace>/"
21+
},
22+
"items": [
23+
{
24+
"execution_item_display": {
25+
"task_display": {
26+
"package_name": "@test/cache-scripts-task-override",
27+
"task_name": "test",
28+
"package_path": "<workspace>/"
29+
},
30+
"command": "print-file package.json",
31+
"and_item_index": null,
32+
"cwd": "<workspace>/"
33+
},
34+
"kind": {
35+
"Leaf": {
36+
"Spawn": {
37+
"cache_metadata": null,
38+
"spawn_command": {
39+
"program_path": "<tools>/node_modules/.bin/print-file",
40+
"args": [
41+
"package.json"
42+
],
43+
"all_envs": {
44+
"NO_COLOR": "1",
45+
"PATH": "<workspace>/node_modules/.bin:<tools>/node_modules/.bin"
46+
},
47+
"cwd": "<workspace>/"
48+
}
49+
}
50+
}
51+
}
52+
}
53+
]
54+
},
55+
"neighbors": []
56+
}
57+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
source: crates/vite_task_plan/tests/plan_snapshots/main.rs
3+
expression: "&plan_json"
4+
info:
5+
args:
6+
- run
7+
- build
8+
input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-task-override
9+
---
10+
[
11+
{
12+
"key": [
13+
"<workspace>/",
14+
"build"
15+
],
16+
"node": {
17+
"task_display": {
18+
"package_name": "@test/cache-scripts-task-override",
19+
"task_name": "build",
20+
"package_path": "<workspace>/"
21+
},
22+
"items": [
23+
{
24+
"execution_item_display": {
25+
"task_display": {
26+
"package_name": "@test/cache-scripts-task-override",
27+
"task_name": "build",
28+
"package_path": "<workspace>/"
29+
},
30+
"command": "print-file package.json",
31+
"and_item_index": null,
32+
"cwd": "<workspace>/"
33+
},
34+
"kind": {
35+
"Leaf": {
36+
"Spawn": {
37+
"cache_metadata": {
38+
"spawn_fingerprint": {
39+
"cwd": "",
40+
"program_fingerprint": {
41+
"OutsideWorkspace": {
42+
"program_name": "print-file"
43+
}
44+
},
45+
"args": [
46+
"package.json"
47+
],
48+
"env_fingerprints": {
49+
"fingerprinted_envs": {},
50+
"pass_through_env_config": [
51+
"<default pass-through envs>"
52+
]
53+
},
54+
"fingerprint_ignores": null
55+
},
56+
"execution_cache_key": {
57+
"UserTask": {
58+
"task_name": "build",
59+
"and_item_index": 0,
60+
"extra_args": [],
61+
"package_path": ""
62+
}
63+
}
64+
},
65+
"spawn_command": {
66+
"program_path": "<tools>/node_modules/.bin/print-file",
67+
"args": [
68+
"package.json"
69+
],
70+
"all_envs": {
71+
"NO_COLOR": "1",
72+
"PATH": "<workspace>/node_modules/.bin:<tools>/node_modules/.bin"
73+
},
74+
"cwd": "<workspace>/"
75+
}
76+
}
77+
}
78+
}
79+
}
80+
]
81+
},
82+
"neighbors": []
83+
}
84+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
source: crates/vite_task_plan/tests/plan_snapshots/main.rs
3+
expression: "&plan_json"
4+
info:
5+
args:
6+
- run
7+
- deploy
8+
input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-task-override
9+
---
10+
[
11+
{
12+
"key": [
13+
"<workspace>/",
14+
"deploy"
15+
],
16+
"node": {
17+
"task_display": {
18+
"package_name": "@test/cache-scripts-task-override",
19+
"task_name": "deploy",
20+
"package_path": "<workspace>/"
21+
},
22+
"items": [
23+
{
24+
"execution_item_display": {
25+
"task_display": {
26+
"package_name": "@test/cache-scripts-task-override",
27+
"task_name": "deploy",
28+
"package_path": "<workspace>/"
29+
},
30+
"command": "print-file package.json",
31+
"and_item_index": null,
32+
"cwd": "<workspace>/"
33+
},
34+
"kind": {
35+
"Leaf": {
36+
"Spawn": {
37+
"cache_metadata": {
38+
"spawn_fingerprint": {
39+
"cwd": "",
40+
"program_fingerprint": {
41+
"OutsideWorkspace": {
42+
"program_name": "print-file"
43+
}
44+
},
45+
"args": [
46+
"package.json"
47+
],
48+
"env_fingerprints": {
49+
"fingerprinted_envs": {},
50+
"pass_through_env_config": [
51+
"<default pass-through envs>"
52+
]
53+
},
54+
"fingerprint_ignores": null
55+
},
56+
"execution_cache_key": {
57+
"UserTask": {
58+
"task_name": "deploy",
59+
"and_item_index": 0,
60+
"extra_args": [],
61+
"package_path": ""
62+
}
63+
}
64+
},
65+
"spawn_command": {
66+
"program_path": "<tools>/node_modules/.bin/print-file",
67+
"args": [
68+
"package.json"
69+
],
70+
"all_envs": {
71+
"NO_COLOR": "1",
72+
"PATH": "<workspace>/node_modules/.bin:<tools>/node_modules/.bin"
73+
},
74+
"cwd": "<workspace>/"
75+
}
76+
}
77+
}
78+
}
79+
}
80+
]
81+
},
82+
"neighbors": []
83+
}
84+
]

crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-task-override/snapshots/task graph.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-ta
1616
"package_path": "<workspace>/"
1717
},
1818
"resolved_config": {
19-
"command": "echo building",
19+
"command": "print-file package.json",
2020
"resolved_options": {
2121
"cwd": "<workspace>/",
2222
"cache_config": {
@@ -45,7 +45,7 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-ta
4545
"package_path": "<workspace>/"
4646
},
4747
"resolved_config": {
48-
"command": "echo deploying",
48+
"command": "print-file package.json",
4949
"resolved_options": {
5050
"cwd": "<workspace>/",
5151
"cache_config": {
@@ -74,7 +74,7 @@ input_file: crates/vite_task_plan/tests/plan_snapshots/fixtures/cache-scripts-ta
7474
"package_path": "<workspace>/"
7575
},
7676
"resolved_config": {
77-
"command": "echo testing",
77+
"command": "print-file package.json",
7878
"resolved_options": {
7979
"cwd": "<workspace>/",
8080
"cache_config": {

0 commit comments

Comments
 (0)