feat(snapshot): devbase up の自動スナップショットを最小間隔でスキップ#75
Merged
Conversation
直近のスナップショット取得から既定 60 分以内のときは _auto_snapshot を スキップする。間隔は DEVBASE_SNAPSHOT_MIN_INTERVAL_MINUTES で可変 (0 で無効化=毎回取得、不正値は警告して既定値)。 - SnapshotManager.last_snapshot_time() を追加 (snapshot.yml の updated_at/created_at から直近取得日時を解決) - _snapshot_min_interval_minutes() で env 値を解決 - cli-reference.md に仕様を追記 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
差分更新は既存ディレクトリ名を再利用するため、ディレクトリ名の日付や メタデータの created_at では「世代作成時刻」しか分からず、直近の差分更新を 取りこぼす。各スナップショットディレクトリ内アーカイブの mtime 実測に変更し、 差分更新の時刻も正確に反映 + メタデータ整合性への依存を排除した。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
takemi-ohama
commented
Jun 25, 2026
takemi-ohama
left a comment
Contributor
Author
There was a problem hiding this comment.
🤖 cross-review | round 1 | codex | COMMENT
時刻比較の正規化漏れについて 1 件コメントしました。
takemi-ohama
commented
Jun 25, 2026
takemi-ohama
left a comment
Contributor
Author
There was a problem hiding this comment.
🤖 cross-review | round 1 | gemini | REQUEST_CHANGES
自動スナップショットのスキップ判定におけるエッジケース(タイムゾーン混在時のクラッシュ、システム時計ズレ時の無期限スキップ)に関する修正提案です。ご確認をお願いします。
takemi-ohama
commented
Jun 25, 2026
takemi-ohama
left a comment
Contributor
Author
There was a problem hiding this comment.
🤖 cross-review | round 2 | codex | REQUEST_CHANGES
成功したスナップショット本体だけを最小間隔の判定対象にする修正が必要です。
takemi-ohama
commented
Jun 25, 2026
takemi-ohama
left a comment
Contributor
Author
There was a problem hiding this comment.
🤖 cross-review | round 2 | gemini | REQUEST_CHANGES
- 新機能
DEVBASE_SNAPSHOT_MIN_INTERVAL_MINUTESに関するテストコードが追加されていません。設定値のパースロジック(0、負の値、不正な文字列)およびlast_snapshot_time()の挙動について、単体テストの追加をお願いします。
- last_snapshot_time() の mtime 集計対象を full.tar.zst / incr-*.tar.zst に限定 (meta.yml / snapshot.snar 等で誤スキップしないように) - _auto_snapshot() で経過時間が負 (last が未来) の場合はスキップしない - _snapshot_min_interval_minutes / last_snapshot_time の単体テスト追加 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
takemi-ohama
commented
Jun 25, 2026
takemi-ohama
left a comment
Contributor
Author
There was a problem hiding this comment.
🤖 cross-review | round 3 | codex | APPROVE
修正要求に相当する新規指摘はありません。
takemi-ohama
commented
Jun 25, 2026
takemi-ohama
left a comment
Contributor
Author
There was a problem hiding this comment.
🤖 cross-review | round 3 | gemini | APPROVE
自動スナップショットのスキップ判定について、テストも含めて適切に実装されています。
一点、夏時間(DST)等の切り替えを考慮したタイムゾーンの扱いについてのみ、より堅牢にするための提案を残します。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
3 tasks
takemi-ohama
added a commit
that referenced
this pull request
Jun 25, 2026
PR #75 のクロスレビュー時、fix サブエージェントが worktree 内で広範に git add した結果、.cross_review/ 配下の内部生成物と gh-payload.json が PR に混入し main にマージされていた。これらを除去し、再発防止のため .gitignore に .cross_review/ と gh-payload.json を追加する。 Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
概要
devbase upは毎回デプロイ前に自動スナップショットを取得していたが、短時間に何度もupを実行すると冗長なスナップショットが蓄積する。直近のスナップショット取得から一定時間(既定 60 分)以内のときはスキップするようにした。間隔は環境変数で可変。関連 Issue
変更点
SnapshotManager.last_snapshot_time()を追加。各スナップショットディレクトリ内アーカイブファイルの mtime(更新時刻)の実測値 から直近のスナップショット取得日時を解決するcreated_atでは「世代作成時刻」しか分からず直近の差分更新を取りこぼす。mtime 実測なら差分更新の時刻も正確に反映でき、メタデータの整合性にも依存しない_auto_snapshot()で直近取得からの経過時間を判定し、最小間隔未満ならスキップしてログ出力_snapshot_min_interval_minutes()で環境変数DEVBASE_SNAPSHOT_MIN_INTERVAL_MINUTESを解決(既定 60、0で無効化=毎回取得、負値・不正値は警告して既定値)。DEVBASE_IMAGE_MAX_AGE_DAYSと同じパターンdocs/user/cli-reference.mdのdevbase project upに仕様を追記挙動
DEVBASE_SNAPSHOT_MIN_INTERVAL_MINUTES30等0mgr.rotate()も省略されるが、ローテーションはdevbase down側でも実行されるため影響なし動作確認
last_snapshot_time()が空ディレクトリでNone、古いフル + 新しい差分ファイルで「新しい差分の mtime」を返すことを確認(名前ベースだと誤判定していたケース)_snapshot_min_interval_minutes()の各入力値(未設定→60, "30"→30, "0"→0, "-5"/"abc"→警告して60)を確認docs/) を更新した補足
閾値判定はスナップショットファイルの mtime に基づく(メタデータ非依存)。