Skip to content

refactor(cli-pr-monitor): poll/mod.rs + fix_commit.rs を 800 行以下に分割 (PR-W2) - #224

Merged
aloekun merged 2 commits into
masterfrom
pr-w2-pr-monitor-split
Jun 28, 2026
Merged

refactor(cli-pr-monitor): poll/mod.rs + fix_commit.rs を 800 行以下に分割 (PR-W2)#224
aloekun merged 2 commits into
masterfrom
pr-w2-pr-monitor-split

Conversation

@aloekun

@aloekun aloekun commented Jun 28, 2026

Copy link
Copy Markdown
Owner

file_length enforcement Phase 1。mechanical refactor、behavior 不変、test count 不変。

  • stages/poll/mod.rs (1404) → 6 module (mod 257 / iteration 365 / rate_limit 588 / rate_limit_signal 464 / review_recheck 428 / review_recheck_signal 313)
  • fix_commit.rs (972) → fix_commit/ dir module (mod 16 / description 140 / abandon 428 / sweep 398)

全 file ≤ 800。tests は所属 module へ co-locate、helper は per-module 複製。
外部 API (crate::fix_commit::*, crate::stages::poll::{run_poll_loop, PollResult}) は再エクスポートで温存。

docs/file-length-enforcement-plan.md: fix_commit.rs 削除に伴う broken link を fix_commit/ へ repoint (docs-lint 追従)。

検証: cargo test -p cli-pr-monitor = 205 passed / 0 failed / 12 ignored (baseline 一致)、cargo clippy --workspace -- -D warnings = clean。

PR size は mechanical refactor のため PR_SIZE_CHECK_OVERRIDE で通過 (順位 151 の想定 use case)。

Summary by CodeRabbit

  • New Features
    • PRモニタリングの1イテレーション処理を整理し、監視継続・停止・タイムアウト判定をより分かりやすくしました。
    • レート制限中/解除後の待機通知に、次回起床時刻などの情報を反映できるようになりました。
    • fix(review): 系の空コミットをPR範囲で自動的に整理する機能を追加しました。
  • Bug Fixes
    • 条件に合わない空コミットや誤再配置のリスクを減らすため、判定のガードを強化しました。

…R-W2)

file_length enforcement Phase 1。mechanical refactor、behavior 不変、test count 不変。

- stages/poll/mod.rs (1404) → 6 module (mod 257 / iteration 365 / rate_limit 588 / rate_limit_signal 464 / review_recheck 428 / review_recheck_signal 313)
- fix_commit.rs (972) → fix_commit/ dir module (mod 16 / description 140 / abandon 428 / sweep 398)

全 file ≤ 800。tests は所属 module へ co-locate、helper は per-module 複製。
外部 API (crate::fix_commit::*, crate::stages::poll::{run_poll_loop, PollResult}) は再エクスポートで温存。

docs/file-length-enforcement-plan.md: fix_commit.rs 削除に伴う broken link を fix_commit/ へ repoint (docs-lint 追従)。

検証: cargo test -p cli-pr-monitor = 205 passed / 0 failed / 12 ignored (baseline 一致)、cargo clippy --workspace -- -D warnings = clean。

PR size は mechanical refactor のため PR_SIZE_CHECK_OVERRIDE で通過 (順位 151 の想定 use case)。
@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@aloekun, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 36 minutes and 19 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5e547f36-b2f3-402c-bf44-a29b8d50714e

📥 Commits

Reviewing files that changed from the base of the PR and between 3899437 and d9f9b1e.

📒 Files selected for processing (2)
  • src/cli-pr-monitor/src/stages/poll/rate_limit_signal.rs
  • src/cli-pr-monitor/src/stages/poll/review_recheck.rs
📝 Walkthrough

Walkthrough

fix_commit を submodule 化して description・abandon・sweep に分割し、poll では iteration と各 signal 生成を別モジュールへ抽出した。あわせて、PARK 文面、reparent、sweep、poll の state 更新とテストが整理された。

Changes

fix_commit モジュール分割

