Commit 05d679e
fix: ownershipOf's stat catch conflated absent with inconclusive
Flagged independently by both gemini-code-assist and the CI claude
reviewer bot on the pushed PR: the bare `catch { return 'absent' }`
in ownershipOf() treated every statSync failure — not just ENOENT —
as "nothing is on disk." A permission or I/O error on a path a live
foreign worker actually owns would misclassify as 'absent' rather
than 'foreign', and markUdsBindFailed()'s guard only blocks on
'foreign' — so an inconclusive stat error could make it delete a
live worker's yaml metadata, reintroducing the bug class this PR
exists to fix. cleanupUdsFiles() is unaffected (it treats 'absent'
and 'foreign' identically), but the distinction matters wherever
'absent' alone is trusted.
Now checks error.code === 'ENOENT' specifically; any other error
returns 'foreign' (the conservative default) instead. Added a test
forcing a non-ENOENT stat failure deterministically via ENOTDIR
(treating a plain file as a path segment) rather than EACCES, since
permission checks aren't reliably enforced when tests run as root
(common in CI containers).
Co-Authored-By: Claude Opus <noreply@anthropic.com>1 parent beead41 commit 05d679e
2 files changed
Lines changed: 25 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
114 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
115 | 118 | | |
116 | 119 | | |
117 | 120 | | |
| |||
121 | 124 | | |
122 | 125 | | |
123 | 126 | | |
124 | | - | |
125 | | - | |
| 127 | + | |
| 128 | + | |
126 | 129 | | |
127 | 130 | | |
128 | 131 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
625 | 625 | | |
626 | 626 | | |
627 | 627 | | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
628 | 646 | | |
629 | 647 | | |
630 | 648 | | |
| |||
0 commit comments