Commit 04be48b
committed
Serialize Deno check tasks behind install in
Running `mise run test` was intermittently failing in the install
step with `NotFound: Unable to get CWD` while loading the yaml CJS
package as part of `@fedify/vocab` codegen. Reproduction with
`(deno lint &); deno task install` showed the race is triggered
whenever another Deno process starts concurrently with the
codegen process. Failure rates measured across stable releases:
- Deno 2.6.10: 2/10
- Deno 2.7.7: 3/10
- Deno 2.7.13: 3–5/10
- Deno 2.7.14: 4/10
So neither upgrading nor downgrading Deno avoids it.
The root cause is the well-known race in Deno's
`nodeModulesDir: "auto"`. When multiple Deno processes start at
once they each try to manage `node_modules/.deno/` and the
`node_modules/@fedify/*` workspace symlinks (verified with
`strace`: deno lint unlinks and recreates these symlinks at
startup, and the `.deno.lock.poll` file is also rewritten). Under
that race, the CJS loader for `yaml@2.8.3` can hit a state where
`Deno.cwd()` returns NotFound from inside
`Module._nodeModulePaths`, killing the codegen subprocess. See
the related upstream report:
denoland/deno#33311
Add `wait_for = ["install"]` to the Deno-based `check:*` tasks
(`check:fmt`, `check:lint`, `check:types`, `check-versions`,
`check:fixture-usage`). `wait_for` is mise's optional
dependency: when `install` is already in the queue (as it is via
`prepare` from `test:deno`/`test:node`/`test:bun`), the check
tasks wait for it to complete before starting their own Deno
processes; when `install` is not queued (e.g. running `mise run
check` on its own), the tasks proceed immediately. Empty Deno
runs left alone (`check:md`, `check:manifest:workspace-protocol`)
are unaffected.
With this change the previously flaky reproducer succeeded 10/10
times under the same parallel load.
Assisted-by: Claude Code:claude-opus-4-7mise test
1 parent 880d1e5 commit 04be48b
1 file changed
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| 60 | + | |
59 | 61 | | |
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
| 65 | + | |
63 | 66 | | |
64 | 67 | | |
65 | 68 | | |
| |||
69 | 72 | | |
70 | 73 | | |
71 | 74 | | |
| 75 | + | |
72 | 76 | | |
73 | 77 | | |
74 | 78 | | |
| |||
79 | 83 | | |
80 | 84 | | |
81 | 85 | | |
| 86 | + | |
82 | 87 | | |
83 | 88 | | |
84 | 89 | | |
| |||
0 commit comments