Commit 364ddf1
committed
Bugfix: Fix dir_stats count drift on file↔dir type changes
- Writer now handles file↔dir type changes in `UpsertEntryV2` automatically: detects the type change, deletes the old entry (propagating correct negative count/size deltas), then inserts fresh with the new type
- Previously, in-place updates left `file_count`/`dir_count` wrong in parent `dir_stats` — the old type's count wasn't decremented and the new type's count wasn't incremented
- `reconcile_subtree`: expanded the existing dir→file guard to also handle file→dir (sends `DeleteEntryById` before `UpsertEntryV2`), matching the pattern the verifier already uses
- Hoisted `get_entry_by_id` from `upsert_update_existing` to `handle_upsert_entry_v2` and pass it down, eliminating a redundant DB read1 parent 9bf0e00 commit 364ddf1
3 files changed
Lines changed: 46 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
450 | 456 | | |
451 | 457 | | |
452 | 458 | | |
| |||
2044 | 2050 | | |
2045 | 2051 | | |
2046 | 2052 | | |
2047 | | - | |
2048 | | - | |
2049 | | - | |
| 2053 | + | |
2050 | 2054 | | |
2051 | 2055 | | |
2052 | 2056 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
612 | 612 | | |
613 | 613 | | |
614 | 614 | | |
615 | | - | |
616 | | - | |
617 | | - | |
| 615 | + | |
618 | 616 | | |
619 | 617 | | |
620 | 618 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
656 | 656 | | |
657 | 657 | | |
658 | 658 | | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
659 | 691 | | |
660 | 692 | | |
661 | 693 | | |
| |||
667 | 699 | | |
668 | 700 | | |
669 | 701 | | |
| 702 | + | |
670 | 703 | | |
671 | 704 | | |
672 | 705 | | |
| |||
707 | 740 | | |
708 | 741 | | |
709 | 742 | | |
| 743 | + | |
710 | 744 | | |
711 | 745 | | |
712 | 746 | | |
| |||
716 | 750 | | |
717 | 751 | | |
718 | 752 | | |
719 | | - | |
720 | | - | |
721 | | - | |
722 | 753 | | |
723 | 754 | | |
724 | 755 | | |
| |||
731 | 762 | | |
732 | 763 | | |
733 | 764 | | |
734 | | - | |
735 | | - | |
736 | | - | |
737 | | - | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
742 | | - | |
743 | 765 | | |
744 | 766 | | |
745 | 767 | | |
| |||
0 commit comments