personal memory agent
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(maint): deep-merge day dirs during chronicle migration race

When new code creates chronicle/YYYYMMDD before the migration runs
(e.g. live capture starts writing to the new path), the migration
was skipping the root day dir entirely — stranding pre-migration
data. Now uses copytree(dirs_exist_ok=True) to deep-merge the root
copy into chronicle, preserving segments from both sides.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+8 -3
+8 -3
apps/sol/maint/002_migrate_chronicle.py
··· 69 69 for source_day in day_dirs: 70 70 target_day = chronicle_dir / source_day.name 71 71 if target_day.exists(): 72 - print(f" Skip (already exists): {source_day.name}") 73 - summary.skipped += 1 72 + # Target exists (race: new code created chronicle/day before migration ran). 73 + # Deep-merge source into target, then remove the root copy. 74 + print(f" Merge: {source_day.name} -> {CHRONICLE_DIR}/{source_day.name}") 75 + if not dry_run: 76 + shutil.copytree(source_day, target_day, dirs_exist_ok=True) 77 + shutil.rmtree(source_day) 78 + summary.moved += 1 74 79 continue 75 80 76 81 print(f" Move: {source_day.name} -> {CHRONICLE_DIR}/{source_day.name}") ··· 78 83 shutil.move(str(source_day), str(target_day)) 79 84 summary.moved += 1 80 85 81 - if summary.moved and not dry_run: 86 + if (summary.moved or summary.skipped) and not dry_run: 82 87 for sqlite_path in _sqlite_paths(journal_path): 83 88 if not sqlite_path.exists(): 84 89 continue