Skip to content

feat(takt): Bundle Z Phase 3 — #B-γ reviewer 異常検知 + #C-2 fix-trust 連帯 (PR 3) - #106

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

feat(takt): Bundle Z Phase 3 — #B-γ reviewer 異常検知 + #C-2 fix-trust 連帯 (PR 3)#106
aloekun merged 3 commits into
masterfrom
feat/bundle-z-phase-3

Conversation

@aloekun

@aloekun aloekun commented May 3, 2026

Copy link
Copy Markdown
Owner

Summary

Summary by CodeRabbit

リリースノート

  • Documentation

    • レビュー指示を異常検知ベースに書き換え(セキュリティ・単純化の判定手順を明確化)
    • ワークフロー用の収束(Convergence)ガイドを追加し、最終判定の出し方と誠実性要件を追記
    • 進捗表およびTODOにテスト/レポート列の拡張や新タスクを追加
  • Chores

    • レビュー→完了のフローに収束判定ショートカットを導入(部分/完全判定で遷移を制御)

aloekun added 2 commits May 4, 2026 05:14
- 順位 57: Aggregation cap integration test (PR #105 T2-1 採用、Tier 2 / S) —
  collect_all_violations の MAX_VIOLATIONS contract を test 化、将来の lint
  追加時の truncate 削除 regression を防止
- 順位 58: post-merge-feedback findings table format 拡張 (Tier 2 / S) —
  Severity / Frequency / Adoption Risk / Recommendation 必須列化、AI 採用
  判定を rubric ベースで安定化、卻下根拠の言語化

PR #105 post-merge-feedback の他 7 件 (T1-1/2/3, T2-2/3, T3-1, T3-2) は採用
見送り (低頻度 + 高実装コスト / NLP 必要 / 過剰一般化 / 重複ルール 等)。
…B-γ + #C-2)

決定論層 (Phase 1 #B-α + Phase 2 #B-β) を通過した状態を前提に、reviewer の責務を
「lint で防げない高次違反のみ flag」 に再定義し、fix step 報告に基づく Iter 3
短絡を追加する。

#B-γ reviewer 役割変更:
- review-simplicity.md: 7 criteria enumerate 義務を削除、anomaly detection モードに転換
  - 決定論層 intercept 項目 (comment policy / function length / function metrics)
    を skip
  - 異常検知 criteria: Unexplained complexity / Inconsistent style / Dead-on-arrival
    code / Hidden coupling / Missing failure paths / Non-obvious magic values
  - DRY/YAGNI scope guards は維持
  - 'Calibration: avoid over-narrowing' セクションで二重 miss リスク対策
- review-security.md: vulnerability checklist を memory aid に格下げ、anomaly mode を
  primary entry point に
  - concrete exploit path 要件を強化 (input control / what becomes possible)
  - docs-only trust boundary criterion は維持

#C-2 fix-trust 連帯:
- fix.md: Convergence verdict セクション追加 (REQUIRED)
  - persists==0 AND misdirected==0 → 'convergence_verdict: fully_resolved'
  - else → 'convergence_verdict: partial'
  - 'Honesty constraint' で安全網 bypass リスクを明示
- post-pr-review.yaml + pre-push-review.yaml: fix step rules に新 condition 追加
  - fully_resolved → COMPLETE 直行 (analyze/reviewers 再実行 skip)
  - partial → analyze/reviewers (既存挙動)
  - Unable to proceed → supervise (既存挙動)

期待効果:
- attention drift 問題消滅 (検出対象が absolute に narrow に)
- 1-iter ALL APPROVE 率 90% 超 (決定論層で大半 intercept)
- review 所要時間短縮 (1m30s〜3m → 30s〜1m 期待)
- post-pr-review 3-iter outlier を 2-iter に圧縮 (~3 分削減/run)

進捗管理 (docs/pipeline-token-efficiency.md):
- #C-3 / #A-2 / #B-β を 'Completed' に更新
- #B-γ / #C-2 を '実装中' (本 commit) に更新

リスク対策:
- 二重 miss: reviewer の anomaly mode に 'Calibration: avoid over-narrowing' を残置
- 自己評価信頼性: fix.md の 'Honesty constraint' で fully_resolved を慎重に emit
  するよう明示
@coderabbitai

coderabbitai Bot commented May 3, 2026

Copy link
Copy Markdown

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: dffb2bdb-934a-4a3a-ad3d-9ccf83f9ec87

📥 Commits

Reviewing files that changed from the base of the PR and between 2c40b18 and 23ba468.

📒 Files selected for processing (1)
  • .takt/facets/instructions/review-simplicity.md

📝 Walkthrough

Walkthrough

レビュープロセス指示を「異常検知」フローへ書き換え、fix ステップの完了判定に convergence_verdict マーカーと簡潔なメトリクス表記を導入。ワークフローはこのマーカーに基づき短絡/再ループを決定。進捗・TODO 文書を更新。

Changes

収束ゲートと異常検知レビューの導入

Layer / File(s) Summary
指示フレームワーク更新(収束ゲート)
.takt/facets/instructions/fix.md
Convergence gate セクションを追加。報告末尾にメトリクス行と convergence_verdict: fully_resolved または convergence_verdict: partial の単一行出力を必須化し、誠実性制約を明記。
セキュリティレビュー:方針変更(Anomaly mode)
.takt/facets/instructions/review-security.md
チェックリスト型から「セキュリティ異常検知」フローへ移行。所見は具体的な exploit path を要求し、diff を通読→候補の exploitability 検証という手順を追加。判定手順をブロッキング基準中心に再構成。
簡潔性レビュー:方針変更(Anomaly mode)
.takt/facets/instructions/review-simplicity.md
固定チェックリストを廃し、diff-first の異常検知ワークフローへ。determinism 層で既保証のチェックは重複しない指示、DRY/YAGNI を実行コードに限定、blocking/non-blocking 判定と REJECT ルールを導入。
ワークフロー条件分岐更新
.takt/workflows/post-pr-review.yaml, .takt/workflows/pre-push-review.yaml
fix ステップの成功条件を convergence_verdict ベースに差し替え。fully_resolved かつ persists: 0misdirected: 0COMPLETE に短絡。partial は再解析/レビューへ戻す。既存の supervise ルートは維持。
進捗・TODO ドキュメント更新
docs/pipeline-token-efficiency.md, docs/todo.md, docs/todo5.md
進捗表の状態・採用日・完了PR 更新および TODO に (1) MAX_VIOLATIONS の集約キャップ統合テスト案、(2) post-merge-feedback findings テーブルへ Severity / Frequency / Adoption Risk / Recommendation 列を必須化する拡張案を追加・記載。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20分

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 タイトルはフェーズ3の主要な2つの機能(#B-γ異常検知と#C-2 fix-trust連帯)を適切に反映し、変更内容と一致している。
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
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 @.takt/facets/instructions/review-simplicity.md:
- Around line 32-35: 「Scope
constraint」セクションが差分のみを確認するよう厳格に指示していますが、同じセクションで言及している"hidden
coupling"の裏取りを不可能にするため、そこを矛盾なく修正してください。具体的には、"Scope
constraint"の文言を緩めて「原則として差分のみをレビューするが、hidden couplingに関する疑義がある場合は当該シンボル('hidden
coupling'で参照される定義や直接参照先)のみに限定して関連ファイルと定義を追跡して裏取りしてよい」旨を追加・置換してください。これにより"hidden
coupling"の確認手順(差分外の直接参照定義の限定追跡)を明示し、矛盾を解消します。

In `@docs/todo.md`:
- Around line 72-73: The two new task rows you added (titles "Aggregation cap
integration test (PR `#105` T2-1 採用)" and "post-merge-feedback findings table
format 拡張 (Severity / Frequency / Adoption Risk / Recommendation を必須列化)") were
created in the wrong document; remove these detailed rows from this summary file
and instead add them to the dedicated todo5 document as full tasks, and in this
file keep only a compact reference/summary line pointing to the dedicated todo5
entry so the summary stays read-only.
🪄 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: d872fb3c-f804-4668-8357-61541dfab328

📥 Commits

Reviewing files that changed from the base of the PR and between 01ba32f and 2c40b18.

📒 Files selected for processing (8)
  • .takt/facets/instructions/fix.md
  • .takt/facets/instructions/review-security.md
  • .takt/facets/instructions/review-simplicity.md
  • .takt/workflows/post-pr-review.yaml
  • .takt/workflows/pre-push-review.yaml
  • docs/pipeline-token-efficiency.md
  • docs/todo.md
  • docs/todo5.md

Comment thread .takt/facets/instructions/review-simplicity.md
Comment thread docs/todo.md
Comment on lines +72 to +73
| 57 | 🔧 Tier 2 | **Aggregation cap integration test (PR #105 T2-1 採用)** | todo5.md | S | なし (`collect_all_violations` の MAX_VIOLATIONS contract を test 化、将来の lint 追加時に `truncate(MAX)` 削除 regression を防止する explicit 安全網) |
| 58 | 🔧 Tier 2 | **post-merge-feedback findings table format 拡張 (Severity / Frequency / Adoption Risk / Recommendation を必須列化)** | todo5.md | S | なし (PR #105 評価で Effort + Rationale のみでは AI 採用判定が安定しないことを確認、rubric ベースの format 固定化で評価コスト削減 + 卻下根拠の言語化) |

@coderabbitai coderabbitai Bot May 3, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

新規タスクの追加先がずれています。

このファイルの運用ルールでは新規タスクは追加しない前提なので、72-73行の追加は役割と衝突しています。実体は docs/todo5.md に置いて、ここは参照用サマリーに留めてください。

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

In `@docs/todo.md` around lines 72 - 73, The two new task rows you added (titles
"Aggregation cap integration test (PR `#105` T2-1 採用)" and "post-merge-feedback
findings table format 拡張 (Severity / Frequency / Adoption Risk / Recommendation
を必須列化)") were created in the wrong document; remove these detailed rows from
this summary file and instead add them to the dedicated todo5 document as full
tasks, and in this file keep only a compact reference/summary line pointing to
the dedicated todo5 entry so the summary stays read-only.

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.

本 finding は採用しません。docs/todo.md の運用ルール「新規タスクは追加しない」は task body (詳細セクション) を todoN.md (現在 todo5.md) に置く規約で、priority table 行の追加は既存運用です (順位 1-56 すべて同パターン、本 PR の 順位 57/58 もユーザー指示で同様に追加)。文言の曖昧性自体は既知で、順位 32 (★ Bundle V) として「docs/todo.md ヘッダの「新規タスクは追加しない」表記を実態整合 (PR #95 T3-3)」が登録済み。本 PR では変更せず、順位 32 の land 時に文言を更新します。

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@aloekun、ご説明ありがとうございます。理解しました。docs/todo.md の「新規タスクは追加しない」は task body(詳細セクション)todoN.md に置く規約であり、priority table 行の追加は既存運用(順位 1〜56 すべて同パターン)に則ったものですね。今回の 順位 57/58 の追加は正しい操作です。

文言の曖昧性は順位 32(★ Bundle V)の land 時に整合される予定とのこと、承知しました。


✏️ Learnings added
Learnt from: aloekun
Repo: aloekun/claude-code-hook-test PR: 106
File: docs/todo.md:72-73
Timestamp: 2026-05-03T20:41:26.405Z
Learning: In the repository aloekun/claude-code-hook-test, docs/todo.md has a header saying "新規タスクは追加しない" (don't add new tasks), but this rule applies only to task body/detail sections (which go into todoN.md, currently todo5.md). Adding new rows to the priority summary table at the top of docs/todo.md IS the established convention — all rows 1-56 follow this pattern. The wording ambiguity is tracked as item `#32` (Bundle V, PR `#95` T3-3) to be fixed when that task lands.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: aloekun
Repo: aloekun/claude-code-hook-test PR: 64
File: docs/adr/adr-022-automation-responsibility-separation.md:128-128
Timestamp: 2026-04-21T09:08:59.321Z
Learning: For Markdown linting in this repository, do not treat MD038 (no-space-in-code) as an error for lines inside fenced code blocks (```...``` or ~~~...~~~). MD038 is intended for inline backtick code spans, so lint warnings should only be enforced outside fenced code blocks.

Finding #1 (Major / .takt/facets/instructions/review-simplicity.md:35):
'Hidden coupling' を anomaly criteria に残しつつ cross-file 全面禁止すると
裏取り不可能で矛盾する指摘 (resolved)。Scope constraint を softening し、
limited cross-file lookups を anomaly verification 目的に限定して許可する。
findings 自体は依然 diff hunk traceable のまま。

Finding #2 (Minor / docs/todo.md:73): reject。docs/todo.md の運用ルール
'新規タスクは追加しない' は task body 追加禁止で、priority table 行追加は
既存運用 (順位 32 で既知の文言整合タスクとして登録済) のため本 PR では
変更しない。
@aloekun

aloekun commented May 4, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 4, 2026

Copy link
Copy Markdown
✅ 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 1adcc7e into master May 4, 2026
1 check passed
@aloekun
aloekun deleted the feat/bundle-z-phase-3 branch May 4, 2026 03:08
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 で扱う。
aloekun added a commit that referenced this pull request Jun 8, 2026
…除) (#199)

* feat(cli-pr-monitor): PastTime newtype + proptest for parse_iso8601/from_parts (Bundle W)

Bundle W (順位 34 PBT + 順位 35 PastTime newtype) を Tier 1 として独立 land。
PR #96 で実証された Finding D class (saturating_sub silent semantic mismatch) を
型層で再発不能化し、proptest で regression net を確立。

## 順位 35: PastTime newtype

src/cli-pr-monitor/src/lock.rs に PastTime { epoch_secs, captured_now } を導入。
`from_iso8601_now` / `from_parts` で「parse 成功 + then <= now」の 2 ステップを
construction に閉じ込め、`age_secs()` が常に非負となる invariant を構造的に保証。

旧 `parse_age_secs(iso8601) -> Option<i64>` は削除し、`read_fresh_lock` を
PastTime ベースに refactor。public API への影響なし (lock module 内 closure)。

## 順位 34: proptest properties

src/cli-pr-monitor/Cargo.toml の [dev-dependencies] に proptest = "1" を追加。
lock.rs の #[cfg(test)] mod proptests に 5 properties を記述:

- P1 past_time_age_is_correct_when_in_past: then <= now で age_secs == now - then
- P2 past_time_rejects_future: then > now で必ず None (Finding D 直接対応)
- P3 parse_iso8601_never_panics: 任意 string で panic しない
- P4 parse_iso8601_rejects_pre_epoch_year: year < 1970 を必ず reject
- P5 parse_iso8601_accepts_well_formed: 有効範囲内の正規 ISO 8601 を必ず accept

PastTime 単体 unit test 4 件 (accepts_past / accepts_equal / rejects_future /
accepts_unix_epoch_origin / rejects_far_future_year_9999) も追加。

実行時間: cargo test -p cli-pr-monitor lock:: で 0.04s (todo4.md 完了基準
「pre-push pipeline +1 秒以内」を充足)。

## 依存解除

Bundle W は元来「順位 19 (REJECT-ESCALATE) land 後着手」とユーザー指示があったが、
順位 19 自身が Status update 2026-06-06 で「5-10 PR baseline 観測フェーズ」に移行
した結果、Tier 1 → Tier 2 の priority inversion + 待機解除タイミング未定でデッド
ロックに近い状態だった。

依存解除の根拠 (advisor 検証済):
- ADR-037 (fix-trust shortcut, PR #106 land): `convergence_verdict: fully_resolved`
  で COMPLETE 直行 → iteration が verdict ベースで有限化、無限 loop 経路は解消済
- ADR-043 (fail-closed 原則, PR #194 land): security/quality gate の semantic を構造化
- PR #194 (mechanical gate 強化): merge 前の検証層を拡充

これにより PBT 由来の test 失敗を fix loop が処理しきれず暴走する旧懸念は解消済。
docs/todo-summary.md 順位 34 row および docs/todo4.md 順位 34 実行優先度行に
依存解除の根拠を明記。

## scope 外

- Finding E (concurrency race): proptest は data generation には強いが thread
  interleaving 網羅は苦手 (todo4.md 詰まっている箇所に既記載)。Bundle X
  (順位 36 cargo-mutants + 順位 37 stress runner) に委譲
- 派生プロジェクト deploy 計画: Bundle W land 後の別 task として todo 登録予定

## 完了確認

- cargo build -p cli-pr-monitor: 成功
- cargo test -p cli-pr-monitor lock::: 23 passed (proptest 5 + PastTime 4 + 既存 14)
- cargo clippy -p cli-pr-monitor --all-targets -- -D warnings: clean

Refs: 順位 34, 35 (todo-summary.md), todo4.md Bundle W entries

* docs(todo): Bundle W (順位 34 + 35) land 完了に伴い削除
aloekun added a commit that referenced this pull request Jun 8, 2026
…nd で代替経路実現済、PR #194-後 8 runs で escalation 候補 0 件

PR #199 (Bundle W) session 内合意 (ユーザー指示 2026-06-07): 「A の PR マージまで進ん
だら、B. 順位 19 自体の Tier 再評価 のタスク化を進める」を実行し、実測値に基づき
(C) retire を決定。

## 決定根拠 (empirical data)

PR #194 (mechanical gate 強化) land 後の takt run logs を集計:

| Run | iteration 上限到達 | supervise step 到達 | escalation 候補 |
|---|---|---|---|
| 8 runs (pre-push-review 7 + post-pr-review 1) | 0/8 | 0/8 | 0/8 |

REJECT-ESCALATE が解決するはずの「iteration 上限到達 + supervise/fix_supervisor の
無限ループ」が **PR #194 land 以降 1 件も観測されていない**。代替経路で十分実用に
耐えていることが定量的に確認できた:

- ADR-037 (fix-trust shortcut、PR #106 land): `convergence_verdict: fully_resolved` で
  COMPLETE 直行 → iteration が verdict ベースで有限化
- ADR-043 (fail-closed 原則、PR #194 land): security/quality gate semantics 構造化
- PR #194 (mechanical gate 強化): merge 前 clippy + 空 commit sweep の決定論層追加

## 変更内容

- docs/todo3.md: 順位 19 entry block を削除 (-46 行)
- docs/todo-summary.md: table から 順位 19 row を削除 (-1 行)

順位 19 を gate にしていた Tier 1 (旧 順位 34/35) は既に PR #199 で priority
inversion 解除済のため、本 retire で残るブロッキングはない。

## 関連 PR / ADR

- PR #199 (Bundle W、priority inversion 解除)
- ADR-037 fix-trust shortcut
- ADR-043 Security/Quality Gate Fail-Closed 原則
- PR #194 mechanical gate 強化 (clippy + 空 commit sweep)
aloekun added a commit that referenced this pull request Jun 9, 2026
…-1/T3-2 採用 (#200)

* feat(cli-docs-lint): priority_inversion validator — Tier 1→Tier 2 依存を機械検知

PR #199 (Bundle W) で実観測した「Tier N が Tier N+k に依存 + 待ち先 Tier N+k 自身が
観測フェーズ」パターンを cli-docs-lint に validator 化。決定論的検出層で Claude 判断
介入なし (`feedback_pipeline_over_rules.md` 適用)。

## 実装

- `src/cli-docs-lint/src/priority_inversion.rs` (新規): todo-summary.md table を parse し
  - 順位/Tier 抽出 (`parse_row`, `parse_tier`)
  - 依存記述から 順位 NN 参照を抽出 (`extract_referenced_ranks`、複合 `順位 NN/MM` 対応)
  - 「なし」プレフィックスで context note を排除 (`has_no_dependency_prefix`)
  - 依存先 Tier > 自分の Tier かつ resolved-marker なしを violation 化
- `src/cli-docs-lint/src/lib.rs`: `priority_inversion` module を export
- `src/cli-docs-lint/src/main.rs`: `--check priority-inversion` mode + `all` 経路統合 +
  help / describe_mode に追記

## resolved-marker 設計

依存記述内で「順位 NN ... land 済 / 完了 / retired / 採用昇格済」が 80 char window
以内に現れる場合 resolved 扱い (= inversion check skip)。「land 済 (2026-06-07)」のような
日付付きマーカーや「Bundle X land 済」のような bundle-level マーカーをカバー。

## 性能 (F-2 対応、pre-push reviewer non-blocking finding)

`parse_tier` / `extract_referenced_ranks` の regex は `std::sync::LazyLock<Regex>` で
module 初期化時に 1 度だけ compile (per-row 再 compile を回避)。既存 codebase の
OnceLock 利用 (cli-pr-monitor) と整合する std::sync::* family。

## テスト fixture 設計 (F-3 対応、pre-push reviewer non-blocking finding)

`check_content_skips_when_referenced_rank_missing_from_table` テストの fixture を
`"順位 19 land 後推奨"` (resolved-marker 非含有) に変更。missing-rank 経路を厳密に
exercise する形に修正し、将来 fixture に rank 19 行を追加した際の test 経路 silent
shift (missing-rank → resolved-marker) を防止。

## prefix-match 防御 (pre-push takt-fix で auto 補正)

`has_resolved_marker_after` に `c.is_ascii_digit()` ガードを追加し、`"順位 19"` が
`"順位 195"` 等の prefix match で誤検出するバグを防止。専用 unit test 追加。

## テスト & dogfood

- 38 unit tests pass (priority_inversion 18 + preamble 9 + cross_ref 11)
- 現 docs/todo-summary.md に対し 0 violations (false positive なし)
- pnpm lint:docs OK (preamble + cross-ref + priority-inversion)

## 統合

- `pnpm lint:docs` 経由で `--check all` 実行時に自動実行
- `.claude/cli-docs-lint.exe` rebuild + deploy 済 (release profile)
- ADR-039 試験運用パターン継承 (kill-switch `CLI_DOCS_LINT_DISABLE=1`、3-5 PR dogfood
  後に default-ON 昇格 / 却下を判定)

* docs(todo): 順位 19 (REJECT-ESCALATE) retire — ADR-037/043 + PR #194 land で代替経路実現済、PR #194-後 8 runs で escalation 候補 0 件

PR #199 (Bundle W) session 内合意 (ユーザー指示 2026-06-07): 「A の PR マージまで進ん
だら、B. 順位 19 自体の Tier 再評価 のタスク化を進める」を実行し、実測値に基づき
(C) retire を決定。

## 決定根拠 (empirical data)

PR #194 (mechanical gate 強化) land 後の takt run logs を集計:

| Run | iteration 上限到達 | supervise step 到達 | escalation 候補 |
|---|---|---|---|
| 8 runs (pre-push-review 7 + post-pr-review 1) | 0/8 | 0/8 | 0/8 |

REJECT-ESCALATE が解決するはずの「iteration 上限到達 + supervise/fix_supervisor の
無限ループ」が **PR #194 land 以降 1 件も観測されていない**。代替経路で十分実用に
耐えていることが定量的に確認できた:

- ADR-037 (fix-trust shortcut、PR #106 land): `convergence_verdict: fully_resolved` で
  COMPLETE 直行 → iteration が verdict ベースで有限化
- ADR-043 (fail-closed 原則、PR #194 land): security/quality gate semantics 構造化
- PR #194 (mechanical gate 強化): merge 前 clippy + 空 commit sweep の決定論層追加

## 変更内容

- docs/todo3.md: 順位 19 entry block を削除 (-46 行)
- docs/todo-summary.md: table から 順位 19 row を削除 (-1 行)

順位 19 を gate にしていた Tier 1 (旧 順位 34/35) は既に PR #199 で priority
inversion 解除済のため、本 retire で残るブロッキングはない。

## 関連 PR / ADR

- PR #199 (Bundle W、priority inversion 解除)
- ADR-037 fix-trust shortcut
- ADR-043 Security/Quality Gate Fail-Closed 原則
- PR #194 mechanical gate 強化 (clippy + 空 commit sweep)

* docs(todo): post-merge-feedback T2-1/T3-2 採用 — 順位 197/198 追加

PR #199 (Bundle W) の post-merge-feedback report (.claude/feedback-reports/199.md)
で analyzer が ✅ 採用候補とした 2 件を、ユーザー承認 (2026-06-08) を経て
docs/todo*.md 系列に登録する。

## 順位 197: hooks-session-start orphan age 計算に proptest 追加 (T2-1)

Bundle W (PR #199) で `cli-pr-monitor::lock` に PastTime newtype + proptest properties を
導入し、`saturating_sub` silent semantic mismatch (Finding D) を構造的に排除した。
同じ bug class が `src/hooks-session-start/src/main.rs:236` の orphan age 計算
(`now_unix.saturating_sub(start_unix)`) にも存在し、clock rewind / future timestamp で
age=0 → orphan reaper が「young」判定でスキップ → `.failed` marker 未生成 → ADR-030
L2 recovery 停止という具体的 failure chain が確認済。Bundle W の pattern を
hooks-session-start に展開する。

- Tier 2 / Effort M / Severity High / Frequency Medium / Adoption Risk None
- proptest 1.x は既存 dev-dependencies、新規依存追加は hooks-session-start のみ

## 順位 198: ADR-NNN Timestamp invariant safety (T3-2)

PR #96 Finding D + PR #199 Bundle W で同型 bug class が 2 件観測 (Frequency Medium)。
「時刻計算における silent failure class と型レベル防御」を永続化し、派生プロジェクト
(techbook-ledger / auto-review-fix-vc) への transferability を確保する ADR を新設。

- Tier 3 / Effort M / Severity Medium / Frequency Medium / Adoption Risk None
- 順位 135 codified placeholder policy 適用 (ADR 番号は land 時 PR で確定)
- CLAUDE.md ADR list 追記

## 変更ファイル

- docs/todo10.md: 順位 197/198 詳細 entry を 2 セクション追加
- docs/todo-summary.md: table に順位 197/198 行を追加

* fix(cli-docs-lint): priority_inversion の resolved-marker window を char-based 化 (CR Major #1)

PR #200 CodeRabbit review で指摘された Major finding を修正。

## Bug

`has_resolved_marker_after` の window 計算が以下の 2 点で spec とズレていた:

1. **byte vs char**: `(abs_pos + RESOLUTION_WINDOW_CHARS)` は **byte** 演算。日本語 1 文字 = 3 bytes
   なので「80 文字 window」のつもりが実質 ~27 文字 window に縮退
2. **window 開始位置**: `&haystack[abs_pos..]` で needle (順位 NN) 自体を window に含めていた。
   spec は「順位参照の **直後** から N 文字以内」

具体 failure 例 (CR review 提示):
- `"順位 19" + "あ"*40 + " land 済"` で、marker "land 済" は char-distance 41 (window 80 内)
- 旧 byte-based: 80 bytes window は ~26 chars のみカバー → marker 圏外 → resolved 扱いされず
  → **false negative (= inversion 誤検出 → reviewer に noise)**

## Fix

```rust
let window_end = haystack[after..]
    .char_indices()
    .nth(RESOLUTION_WINDOW_CHARS)
    .map(|(i, _)| after + i)
    .unwrap_or(haystack.len());
let window = &haystack[after..window_end];
```

- 起点を `after` (needle 直後) に変更
- `char_indices().nth(N)` で N 文字目の byte offset を取得 → char-based window

不要になった `next_char_boundary` ヘルパー関数を削除。

## Test

regression test 追加 (`is_resolved_detects_marker_across_multibyte_gap`):
- `"順位 19" + "あ".repeat(40) + " land 済"` で resolved 判定が true になることを assert
- 旧実装ではこの test は fail する (byte window で marker 圏外)

## Doc update

`RESOLUTION_WINDOW_CHARS` の doc に「**文字数** (バイト数ではない)」を明記。
multi-byte でも spec 通り動作することを comment で保証。

## 検証

- cargo test -p cli-docs-lint: 19 priority_inversion tests pass (新規 regression 1 含む)
- cargo clippy -p cli-docs-lint --all-targets -- -D warnings: clean
- pnpm lint:docs: OK (preamble + cross-ref + priority-inversion)
- .claude/cli-docs-lint.exe rebuild + deploy 済

Refs: CR comment on PR #200 (src/cli-docs-lint/src/priority_inversion.rs:182)
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