Repository navigation
Commit 3caf4db
committed
test(file-safety,fileLock): carry the four pinned rows from PR 1914 across to this re-port
The reviewer verified these fixes on PR 1914 and then said, on threads 4525470987, 4525471078 and
4525471113, that this PR still contains the original test and the inline extractor at
src/utils/fileLock.ts:82, and asked that the change be brought here if this PR proceeds. It does
proceed, so the change comes here.
The four paths are carried as the same blobs as commit
28129e1 on PR 1914: git hash-object of each staged file equals the
blob id recorded in that commit (7d16823 fileLock.ts, ceb1388 fileLock.spec.ts,
f5725de fileLock.canonicalKey.spec.ts, 68fc6e6 safeWriteText.spec.ts). That is deliberate:
if PR 1914 merges first, the later rebase of this branch onto it drops this copy with no content
change, because both sides hold byte-identical blobs for the same paths. No reader has to infer that
from the diff.
What lands, with line numbers taken from the blobs this commit records:
- src/utils/fileLock.ts:5 imports getErrorCode from src/utils/errorCode.ts and line 83 calls it, so the
inline extractor at the old line 82 is gone and three counted executable lines come off the diff.
The two copies differed only on a non-string code property, and the sole use compares against the
string literals "ENOENT" and "ENOTDIR", so behaviour is unchanged.
- src/utils/__tests__/fileLock.spec.ts:171-172 pin the cycle walk exactly - the lock lands on the
lexical second member and the walk spends 64 link hops - instead of asserting toBeLessThanOrEqual(64).
- src/services/file-safety/__tests__/safeWriteText.spec.ts:367-395 rename and re-comment the post-commit
backup cleanup case to say what makes it pass, a retried unlink, and count the attempts with
expect(backupUnlinks).toHaveLength(2). The same file also carries the failure-path pin at line 1613.
- src/utils/__tests__/fileLock.canonicalKey.spec.ts:71 pins the deliberate divergence - an ancestor
realpath failure with EACCES rejects resolveLockKey but not the lock - and the BigIntStats cast fix
for the lstat double arrives with the same blob.
Verification, all of it in worktree wt-r164-2383 at node v22.23.4 (the version in .nvmrc) on a
frozen-lockfile install of this tree's own pnpm-lock.yaml (37.9 s, husky installed by its prepare):
- vitest run of the six affected specs (fileLock.spec, fileLock.canonicalKey.spec, fileLock.test,
safeWriteText.spec, safeWriteJson.test, safeWriteJson.interruption.test): exit 0, 6 files passed,
139 tests passed. The kill evidence for these rows lives with PR 1914, where each mutant was run in
the same content: frame budget 8 to 9 killed 1 of 7, hop budget not carried killed 1 of 7, the retry
narrowed from two attempts to one killed 3 of 74, the skipped unlink killed 4 of 74, and swallowing
the canonicalDirKey rethrow killed 1 of 3.
- eslint --prune-suppressions --max-warnings=0 on each of the four touched files exits 0 with no
output, and none of the four has an entry in src/eslint-suppressions.json, so each count is 0 before
and 0 after; summed over that file the counts read 2,868 before and 2,868 after across 265 file keys.
The prune run rewrote the JSON from tab indent to two-space indent (30,910 B to 33,294 B, 0 semantic
count diffs) and that churn was reverted, so this commit carries only the four paths.
- no --no-verify, no HUSKY=0, no git add -A, no changeset and no CHANGELOG change, and no label change.1 parent 1f656e3 commit 3caf4db
4 files changed
Lines changed: 96 additions & 14 deletions
File tree
- src
- services/file-safety/__tests__
- utils
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
364 | 364 | | |
365 | 365 | | |
366 | 366 | | |
367 | | - | |
| 367 | + | |
368 | 368 | | |
369 | 369 | | |
370 | 370 | | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
375 | 385 | | |
376 | 386 | | |
377 | 387 | | |
378 | 388 | | |
379 | 389 | | |
380 | 390 | | |
381 | 391 | | |
382 | | - | |
| 392 | + | |
| 393 | + | |
383 | 394 | | |
| 395 | + | |
384 | 396 | | |
385 | 397 | | |
386 | 398 | | |
| |||
1598 | 1610 | | |
1599 | 1611 | | |
1600 | 1612 | | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
| 1640 | + | |
| 1641 | + | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
1601 | 1654 | | |
1602 | 1655 | | |
1603 | 1656 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
37 | 41 | | |
38 | 42 | | |
39 | 43 | | |
| |||
64 | 68 | | |
65 | 69 | | |
66 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
67 | 92 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
164 | | - | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
165 | 170 | | |
166 | | - | |
| 171 | + | |
| 172 | + | |
167 | 173 | | |
168 | 174 | | |
169 | 175 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
| 83 | + | |
86 | 84 | | |
87 | 85 | | |
88 | 86 | | |
| |||
0 commit comments