Skip to content

Commit 6f776d1

Browse files
takemi-ohamaclaude
andcommitted
fix(snapshot): スナップショット間隔判定を UTC ベースに統一 (DST ズレ回避)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent f823134 commit 6f776d1

33 files changed

Lines changed: 2447 additions & 8 deletions

.cross_review/codex-review-pr75-err.log

Lines changed: 2028 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"id":4571476541,"node_id":"PRR_kwDOSHX-a88AAAABEHsyPQ","user":{"login":"takemi-ohama","id":10234200,"node_id":"MDQ6VXNlcjEwMjM0MjAw","avatar_url":"https://avatars.githubusercontent.com/u/10234200?u=5234c3bda85b1b6bdd98e5a4f2dfa04541b37ebb&v=4","gravatar_id":"","url":"https://api.github.com/users/takemi-ohama","html_url":"https://github.com/takemi-ohama","followers_url":"https://api.github.com/users/takemi-ohama/followers","following_url":"https://api.github.com/users/takemi-ohama/following{/other_user}","gists_url":"https://api.github.com/users/takemi-ohama/gists{/gist_id}","starred_url":"https://api.github.com/users/takemi-ohama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/takemi-ohama/subscriptions","organizations_url":"https://api.github.com/users/takemi-ohama/orgs","repos_url":"https://api.github.com/users/takemi-ohama/repos","events_url":"https://api.github.com/users/takemi-ohama/events{/privacy}","received_events_url":"https://api.github.com/users/takemi-ohama/received_events","type":"User","user_view_type":"public","site_admin":false},"body":"## 🤖 cross-review | round 1 | codex | COMMENT\n\n時刻比較の正規化漏れについて 1 件コメントしました。","state":"COMMENTED","html_url":"https://github.com/devbasex/devbase/pull/75#pullrequestreview-4571476541","pull_request_url":"https://api.github.com/repos/devbasex/devbase/pulls/75","author_association":"MEMBER","_links":{"html":{"href":"https://github.com/devbasex/devbase/pull/75#pullrequestreview-4571476541"},"pull_request":{"href":"https://api.github.com/repos/devbasex/devbase/pulls/75"}},"submitted_at":"2026-06-25T13:42:09Z","commit_id":"5ddd4981eef09374487a77c98380d2d041335a1e"}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# /ndf:review 実行 (cross-review codex / round 3)
2+
3+
PR #75**codex の観点でレビューし、gh api で直接 PR に投稿** してください。
4+
5+
## 必須コンテキスト
6+
- repo: devbasex/devbase
7+
- PR: #75
8+
- commit_id (headRefOid): f8231341fb4dfa044e1b27ee4e698058b7ff28b2
9+
- worktree: /var/folders/qz/qxt0p_y15xv5jg4x77zmtxj80000gp/T/ndf-worktrees/devbasex--devbase/pr75 (**ファイル読み取りは必ず此処の絶対パスを使う**
10+
- event_downgrade: true
11+
- true の場合: payload の `event``COMMENT` にすること。
12+
ただし body 先頭 prefix の `<event>` には **本来の intent** を書く。
13+
- 既存コメントスナップショット: /var/folders/qz/qxt0p_y15xv5jg4x77zmtxj80000gp/T/ndf-worktrees/devbasex--devbase/pr75/.cross_review/cross-review-pr75-existing-comments.txt (重複指摘禁止)
14+
15+
## 出力契約
16+
- review body の **先頭行** に必ず以下を入れる(fence 不要、Markdown 見出しとして):
17+
```
18+
## 🤖 cross-review | round 3 | codex | <event(intent)>
19+
```
20+
例: `## 🤖 cross-review | round 3 | codex | REQUEST_CHANGES`
21+
- `<event>`**本来の intent** (REQUEST_CHANGES / APPROVE / COMMENT)
22+
23+
### 出力に **含めてはいけないもの**(Resolve 負荷を増やすため)
24+
-**「良い点」/「Strengths」/「評価できる点」 section** — body にも書かない
25+
-**対応アクションが無いインラインコメント** — 観察・感想・現状説明だけは禁止
26+
-**nit / スタイル指摘のインライン化** — 好みの問題はコメント化しない (無視する)
27+
-**コード引用 (``` ... ```) だけで指摘内容が無いコメント**
28+
-**`event=COMMENT` での雑感投稿** — 直すべき点が無ければ `APPROVE` にする
29+
30+
### インラインコメントの書式
31+
- `[重要度 / カテゴリ]` プレフィックス必須 (例: `[major / 正確性]`)
32+
- 重要度は `critical` / `major` / `minor` のみ使う (nit はインライン化しない)
33+
- 本文は **1 コメント = 1 修正アクション** で完結させる。1〜2 文で具体的な修正提案を書く
34+
35+
### body (総評) の書き方
36+
- 設計レベル・PR 横断の **修正提案のみ** 書く
37+
- 書くことが無ければ prefix 行 + 1 行サマリだけで良い (褒め言葉や評価文は不要)
38+
39+
- 投稿後、サマリを **/var/folders/qz/qxt0p_y15xv5jg4x77zmtxj80000gp/T/ndf-worktrees/devbasex--devbase/pr75/.cross_review/codex-review-pr75-result.json** に書く:
40+
```json
41+
{
42+
"event": "REQUEST_CHANGES",
43+
"posted_as": "COMMENT",
44+
"comments_count": 5,
45+
"review_url": "https://github.com/.../pull/75#pullrequestreview-...",
46+
"by_severity": {"critical": 0, "major": 3, "minor": 2, "nit": 0}
47+
}
48+
```
49+
- payload(全コメント詳細)は **/var/folders/qz/qxt0p_y15xv5jg4x77zmtxj80000gp/T/ndf-worktrees/devbasex--devbase/pr75/.cross_review/codex-review-pr75-round3-payload.json** に保存
50+
(振動検知用、`{ "comments": [{path, line, body, severity}, ...] }` 形式)
51+
52+
## 守るべきこと
53+
- リポジトリ編集は行わない(コード修正は別ステップ)
54+
- worktree 外のパスは触らない
55+
- gh api 失敗時は err.log にエラー詳細を残して即時終了
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"event": "APPROVE",
3+
"posted_as": "COMMENT",
4+
"comments_count": 0,
5+
"review_url": "https://github.com/devbasex/devbase/pull/75#pullrequestreview-4571614169",
6+
"by_severity": {
7+
"critical": 0,
8+
"major": 0,
9+
"minor": 0,
10+
"nit": 0
11+
}
12+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"comments": [
3+
{
4+
"path": "lib/devbase/snapshot/manager.py",
5+
"line": 110,
6+
"body": "[minor / 正確性] `fromisoformat()` は `2026-06-25T12:00:00+09:00` のような offset-aware な日時も返すため、既存の naive な `created_at` と混在すると `dt > latest` や `_auto_snapshot()` 側の `datetime.now() - last` が `TypeError` になります。比較前に naive/aware を同じ基準へ正規化するか、offset-aware な日時を明示的に無視する処理にしてください。",
7+
"severity": "minor"
8+
}
9+
]
10+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"commit_id": "f99f050fb2cb1d1d1d2609be1cab5b73a4ff2f7d",
3+
"event": "COMMENT",
4+
"body": "## 🤖 cross-review | round 2 | codex | REQUEST_CHANGES\n\n成功したスナップショット本体だけを最小間隔の判定対象にする修正が必要です。",
5+
"comments": [
6+
{
7+
"path": "lib/devbase/snapshot/manager.py",
8+
"line": 114,
9+
"side": "RIGHT",
10+
"body": "[major / 正確性] 判定対象を と に限定してください。現状は や / の mtime でも直近スナップショット扱いになるため、コピーや失敗した差分作成後に成功したバックアップが無いまま がスキップされます。"
11+
}
12+
]
13+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"url":"https://api.github.com/repos/devbasex/devbase/pulls/comments/3474878988","pull_request_review_id":4571528229,"id":3474878988,"node_id":"PRRC_kwDOSHX-a87PHnIM","diff_hunk":"@@ -95,6 +95,32 @@ def list(self) -> list[dict]:\n snap['size_bytes'] = 0\n return snapshots\n \n+ def last_snapshot_time(self) -> Optional[datetime]:\n+ \"\"\"直近のスナップショット取得 (フル/差分) 日時を返す。\n+\n+ 各スナップショットディレクトリ内のアーカイブファイルの mtime のうち\n+ 最新のものを採用する。差分更新は既存ディレクトリ名を再利用するため\n+ (ディレクトリ名の日付は世代作成時のまま) ファイルの mtime を実測する方が\n+ 正確で、メタデータの整合性にも依存しない。\n+\n+ スナップショットが存在しない場合は None。\n+ \"\"\"\n+ if not self.backups_dir.exists():\n+ return None\n+ latest: Optional[float] = None\n+ for snap_dir in self.backups_dir.iterdir():\n+ if not snap_dir.is_dir():\n+ continue\n+ for f in snap_dir.iterdir():","path":"lib/devbase/snapshot/manager.py","commit_id":"f99f050fb2cb1d1d1d2609be1cab5b73a4ff2f7d","original_commit_id":"f99f050fb2cb1d1d1d2609be1cab5b73a4ff2f7d","user":{"login":"takemi-ohama","id":10234200,"node_id":"MDQ6VXNlcjEwMjM0MjAw","avatar_url":"https://avatars.githubusercontent.com/u/10234200?v=4","gravatar_id":"","url":"https://api.github.com/users/takemi-ohama","html_url":"https://github.com/takemi-ohama","followers_url":"https://api.github.com/users/takemi-ohama/followers","following_url":"https://api.github.com/users/takemi-ohama/following{/other_user}","gists_url":"https://api.github.com/users/takemi-ohama/gists{/gist_id}","starred_url":"https://api.github.com/users/takemi-ohama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/takemi-ohama/subscriptions","organizations_url":"https://api.github.com/users/takemi-ohama/orgs","repos_url":"https://api.github.com/users/takemi-ohama/repos","events_url":"https://api.github.com/users/takemi-ohama/events{/privacy}","received_events_url":"https://api.github.com/users/takemi-ohama/received_events","type":"User","user_view_type":"public","site_admin":false},"body":"[major / 正確性] 判定対象を `full.tar.zst` と `incr-*.tar.zst` に限定してください。現状は `meta.yml` や `snapshot.snar`/`.bak` の mtime でも直近スナップショット扱いになるため、コピーや失敗した差分作成後に成功したバックアップが無いまま `up` がスキップされます。","created_at":"2026-06-25T13:47:29Z","updated_at":"2026-06-25T13:48:08Z","html_url":"https://github.com/devbasex/devbase/pull/75#discussion_r3474878988","pull_request_url":"https://api.github.com/repos/devbasex/devbase/pulls/75","_links":{"self":{"href":"https://api.github.com/repos/devbasex/devbase/pulls/comments/3474878988"},"html":{"href":"https://github.com/devbasex/devbase/pull/75#discussion_r3474878988"},"pull_request":{"href":"https://api.github.com/repos/devbasex/devbase/pulls/75"}},"reactions":{"url":"https://api.github.com/repos/devbasex/devbase/pulls/comments/3474878988/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0},"start_line":null,"original_start_line":null,"start_side":null,"line":114,"original_line":114,"side":"RIGHT","author_association":"MEMBER","original_position":20,"position":20,"subject_type":"line"}

.cross_review/codex-review-pr75-round2-err.log

Whitespace-only changes.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"comments": [
3+
{
4+
"path": "lib/devbase/snapshot/manager.py",
5+
"line": 114,
6+
"body": "[major / 正確性] 判定対象を `full.tar.zst` と `incr-*.tar.zst` に限定してください。現状は `meta.yml` や `snapshot.snar`/`.bak` の mtime でも直近スナップショット扱いになるため、コピーや失敗した差分作成後に成功したバックアップが無いまま `up` がスキップされます。",
7+
"severity": "major"
8+
}
9+
]
10+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"id":4571528229,"node_id":"PRR_kwDOSHX-a88AAAABEHv8JQ","user":{"login":"takemi-ohama","id":10234200,"node_id":"MDQ6VXNlcjEwMjM0MjAw","avatar_url":"https://avatars.githubusercontent.com/u/10234200?u=5234c3bda85b1b6bdd98e5a4f2dfa04541b37ebb&v=4","gravatar_id":"","url":"https://api.github.com/users/takemi-ohama","html_url":"https://github.com/takemi-ohama","followers_url":"https://api.github.com/users/takemi-ohama/followers","following_url":"https://api.github.com/users/takemi-ohama/following{/other_user}","gists_url":"https://api.github.com/users/takemi-ohama/gists{/gist_id}","starred_url":"https://api.github.com/users/takemi-ohama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/takemi-ohama/subscriptions","organizations_url":"https://api.github.com/users/takemi-ohama/orgs","repos_url":"https://api.github.com/users/takemi-ohama/repos","events_url":"https://api.github.com/users/takemi-ohama/events{/privacy}","received_events_url":"https://api.github.com/users/takemi-ohama/received_events","type":"User","user_view_type":"public","site_admin":false},"body":"## 🤖 cross-review | round 2 | codex | REQUEST_CHANGES\n\n成功したスナップショット本体だけを最小間隔の判定対象にする修正が必要です。","state":"COMMENTED","html_url":"https://github.com/devbasex/devbase/pull/75#pullrequestreview-4571528229","pull_request_url":"https://api.github.com/repos/devbasex/devbase/pulls/75","author_association":"MEMBER","_links":{"html":{"href":"https://github.com/devbasex/devbase/pull/75#pullrequestreview-4571528229"},"pull_request":{"href":"https://api.github.com/repos/devbasex/devbase/pulls/75"}},"submitted_at":"2026-06-25T13:47:29Z","commit_id":"f99f050fb2cb1d1d1d2609be1cab5b73a4ff2f7d"}

0 commit comments

Comments
 (0)