Skip to content

Documentation does not cover the orphaned-file cleanup service or its settings row #57

@kmch4n

Description

@kmch4n

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

  1. Add orphanedFileCleanupService to SnowLog.md §9.3 and to the CLAUDE.md services line.
  2. Add a step "5. 不要ファイル掃除(非ブロッキング、起動後 runAfterInteractions で実行)" to SnowLog.md §5 and align the boot-order comment in CLAUDE.md.
  3. Update SnowLog.md §7.7 to reflect 5 navigable items + a maintenance "不要ファイルを削除" row, and document the confirm/result UX.
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationpriority:mediumMedium prioritytech-debtCode health and maintainability

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions