|
26 | 26 | all = Sequential(fix, Parallel(typecheck, coverage)) |
27 | 27 | check = Parallel(format_check, lint, typecheck, test) |
28 | 28 |
|
| 29 | +# Per-cell filesystem isolation. This is a rare workaround, NOT something camas |
| 30 | +# requires — the matrix / cwd / env primitives below are general; we just |
| 31 | +# compose them here to dodge one flaky type-checker. |
| 32 | +# |
| 33 | +# `check` runs five type-checkers, and the matrix fans it across six Python |
| 34 | +# versions in parallel: ~6 `uv sync`s and ~30 checkers pound ONE working tree at |
| 35 | +# once. pyrefly globs `**/*.py*` over the whole tree and intermittently reads a |
| 36 | +# file that a sibling cell's `uv sync` is mid-way through deleting under its |
| 37 | +# `.venv`, dying with "No such file or directory (os error 2)" and flaking CI. |
| 38 | +# That race is pyrefly's, not ours; the fix is simply to stop sharing the tree. |
| 39 | +# |
| 40 | +# So each cell runs in a throwaway `git worktree` — a sibling dir holding only |
| 41 | +# tracked files, with its own `.venv` — and no two cells ever touch the same |
| 42 | +# path. `rm -rf` then `add --force` is idempotent and safe to run concurrently |
| 43 | +# across cells (no `git worktree prune`, which would race a sibling mid-rebuild). |
| 44 | +# Worktrees check out HEAD, so commit locally before running the matrix if you |
| 45 | +# want it to cover your working changes. |
| 46 | +# |
| 47 | +# The dir name has no leading dot on purpose: pyrefly skips hidden directories, |
| 48 | +# so a `.`-prefixed worktree silently matches zero files and "passes" vacuously. |
| 49 | +_worktree = "../camas-matrix/{PY}" |
| 50 | + |
29 | 51 | matrix = Sequential( |
30 | | - Task("uv sync"), |
31 | | - check, |
32 | | - env={"UV_PROJECT_ENVIRONMENT": ".venv-{PY}", "UV_PYTHON": "{PY}"}, |
| 52 | + Task(f"rm -rf {_worktree}"), |
| 53 | + Task(f"git worktree add --force --detach {_worktree} HEAD"), |
| 54 | + Sequential( |
| 55 | + Task("uv sync"), |
| 56 | + check, |
| 57 | + cwd=_worktree, |
| 58 | + env={"UV_PYTHON": "{PY}"}, |
| 59 | + ), |
33 | 60 | matrix={ |
34 | 61 | "PY": tuple( |
35 | 62 | stripped |
|
0 commit comments