Commit 13fcd99
Make prune decide retention from filenames, not file content
Same anti-pattern as the last commit (ac7cf22), one function over:
history::prune read and fully deserialized EVERY run's JSON just to
sort by run.timestamp - a value save_run already writes straight into
the filename ({ts}.json / {ts}-{suffix}.json). prune is the one
command whose entire job is dealing with a lot of accumulated history,
so this was the worst-affected function of the three fixed this week -
a deployment that's been running monitor nightly for months, with
runs full of embedded screenshots, paid for parsing all of that on
every single prune.
Fix: reuse the timestamp_from_filename helper added in ac7cf22 for
all_known_forms. prune now never opens or reads a run file's content
at all, only its name - retention is pure filename bookkeeping.
Verified the same way as the last two rounds: added a test that
corrupts every run file's content and confirms prune still counts and
removes the right ones (it never needed to read them), then verified
that test actually catches the regression by temporarily reverting to
the old "parse every file, sort by parsed timestamp" implementation -
it failed on the corrupted content exactly as predicted - then
restored the fix.
cargo fmt/clippy -D warnings clean, full suite green (157 tests).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent ac7cf22 commit 13fcd99
3 files changed
Lines changed: 52 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
27 | 36 | | |
28 | 37 | | |
29 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
525 | 525 | | |
526 | 526 | | |
527 | 527 | | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
528 | 533 | | |
529 | 534 | | |
530 | 535 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
346 | 346 | | |
347 | 347 | | |
348 | 348 | | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
349 | 356 | | |
350 | 357 | | |
351 | 358 | | |
| |||
364 | 371 | | |
365 | 372 | | |
366 | 373 | | |
367 | | - | |
368 | | - | |
369 | | - | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
370 | 378 | | |
371 | 379 | | |
372 | 380 | | |
| |||
738 | 746 | | |
739 | 747 | | |
740 | 748 | | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
741 | 776 | | |
742 | 777 | | |
743 | 778 | | |
| |||
0 commit comments