Skip to content

[P1][Operability] disk capacity budget・reserved-space preflight・orphan staging cleanupを実装する #129

Description

@tuzuminami

背景 / 現状

import staging、export staging、SQLite WAL、migration backup、backup/restoreが重なるとdiskを埋め、commitやartifact生成が途中失敗する。crash後のapp-owned staging/tempが残り続けると、非エンジニアには原因も安全なcleanup方法も分からない。

目的

record/import/analysis/export/backup/migration前に必要容量と安全headroomを判定し、容量枯渇前に安全に止め、app-owned orphanだけを回復できるlocal operability contractを作る。

対象

  • operationごとのcapacity budget/reserved headroom preflight
  • running job中のlow-space safe pause/cancel、partial output/DB cleanup
  • app-owned staging/temp/migration backup/log/job artifactのsize/age/owner/symlink-bound cleanup
  • diagnosticsのcapacity category、needed/free amount、safe cleanup action、日英recovery copy
  • disk full/read-only/detach/crash E2E/fault injection

非対象

  • filesystem全体のcleanup、user-selected export/backupの自動削除、remote storage/telemetry
  • OS storage managementを置き換えること、容量を保証すること

Claude Code実装契約

  1. mutation/file operation前に入力size、worst-case staging/DB/WAL/archive overhead、reserved headroomを計算する。足りない場合はdata変更前に#63のsafe recovery actionで拒否する。
  2. 実行中にthresholdを下回ったら、operation種別ごとにatomic rollback、safe cancel、write-blockを選び、partial DB/backup/exportをsuccess扱いしない。[P0][Storage] 永続化commit失敗時のin-memory phantom stateを排除し全mutationをatomicにする #117/#122のstorage contractを迂回しない。
  3. startup/recovery cleanupはapp-owned root、expected filename/marker、owner、non-symlink、age/size capをすべて満たすstaging/tempだけを対象にする。user-selected exports/backups、other app、unknown fileを削除しない。
  4. staging/migration backup/log/job artifactに上限とlifecycleを定義する。retention/delete/uninstallと矛盾させず、safe cleanup前後をreceiptへ残す。
  5. diagnosticsはcapacity class/free/needed/blocked operation/cleanup resultをprivacy-safeに示す。full path、event content、telemetryを出さない。

受け入れ条件

  • import、export、backup/restore、migration、recordingの各operationがinsufficient headroomをmutation前に止め、既存dataを保持する。
  • disk full、sparse file、read-only volume、unmount/detach、crash/restartでDB/backup/exportが整合するかsafe recoveryになる。
  • orphan staging/temp fixtureだけがcleanupされ、user export/backup、unknown file、symlink target、other projectのfileは0件削除される。
  • capacity diagnostics、日英recovery action、reopen後state、receiptが一致する。
  • resource limit/cancel policyとpackaged E2Eが通る。

検証

controlled disk quota/fault fixtures、WAL/staging/migration backup、symlink/owner/age boundaries、crash/restart、privacy scan、clean Mac E2E。

依存関係

#52#53#55#63#78#87#88#92#97#101#117#122

PR運用

1 Issue = 1 branch / PR。capacity model/headroom、cleanup allowlist、failure matrix、OS non-guarantee、testsを記載する。

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:operationsDiagnostics, audit, support, and lifecyclearea:qualityTests, CI, performance, and release gatesarea:storagePersistence, migration, backup, and recoverypriority:P1Required for v1.0 qualityrelease:v1.0Targeted for OpsMineFlow v1.0.0

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions