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
Copy file name to clipboardExpand all lines: .github/CACHE_CONTRACT.md
+129-5Lines changed: 129 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,7 @@ from three independent sources: a pinned CUDA container image, a pinned
37
37
| Invalidates when | container image or Python version changes (prefix change → new slot) |
38
38
| Does **not** invalidate on |`uv.lock`, `pyproject.toml`, or kernel source changes (each compiler handles its own source-hash invalidation internally) |
39
39
| Restore semantics |**fail-open**; missing cache only costs compilation time, never correctness |
40
-
| Save semantics | nightly `testmon` job only, via delete-before-save; PR workflows restore but never save |
40
+
| Save semantics | nightly `testmon` job only, via the `replace-cache` action; PR workflows restore but never save |
41
41
42
42
The JIT compilation cache bundles all JIT compiler artifact directories
43
43
under a single umbrella path. Each compiler writes to a subdirectory
@@ -57,6 +57,128 @@ old ones.
57
57
To add a new JIT backend: create a subdirectory under `$JIT_CACHE_DIR`,
58
58
set the backend's cache-path env var in the test step, done.
| Invalidates when | prefix is bumped (essentially never, by design) |
69
+
| Does **not** invalidate on |`uv.lock` or `pyproject.toml` changes -- testmon detects changed dependency hashes itself and re-runs only the affected tests |
70
+
| Restore semantics |**fail-open**; a miss only costs full-suite runtime, never correctness, and testmon handles stale DBs gracefully |
71
+
| Save semantics | nightly `testmon` job only, via the `replace-cache` action with `if: always()` so partial DBs from flaky runs still publish |
72
+
73
+
Historical note: the key was previously suffixed with
74
+
`hashFiles('uv.lock', 'pyproject.toml')`. Because GitHub Actions
75
+
caches are immutable, two consecutive nightlies with an unchanged
76
+
lockfile (the common case) collided on the same key, and the second
77
+
save logged `Failed to save: Unable to reserve cache` only as a
78
+
*warning*. The stale DB persisted for days, PRs restored it via the
79
+
prefix fallback, and testmon then invalidated everything because the
80
+
realized environment had drifted away from what the cached DB
81
+
recorded. Switching to a `-latest` mutable slot via `replace-cache`
82
+
fixes the save bug, and the embedded verify step turns any future
83
+
silent save failure into a hard job failure.
84
+
85
+
#### Why a separate `ci-requirements.lock`
86
+
87
+
The cache fix above only addresses *saving* the DB; the DB is still
88
+
worthless to PRs if testmon's environment fingerprint at PR time
89
+
differs from the fingerprint stored at nightly time. Testmon
90
+
computes that fingerprint from `importlib.metadata.distributions()`
91
+
over the active venv -- i.e. *everything* in
92
+
`.venv/lib/python3.12/site-packages`, not just the lockfile-pinned
93
+
closure.
94
+
95
+
`setup-uv-env` builds the venv in two layered steps:
96
+
97
+
1.`uv sync --frozen --group dev --extra <EXTRAS_TAG>` -- deterministic
0 commit comments