Layer / File(s) Summary
description と状態表現
src/cli-pr-monitor/src/fix_commit/description.rs
FixCommitState、fix commit description 生成、issue の単行化、関連テストが追加された。
cleanup と reparent
src/cli-pr-monitor/src/fix_commit/abandon.rs
空 fix commit の abandon、commit id 照合、PR tip への reparent、関連統合テストが追加された。
empty commit sweep
src/cli-pr-monitor/src/fix_commit/sweep.rs
fix(review): を含む空 commit の列挙と abandon、統合テストが追加された。
mod.rs と docs 更新
src/cli-pr-monitor/src/fix_commit/mod.rs, docs/file-length-enforcement-plan.md
fix_commit のサブモジュール再エクスポートと docs の参照先更新が行われた。

poll ステージの分離

Layer / File(s) Summary
review_recheck signal
src/cli-pr-monitor/src/stages/poll/review_recheck_signal.rs, src/cli-pr-monitor/src/stages/poll/review_recheck.rs
safe minute 計算と review_recheck PARK signal の生成ロジックが新モジュールへ移された。
rate_limit signal
src/cli-pr-monitor/src/stages/poll/rate_limit_signal.rs, src/cli-pr-monitor/src/stages/poll/rate_limit.rs
mergeable 判定、shortcut signal、posted retrigger PARK signal、rate-limit retry PARK signal が新モジュールへ追加され、rate_limit.rs のローカル実装とテストが整理された。
iteration 抽出と poll wiring
src/cli-pr-monitor/src/stages/poll/iteration.rs, src/cli-pr-monitor/src/stages/poll/mod.rs
checker 実行と action 判定を iteration.rs に分離し、poll/mod.rs は委譲と型更新に整理された。
review_recheck tests
src/cli-pr-monitor/src/stages/poll/review_recheck.rs
review_recheck の state 書き込み、fix_push_time の保持、recheck_count リセットに関するテストとヘルパーが追加された。

推定コードレビュー工数

🎯 4 (Complex) | ⏱️ ~60 minutes

関連する可能性のある PR

🚥 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 主要な変更である cli-pr-monitor の poll/mod.rs と fix_commit.rs の分割を正しく要約しており、簡潔で分かりやすいです。
Docstring Coverage ✅ Passed Docstring coverage is 100.00% 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.

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.

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/cli-pr-monitor/src/stages/poll/mod.rs (1)

136-140: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

process-global env var 用の lock は全 test module で共有してください。

PR_MONITOR_STATE_FILE_OVERRIDE は process-global ですが、この static LOCKpoll/mod.rs 内だけを直列化します。同じ PR の rate_limit.rs / review_recheck.rs 側にも別 static LOCK があるため、cargo test の並列実行で env override が相互に上書きされ得ます。共通の test helper に 1 つだけ置いて全モジュールから使ってください。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/cli-pr-monitor/src/stages/poll/mod.rs` around lines 136 - 140, The env
override lock in env_override_lock is only serializing tests within poll/mod.rs,
but PR_MONITOR_STATE_FILE_OVERRIDE is process-global and must be shared across
all test modules. Move this lock into a single common test helper and update the
poll/mod.rs, rate_limit.rs, and review_recheck.rs test code to use that shared
lock instead of each defining its own static LOCK, so parallel cargo test runs
cannot overwrite the env var.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/cli-pr-monitor/src/fix_commit/abandon.rs`:
- Around line 16-18: The create_fix_commit function in abandon.rs always runs jj
new even when findings is empty, which violates the FixCommitState::None
contract; add an early return at the start of create_fix_commit to map an empty
findings slice to None and skip commit creation. Use the existing
create_fix_commit, build_fix_commit_description, and FixCommitState::None
symbols to keep the normal monitor.rs call path from rewriting the repo for zero
findings and avoid empty header-only commits and unnecessary cleanup.

