Commit 9c10127
committed
fix(mutmut): switch container to :ro repo mount + tmpfs scratch dir
v1.1 item B from the 2026-05-18 pre-release sweep — closes the
host-tree-corruption hazard that nearly shipped a live mutation
to git on 2026-05-18 (caught at stage time).
## Problem
Prior layout: -v "$REPO_ROOT:/work" (read-write bind mount).
Every mutation mutmut applied was a real write to the HOST
filesystem under /c/Users/PC/wl_manager/. When mutmut died
between mutate-and-restore (SIGKILL, container stop, host reboot),
the source file stayed in mutated state and `git diff` showed it
as a normal edit. The 2026-05-18 session caught a live
`_csv_file_hash → None` mutation about to be staged in Phase 2 —
would have silently broken CSV-hash bootstrapping if missed.
## Fix
Two-mount layout:
/repo — host repo, READ-ONLY (`:ro` bind mount).
mutmut cannot write here at all.
/scratch — tmpfs (in-RAM, 512 MiB cap). Populated from /repo
at container creation via 'cp -a /repo/. /scratch/'.
mutmut runs with WORKDIR=/scratch and mutates the
tmpfs copy. Host /repo is untouchable.
Helper functions added to scripts/mutmut.sh:
- populate_scratch() — copies /repo into /scratch as root
- scratch_is_empty() — detects tmpfs wipe after container
stop/start cycles, triggers re-populate
Source-refresh semantics: 'scripts/mutmut.sh kill' then re-run.
The fresh container repopulates /scratch from current /repo. The
tmpfs is intentionally not refreshed on every 'run' invocation —
that would invalidate mutmut's incremental cache (keyed on source
file timestamps) and lose the cross-run speedup.
## Verification
Verified end-to-end:
1. Mount inspect: /c/Users/PC/wl_manager -> /repo, rw=false
2. Tmpfs config: {"/scratch":"size=536870912"} (512 MiB cap)
3. /scratch/bin/ contains the wl_*.py module copies
4. Deliberate write attempt to /repo/bin/wl_validation.py:
'Read-only file system' (exit non-zero)
5. Host file sha256 unchanged after fresh container creation
(pre and post both c8553865...)
6. pytest tests/unit/test_validation.py inside /scratch:
33 passed (+1 vs host because Linux symlink test runs;
Windows host skips it)
## Doc update
docs/MUTATION_TESTING.md "Recommended improvements" marks item 2
(volume mount switch) CLOSED with the verification evidence above.
Open list renumbers 2->1, 3->2, 4->3 (markdownlint ordered-list
rule).
doc-drift: OK (33 docs against build 660).1 parent d40304d commit 9c10127
2 files changed
Lines changed: 90 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
213 | 222 | | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
| 223 | + | |
221 | 224 | | |
222 | | - | |
| 225 | + | |
223 | 226 | | |
224 | 227 | | |
225 | 228 | | |
226 | | - | |
| 229 | + | |
227 | 230 | | |
228 | 231 | | |
229 | 232 | | |
230 | | - | |
| 233 | + | |
231 | 234 | | |
232 | 235 | | |
233 | 236 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
55 | 84 | | |
56 | 85 | | |
57 | 86 | | |
| |||
199 | 228 | | |
200 | 229 | | |
201 | 230 | | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
202 | 260 | | |
203 | 261 | | |
204 | 262 | | |
205 | 263 | | |
206 | 264 | | |
207 | 265 | | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
208 | 271 | | |
209 | 272 | | |
210 | 273 | | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
211 | 280 | | |
212 | | - | |
213 | | - | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
214 | 284 | | |
215 | 285 | | |
216 | 286 | | |
217 | 287 | | |
218 | 288 | | |
219 | 289 | | |
220 | 290 | | |
| 291 | + | |
| 292 | + | |
221 | 293 | | |
222 | 294 | | |
223 | 295 | | |
| |||
228 | 300 | | |
229 | 301 | | |
230 | 302 | | |
| 303 | + | |
| 304 | + | |
231 | 305 | | |
232 | 306 | | |
233 | 307 | | |
| |||
0 commit comments