Summary
A new service src/services/orphanedFileCleanupService.ts (currently uncommitted on main) plus a new "不要ファイルを削除" maintenance row in the settings screen and a new startup cleanup hook are not described in the project documents. SnowLog.md and CLAUDE.md still list only the previously-shipped services and 5 settings menu items.
Problem
What was added
src/services/orphanedFileCleanupService.ts (+ .web.ts stub) — scans documentDirectory/thumbnails/ and documentDirectory/videos/ against the set of files referenced by current videos rows and deletes anything else.
src/app/_layout.tsx:160-164 — the startup InteractionManager.runAfterInteractions callback now also calls cleanupOrphanedFiles().catch(() => {}) after repairInvalidCapturedAt.
src/app/(tabs)/settings/index.tsx:60-101, 134-166 — manual "不要ファイルを削除" row with confirm → run → result alert flow, using hapticWarning / hapticSuccess / hapticError.
src/services/managedVideoFileService.ts and src/services/thumbnailService.ts got new exports getManagedVideoDirectoryUri() / getThumbnailDirectoryUri() to support the cleanup service.
- i18n:
settings.menu.storageCleanup, settings.descriptions.storageCleanup, and the settings.storageCleanup.* block were added to ja.ts and en.ts.
What the docs still say
SnowLog.md §7.7 lists exactly 6 menu items where the 6th was "言語設定". Today it should be 5 navigable rows + 1 maintenance row (storage cleanup). The language row was removed in bab0b45.
SnowLog.md §9.3 Service table — no orphanedFileCleanupService entry.
SnowLog.md §5 startup-processing list does not mention the orphan-file cleanup pass.
SnowLog.md §10 "Media storage policy" does not document the cleanup invariant (managed video files / thumbnails not referenced from videos are reclaimed at startup and on demand).
.claude/CLAUDE.md "Boot order" comment ends at the i18n step and never mentions the cleanup pass.
.claude/CLAUDE.md Repo Map / Service section — no mention of orphanedFileCleanupService.ts.
Relevant files
src/services/orphanedFileCleanupService.ts:1-111
src/services/orphanedFileCleanupService.web.ts
src/app/_layout.tsx:157-165
src/app/(tabs)/settings/index.tsx:60-166
src/services/managedVideoFileService.ts:7-9 — new directory accessor
src/services/thumbnailService.ts:23-25 — new directory accessor
src/i18n/locales/{ja,en}.ts — new storageCleanup block
Proposed fix
- Add
orphanedFileCleanupService to SnowLog.md §9.3 and to the CLAUDE.md services line.
- Add a step "5. 不要ファイル掃除(非ブロッキング、起動後
runAfterInteractions で実行)" to SnowLog.md §5 and align the boot-order comment in CLAUDE.md.
- Update
SnowLog.md §7.7 to reflect 5 navigable items + a maintenance "不要ファイルを削除" row, and document the confirm/result UX.
- Add a brief paragraph to
SnowLog.md §10 describing the cleanup invariant: only files referenced by videos.thumbnailUri (relative) and getManagedVideoFileUri(id, filename) are kept; everything else under thumbnails/ and videos/ is reclaimable.
Acceptance criteria
- The two docs each describe the new service, the startup hook, and the manual cleanup row.
- Settings menu count in SnowLog.md §7.7 matches the actual UI.
- A reader can locate the service from CLAUDE.md's repo map.
Related
Summary
A new service
src/services/orphanedFileCleanupService.ts(currently uncommitted onmain) plus a new "不要ファイルを削除" maintenance row in the settings screen and a new startup cleanup hook are not described in the project documents. SnowLog.md and CLAUDE.md still list only the previously-shipped services and 5 settings menu items.Problem
What was added
src/services/orphanedFileCleanupService.ts(+.web.tsstub) — scansdocumentDirectory/thumbnails/anddocumentDirectory/videos/against the set of files referenced by currentvideosrows and deletes anything else.src/app/_layout.tsx:160-164— the startupInteractionManager.runAfterInteractionscallback now also callscleanupOrphanedFiles().catch(() => {})afterrepairInvalidCapturedAt.src/app/(tabs)/settings/index.tsx:60-101, 134-166— manual "不要ファイルを削除" row with confirm → run → result alert flow, usinghapticWarning/hapticSuccess/hapticError.src/services/managedVideoFileService.tsandsrc/services/thumbnailService.tsgot new exportsgetManagedVideoDirectoryUri()/getThumbnailDirectoryUri()to support the cleanup service.settings.menu.storageCleanup,settings.descriptions.storageCleanup, and thesettings.storageCleanup.*block were added toja.tsanden.ts.What the docs still say
SnowLog.md §7.7lists exactly 6 menu items where the 6th was "言語設定". Today it should be 5 navigable rows + 1 maintenance row (storage cleanup). The language row was removed inbab0b45.SnowLog.md §9.3Service table — noorphanedFileCleanupServiceentry.SnowLog.md §5startup-processing list does not mention the orphan-file cleanup pass.SnowLog.md §10"Media storage policy" does not document the cleanup invariant (managed video files / thumbnails not referenced fromvideosare reclaimed at startup and on demand)..claude/CLAUDE.md"Boot order" comment ends at the i18n step and never mentions the cleanup pass..claude/CLAUDE.mdRepo Map / Service section — no mention oforphanedFileCleanupService.ts.Relevant files
src/services/orphanedFileCleanupService.ts:1-111src/services/orphanedFileCleanupService.web.tssrc/app/_layout.tsx:157-165src/app/(tabs)/settings/index.tsx:60-166src/services/managedVideoFileService.ts:7-9— new directory accessorsrc/services/thumbnailService.ts:23-25— new directory accessorsrc/i18n/locales/{ja,en}.ts— newstorageCleanupblockProposed fix
orphanedFileCleanupServicetoSnowLog.md §9.3and to the CLAUDE.md services line.runAfterInteractionsで実行)" toSnowLog.md §5and align the boot-order comment in CLAUDE.md.SnowLog.md §7.7to reflect 5 navigable items + a maintenance "不要ファイルを削除" row, and document the confirm/result UX.SnowLog.md §10describing the cleanup invariant: only files referenced byvideos.thumbnailUri(relative) andgetManagedVideoFileUri(id, filename)are kept; everything else underthumbnails/andvideos/is reclaimable.Acceptance criteria
Related