In `@src/cli-pr-monitor/src/stages/poll/rate_limit_signal.rs`:
- Around line 62-65: The shortcut clean check in `rate_limit_signal` is too
permissive when `CodeRabbitState` is incomplete, because `unresolved_threads:
None` is treated as clean and can wrongly emit `[RATE_LIMIT_BUT_MERGEABLE]`.
Update the `cr_clean` logic to be conservative in this path: when `coderabbit`
is present in `rate_limit_signal.rs`, require a fully known clean state and
incorporate `new_comments` and `actionable_comments` alongside
`unresolved_threads` when deciding whether the PR is safe to shortcut. Keep the
existing mergeability checks, but only allow the shortcut when `CodeRabbitState`
clearly indicates no outstanding review work.

In `@src/cli-pr-monitor/src/stages/poll/review_recheck.rs`:
- Line 40: The assignment in `review_recheck` is reversing the intended
write-once behavior for `fix_push_time`, since `ctx.fix_push_time` is currently
taking precedence over the existing state. Update the logic around
`state.fix_push_time` so the existing value in state is preserved and only
populated from `ctx.fix_push_time` when the state field is still unset, matching
the intended one-way initialization and keeping the preserve test passing.

---

Outside diff comments:
In `@src/cli-pr-monitor/src/stages/poll/mod.rs`:
- Around line 136-140: The env override lock in env_override_lock is only
serializing tests within poll/mod.rs, but PR_MONITOR_STATE_FILE_OVERRIDE is
process-global and must be shared across all test modules. Move this lock into a
single common test helper and update the poll/mod.rs, rate_limit.rs, and
review_recheck.rs test code to use that shared lock instead of each defining its
own static LOCK, so parallel cargo test runs cannot overwrite the env var.
🪄 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: 09bf229c-9891-48ea-ac8b-5f10b0d005ca

📥 Commits

Reviewing files that changed from the base of the PR and between 509c671 and 1d571d5.

📒 Files selected for processing (12)
  • docs/file-length-enforcement-plan.md
  • src/cli-pr-monitor/src/fix_commit.rs
  • src/cli-pr-monitor/src/fix_commit/abandon.rs
  • src/cli-pr-monitor/src/fix_commit/description.rs
  • src/cli-pr-monitor/src/fix_commit/mod.rs
  • src/cli-pr-monitor/src/fix_commit/sweep.rs
  • src/cli-pr-monitor/src/stages/poll/iteration.rs
  • src/cli-pr-monitor/src/stages/poll/mod.rs
  • src/cli-pr-monitor/src/stages/poll/rate_limit.rs
  • src/cli-pr-monitor/src/stages/poll/rate_limit_signal.rs
  • src/cli-pr-monitor/src/stages/poll/review_recheck.rs
  • src/cli-pr-monitor/src/stages/poll/review_recheck_signal.rs
💤 Files with no reviewable changes (1)
  • src/cli-pr-monitor/src/fix_commit.rs

Comment thread src/cli-pr-monitor/src/fix_commit/abandon.rs
Comment thread src/cli-pr-monitor/src/stages/poll/rate_limit_signal.rs
Comment thread src/cli-pr-monitor/src/stages/poll/review_recheck.rs Outdated
@aloekun

aloekun commented Jun 28, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

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 added a commit that referenced this pull request Jun 28, 2026
Resolved findings:
- [Major] src/cli-pr-monitor/src/fix_commit/abandon.rs:18 `findings` が空でも fix commit を作成しています。
- [Major] src/cli-pr-monitor/src/stages/poll/rate_limit_signal.rs:65 CR 状態が不完全な場合は shortcut を抑止してください。
- [Critical] src/cli-pr-monitor/src/stages/poll/review_recheck.rs:40 `fix_push_time` の write-once 順序を戻してください。

@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.

♻️ Duplicate comments (1)
src/cli-pr-monitor/src/stages/poll/rate_limit_signal.rs (1)

62-66: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

unresolved_threads: None を clean 扱いしないでください。

Line 66 の unwrap_or(0) だと、CR の未解決スレッド数が未取得でも shortcut が通ってしまいます。[RATE_LIMIT_BUT_MERGEABLE] を出す条件としてはまだ緩すぎるので、ここは Some(0) を必須にした方が安全です。あわせて unresolved_threads: None の回帰テストも 1 本あると再発防止になります。

