Skip to content

docs(todo): PR #88 post-merge-feedback の Tier 1/2 finding を採用#89

Merged
aloekun merged 2 commits intomasterfrom
docs/feedback-88-tier1-2
Apr 28, 2026
Merged

docs(todo): PR #88 post-merge-feedback の Tier 1/2 finding を採用#89
aloekun merged 2 commits intomasterfrom
docs/feedback-88-tier1-2

Conversation

@aloekun
Copy link
Copy Markdown
Owner

@aloekun aloekun commented Apr 28, 2026

Summary

PR #88 (markdownlint-cli2 hook 統合) のマージ後に生成された post-merge-feedback report (.claude/feedback-reports/88.md) から、ユーザー判断により Tier 1/2 の finding 5 件 を採用し、推奨実行順序サマリーに反映する docs-only PR。

採用 finding と新順位

新順位 Tier 内容 工数 ファイル
5 🚀 T1 Stop hook の pnpm lint:md 統合 (PR #88 T1-1) XS todo3.md
6 🚀 T1 AI 生成一時スクリプト pattern の pre-push 検出 (PR #88 T1-2) Small todo3.md
12 🔧 T2 cli-pr-monitor ポーリング延長 + 重複起動ロック (PR #88 T2-4) ★ rate-limit critical Medium todo3.md
13 🔧 T2 vitest を devDependencies に固定 (PR #88 T2-3) Small todo3.md
14 🔧 T2 pnpm create-pr 必須引数ヘルプ改善 (PR #88 T2-5) Small todo3.md

見送り finding

Finding 理由
T3 #6 (commit 分割基準のグローバルルール明文化) ~/.claude/ への編集は permission denied、別経路要
T3 #7 (jj rebase conflict 解消手順 ADR-024 追記) 同上

主要な変更

  1. docs/todo3.md 新設: docs/todo2.md がファイルサイズ約 50KB に到達したため、PR feat(hooks): markdownlint-cli2 を PostToolUse hook に統合 #88 以降の新規エントリは docs/todo3.md に追加する運用に切替。本 PR で初期 5 タスクを記載。

  2. docs/todo.md 推奨実行順序サマリー table 全面更新:

    • 順位 5/6/12/13/14 に新タスクを Tier 別に挿入
    • 既存 20 タスク → 24 タスクへ全 renumber
    • 戦略テキスト「Tier 1 (1〜7) 2〜3 セッション → Tier 2 (8〜14) で ADR-032 前提を埋めつつ rate-limit 改善 → Tier 3 (15〜22) で ADR-032 を land」へ更新
    • 副題テキスト 5 行を新順位に追従更新
  3. docs/todo2.md cross-reference 更新:

    • 17 箇所の (順位 X/20)(順位 Y/24) を sed bulk で更新
    • 6 箇所の semantic reference (順位 N (タスク名) 形式) を Edit で個別更新
    • 旧順位 1 (markdownlint = merged) への参照を merged context に書き換え
  4. docs/todo3.md / 運用ルール明記:

    • todo.md / todo2.md / todo3.md の三本立てに更新
    • todo2.md は「既存タスクの編集・完了削除専用、新規タスク追加禁止 (50KB 到達)」
    • todo3.md は「新規タスクの追加先、50KB 到達まで」

動作確認

  • pnpm lint:md: 48 files, 0 errors (todo3.md 新設後も clean baseline 維持)
  • PostToolUse hook: 本 PR の編集 8 回以上で auto-fix + diagnostic 動作 (markdownlint hook の dogfood 継続)
  • takt pre-push-review: simplicity + security 両方 APPROVE (1 iteration)
  • cross-reference 整合性: grep -n "順位 [0-9]" docs/todo*.md で検証済

関連

  • 参照 1: .claude/feedback-reports/88.md (post-merge-feedback による独立提案)
  • 参照 2: PR feat(hooks): markdownlint-cli2 を PostToolUse hook に統合 #88 (本 finding の元となった Markdown linter hook 統合)
  • 順位 22 (todo.md 採番管理の簡素化 ADR 起案) の必要性を本 PR の 30 箇所に及ぶ renumber 作業が改めて実証

Test plan

  • pnpm lint:md で 0 errors
  • pnpm push の quality_gate (lint/test/build/rust-test) が全 PASS
  • takt pre-push-review (simplicity + security) が APPROVE
  • CI (GitHub Actions) PASS
  • CodeRabbit review で重大な findings なし

Summary by CodeRabbit

  • ドキュメンテーション
    • タスク管理ワークフローを拡張し docs/todo3.md を追加、運用ルールと「attempted/current/stuck」フローを定義
    • 新セッション時は3ファイルを参照する旨を明記
    • 実行優先度表を再編成(スケールを1–24へ再採番)、複数タスクの再配分と順位更新
    • ポーリングのレート制限対策や検出・検証フロー等、5件の進行中タスクを追加

PR #88 post-merge-feedback (.claude/feedback-reports/88.md) で生成された 7 件の
finding のうち、ユーザー判断により #1-5 を採用、#6-7 を見送り。

採用 finding (5 件):
- T1 #1 (順位 5): Stop hook の `pnpm lint:md` 統合 — XS、順位 1 完了済の gap closure
- T1 #2 (順位 6): AI 生成一時スクリプト pattern の pre-push 検出 — Small、順位 1 と関連
- T2 #3 (順位 13): `vitest` を devDependencies に固定 — Small
- T2 #4 (順位 12): `cli-pr-monitor` ポーリング延長 + 重複起動ロック — Medium、★ rate-limit critical
- T2 #5 (順位 14): `pnpm create-pr` 必須引数ヘルプ改善 — Small

見送り finding:
- T3 #6: hook 統合時の commit 分割基準 → グローバルルール (~/.claude/) 編集は permission denied、要別経路
- T3 #7: jj rebase conflict 解消手順 → 同上

変更:
- docs/todo3.md 新設 (todo2.md が 50KB に到達したため、PR #88 以降の新規エントリは todo3.md へ)
- docs/todo.md 推奨実行順序サマリーに 5 件を Tier 別に挿入し、20 → 24 タスクへ全 renumber
- 戦略テキストと cross-reference を全面更新
- todo2.md / todo3.md 内の 順位 N 参照を新採番へ追従
- 順位 1 (markdownlint hook 統合) は merged 済として削除参照を merged context に書き換え
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6c2e2778-46f4-4122-a819-244616de55b9

📥 Commits

Reviewing files that changed from the base of the PR and between 33ef4db and 5ef4acd.

📒 Files selected for processing (3)
  • docs/todo.md
  • docs/todo2.md
  • docs/todo3.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • docs/todo.md
  • docs/todo3.md
  • docs/todo2.md

📝 Walkthrough

Walkthrough

プロジェクトの課題管理ワークフローが2ファイル(docs/todo.md / docs/todo2.md)から3ファイルモデルへ拡張され、docs/todo3.md を新規追加。推奨実行順序表が全面的に再編成され、ランキングスケールが1–20から1–24へ再番号化され、複数タスクの優先度と割当先が更新されています。

Changes

Cohort / File(s) Summary
既存タスク一覧更新
docs/todo.md, docs/todo2.md
推奨実行順序表を再編成しランクスケールを1–20→1–24へ変更。多数のタスク優先度(ADR-030/ADR-031 等)と割当先の再配分、docs/todo.md 内の「新セッション」指示を全3ファイル参照に更新。リンク/broken-link 表現の文言更新。
新規タスクファイル追加
docs/todo3.md
新ファイル追加。運用ルール(報告状態・完了ルール等)を定義し、5件の進行中タスクを追加(pnpm lint:md Stopフック登録、pre-push AI-temp-filename 検出、vitest 固定化とStopフロー変更、cli-pr-monitor のポーリング間隔と重複起動防止、pnpm create-pr の引数検証と改善)。

Sequence Diagram(s)

(該当なし)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PRのタイトルは「docs(todo): PR #88 post-merge-feedback の Tier 1/2 finding を採用」で、PR概要に完全に対応しており、主な変更内容(PR #88のフィードバックからTier 1/2の5件のfindingを採用して推奨実行順序を更新する)を明確に示しています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/todo.md`:
- Line 49: The text "順位 1 (markdownlint hook 統合、merged 済)" on Line 49 is
inconsistent with the current table; update that phrase to either "旧順位1
(markdownlint hook 統合、merged 済)" or replace it with the actual current task name
used in the table so the reference matches; search for the exact string "順位 1
(markdownlint hook 統合、merged 済)" in docs/todo.md and edit it to use "旧順位1" or
the canonical task title used elsewhere to resolve the mismatch.

In `@docs/todo3.md`:
- Line 7: The link in docs/todo3.md points to a mutable Japanese heading anchor
(`todo.md#推奨実行順序サマリー`) that may break; add a stable anchor element (for example
`<a id="recommended-order-summary"></a>`) next to the corresponding heading in
docs/todo.md (place it immediately before the "推奨実行順序" section header), then
update the reference in docs/todo3.md to use the stable id
(`todo.md#recommended-order-summary`) so the cross-doc link remains valid even
if the heading text changes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 360ced5c-c70d-4729-a145-1d76c8c7662e

📥 Commits

Reviewing files that changed from the base of the PR and between 75f1646 and 33ef4db.

📒 Files selected for processing (3)
  • docs/todo.md
  • docs/todo2.md
  • docs/todo3.md

Comment thread docs/todo.md Outdated
Comment thread docs/todo3.md Outdated
Resolved findings:
- [Minor] docs/todo.md:49 順位参照の文言が現行テーブルと不整合です
- [Major] docs/todo3.md:7 見出しリンクのアンカーが壊れる可能性があります
@aloekun
Copy link
Copy Markdown
Owner Author

aloekun commented Apr 28, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 28, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@aloekun aloekun merged commit a2b25af into master Apr 28, 2026
1 check passed
@aloekun aloekun deleted the docs/feedback-88-tier1-2 branch April 28, 2026 14:35
aloekun added a commit that referenced this pull request Apr 28, 2026
Tier 2 #2 finding -> Tier 2 #1 finding に書き換え (case A)。
title "PR #89 T2-1" の Tier-local 番号と body の参照番号を統一。

参照: PR #90 CodeRabbit Minor finding (docs/todo3.md:298)
aloekun added a commit that referenced this pull request Apr 28, 2026
* docs(todo): PR #89 post-merge-feedback の Tier 1/2 finding を採用

PR #89 post-merge-feedback (.claude/feedback-reports/89.md) で生成された 4 件の
finding のうち、ユーザー判断により Tier 1/2 (#1, #2) を採用、Tier 3 (#3, #4) を
見送り (お願いベースのため Tier 1 対応で様子見)。

採用 finding (2 件):
- T1 #1 (順位 7): Markdown 非 ASCII GFM アンカー検出 lint rule — S、ADR-007 拡張
- T2 #2 (順位 14): post-pr-review に rate-limit 自動検出 + 再トリガーロジック — Medium、★ rate-limit critical

見送り finding:
- T3 #3: 可変テキスト見出しに明示アンカー必須ルール → Tier 1 #1 で決定論的に防止できる
- T3 #4: 表並び替え後の prose rank 参照 grep ルール → 順位 24 (採番管理 ADR) で構造的に解消予定

変更:
- docs/todo3.md に 2 タスク追記 (本ファイルでの新規追加は計 7 タスク)
- docs/todo.md 推奨実行順序サマリーを 24 → 26 タスクへ全 renumber
- 順位 7 (anchor lint) を Tier 1 末尾に挿入、順位 14 (rate-limit auto-trigger) を Tier 2 内 順位 13 (cli-pr-monitor polling) の隣に挿入
- 戦略テキストに rate-limit 改善の 3 層構造 (順位 4/13/14) を明記
- 順位 7 と順位 20 の二重防衛関係を sub-text に追記
- todo2.md cross-reference を全面更新 (sed bulk + 個別 fix)

PR #89 セッション知見:
- ADR-030 の soft-fail recovery (.failed marker + UserPromptSubmit hook) が Claude
  rate-limit interruption からの復旧で機能した実証
- takt 単独実行時の post-processing (report copy + marker 削除) は cli-merge-pipeline
  側責務で手動補完が必要 — 復旧手順 marker への追記が将来の改善ポイント

* fix(review): apply CodeRabbit fix for #90

Tier 2 #2 finding -> Tier 2 #1 finding に書き換え (case A)。
title "PR #89 T2-1" の Tier-local 番号と body の参照番号を統一。

参照: PR #90 CodeRabbit Minor finding (docs/todo3.md:298)
aloekun added a commit that referenced this pull request Apr 29, 2026
…Bundle 1) (#91)

* feat(lint): add PowerShell + Markdown anchor rules to ADR-007 layer

Bundle 1 (post-merge-feedback の旧順位 3 + 7 を 1 PR に統合):

- no-empty-powershell-catch (error): 空 `catch {}` ブロックでの swallowed error
  検出 (PR #85 T1-2 finding)
- no-silent-error-action (warning): `-ErrorAction SilentlyContinue` の検出
  (PR #85 T1-2 finding、片方単独 warning)
- no-mutable-anchor (warning): Markdown link の non-ASCII GFM fragment 検出
  (PR #89 T1-1 finding)

実装:
- .claude/custom-lint-rules.toml に 3 rule 追加
- src/hooks-post-tool-linter/src/main.rs に 13 unit test 追加
  (#7 の 4 edge case + ps1 / extension filter 全網羅)
- cargo test: 58 passed
- dogfood で 3 rule すべて発火確認

設計判断:
- ADR-007 既存 pattern (regex 層 / file 単位) に適合、ADR 更新不要
- #3 の "片方単独 warning / 組合せ error" spec は engine の per-line 設計で
  実現できないため、severity を rule 別に分離 (empty catch=error /
  SilentlyContinue=warning) で精神を保つ
- #7 は ADR-007 Q2 (string literal 誤検出) が borderline だが、MVP として
  regex 層採用。lookbehind 非対応のため backtick 内例は誤検出するが、
  task entry 削除で clean baseline 達成

Bundle 戦略 (post-merge-feedback ループ収束のため):
- 個別 PR なら 2 件 → 1 PR に統合 (50% 削減)
- summary table を 27 → 25 行に renumber、Tier breakdown 全更新

Closes feedback: PR #85 T1-2, PR #89 T1-1

* fix(lint): apply CodeRabbit findings on PR #91

PR #91 で受けた CodeRabbit findings 2 件を child commit として修正。

1. Major: PowerShell rule case-insensitivity (.claude/custom-lint-rules.toml:115-118)
   - PowerShell の `catch` keyword と `-ErrorAction` parameter は case-insensitive
     なので、`Catch {}` / `CATCH {}` / `-erroraction silentlycontinue` /
     `-ErrorAction SILENTLYCONTINUE` などの大文字バリアントは現 regex で見逃していた
   - 両 rule の pattern に Rust regex `(?i)` inline flag を追加して case-insensitive
     マッチに変更
   - test helper (ps_empty_catch_rule / ps_silent_error_rule) も同様に更新

2. Minor: docs/todo.md stale references (lines 68 / 250 / 264)
   - Bundle 1 の renumber (27 \u2192 25) で本文内の cross-reference が追従漏れ
   - line 68: `Tier 4 (順位 25/26)` \u2192 `24/25`
   - line 250: `Tier 5 (順位 26/26)` \u2192 `25/25`、`順位 25` \u2192 `順位 24`
   - line 264: `Tier 2 (順位 9/26)` \u2192 `7/25`、`順位 17 (ADR-032 PR-β)` \u2192 `順位 16`

実装 (TDD):
- 先に case-insensitive variant の 4 unit test を追加し、cargo test で FAIL を実証 (RED)
- (?i) flag 追加で GREEN \u2192 62 tests pass (旧 58 + 新 4)
- bad/good example も大文字混在ケースで影響なしを確認 (regex は (?i) 範囲)

順位 23 (todo.md 採番管理の簡素化 ADR 起案、PR #86 T3-3) で構造的解決予定。
本 fix は当面の対症療法として cross-ref を手作業で同期。

* fix(lint): detect multi-line empty catch blocks (file-level regex)

PR #91 の 2nd CodeRabbit review で指摘された Major finding を修正。

問題:
- run_custom_rules() が `for line in content.lines()` で行ごとに regex.find() を
  呼ぶ実装だったため、PowerShell 慣用形 `} catch {\n}` の複数行空ブロックが
  検出できなかった (no-empty-powershell-catch は error severity なのに false
  negative)。
- 既存パターン (console.log( / no-personal-paths / no-mutable-anchor 等) は
  すべて行内完結のため挙動変化なし。SilentlyContinue は \s+ で改行を跨ぎ得るが、
  PowerShell の backtick 行継続を含む正当な使用も検出対象として妥当。

修正:
- run_custom_rules() を file-level マッチに変更
  (`compiled.regex.find_iter(&content)` でファイル全体を走査)
- match の byte offset から改行カウントで line 番号を逆算
  (`content[..m.start()].bytes().filter(|b| *b == b'\n').count() + 1`)
- MAX_CUSTOM_VIOLATIONS の上限と既存テスト挙動はそのまま維持

実装 (TDD):
- ps_empty_catch_detects_multiline_block test を追加し RED 確認
  (既存実装で 0 件検出 → 1 件期待で FAIL)
- 修正後 GREEN \u2192 63 tests pass (旧 62 + 新 1)

* fix(lint): exclude external URLs from no-mutable-anchor (path `:` exclusion)

PR #91 の 3rd CodeRabbit review で指摘された Minor finding を修正。

問題:
- regex `\]\([^)#]*#[^\x00-\x7F)]+` は path 部に `:` を許容するため、
  `[link](https://example.com/#日本語)` のような外部 URL の fragment を
  GFM anchor と誤判定 (false positive)。
- 外部 URL の fragment は GFM anchor ではないため、warning rule の
  alert fatigue を招く。

修正:
- regex を `\]\([^)#:]*#[^\x00-\x7F)]+` に変更 (path 部から `:` を除外)。
  http(s):// を含む URL は path 部マッチで止まるため対象外になる。
- protocol-relative URL (`//example.com/...`) は `:` を含まないため除外
  できないが、Markdown 文書では稀なので許容。
- CodeRabbit 提案の negative lookahead は Rust regex 非対応なので、
  character class 否定 1 文字追加で同等効果を実現。

実装 (TDD):
- md_mutable_anchor_skips_external_url_with_fragment test を追加 → RED
  (`[spec](https://example.com/#日本語)` で 1 件検出 → 0 件期待で FAIL)
- pattern 修正後 GREEN \u2192 64 tests pass (旧 63 + 新 1)
aloekun added a commit that referenced this pull request Apr 29, 2026
* feat(adr): ADR-033 todo numbering simplification (試験運用)

PR #85/#86/#88/#89/#90/#91/Bundle 1 で連続発生した renumber 作業の構造的負債を
解消する ADR を起案。

問題:
- docs/todo.md の本文中 `順位 N` cross-reference が線形コストで増加
- PR #91 では 4 件追加に対し本文 8 箇所修正、過去 PR で stale reference の
  追従漏れによる CodeRabbit Minor 指摘が発生 (a15b263 で修正)
- 採番のみが情報源で、本文と表の往復が発生

決定 (選択肢 B 採用):
- 絶対番号 (`順位 N`) は推奨実行順序サマリー table のみに保持
- 本文での参照は task 名 (heading text or 略称) で行う
- table の `依存` 列のみ絶対番号を許可 (table 内なので renumber 同期可能)
- 「Tier N (順位 X/Y)」表記の `(順位 X/Y)` 部分は除去 → `Tier N` のみ残す

却下した選択肢:
- 選択肢 A (renumber script の自動化): 保守コスト新規発生、問題のすり替え
- 選択肢 C (現状維持): convergence loop の一因、線形増加は止まらない

本 commit は ADR と CLAUDE.md リンク追加のみ。本文 cross-ref の一括変換と
新規 entry template は次の commit で実施。

References:
- docs/adr/adr-013, adr-022, adr-028
- .claude/feedback-reports/86.md Tier 3 #3 (起案動機の起源)
- PR #91 a15b263 (stale reference 起因の Minor 指摘実例)

* refactor(docs): remove inline rank references from todo files

ADR-033 のガイドライン適用。docs/todo.md / todo2.md / todo3.md の本文中
`順位 N` cross-reference をすべて task 名参照に変換。

変更対象:
- docs/todo.md: 戦略 section の 12 箇所、Tier 4/5 entry の (順位 X/Y) 表記、
  週次レビュー entry の cross-ref
- docs/todo2.md: ADR-032 series の Phase ごと優先度表記、reviewer facet /
  各 Tier 1/2/3 entry の (順位 X/Y) と inline 参照
- docs/todo3.md: Stop hook lint:md / AI 生成一時スクリプト / cli-pr-monitor
  polling 延長 / post-pr-review rate-limit / .failed marker / Recovery 経路 /
  REJECT-ESCALATE entry の inline 参照を全て task 名に変換

維持した absolute number:
- docs/todo.md の推奨実行順序サマリー table の `順位` 列 (source of truth)
- table の `依存` 列の絶対番号 (table 内なので renumber と同期可能)
- table 内 cell の歴史的 `旧順位 N` 表記 (完了済み task の参照)

未変換の例外:
- docs/todo2.md line 696 の採番管理 ADR 元 entry の `(順位 24/26)` は
  本 PR の Commit 3 で entry 全体を削除するため未変換 (削除待ち)

検証:
```sh
grep -nE '順位 [0-9]+' docs/todo.md docs/todo2.md docs/todo3.md
# 期待: docs/todo.md table 列のみ + docs/todo2.md 採番管理 ADR 元 entry のみ
```

References:
- docs/adr/adr-033-todo-numbering-simplification.md (本 ADR の決定)

* docs(todo): remove completed numbering simplification ADR entry

ADR-033 land により採番管理簡素化 task が完了したため、運用ルール
(memory feedback_todo_no_history.md) に従い元 entry を削除する。

変更:
- docs/todo2.md: "todo.md 採番管理の簡素化 ADR 起案 (PR #86 T3-3)" entry
  全体 (40 行) を削除
- docs/todo.md summary table:
  - 旧順位 27 (採番管理 ADR) 行を削除
  - 旧順位 28 (ADR-030 Phase E/F) → 順位 27 に renumber
  - 旧順位 29 (ADR-030 takt-test-vc) → 順位 28 に renumber、依存表記の
    `順位 28 Phase F` も `順位 27 Phase F` に追従
  - サマリー header 日付ラベルを "Bundle 1 完了後" → "ADR-033 land 後" に更新

検証:
- 本文 cross-ref は Commit 2 で除去済のため、本 commit の renumber は
  table 行と `依存` 列のみで完結 (ADR-033 の効果を本 PR 内で実証)
- markdownlint pass (PostToolUse hook で各 Edit ごとに検証)

* fix(adr): apply CodeRabbit findings on PR #92

PR #92 で受けた CodeRabbit Minor findings 2 件を child commit として修正。
両 finding は self-consistent: Finding 1 の改善 regex が Finding 2 の placeholder
残存を機械的に検出可能になる。

1. Minor: ADR-033 line 111 の検証 regex が数値以外の placeholder を見逃す
   - 旧: `順位 [0-9]+` (数値のみマッチ)
   - 新: `順位 [0-9A-Za-z_-]+` (英字 placeholder `順位 X` / `順位 N` も検出)
   - 期待コメントも更新し、placeholder 検出意図を明記

2. Minor: docs/todo3.md line 511 (REJECT-ESCALATE entry の動機セクション) で
   `.claude/ filter (順位 X = T2-1+T3-2 Bundle)` という placeholder が残存
   - 旧: `.claude/ filter (順位 X = T2-1+T3-2 Bundle)`
   - 新: `.claude/ filter + ADR-030 制約明記 task (PR #91 T2-1 + T3-2 Bundle)`
   - ADR-033 「本文はタスク名参照」方針に準拠

検証 (改善 regex で 0 件達成):
```sh
grep -nE "順位 [0-9A-Za-z_-]+" docs/todo.md docs/todo2.md docs/todo3.md   | grep -vE "推奨実行順序サマリー|^[^:]+:[0-9]+:\| [0-9]+ \|"
# 結果: 0 行
```
aloekun added a commit that referenced this pull request Apr 30, 2026
PR #89 T2-1 の自動化。CodeRabbit が `Rate limit exceeded` コメントを投稿した
場合、reset 時刻 + 60s buffer まで sleep し `@coderabbitai review` を再投稿する。

## 実装

- check-ci-coderabbit: rate-limit comment を検出し reset 時刻を計算する
  `parse_rate_limit` を追加。`Please wait N minutes M seconds` の正規表現抽出 +
  ISO 8601 → unix epoch 秒の手動パース (chrono 依存追加なし)。

- cli-pr-monitor: poll loop に rate-limit retry ブランチを追加
  - `RateLimitConfig`: auto_retry_enabled (default true) + max_retries (default 3)
  - `state.rate_limit_retries`: 累積 retry 回数を state.json で persist
  - `state.rate_limit_last_retriggered_at`: dedup key (advisor 指摘対応)
  - `handle_rate_limit_retry`: sleep → gh pr comment 投稿 → counter++

## dedup の必要性 (advisor finding)

`comment_created_at` で dedup しないと、同一 rate-limit comment が iteration を
跨いで PR コメント一覧に残り、`(until_unix_secs - now).max(0) = 0` となって
即時 retrigger を繰り返す。結果 max_retries=3 が数秒で消費され誤って
`action_required` で抜ける。`rate_limit_last_retriggered_at` で同じ created_at
を skip し、CR が新しい rate-limit comment を投稿した時点で再度対象にする。

## テスト

- check-ci-coderabbit: rate-limit detection / parsing 11 tests 追加 (56 passed)
- cli-pr-monitor: poll dedup + state persistence 4 tests 追加 (116 passed)

## 完了タスク

- 順位 13 を docs/todo.md table から削除、todo3.md detail 削除
- 順位 19 (REJECT-ESCALATE) が rate-limit critical 系の最後の Tier 2 残
aloekun added a commit that referenced this pull request Apr 30, 2026
* feat(cli-pr-monitor): rate-limit 自動検出 + 再トリガーロジック (Phase 4 / 順位 13)

PR #89 T2-1 の自動化。CodeRabbit が `Rate limit exceeded` コメントを投稿した
場合、reset 時刻 + 60s buffer まで sleep し `@coderabbitai review` を再投稿する。

## 実装

- check-ci-coderabbit: rate-limit comment を検出し reset 時刻を計算する
  `parse_rate_limit` を追加。`Please wait N minutes M seconds` の正規表現抽出 +
  ISO 8601 → unix epoch 秒の手動パース (chrono 依存追加なし)。

- cli-pr-monitor: poll loop に rate-limit retry ブランチを追加
  - `RateLimitConfig`: auto_retry_enabled (default true) + max_retries (default 3)
  - `state.rate_limit_retries`: 累積 retry 回数を state.json で persist
  - `state.rate_limit_last_retriggered_at`: dedup key (advisor 指摘対応)
  - `handle_rate_limit_retry`: sleep → gh pr comment 投稿 → counter++

## dedup の必要性 (advisor finding)

`comment_created_at` で dedup しないと、同一 rate-limit comment が iteration を
跨いで PR コメント一覧に残り、`(until_unix_secs - now).max(0) = 0` となって
即時 retrigger を繰り返す。結果 max_retries=3 が数秒で消費され誤って
`action_required` で抜ける。`rate_limit_last_retriggered_at` で同じ created_at
を skip し、CR が新しい rate-limit comment を投稿した時点で再度対象にする。

## テスト

- check-ci-coderabbit: rate-limit detection / parsing 11 tests 追加 (56 passed)
- cli-pr-monitor: poll dedup + state persistence 4 tests 追加 (116 passed)

## 完了タスク

- 順位 13 を docs/todo.md table から削除、todo3.md detail 削除
- 順位 19 (REJECT-ESCALATE) が rate-limit critical 系の最後の Tier 2 残

* fix(cli-pr-monitor): CodeRabbit 指摘 (PR #97) 反映 + 誤混入 lock 削除

- handle_rate_limit_retry の log format 修正: retry={}/{} の 2 番目に
  rl.until_unix_secs (unix 秒) が渡されていたバグ。max_retries に修正。
  以前は "retry=1/1735689600" のような意味不明な出力になっていた。
- RateLimitConfig の parse test 追加 (defaults + custom)。既存
  config_fix_defaults / config_fix_custom と同パターンで網羅。
- 前 commit で誤って snapshot された .claude/pr-monitor.lock を削除
  (.gitignore 追加は後続 commit で実施)。

* fix(cli-pr-monitor): CodeRabbit round 2 指摘 (PR #97) 反映 + .gitignore 整備

CR review @ commit e7b8d49 で検出された 3 Major + 1 Nitpick を修正。

## 修正内容

### Finding 1 (Major): parse_rate_limit に push_time フィルタ追加
過去セッションの rate-limit comment を新セッション開始時に誤って拾うバグを修正。
`comment.created_at >= push_time` フィルタを追加し、parse_new_comments / parse_findings
と同じ規則に揃える。これにより本 PR 検証中に観測された 22 分遅延の根因の一つが解消される。

### Finding 2 (Major): parse_new_comments で rate-limit comment 除外
rate-limit comment が new_comments にカウントされると `decide()` が action_required
を早期 return し、poll.rs の rate-limit retry 経路に入らずに監視終了するバグ。
"Rate limit exceeded" を含む comment を新規コメント集計から除外する。22 分遅延のもう
一つの根因。

### Finding 3 (Major): write_state 失敗時の自動 retry 停止
retrigger 後の state 永続化に失敗すると、次 iteration で `rate_limit_retries` と
`rate_limit_last_retriggered_at` の復元に失敗し、dedup と max_retries が壊れて
`@coderabbitai review` 重複投稿の可能性がある。失敗時は action_required で抜ける。

### Finding 4 (Nitpick): docs/todo.md 順位 絶対参照削除
ADR-033 の「絶対番号は table のみに保持」原則に従い、Bundle W/X 説明文から
`(順位 34)` `(順位 35)` 等の絶対参照を削除しタスク名参照に置換。

### .gitignore: pr-monitor.lock 除外
cli-pr-monitor の重複起動防止 lock file (PR #88 / #96 で導入) が .gitignore
漏れで PR snapshot に混入する事故を防ぐ。

## テスト

- check-ci-coderabbit: 59 tests pass (rate_limit_filters_out_past_session_comments,
  rate_limit_includes_comment_at_exact_push_time, comments_excludes_rate_limit を追加)
- cli-pr-monitor: 118 tests pass
- clippy + fmt clean (変更パッケージ)

* fix(cli-pr-monitor): CodeRabbit round 3 指摘 (PR #97) 反映

CR review @ commit 79b7c3d で検出された 3 Major + 1 Minor のうち
Finding 1 (updated_at) を除く 3 件を修正。

## 修正内容

### Finding 2 (Major): rate-limit sleep を max_duration で cap
`handle_rate_limit_retry` に `remaining_monitor_secs` 引数を追加し、
sleep が監視残り予算を超える場合は Err を返して retry を停止する。
これまでは max_duration を素通りして 30 分超ブロックする可能性があった。

### Finding 3 (Major): handle_rate_limit_retry を Result 化
gh pr comment 投稿失敗 / PR 番号未確定の場合に retries++ や
last_retriggered_at 更新を実施しないよう、関数を Result<(), String> に
変更。caller は Ok 時のみ dedup key を更新し、Err 時は action_required
で抜ける。これにより失敗 retrigger が dedup で perma-skip 化する
silent failure を防ぐ。

### Finding 4 (Minor): docs/todo.md 第2層 PR 参照に #96 追記
"(PR #88 T2-4、完了済)" → "(PR #88 T2-4 / #96、完了済)" に履歴整合。

## テスト追加 (2 件)

- rate_limit_retry_returns_err_when_sleep_exceeds_budget:
  remaining=60s だが sleep=600s 必要なケースで Err を返し state 不変を確認
- rate_limit_retry_returns_err_when_pr_number_missing:
  PR 番号未確定で Err を返し state 不変を確認

## 未対応 (任意)

Finding 1 (updated_at): CR が rate-limit comment を編集する挙動は実観測なし。
将来的な堅牢性向上のため todo 化候補。

* fix(check-ci-coderabbit): rate-limit 計算を updated_at 基準に変更 (PR #97 round 3 Finding 1 実観測対応)

CR が rate-limit comment を編集して wait 時間を更新するケースが本 PR の dogfood で
実観測された (created_at=2026-04-30T11:11:51Z, updated_at=2026-04-30T14:38:32Z で
"wait 21 minutes" に編集)。created_at 基準だと reset 時刻を 3 時間以上前として誤算定し、
premature retrigger → CR 再 rate-limit → comment edit のループに陥る危険があった。

## 修正内容

- GhComment に updated_at フィールドを追加
- rate_limit_event_time(): updated_at fallback created_at を返すヘルパー追加
- parse_rate_limit: 計算基準を event_time に変更 (フィルタ / sort / until 計算)
- RateLimitInfo.comment_created_at: 値の意味を「event_time」に拡張 (フィールド名は維持)
- state.rs RateLimitState.comment_created_at の doc 更新

## テスト追加 (3 件)

- rate_limit_uses_updated_at_when_present:
  実観測ケース (created_at != updated_at) で updated_at 基準計算を確認
- rate_limit_falls_back_to_created_at_when_updated_at_missing:
  既存挙動の後方互換性を確認
- rate_limit_edited_comment_yields_new_dedup_key:
  編集前後で dedup key が変化することを確認 (新 wait 時間で再 trigger 可能)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant