You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
onboard: use offload collect for vitest duplicate name verification
Move the vitest duplicate check from Step 2 (manual npx vitest list)
to new Step 5 (after offload.toml creation) using offload collect.
The agent now iterates on offload collect until all duplicate
space-separated test names are resolved.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: skills/offload-onboard/SKILL.md
+29-31Lines changed: 29 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,33 +34,7 @@ Before proceeding, verify the following are installed:
34
34
- For pytest projects: the configured Python runner (`uv`, `poetry`, or `python`) and pytest must be available locally for test discovery
35
35
- For cargo projects: `cargo-nextest` must be installed (`cargo install cargo-nextest`)
36
36
37
-
### Step 2: Check for Duplicate Vitest Test Names
38
-
39
-
**Skip this step if the framework is not `vitest`.**
40
-
41
-
Offload's vitest integration uses `--testNamePattern` to select specific tests for parallel execution. This flag matches tests by their **space-separated** describe/test chain — not by file path. When two tests in different files share the same space-separated name, Offload cannot distinguish them and **will error during discovery**, blocking all test execution.
42
-
43
-
To check for duplicates:
44
-
45
-
1. Run `npx vitest list --json` (or the project's vitest command with `list --json`) and capture the JSON output
46
-
2. For each test entry, take the `name` field (e.g. `"suite > nested > test name"`) and replace all ` > ` with spaces to get the space-separated form (e.g. `"suite nested test name"`)
47
-
3. Collect all space-separated names and check for duplicates
48
-
49
-
If duplicates are found, **stop and present the duplicates to the user**. Explain:
50
-
51
-
> Offload cannot run vitest tests that share the same space-separated name across different files. This is a requirement of Offload's `--testNamePattern`-based test selection — without unique names, Offload will error during test discovery and no tests will run.
52
-
>
53
-
> The following test names (space-separated form) appear in multiple files:
54
-
> -`{duplicate name}` (in `{file1}`, `{file2}`)
55
-
> - ...
56
-
57
-
Then ask: **"Would you like me to deduplicate these test names by making them more descriptive? This typically involves wrapping tests in uniquely named `describe()` blocks or renaming `test()`/`it()` calls to include more context."**
58
-
59
-
If the user agrees, rename the tests to make the space-separated names unique. Prefer wrapping in descriptive `describe()` blocks over renaming individual tests, as this preserves the existing test names while adding disambiguation.
60
-
61
-
If the user declines, **do not proceed with Offload onboarding** — inform them that Offload's vitest integration cannot function with duplicate test names and they will need to resolve this before onboarding can continue.
62
-
63
-
### Step 3: Find or Create a Dockerfile
37
+
### Step 2: Find or Create a Dockerfile
64
38
65
39
Offload's Modal provider needs a Dockerfile to build sandbox images. Look for an existing one:
66
40
@@ -103,7 +77,7 @@ Key principles:
103
77
- Do NOT `COPY . .` — Offload overlays source via `--copy-dir` at image build time
104
78
- Keep it minimal — dependencies are installed at runtime inside the sandbox
105
79
106
-
### Step 4: Create .dockerignore
80
+
### Step 3: Create .dockerignore
107
81
108
82
Create a `.dockerignore` to prevent local artifacts from being copied into sandboxes:
109
83
@@ -125,7 +99,7 @@ node_modules
125
99
**CRITICAL**: `.venv` must be excluded. If a local virtual environment (e.g. macOS binaries) gets copied into a Linux sandbox, tests will fail with "Exec format error". This is the most common onboarding failure.
126
100
**NOTE**: Sometimes tests depend on the git repository, and we will need to include `.git`. Attempt to begin by removing it, and only include it if necessary.
127
101
128
-
### Step 5: Create offload.toml
102
+
### Step 4: Create offload.toml
129
103
130
104
Create `offload.toml` at the project root. Start with these defaults:
131
105
@@ -234,6 +208,30 @@ Configuration reference:
234
208
-`sandbox_project_root`: The path where project files live inside the sandbox, exported as `OFFLOAD_ROOT`
235
209
-`retry_count`: Number of retries for failed tests (0 = no retries, 1 = catches transient failures)
236
210
211
+
### Step 5: Verify Vitest Test Discovery (vitest only)
212
+
213
+
**Skip this step if the framework is not `vitest`.**
214
+
215
+
Offload's vitest integration uses `--testNamePattern` to select specific tests for parallel execution. This flag matches tests by their **space-separated** describe/test chain — not by file path. When two tests in different files share the same space-separated name, Offload cannot distinguish them and **will error during discovery**, blocking all test execution.
216
+
217
+
Run `offload collect` to verify that test discovery works:
218
+
219
+
```bash
220
+
offload collect
221
+
```
222
+
223
+
If Offload reports **"Duplicate test names found (space-separated)"**, stop and present the duplicates to the user. Explain:
224
+
225
+
> Offload cannot run vitest tests that share the same space-separated name across different files. This is a requirement of Offload's `--testNamePattern`-based test selection — without unique names, Offload will error during test discovery and no tests will run.
226
+
227
+
Then ask: **"Would you like me to deduplicate these test names by making them more descriptive? This typically involves wrapping tests in uniquely named `describe()` blocks or renaming `test()`/`it()` calls to include more context."**
228
+
229
+
If the user agrees, rename the tests to make the space-separated names unique. Prefer wrapping in descriptive `describe()` blocks over renaming individual tests, as this preserves the existing test names while adding disambiguation.
230
+
231
+
After making changes, run `offload collect` again. **Repeat until `offload collect` succeeds with no duplicate name errors.**
232
+
233
+
If the user declines deduplication, **do not proceed with Offload onboarding** — inform them that Offload's vitest integration cannot function with duplicate test names and they will need to resolve this before onboarding can continue.
234
+
237
235
### Step 6: Add JUnit ID Normalization (pytest only)
238
236
239
237
**Skip this step if the framework is not `pytest`.**
@@ -243,7 +241,7 @@ By default, pytest's JUnit XML output uses a `classname` + `name` format that ca
243
241
There are two approaches. **Try Approach A first** (preferred). If it fails (e.g., due to pytest version incompatibility or internal API changes), fall back to **Approach B**.
244
242
245
243
1. Identify the root `conftest.py` for the test paths configured in `offload.toml` (e.g., `tests/conftest.py`)
246
-
2. If a `conftest.py` already exists at that location, check whether it already contains `_set_junit_test_id`, `pytest_runtest_setup` modifying JUnit XML, or an equivalent `record_xml_attribute("name", ...)` override. If so, **stop and show the user the existing hook/fixture**. Explain that offload needs the JUnit `name` attribute to match collected test IDs, and ask if they want to replace it with offload's version. If they approve, replace it. If they decline, switch the `[framework]` section in `offload.toml` to `type = "default"` using the fallback pattern from Step 5, wrapping their existing pytest invocation in custom `discover_command` and `run_command` so that offload controls the `--junitxml` flag directly without needing the conftest hook.
244
+
2. If a `conftest.py` already exists at that location, check whether it already contains `_set_junit_test_id`, `pytest_runtest_setup` modifying JUnit XML, or an equivalent `record_xml_attribute("name", ...)` override. If so, **stop and show the user the existing hook/fixture**. Explain that offload needs the JUnit `name` attribute to match collected test IDs, and ask if they want to replace it with offload's version. If they approve, replace it. If they decline, switch the `[framework]` section in `offload.toml` to `type = "default"` using the fallback pattern from Step 4, wrapping their existing pytest invocation in custom `discover_command` and `run_command` so that offload controls the `--junitxml` flag directly without needing the conftest hook.
247
245
3. If no `conftest.py` exists, create one. If one exists, append to it.
248
246
249
247
Offload's parser already handles `name` values containing `::` by using them verbatim.
@@ -378,7 +376,7 @@ offload collect
378
376
This runs test discovery locally without creating sandboxes or executing tests. Fix any errors until `offload collect` succeeds and lists the expected tests. Common issues:
379
377
380
378
1.**"No tests discovered"**: Check that `paths` in `offload.toml` points to the correct test directories and the framework command is correct.
381
-
2.**"Duplicate test names found"** (vitest): Duplicate space-separated test names exist. Return to Step 2 and resolve them.
379
+
2.**"Duplicate test names found"** (vitest): Duplicate space-separated test names exist. Return to Step 5 and resolve them.
382
380
3.**Discovery command failed**: The framework tool (`pytest`, `cargo nextest`, `npx vitest`) is not installed or not on PATH.
383
381
384
382
Do not proceed to execution until `offload collect` lists the expected tests.
0 commit comments