Commit a41069b
fix(storage): serve a tombstoned sys_file that still has a live holder (#11428)
A sys_file tombstone is recoverable state, not a delete: the reap guard
re-verifies references at sweep time, finds a regained holder, un-tombstones
the row and vetoes the reap. But the guard is the only thing that ever asked,
and sys_file's declared lifecycle (ttl { field: 'deleted_at', expireAfter:
'30d' }) nominates a tombstone only AFTER the window expires. Inside the
window the file was not a sweep candidate at all, while both download
endpoints refused anything not 'committed' — so a live attachment could point
at a file that 404s for up to 30 days and then silently starts working.
Ruled direction 2: the judgement moves to the read side, the revival mechanism
does not move at all. No lifecycle verb is added; nothing on the download path
writes to the row.
The two download handlers carried a copy each of `file.status !== 'committed'`.
They now share one predicate, isServableForDownload, which serves 'committed'
unconditionally, refuses 'pending' unconditionally, and asks
opts.resolveFileHolder about a tombstone. The plugin binds that to
findFileHolder — the reap guard's own definition of "is anything still holding
this file?", imported rather than re-derived — so the read verdict and the
sweep verdict are the same question answered by the same code.
Tests pin the pair, not the widening: tombstoned + a live holder serves 200 on
both endpoints while the guard vetoes and reclaims nothing; the last holder
removed 404s on both endpoints while the guard confirms the reap and deletes
the bytes. Boundaries pinned unmoved: pending, bare kernel, a throwing holder
question, a released field file, and the full authorization gate.
Repairs one prose claim this change falsifies: the platform-checklist item
attachments-storage.sys-file-status-pipeline stated the refusal as
"status != committed", which a runner would now score as a failure of the
fixed behaviour.
Claude-Session: https://claude.ai/code/session_01APWX2AwT3a4xDcjPCe8bk4
Co-authored-by: Claude <noreply@anthropic.com>1 parent d0e3a88 commit a41069b
7 files changed
Lines changed: 448 additions & 9 deletions
File tree
- .changeset
- content/docs/permissions
- docs/qa/platform-checklist/areas
- packages/services/service-storage/src
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
112 | 119 | | |
113 | 120 | | |
114 | 121 | | |
| |||
Lines changed: 13 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
433 | 433 | | |
434 | 434 | | |
435 | 435 | | |
436 | | - | |
| 436 | + | |
437 | 437 | | |
438 | 438 | | |
439 | 439 | | |
| |||
445 | 445 | | |
446 | 446 | | |
447 | 447 | | |
448 | | - | |
| 448 | + | |
449 | 449 | | |
450 | 450 | | |
451 | 451 | | |
452 | 452 | | |
| 453 | + | |
| 454 | + | |
453 | 455 | | |
454 | 456 | | |
455 | 457 | | |
| |||
461 | 463 | | |
462 | 464 | | |
463 | 465 | | |
464 | | - | |
| 466 | + | |
465 | 467 | | |
466 | 468 | | |
467 | 469 | | |
468 | 470 | | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
469 | 477 | | |
470 | 478 | | |
471 | 479 | | |
| |||
499 | 507 | | |
500 | 508 | | |
501 | 509 | | |
502 | | - | |
| 510 | + | |
| 511 | + | |
503 | 512 | | |
504 | 513 | | |
505 | 514 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
9 | 13 | | |
10 | 14 | | |
11 | 15 | | |
| |||
47 | 51 | | |
48 | 52 | | |
49 | 53 | | |
| 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 | + | |
50 | 83 | | |
51 | 84 | | |
52 | 85 | | |
| |||
133 | 166 | | |
134 | 167 | | |
135 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
136 | 205 | | |
137 | 206 | | |
138 | 207 | | |
| |||
603 | 672 | | |
604 | 673 | | |
605 | 674 | | |
606 | | - | |
607 | | - | |
| 675 | + | |
| 676 | + | |
608 | 677 | | |
609 | 678 | | |
610 | 679 | | |
| |||
650 | 719 | | |
651 | 720 | | |
652 | 721 | | |
653 | | - | |
654 | | - | |
| 722 | + | |
| 723 | + | |
655 | 724 | | |
656 | 725 | | |
657 | 726 | | |
| |||
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
413 | 413 | | |
414 | 414 | | |
415 | 415 | | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
416 | 426 | | |
417 | 427 | | |
418 | 428 | | |
| |||
0 commit comments