Repository navigation
Commit 2273913
committed
fix(state): recover from a torn journal; journal cd's previous_dir
Two findings from the Codex review on #229, both regressions from the
journal introduced in 52ed149:
- A torn journal line (crash mid-append) ended replay but left the line
in place, so operations appended after the restart were skipped by
every later reload and could no longer be undone. load() now marks a
snapshot as pending when replay stops early, so the next persist
writes a full snapshot and truncates the journal.
- cd set previous_dir without persisting it; before the journal, the
next operation's full rewrite carried it. cd now goes through
ShellState::set_previous_dir, which journals a PreviousDir entry, so
cd - survives a restart.
Two regression tests; the torn-tail one fails without the fix.
cargo test 837 passed; stress suite 11 passed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4QvDjNR1ZoYKEPxSKE2nq1 parent 52ed149 commit 2273913
3 files changed
Lines changed: 77 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
116 | 118 | | |
117 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
118 | 122 | | |
119 | 123 | | |
120 | 124 | | |
| |||
190 | 194 | | |
191 | 195 | | |
192 | 196 | | |
193 | | - | |
194 | | - | |
195 | 197 | | |
196 | 198 | | |
197 | 199 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
402 | 402 | | |
403 | 403 | | |
404 | 404 | | |
405 | | - | |
| 405 | + | |
406 | 406 | | |
407 | 407 | | |
408 | 408 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
664 | 664 | | |
665 | 665 | | |
666 | 666 | | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
667 | 682 | | |
668 | 683 | | |
669 | 684 | | |
| |||
829 | 844 | | |
830 | 845 | | |
831 | 846 | | |
| 847 | + | |
832 | 848 | | |
833 | 849 | | |
834 | 850 | | |
835 | 851 | | |
836 | 852 | | |
| 853 | + | |
837 | 854 | | |
838 | 855 | | |
839 | 856 | | |
840 | 857 | | |
841 | 858 | | |
842 | 859 | | |
| 860 | + | |
843 | 861 | | |
844 | 862 | | |
845 | 863 | | |
846 | 864 | | |
847 | 865 | | |
848 | 866 | | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
849 | 873 | | |
850 | 874 | | |
851 | 875 | | |
| |||
877 | 901 | | |
878 | 902 | | |
879 | 903 | | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
880 | 907 | | |
881 | 908 | | |
882 | 909 | | |
| |||
1209 | 1236 | | |
1210 | 1237 | | |
1211 | 1238 | | |
| 1239 | + | |
| 1240 | + | |
1212 | 1241 | | |
1213 | 1242 | | |
1214 | 1243 | | |
| |||
1217 | 1246 | | |
1218 | 1247 | | |
1219 | 1248 | | |
| 1249 | + | |
1220 | 1250 | | |
1221 | 1251 | | |
1222 | 1252 | | |
| |||
1749 | 1779 | | |
1750 | 1780 | | |
1751 | 1781 | | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
| 1806 | + | |
| 1807 | + | |
| 1808 | + | |
| 1809 | + | |
| 1810 | + | |
| 1811 | + | |
| 1812 | + | |
| 1813 | + | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
1752 | 1822 | | |
1753 | 1823 | | |
1754 | 1824 | | |
| |||
0 commit comments