Skip to content

feat(takt+hooks): Bundle Z Phase 2 — 制約付き fix instruction (#B-β) + todo follow-ups#103

Merged
aloekun merged 3 commits into
masterfrom
feat/bundle-z-phase-2
May 3, 2026
Merged

feat(takt+hooks): Bundle Z Phase 2 — 制約付き fix instruction (#B-β) + todo follow-ups#103
aloekun merged 3 commits into
masterfrom
feat/bundle-z-phase-2

Conversation

@aloekun
Copy link
Copy Markdown
Owner

@aloekun aloekun commented May 3, 2026

Summary

docs/pipeline-token-efficiency.md の「PR 2: Bundle Z Phase 2 — #B-β 単独」を実装。fix step の self-check を LLM 判断ではなく 機械的指標の diff 比較 に置き換える決定論層を構築する。pre-fix と post-fix を関数単位で比較し、nesting depth / function length / non-doc comment count のいずれかが増加した場合に fix の override 判断 / refactor を促す。

副次的に 2 件の post-merge-feedback follow-up docs commit を同梱 (パイプライン改善完了までは PR 数を最小化する方針)。

Commits

Commit 内容
vosquypp docs(todo): PR #101 post-merge-feedback の Tier 1/2 finding 採用 (順位 47-49) + todo5.md 新設
nkksmwyv docs(todo): PR #102 post-merge-feedback Tier 1 #1 を採用 (順位 50)
pxzkpzxu feat(takt+hooks): Bundle Z Phase 2 - 制約付き fix instruction (#B-β)

Phase 2 (#B-β) 実装の要点

hooks-post-tool-comment-lint-rust crate に --metrics <file> モード追加

  • tree-sitter で function_item を walk、name / line range / max nesting depth を抽出
  • non-doc comment count は 既存 ALLOWED_LINE_PREFIXES / ALLOWED_BLOCK_PREFIXES (PR feat(hooks): Bundle Z Phase 1 - Rust comment lint hook + 計画書再編 #99) を流用 (single source of truth、fix.md と lint hook で例外マーカー定義が乖離しない)
  • JSON 出力で scripts/fix-metrics-check.ps1 が消費
  • 13 件の新規 unit test (空 file / 単純 / nested / match / closure / trait method / 関数長 / JSON serialization 等)

scripts/fix-metrics-check.ps1 新規追加

  • jj file show -r @- で pre-state を temp file に取得 (default revset @-、引数で指定可)
  • helper exe を pre / post 両方に対して --metrics モードで起動
  • 関数を name で突き合わせ、length / max_nesting_depth の増加を検出
  • file-level non_doc_comment_count の増加も検出
  • 終了コード: PASS=0 / FAIL=1 (JSON violations) / SKIPPED=0 (新規 file) / 環境エラー=2

.takt/facets/instructions/fix.md に "Pre-completion deterministic check" セクション追加

  • .rs 修正 file で helper 起動を指示
  • exit 1 時は refactor (extract function / early return / match flatten / guard) を優先、override は ## Work results### Metrics override 見出しで根拠記載
  • exit 2 (infra error) は fix 完了を block しない (環境問題なので surface のみ)
  • 新規 file は metrics_check: skipped で扱われ block しない (Rust 限定 PoC、markdown / yaml / pwsh は scope 外)

v1 (PoC) の意図的 scope 外 (docs/pipeline-token-efficiency.md PR 2 参照)

  • change-site 周辺への scope 絞り込み: file 全体 + 関数単位の比較で代用 (実装 cost 高、Phase 3 dogfood 後に再検討)
  • Rust 限定: 将来言語拡張時に metric tool を再評価
  • 関数 rename 追跡: name match のみ、rename は新規扱い (鎖切れリスクあるが PoC では許容)

実装中に発見したハマりポイント

  • Windows + 日本語ロケールで & jj file show の UTF-8 stdout が PowerShell によって Shift-JIS と解釈され、日本語コメントが mojibake → tree-sitter parser が早期失敗 (435 行のソースから 1 関数しか発見しない症状) を観測。helper script 冒頭で [Console]::OutputEncoding = UTF8 を明示設定して回避。

Test plan

  • crate test: 37 passed (24 既存 + 13 新規)
  • helper script PASS case (@- baseline、変更なし) → exit 0, metrics_check: pass
  • helper script FAIL case (master 比較で main 関数 42→48) → exit 1, JSON violations
  • helper script SKIP case (新規 file = master に存在しない) → exit 0, metrics_check: skipped
  • markdownlint clean (新規 / 修正 markdown)
  • dogfood (本 PR merge 後 1〜2 PR で fix step が deterministic check を実行し、誤 reject 率 / override 率を観測)
  • Phase 3 (#B-γ) 着手判断は Phase 2 dogfood 完了後 (docs/pipeline-token-efficiency.md PR 計画通り)

参照

Summary by CodeRabbit

リリースノート

  • New Features

    • コード品質監視のための自動メトリクス チェック機能を追加しました。
  • Documentation

    • ワークフロー指示書を更新し、メトリクス確認プロセスを明確化しました。
    • 内部タスク管理システムの運用ルールを整理し、スケーラビリティを向上させました。

aloekun added 3 commits May 3, 2026 20:35
…-49) + todo5.md 新設

- 順位 47 (Tier 1): `>` vs `>=` boundary inconsistency lint rule
- 順位 48 (Tier 1): 関数長スケーリング検出 oxlint rule
- 順位 49 (Tier 2): `parse_findings` 系の error-path test infrastructure (Bundle a Sub-PR 2)
- todo5.md を新設 (todo4.md が 50KB 到達のため、新規エントリ移行先)
- todo.md ヘッダを todo5.md 言及に更新
PR #102 post-merge-feedback で提案された 4 件のうち Tier 1 #1 のみ user 判断で採用:

- comment-lint hook の scope を「変更行のみ」に限定する設計修正
- PR #102 セッション中に観測した 'pre-existing 20 violations が edit のたびに flag される'
  問題への対応 (hook の file-level scan の設計問題)

todo.md の推奨実行順序サマリーに 順位 50 (Tier 1, Effort M) として追加し、
todo5.md に詳細エントリ (動機・設計決定 2 案・作業計画・完了基準・詰まっている箇所) を記載。

Bundle Z Phase 2 (#B-β) 着手前に解消することを推奨 (Phase 2 で fix.md / helper script を
編集する際に同じ block 問題が再発するため)。

参照: .claude/feedback-reports/102.md Tier 1 #1
fix step の self-check を LLM 判断ではなく機械的指標の diff 比較に置き換える決定論層を実装。
fix が introduce した新規 violation (nesting / function 長 / non-doc comment 数の増加) を
構造的に検出し、LLM に override / refactor 判断を促す。

実装要素:
- hooks-post-tool-comment-lint-rust crate に '--metrics <file>' モード追加
  - tree-sitter で function_item を walk、name / line range / max nesting depth を抽出
  - non-doc comment count は既存 ALLOWED_*_PREFIXES (PR #99) を流用 (single source of truth)
  - JSON 出力で scripts/fix-metrics-check.ps1 が消費
  - 13 件の新規 unit test (空 file / 単純 / nested / match / closure / trait / 関数長 等)
- scripts/fix-metrics-check.ps1 新規追加
  - jj file show -r @- で pre-state 取得、temp file 経由で metrics 算出
  - 関数を name で突き合わせ、length / max_nesting_depth の増加を検出
  - file-level non_doc_comment_count の増加も検出
  - PASS / FAIL (exit 1, JSON violations) / SKIPPED (新規 file) / infrastructure error (exit 2)
  - Windows + 日本語ロケールで jj UTF-8 stdout が Shift-JIS 解釈される問題を回避するため
    [Console]::OutputEncoding = UTF8 を明示設定 (実装中に発覚した mojibake → tree-sitter 早期失敗)
- .takt/facets/instructions/fix.md に Pre-completion deterministic check セクション追加
  - 各 .rs 修正 file で helper 起動を指示
  - exit 1 時は refactor 優先、override は Metrics override 見出しで根拠記載
  - exit 2 (infra error) は fix 完了を block しない (環境問題なので surface のみ)

v1 (PoC) の意図的な scope 外 (docs/pipeline-token-efficiency.md PR 2 参照):
- change-site 周辺への scope 絞り込み (file 全体 + 関数単位の比較で代用)
- Rust 限定 (将来言語拡張で別 metric tool 評価)
- 関数 rename 時の追跡 (name match のみ、rename は新規扱い)

参照: docs/pipeline-token-efficiency.md PR 2 (Bundle Z Phase 2)、PR #99 (Phase 1)
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 3, 2026

📝 Walkthrough

Walkthrough

このPRは、Rustファイルのメトリクス回帰を検出するための決定論的チェック基盤を追加し、同時にタスク管理ドキュメントを再整理します。PowerShellスクリプトがjjを経由してpre状態を取得し、メトリクス実行ファイルに対してpre/post状態の差分を比較する仕組みが導入されます。

Changes

メトリクス回帰チェック基盤

レイヤー / ファイル 概要
ワークフロー指示
.takt/facets/instructions/fix.md
修正後の決定論的メトリクスチェック実行フロー、終了コードの解釈(refactor要否判定、Metrics overrideドキュメント、スキップ対象)、新規ファイル・非Rust言語の除外ルールを明記。
メトリクス計算実装
src/hooks-post-tool-comment-lint-rust/src/main.rs
--metricsモードを追加。Tree-sitterのAST走査により、非ドキュメントコメント数、関数ごとの行数、最大ネスト深度を計測するcompute_metricscount_non_doc_comments、関数収集・ネスト深度計算ロジックを実装。
メトリクス検証スクリプト
scripts/fix-metrics-check.ps1
PowerShellヘルパースクリプト。jjで指定revisionのpre状態を取得、メトリクス実行ファイルをpre/post両方で実行し、コメント数・関数長・ネスト深度の増加を検出。JSON結果を出力し終了コード(0/1/2)で結果を通知。
テスト・検証
src/hooks-post-tool-comment-lint-rust/src/main.rs(lines 619–740)
メトリクス計算モードの単体テスト。空ファイル、コメント計数、関数追跡、ネスト深度(各構造体での挙動)、JSON直列化を確認。

タスク管理ドキュメント再整理

レイヤー / ファイル 概要
ファイル位置付け更新
docs/todo.md, docs/todo4.md
todo5.mdを新規タスク追加先として追加。既存todo.md~todo4.mdは編集・完了削除専用に整理。新セッションでは5つすべてのファイルを確認することを明文化。
新規タスク記録
docs/todo5.md
Part 5として新規に作成。現在進行中4つのTierタスク(時刻境界lint rule、関数長oxlint rule、parse_findingsエラーパステスト基盤、comment-lint hookのスコープ制限)の詳細、関連PR、完了基準、作業計画を記録。

Sequence Diagram

sequenceDiagram
    participant Dev as 開発者
    participant Script as fix-metrics-check.ps1
    participant JJ as Jujutsu<br/>(バージョン管理)
    participant Metrics as メトリクス<br/>実行ファイル
    participant JSON as JSON結果

    Dev->>Script: FilePath指定、実行
    Script->>JJ: jj file show `@-` で<br/>pre状態を取得
    JJ-->>Script: pre状態の内容
    Script->>Metrics: pre状態ファイルで<br/>メトリクス計算
    Metrics-->>Script: pre JSON結果
    Script->>Metrics: post状態ファイル<br/>(現在のFilePath)で<br/>メトリクス計算
    Metrics-->>Script: post JSON結果
    Script->>Script: コメント数、関数長、<br/>ネスト深度を比較
    alt メトリクス増加
        Script->>JSON: fail結果<br/>(violations含む)
        JSON-->>Dev: exit code 1
    else メトリクス安定
        Script->>JSON: pass結果
        JSON-->>Dev: exit code 0
    else エラー/スキップ
        Script->>JSON: skipped/error<br/>結果
        JSON-->>Dev: exit code 2/0
    end
    Script->>Script: temp cleanup、<br/>encoding復元
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 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 The pull request title clearly and specifically describes the main change: implementing Bundle Z Phase 2 with a deterministic fix instruction (#B-β), which is the primary objective reflected in the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 84.62% which is sufficient. The required threshold is 80.00%.
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.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

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: 3

🤖 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 90: The body currently repeats absolute ranking numbers (順位 47/48/49) at
Line 90 in todo.md; update the prose to use relative phrasing (e.g., "これらの項目" or
"上記の高頻度項目") and remove the explicit absolute numbers from the paragraph,
ensuring that the canonical absolute rankings remain only in the table per
ADR-033; keep the table entries unchanged but reference them from the text
generically so the table is the single source of truth.

In `@scripts/fix-metrics-check.ps1`:
- Around line 91-92: The code currently pipes $preJson and $postJson into
ConvertFrom-Json without error handling; wrap the two conversions in a try/catch
so that any JSON parse failure logs or emits the same metrics_check:error and
exits with code 2. Specifically, try to perform "$pre = $preJson |
ConvertFrom-Json; $post = $postJson | ConvertFrom-Json" inside a try block, and
in the catch block call whatever emits the metric ("metrics_check:error") and
call "exit 2" to match the existing behavior used elsewhere.
- Around line 65-73: Change the broad "jj file show" failure path so only the
case where the file truly does not exist in the given revset returns
metrics_check: "skipped"; instead validate the revset first (e.g. run "jj log -r
$PreStateRevset -- $relFilePath" or otherwise probe the revset) and if that
validation fails with an infrastructure/revset error return exit code 2 and emit
the jj output, but if the validation shows the file is absent then emit the
existing skipped JSON and exit 0; also guard the ConvertFrom-Json call (the
metrics exe output) with a try/catch or a pre-validation step so invalid JSON
causes a controlled exit code 2 and an explanatory log rather than throwing an
unhandled exception.
🪄 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: a912cd4c-5666-46ca-98d9-f90bb5d2e9dd

📥 Commits

Reviewing files that changed from the base of the PR and between c06aece and cb6ebe3.

📒 Files selected for processing (6)
  • .takt/facets/instructions/fix.md
  • docs/todo.md
  • docs/todo4.md
  • docs/todo5.md
  • scripts/fix-metrics-check.ps1
  • src/hooks-post-tool-comment-lint-rust/src/main.rs

Comment thread docs/todo.md
Comment on lines +65 to +73
$preContent = & jj file show -r $PreStateRevset -- $relFilePath 2>&1
if ($LASTEXITCODE -ne 0) {
Write-Output (@{
metrics_check = "skipped"
reason = "jj file show -r $PreStateRevset -- $relFilePath failed (file may be new in this revision)"
jj_output = ($preContent -join "`n")
} | ConvertTo-Json -Depth 4)
exit 0
}
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot May 3, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
target="$(fd -t f --glob '*.rs' | head -n1)"
pwsh -NoProfile -File scripts/fix-metrics-check.ps1 "$target" '@@invalid_revset@@'
echo "exit=$?"
# 期待: exit=2(現状は 0 になる可能性あり)

Repository: aloekun/claude-code-hook-test

Length of output: 424


🏁 Script executed:

fd -t f -name "fix-metrics-check.ps1"

Repository: aloekun/claude-code-hook-test

Length of output: 304


🏁 Script executed:

fd fix-metrics-check.ps1

Repository: aloekun/claude-code-hook-test

Length of output: 103


🏁 Script executed:

cat -n scripts/fix-metrics-check.ps1

Repository: aloekun/claude-code-hook-test

Length of output: 6511


jj file show の失敗を一律 skipped にすると環境異常を見落とします

行 66-73 の現在の実装では、revset が不正な場合や jj の一時障害でも exit 0 (metrics_check: skipped) となり、本来は exit 2 で通知すべき環境エラーを品質ゲートが通過させてしまいます。「ファイルが該当 revset に存在しない」場合のみ skip にし、revset 不正などのインフラエラーは exit 2 で分岐してください。

提案された jj log による revset 事前検証で対応できます:

修正イメージ
+        $revCheck = & jj log -r $PreStateRevset --no-graph -T 'commit_id' 2>&1
+        if ($LASTEXITCODE -ne 0) {
+            Write-Output (@{
+                metrics_check = "error"
+                reason        = "invalid pre_state_revset: $PreStateRevset"
+                jj_output     = ($revCheck -join "`n")
+            } | ConvertTo-Json -Depth 4)
+            exit 2
+        }
+
         $preContent = & jj file show -r $PreStateRevset -- $relFilePath 2>&1
         if ($LASTEXITCODE -ne 0) {
             Write-Output (@{
                 metrics_check = "skipped"
                 reason        = "jj file show -r $PreStateRevset -- $relFilePath failed (file may be new in this revision)"
                 jj_output     = ($preContent -join "`n")
             } | ConvertTo-Json -Depth 4)
             exit 0
         }

また、行 91-92 の ConvertFrom-Json はガードされていないため、metrics exe の出力が不正 JSON の場合は終了コードが 2 ではなく例外になります。可能であれば try-catch で wrap するか、exe 出力の妥当性チェックを追加してください。

🧰 Tools
🪛 PSScriptAnalyzer (1.25.0)

[warning] Missing BOM encoding for non-ASCII encoded file 'fix-metrics-check.ps1'

(PSUseBOMForUnicodeEncodedFile)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/fix-metrics-check.ps1` around lines 65 - 73, Change the broad "jj
file show" failure path so only the case where the file truly does not exist in
the given revset returns metrics_check: "skipped"; instead validate the revset
first (e.g. run "jj log -r $PreStateRevset -- $relFilePath" or otherwise probe
the revset) and if that validation fails with an infrastructure/revset error
return exit code 2 and emit the jj output, but if the validation shows the file
is absent then emit the existing skipped JSON and exit 0; also guard the
ConvertFrom-Json call (the metrics exe output) with a try/catch or a
pre-validation step so invalid JSON causes a controlled exit code 2 and an
explanatory log rather than throwing an unhandled exception.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

resolved: jj file list で pre-state 存在を 2 段階判定し、環境エラーは exit 2 に分離 (wlswkkvr commit, lines 65-85)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
cat -n scripts/fix-metrics-check.ps1 | sed -n '60,95p'

Length of output: 1564


@aloekun、現在のブランチ(feat/bundle-z-phase-2)上の scripts/fix-metrics-check.ps1 を確認しましたが、Lines 65–73 は元の実装のままになっています:

$preContent = & jj file show -r $PreStateRevset -- $relFilePath 2>&1
if ($LASTEXITCODE -ne 0) {
    Write-Output (@{
        metrics_check = "skipped"
        reason        = "jj file show -r $PreStateRevset -- $relFilePath failed ..."
        jj_output     = ($preContent -join "`n")
    } | ConvertTo-Json -Depth 4)
    exit 0
}

jj file list による 2 段階判定は反映されていないようです。コミット wlswkkvr がまだプッシュされていない、あるいは別ブランチに存在する可能性があります。プッシュ後にご確認ください。

Comment thread scripts/fix-metrics-check.ps1
@aloekun aloekun merged commit e62a26e into master May 3, 2026
1 check passed
@aloekun aloekun deleted the feat/bundle-z-phase-2 branch May 3, 2026 13:12
aloekun added a commit that referenced this pull request May 3, 2026
…-ups) (#104)

* docs(todo): PR #103 セッション知見から順位 51 を追加 — review-diff.txt iter 間 refresh

PR #103 push の実観測で takt pre-push-review が 6-iter outlier (22m 50s) を発生させ、
うち iter 3+4 の ~10 分が wasted (stale review-diff.txt による false positive 'persists')。
supervisor の live Read で打開されたが、構造的制約として残存。

post-merge-feedback の Tier 3 #1 (snapshot semantics の ADR 化) は順位 51 land で
obsolete になるため skip、Tier 3 #2 (fix scope clarity) は coding-style.md 既存ルールと
重複のため skip。機構で塞ぐ実装層対策のみ採用 (Tier 1, Effort M)。

todo.md table に順位 51 を追加し、todo5.md に詳細エントリ (動機・設計決定 2 案・
作業計画・完了基準) を記載。

* feat(hooks): comment-lint hook scope を変更行に限定 (順位 50 / PR #102 T1-1)

Edit tool の new_string 出現位置から変更行 range を導出し、その範囲外の
pre-existing violations を flag しないよう scope を絞る。

変更前は `hooks-post-tool-comment-lint-rust` がファイル全体を scan する
設計のため、PR #102 セッション中に poll.rs / monitor.rs / feedback.rs /
main.rs への 1 行追加レベルの edit でも pre-existing 20 violations が
毎回 flag され、hook 出力 12.6KB の繰り返しで token 浪費 + scope creep
への暗黙圧力が発生していた (Tier 1 #1)。

実装方針 (Approach 3 / advisor 推奨):
- Edit (non-empty new_string): post-edit source 内で new_string の出現を
  全件検索 → 各 match の行 range の union を filter として使用
- Edit (empty new_string): 純削除につき lint skip
- Write / MultiEdit / 不明 tool: フィルタなし (whole-file lint)
- new_string が見つからない (line ending mismatch 等): 安全側に倒し
  whole-file lint にフォールバック

MultiEdit は v1 では未対応 (whole-file lint にフォールバック)。利用頻度
が低く no-regression な現状維持で十分なため、follow-up とする。

検証:
- 60 unit tests pass (cargo test)
- cargo clippy -- -D warnings clean
- 手動統合テスト: pre-existing comments を含むファイルへの Edit (line
  3 のみ変更) → line 3 のみ flag、line 1/4 の pre-existing は除外 ✓
- 純削除 (new_string="") → 出力なし (lint skip) ✓
- Write tool → whole-file (3 violations) ✓
- 多行 new_string → 範囲が複数行に展開され正しく filter ✓

* docs(todo): 順位 50 完了に伴い削除 + 順位 52 (MultiEdit follow-up) 追加

順位 50 (comment-lint hook の scope を変更行に限定) を実装完了 (前 commit) に
伴い、todo.md 表と todo5.md 詳細エントリを削除。v1 では MultiEdit が whole-file
fallback (no-regression) で残るため、Tier 3 follow-up として 順位 52 を新規登録。

* fix(review): apply CodeRabbit fixes for #104

Resolved findings:
- [Critical] src/hooks-post-tool-comment-lint-rust/src/main.rs:152 `locate_string_line_ranges` 関数が UTF-8 文字境界を破壊し、パニックを引き起こす可能性があります
- [Minor] src/hooks-post-tool-comment-lint-rust/src/main.rs:221 複数行 block comment が変更範囲内でも検出漏れします
aloekun added a commit that referenced this pull request May 4, 2026
… 59/60 + ADR-035/036/037) (#108)

* docs(todo): 順位 59 (ADR-035 docs 評価ポリシー / PR #107 T3-1) を追加

PR #107 post-merge-feedback の Tier 3 #1 採用に伴い、docs/todo.md 表と
todo5.md 詳細を追加。

- 順位 59 (Tier 3, M): ADR-035 docs 評価ポリシー
  - docs-only 変更への code review criteria 誤適用を排除する global policy
  - review-security.md の既存 trust boundary criterion を ADR で集約
  - review-simplicity.md / analyze-coderabbit.md にも一貫展開
  - false REJECT 削減 + 開発体験劣化抑制

判定根拠 (順位 58 で導入した rubric ベース):
- Severity Medium / Frequency Medium / Effort M / Adoption Risk None / ✅ 採用

* docs(efficiency): docs-pr-iteration-efficiency.md を新規作成

docs-only PR の iteration 改善に関する task 分類・bundle 案を集約する index
を docs/ に新規追加。各 task の作業詳細は docs/todo*.md 系列に置き、本ファイル
は概要 + リンクに留める設計。

掲載内容:
- 現状の課題 / ボトルネック分析 (5 観点)
- 改善 task 分類 (HIGH / MEDIUM / LOW IMPACT、合計 12 順位)
- 推奨 bundle 案 (Bundle 'docs PR streamline' = 順位 59+31+32 を最優先)
- 関連ドキュメント (todo.md / pipeline-token-efficiency.md / ADR-019/027/035)

役割: 試験運用 (bundle が消化されたら役割を終える計画書)。pipeline-token-
efficiency.md と並列の領域特化計画書として機能する。

動機: 本セッションで 「docs-only PR の iteration 改善に当たる task をピック
アップしてほしい」「毎回この情報を調べるのは手間」 とのユーザー要望に対応。
分析結果を再調査せず参照可能にする。

* docs(efficiency): coderabbit-monitoring-efficiency.md を新規作成

CodeRabbit 監視機能改善 (rate-limit 自動回復) に関する task 分類・bundle 案
を集約する index を docs/ に新規追加。各 task の作業詳細は docs/todo*.md
系列に置き、本ファイルは概要 + リンクに留める設計。

掲載内容:
- 現状の課題 (CodeRabbit 無課金 = 1 時間 3 reviews 上限、47 分 rate-limit
  で auto-retry がバウンスする致命点)
- ボトルネック分析 (6 観点: 長時間 rate-limit / polling 負荷 / silent loss /
  structured findings / 自動 trigger 信頼性 / ポリシー暗黙化)
- 改善 task 分類 (HIGH / MEDIUM / LOW IMPACT、合計 9 順位)
- 推奨 bundle 案 (Bundle 'CR auto-monitoring core' = 順位 53/54/55、
  Bundle 'CR rate-limit auto-retry robustness' = 順位 42/43/46/49)
- 推奨実行順序: 53 → 42-43-46-49 → 54 → 55 (1 と 2 は並行可)
- 関連ドキュメント (ADR-009/018/019/034、todo.md、pipeline-token-
  efficiency.md、docs-pr-iteration-efficiency.md)

役割: 試験運用 (bundle 消化後に役割終了)。pipeline-token-efficiency.md /
docs-pr-iteration-efficiency.md と並列の領域特化計画書として機能。

動機: 本セッションで 'CodeRabbit の監視機能改善に関する task をピックアップ
してほしい'、'毎回この情報を調べるのは手間' とのユーザー要望に対応。

* docs(retire): pipeline-token-efficiency.md retire — ADR-036/037 化 + 順位 60 移管 + 削除

PR #97 セッション起源の計画書 docs/pipeline-token-efficiency.md (481 行) を
役割完了として retire。重要な設計決定は ADR に永続保存し、残作業 1 件のみを
todo に移管した上で計画書ファイル本体を削除する。

新規 ADR (2 件):
- ADR-036: Bundle Z 3 層アーキテクチャ
  - 決定論層 (#B-α PR #99/#105) → 制約付き修正 (#B-β PR #103)
    → 異常検知レビュアー (#B-γ PR #106) の 3 層スタック設計
  - 'upper layer skips what lower layer catches' 原則
  - 二重 miss 対策 (Calibration: avoid over-narrowing) を残置
- ADR-037: takt fix-trust shortcut (convergence_verdict 機構)
  - post-pr-review / pre-push-review の fix step が
    'convergence_verdict: fully_resolved' で COMPLETE 直行する設計
  - 'LLM が出した結果を後段で再検証しない' 原則
  - Honesty constraint で安全網 bypass リスク管理

ADR-034 更新:
- #D-4 (Claude 応答スタイル簡素化) を ❌ 不採用 に確定 (2026-05-04 ユーザー判断)
  Bundle Z Phase 2/3 完了後の再評価で副作用観測手段確立が見えないため
  永続的に見送り。潜在 2.5-4M tokens 削減は採用しない
- '将来の検討事項' から #D-4 再評価条件セクションを削除
- pipeline-token-efficiency.md への参照を '(削除済)' に annotate

順位 60 新規登録 (旧 #A-3、唯一の残作業):
- analyze-session の transcript filter 絞り込み (Tier 3 / M)
- input range を PR 作成 commit〜merge に限定し input token 30-50% 削減

ファイル削除:
- docs/pipeline-token-efficiency.md (481 行) を削除
  内容は git log で復元可能、主要設計は ADR-036/037 に集約

参照更新 (5 ファイル):
- docs/coderabbit-monitoring-efficiency.md: 関連リンクから dead link
  削除、ADR-036/037 を追加
- docs/docs-pr-iteration-efficiency.md: 同上
- docs/todo4.md: 順位 41 (Bundle Y2 効果定量計測) は動機失効を明記
  (Bundle Z 完成 + Z2 不採用)、本格着手前にユーザー判断要。
  順位 44/45 の参照を '(削除済)' に annotate
- docs/todo5.md: 順位 51 の参照を ADR-036 に置換
- CLAUDE.md: ADR-036 / ADR-037 を index に追加

動機:
ユーザー方針 '本当に必要な決定事項はADRに残し、不要になったTodoファイルや
作業計画のファイルは定期的に削除' に従い、計画書 retire の標準パターンを
本セッションで確立。今後類似の '計画書' (試験運用フラグ付き docs/) は
役割完了時に同パターンで retire する。

* fix(todo): 順位 41 entry の retire 済前提と旧フロー文言の不整合を解消 (#108 CR Minor)

CodeRabbit が PR #108 review で 'outside diff range comment' として指摘した
docs/todo4.md 順位 41 (Bundle Y2 効果定量計測) の line 371/378 残存問題を修正。

- 削除: 'Line 371: 想定削減量達成判定に基づき計画書 retire / 追加 Bundle 提案'
  (計画書はすでに retire 済のため、retire 判定ステップが矛盾)
- 削除: 'Line 378: Bundle Z / Z2 の ROI 判断材料として活用可能なデータが揃う'
  (Bundle Z は完成、Bundle Z2 = #D-4 は不採用で本目的の役割消滅)
- 修正: '結果を本 todo entry 内 (もしくは新規 ADR) に記録 — 旧計画は ...'
  → '結果を本 entry または新規 ADR に記録 (= 完了)' に簡素化

判定対象を「本 entry/ADR への記録完了」に統一し、retire 済前提との整合を確保。

備考 (別観察): 本指摘は CodeRabbit が 'outside diff range comment' として
review body 内に含めて投稿したため、inline comment 前提の takt
analyze-coderabbit step では 0 findings 判定 (= 検出漏れ) となった。
takt analyzer の coverage gap として将来の post-merge-feedback で扱う。
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