修正例
     let cr_clean = coderabbit
         .map(|c| {
             c.new_comments == 0
                 && c.actionable_comments.unwrap_or(0) == 0
-                && c.unresolved_threads.unwrap_or(0) == 0
+                && c.unresolved_threads == Some(0)
         })
         .unwrap_or(true);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/cli-pr-monitor/src/stages/poll/rate_limit_signal.rs` around lines 62 -
66, The clean-check in `rate_limit_signal.rs` is too permissive because
`cr_clean` treats `unresolved_threads: None` as zero via `unwrap_or(0)`, which
can incorrectly allow the `[RATE_LIMIT_BUT_MERGEABLE]` shortcut. Update the
logic in the `coderabbit.map(...)` block so `unresolved_threads` must be
explicitly `Some(0)` to count as clean, while keeping the existing
`new_comments` and `actionable_comments` checks unchanged. Also add a regression
test around the `rate_limit_signal` path to verify that `unresolved_threads:
None` does not produce a clean result.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@src/cli-pr-monitor/src/stages/poll/rate_limit_signal.rs`:
- Around line 62-66: The clean-check in `rate_limit_signal.rs` is too permissive
because `cr_clean` treats `unresolved_threads: None` as zero via `unwrap_or(0)`,
which can incorrectly allow the `[RATE_LIMIT_BUT_MERGEABLE]` shortcut. Update
the logic in the `coderabbit.map(...)` block so `unresolved_threads` must be
explicitly `Some(0)` to count as clean, while keeping the existing
`new_comments` and `actionable_comments` checks unchanged. Also add a regression
test around the `rate_limit_signal` path to verify that `unresolved_threads:
None` does not produce a clean result.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1ec23f73-8254-40de-a070-fadb6cb95b13

📥 Commits

Reviewing files that changed from the base of the PR and between 1d571d5 and 3899437.

📒 Files selected for processing (3)
  • src/cli-pr-monitor/src/fix_commit/abandon.rs
  • src/cli-pr-monitor/src/stages/poll/rate_limit_signal.rs
  • src/cli-pr-monitor/src/stages/poll/review_recheck.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/cli-pr-monitor/src/stages/poll/review_recheck.rs
  • src/cli-pr-monitor/src/fix_commit/abandon.rs

post-pr-review で検出された CodeRabbit findings の対応:

- [採用] Critical: review_recheck.rs finalize_initial_review_park の fix_push_time を
  write-once 順序に修正 (ctx 優先 → state 優先)。sibling finalize_review_recheck_park と整合。
  これは master に元々あった不整合で、PR-W2 の分割で両関数が並んだことで顕在化。
- [採用] Major: rate_limit_signal.rs evaluate_rate_limit_shortcut を new_comments /
  actionable_comments も見るよう拡張 (CR 状態が不完全な場合の shortcut 抑止)。discriminating test 追加。
- [却下] Major: create_fix_commit の「空 findings でも commit 作成」は ADR-022 の意図的な
  pre-create 設計 (takt amend → 変更なければ try_abandon_empty_fix_commit で片付け)。
  早期 return 化は repush 統合テスト2件を壊す回帰だったため不採用。
