Commit 02e1d29
committed
status: preserve authenticated proofs across owned index writes
b65fc91 (status: retain the identity of an index it rewrites,
2026-08-17) lets status keep a race-proof receipt for an index it
rewrites. Receipt preparation duplicates the writer descriptor so it can
hash the final bytes, and requires the in-memory checksum to match the
configured null trailer.
Three owned write paths can leave an otherwise valid index without a
usable clean proof. A worktree-update repair first writes a checksummed
provisional index, then reopens the lockfile write-only before the final
skipHash write while the index still records the provisional checksum.
Receipt preparation rejects both states, so scoped stash cannot publish
a sidecar for the index it installs.
Worktree add creates its linked index before the new worktree has a
closed FSMonitor provider epoch. The index has FSMonitor and
untracked-cache extensions, but lacks the authenticated clean-config
proof. Later read-only status processes remain correct, but cannot
persist that proof and repeat the full fallback on every invocation.
A clean non-fast-forward merge repairs its authenticated index proof
before committing, but leaves the existing sidecar bound to the old
index and HEAD tree. The next read-only status rejects it with a
fast-index-mismatch and scans the semantic manifest. Only a later
writable status can replace the stale sidecar.
Add a read-write reopen operation only for the provisional index lock so
receipt preparation can read the final index. Fall back to the original
write-only reopen when read access is unavailable, allowing the write to
succeed without a receipt. Finish provisional writes through a cold
helper that restores the null object ID before the receipt-aware write.
After worktree add successfully runs the post-checkout hook, run one
silent status to establish the provider epoch and persist the complete
proof. Do so only when the caller permits optional locks; never override
an explicit --no-optional-locks request.
Factor the best-effort sidecar reissue used by rebase into wt-status.
After a successful merge commit has installed its final HEAD and index,
use that helper to authenticate the settled state. Sidecar failure still
falls back to ordinary status and never changes the merge result.
Cover receipt publication and adoption after scoped stash, preserve the
generic write-only tempfile contract, and require worktree add to honor
post-checkout index writes and disabled optional locks. Also require a
clean non-fast-forward merge to publish a sidecar that its next
read-only status can consume.1 parent 5e6128e commit 02e1d29
16 files changed
Lines changed: 296 additions & 46 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2580 | 2580 | | |
2581 | 2581 | | |
2582 | 2582 | | |
| 2583 | + | |
| 2584 | + | |
2583 | 2585 | | |
2584 | 2586 | | |
2585 | 2587 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1431 | 1431 | | |
1432 | 1432 | | |
1433 | 1433 | | |
| 1434 | + | |
1434 | 1435 | | |
1435 | 1436 | | |
1436 | 1437 | | |
| |||
1536 | 1537 | | |
1537 | 1538 | | |
1538 | 1539 | | |
| 1540 | + | |
| 1541 | + | |
1539 | 1542 | | |
1540 | 1543 | | |
1541 | 1544 | | |
| |||
1800 | 1803 | | |
1801 | 1804 | | |
1802 | 1805 | | |
| 1806 | + | |
| 1807 | + | |
1803 | 1808 | | |
1804 | 1809 | | |
1805 | 1810 | | |
| |||
1909 | 1914 | | |
1910 | 1915 | | |
1911 | 1916 | | |
| 1917 | + | |
| 1918 | + | |
1912 | 1919 | | |
1913 | 1920 | | |
1914 | 1921 | | |
| |||
1957 | 1964 | | |
1958 | 1965 | | |
1959 | 1966 | | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
1960 | 1972 | | |
1961 | 1973 | | |
1962 | 1974 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| 32 | + | |
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
| |||
409 | 412 | | |
410 | 413 | | |
411 | 414 | | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
412 | 440 | | |
413 | 441 | | |
414 | 442 | | |
| |||
593 | 621 | | |
594 | 622 | | |
595 | 623 | | |
596 | | - | |
597 | 624 | | |
598 | 625 | | |
599 | 626 | | |
| |||
622 | 649 | | |
623 | 650 | | |
624 | 651 | | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
625 | 661 | | |
626 | 662 | | |
627 | 663 | | |
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
55 | 61 | | |
56 | 62 | | |
57 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
344 | 344 | | |
345 | 345 | | |
346 | 346 | | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
347 | 352 | | |
348 | 353 | | |
349 | 354 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
340 | 340 | | |
341 | 341 | | |
342 | 342 | | |
| 343 | + | |
343 | 344 | | |
344 | 345 | | |
345 | 346 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5616 | 5616 | | |
5617 | 5617 | | |
5618 | 5618 | | |
5619 | | - | |
5620 | | - | |
5621 | | - | |
5622 | | - | |
5623 | | - | |
5624 | | - | |
5625 | | - | |
5626 | | - | |
5627 | | - | |
5628 | | - | |
5629 | | - | |
5630 | | - | |
5631 | | - | |
5632 | | - | |
5633 | | - | |
5634 | | - | |
5635 | | - | |
5636 | | - | |
5637 | | - | |
5638 | | - | |
5639 | | - | |
5640 | | - | |
5641 | | - | |
5642 | | - | |
5643 | | - | |
5644 | | - | |
5645 | | - | |
5646 | | - | |
5647 | | - | |
5648 | | - | |
5649 | | - | |
5650 | | - | |
5651 | | - | |
5652 | | - | |
5653 | | - | |
5654 | | - | |
5655 | | - | |
5656 | | - | |
5657 | | - | |
5658 | | - | |
5659 | 5619 | | |
5660 | 5620 | | |
5661 | 5621 | | |
| |||
5727 | 5687 | | |
5728 | 5688 | | |
5729 | 5689 | | |
5730 | | - | |
| 5690 | + | |
5731 | 5691 | | |
5732 | 5692 | | |
5733 | 5693 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
11 | 28 | | |
12 | 29 | | |
13 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
24 | 29 | | |
25 | 30 | | |
26 | 31 | | |
| |||
0 commit comments