@aloekun
aloekun force-pushed the pr-w2-pr-monitor-split branch from 3899437 to d9f9b1e Compare June 28, 2026 11:31
@aloekun
aloekun merged commit 1c0f345 into master Jun 28, 2026
1 check passed
@aloekun
aloekun deleted the pr-w2-pr-monitor-split branch June 28, 2026 13:15
aloekun added a commit that referenced this pull request Jun 29, 2026
…ay script cleanup (#225)

PR #224 (cli-pr-monitor 分割、PR-W2) の post-merge-feedback 採用分 + セッション議論由来の改善タスクを登録。

- docs/todo13.md 新設: 従来の追加先 docs/todo10.md が約 95KB (50KB 安定読み取り閾値の約 2 倍) で分割 overdue のため、新規エントリ受入先を移行
- 順位 225-232 を docs/todo-summary.md に追加:
  - 高優先度 (Tier 1): 225 auto-push gate-bypass 是正 (A1+B1-loop) / 226 fmt baseline+gate / 227 rule⑬ 理由なし #[allow] 禁止
  - report 由来: 228 cr_clean regression test / 229 env_override_lock 抽出 / 230 flaky test 修正 / 231 ADR-022 拡張
  - workflow hygiene: 232 feedback agent の repo 書込禁止 + 検知安全網
- docs/todo3-11.md: TODO 系ファイル数 13→14 に伴う preamble 数詞同期
- parse_transcript.py 削除: post-merge-feedback workflow が repo root に残した PR-specific throwaway (順位 232 で再発防止を別途タスク化)

docs-only、behavior 変更なし。
aloekun added a commit that referenced this pull request Jul 2, 2026
…ied-files batch mode + [file_length_gate] opt-in (#234)

* docs(todo): PR #232 post-merge-feedback 採用 1 件を登録 (順位 246)

* feat(hooks): PR-W5 file-length Stop gate — comment-lint --check-modified-files batch mode + [file_length_gate] opt-in

Phase 1 (PR-W1〜W4、#220/#224/#230/#231) で 800 行以下に整えた clean state を恒久維持する
強制層。hooks-post-tool-comment-lint-rust に --check-modified-files batch mode を追加し、
Stop hook quality_gate の 1 step として PR 範囲 (base..@) の .rs file 行数を検査。
800 行超が 1 件でもあれば exit 1 で Stop を block する (Option C-2)。

実装:
- src/hooks-post-tool-comment-lint-rust/src/modified_files_check.rs (新規、17 tests)
- main.rs に --check-modified-files dispatch 追加、Cargo.toml に toml 依存追加
- .claude/hooks-config.toml に file-length step + [file_length_gate] section

mechanical refactor、behavior 不変。既存 lint (comment/function/file_length/metrics) は不変。

## ADR-039 3 点セット (experimental feature 標準パターン)

- Config opt-in (default OFF): gate_enabled() が unwrap_or(false)。本 repo のみ dogfood で enabled=true
- Kill-switch: 下表
- Bounded lifetime: file-length-enforcement-plan.md 削除条件 3 (override 未使用で 1-2 セッション通過)

## Kill-switch table

| 起動経路 | 停止コマンド | 影響範囲 |
|---|---|---|
| .claude/hooks-config.toml の [file_length_gate] enabled=true + file-length step | enabled=false (恒久) | Stop hook の file-length 判定のみ (他 step 不変) |
| Stop hook 発火時に file-length step 実行 | env FILE_LENGTH_CHECK_OVERRIDE=1 (緊急、truthy 値) | 当該 Stop の判定を skip |

## 設計判断

- jj 変更検出は base branch を config 引数化 (default master、ADR-021 § Revset Composability)
- cmd path は cmd.exe の forward-slash 非対応のため backslash TOML literal string
- jj 失敗時は fail-closed で block (ADR-043、stop_hook_active retry-skip が永続 lock を防止)
- templates (TS/Python) は Rust 非対象のため未追加

## 検証

- cargo test -p hooks-post-tool-comment-lint-rust: 116 pass / clippy clean / fmt clean
- cargo test --workspace: regression なし / cargo clippy --workspace clean
- dogfood (deploy 済 exe): clean=exit0 / 850行file=block / OVERRIDE(=1,=true)=bypass / enabled=false=no-op / self-host=exit0

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(review): CodeRabbit #234-1 fail-closed 対応 + 削除 file skip 補正

CodeRabbit Major #234-1 (読み取り不能な既存 .rs は fail-closed に) を適用:
collect_oversize_files を Result 化し、存在するのに読めない .rs は Err → exit 1 (block)。

さらに削除 file 誤検知を補正: jj diff --name-only は削除 file も列挙する (実測確認) ため、
Path::exists() で存在確認し削除 file (非存在) は skip する。これがないと file split
refactor (元 file 削除を伴う、本 plan が促進する作業そのもの) を gate が誤 block する。
CodeRabbit の指摘文言も「*既存* .rs」であり削除 file は対象外。

- collect_oversize_files: filter(Path::exists) + Result<Vec, String>
- fail-closed 診断を run_check_modified_files で block 表示 (ADR-043 § 原則1)
- tests: skips_deleted_file (skip) + errors_on_present_but_unreadable (Err) で両分岐を assert

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
aloekun added a commit that referenced this pull request Jul 2, 2026
…ignored ゲート + B1 auto-push 前 quality gate (順位225) (#238)

PR #224 で takt auto-fix が #[ignore] repush テスト 2 件を破壊したまま
convergence_verdict: fully_resolved を宣言し、auto-push の jj git push
直 push が cli-push-runner の quality_gate をバイパスして回帰が無検証で
PR に到達した。fix 時 (A1) と push 時 (B1) の 2 層で遮断する。

A1 (.takt/facets/instructions/fix.md、pre-push/post-pr 共有 facet):
- test ファイル変更 or pub/pub(crate) 関数の挙動・signature 変更時は
  cargo test -- --ignored --test-threads=1 の PASS を fully_resolved の
  前提条件化。Honesty constraint / Test results 出力要件も更新

B1 (src/cli-pr-monitor/src/stages/gate.rs 新設):
- auto-push 前に push-runner-config.toml の quality_gate group
  (default: rust-lint-test) を単一ソース参照で実行。config 欠落・group
  不在・コマンド失敗はすべて FAIL = push 中止 + action_required
  (fail-closed、ADR-043)
- fix diff (pre_takt_cid → @) が docs-only (ADR-035 path 基準) なら
  gate を skip し docs auto-fix の速度を維持。判定不能は source 扱い
- [fix.gate] enabled (default true) + group、kill-switch は環境変数
  PR_MONITOR_GATE_DISABLE=1。派生プロジェクト template に非 Rust
  環境向け opt-out 注意書きを追加
- GateConfig は file-length gate (800 行) 回避と凝集のため config.rs
  でなく stages/gate.rs に配置

docs:
- docs/auto-push-gate-dogfood.md 新設 (ephemeral、B1-loop GO/NO-GO 判定
  完了時に削除): 観測ログ・判断基準・B1-loop 設計案 (gate-fix.yaml 方式、
  N=2、空振り検知) と不採用案を保存
- todo13.md / todo-summary.md 順位225 現在地更新
- ADR-037 Mitigations + ADR-022 採用される構成要素に B1 gate を追記

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
aloekun added a commit that referenced this pull request Jul 17, 2026
takt (reviewers → fix loop) の後に post_takt_regate stage を追加し、fix が
作業コピーを書き換えた場合のみ quality_gate 全 group を再実行して push を
block する。虚偽ではないが検証不足の fully_resolved (PR #224 型) を pre-push
でも遮断する。post-PR gate (ADR-037 §Mitigations) の pre-push 版。

- 変化検出は diff snapshot 前後比較 (Stage 1.5 の diff を takt 前に保持し、
  takt 後に再取得して比較)。metadata のみの変化に構造的に不感 (ADR-021 §
  commit_id 単独比較の限界)。判定は pure fn + closure 注入 (ADR-021 原則 3)
- fail 方向は gate 系 fail-closed (判定不能 → 実行)。ADR-021 原則 4 の
  repush 系 fail-safe (判定不能 → 何もしない) とは逆向き
- 再ゲート範囲は quality_gate 全 group (docs-only skip は fix 後は非適用)
- fix.md (共有 facet / ADR-020) の workspace 全体 + --ignored 自己申告義務を
  撤去し影響 crate の build -p + test -p に縮小。検証を決定論 gate へ委譲。
  post-pr gate も rust-lint-test group (--ignored 含む) を実行済で両経路担保
- ADR-039 3 点セット: [post_takt_regate] default OFF / env
  POST_TAKT_REGATE_DISABLE=1 kill-switch / 本 repo enabled=true で dogfood
- 新規 ADR-058 (試験運用、判定期限 2026-08-15) + ADR-037 §Mitigations 追記

回帰テスト: post_takt_regate 11 本 (decide_regate 全 5 分岐 + 統合 block/pass/
skip) + capture_diff_snapshot 2 本 (cli-push-runner 215 → 250 passed)。配布 exe
で re-gate ON=block/exit 1 vs OFF=push (従来挙動) / 無変更 skip / kill-switch の
4 scenario を実機で before/after 確認 (takt は自作 pnpm.exe stub で代役)。

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
aloekun added a commit that referenced this pull request Jul 20, 2026
- ① todo10.md: 「新規追加先は引き続き本ファイル」→ 編集・完了削除専用に修正 (新規は todo14.md、PR #224 以降 edit-only)
- ② 順位≥220 を収容する todo13/14/15/16/17/19 の作業計画「todo-summary.md 行削除」→ todo-summary2.md 行削除 (該当行は分割で part2 へ移動済み)。< 220 の todo10/18 は part1 のため不変
- ④ todo3-7 preamble の既存エントリ範囲 todo2-9.md → todo2-19.md (分割後の全 TODO ファイルを包含)
- ③ (todo17 の CodeRabbit 検証スクリプトログ) は実指摘でないため非対応

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
aloekun added a commit that referenced this pull request Jul 20, 2026
* docs(todo): 50KB 超過の todo13/todo10 を物理分割し全 todo を閾値以下に

docs/todo13.md (171KB) を todo13/15/16/17、docs/todo10.md (95KB) を
todo10/18/19 に順位帯で物理分割し file_size_check 50KB 閾値以下に縮小。

- todo13.md=順位225-247(45KB) / todo15=248-296 / todo16=297-318 / todo17=319-332
- todo10.md=順位198-214(39KB) / todo18=215-219 / todo19=220-224
- todo-summary.md「ファイル」列を移動先へ更新、todo.md routing list に todo15-19 追加
- 全 todo preamble の数詞を 20(二十つ)/範囲を todo2-19 に追従、todo13/10/14 位置付け更新
- ### エントリ数 (todo13系 82 / todo10系 22) 完全保存、pnpm lint:md / lint:docs 通過

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs(todo): todo-summary を 2 分割し cli-docs-lint を両 summary 対応に (Phase 3)

todo-summary.md (79KB) を todo-summary.md (順位6-219, 39KB) + todo-summary2.md
(順位220-335, 41KB) に物理分割し、両方 50KB 閾値以下に縮小。

- cli-docs-lint を分割 index 対応に改修 (tooling 劣化を回避):
  - priority_inversion: 全 todo-summary*.md の row を統合し tier_by_rank を構築、
    part をまたぐ cross-file 依存も検査。violation は出自 part (file/line) に帰属
  - preamble: is_todo_summary を prefix match 化 (両 part を summary 扱いで check skip)、
    summary 複数対応の count に。実ファイル数 21 に伴い数詞をアラビア「21つ」へ
  - 新テスト 5 件 (cross-part inversion / list_summary_files / split count)、clippy 0 warning
- todo3-11.md preamble の数詞 20→21 + 括弧に todo-summary2.md 追加
- todo.md routing / todo-summary.md 更新方針に 2 ファイル構成を明記
- data 行 167 完全保存、pnpm lint:docs (両ファイル統合) / lint:md / cargo clippy --workspace 通過

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs(todo): PR #306 CodeRabbit 指摘対応 (分割後の preamble 整合)

- ① todo10.md: 「新規追加先は引き続き本ファイル」→ 編集・完了削除専用に修正 (新規は todo14.md、PR #224 以降 edit-only)
- ② 順位≥220 を収容する todo13/14/15/16/17/19 の作業計画「todo-summary.md 行削除」→ todo-summary2.md 行削除 (該当行は分割で part2 へ移動済み)。< 220 の todo10/18 は part1 のため不変
- ④ todo3-7 preamble の既存エントリ範囲 todo2-9.md → todo2-19.md (分割後の全 TODO ファイルを包含)
- ③ (todo17 の CodeRabbit 検証スクリプトログ) は実指摘でないため非対応

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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