Skip to content

feat(cli-pr-monitor): auto-push gate-bypass 是正 PR-1 — A1 fix facet --ignored ゲート + B1 auto-push 前 quality gate (順位225) - #238

Merged
aloekun merged 1 commit into
masterfrom
feat/auto-push-gate-pr1
Jul 2, 2026
Merged

feat(cli-pr-monitor): auto-push gate-bypass 是正 PR-1 — A1 fix facet --ignored ゲート + B1 auto-push 前 quality gate (順位225)#238
aloekun merged 1 commit into
masterfrom
feat/auto-push-gate-pr1

Conversation

@aloekun

@aloekun aloekun commented Jul 2, 2026

Copy link
Copy Markdown
Owner

概要

PR #224 で顕在化した auto-push の gate-bypass (takt auto-fix が #[ignore] repush テスト 2 件を破壊したまま無検証で PR に到達) を、fix 時 (A1) と push 時 (B1) の 2 層で是正する。順位 225 の PR-1 (2 PR 構成の 1 本目。B1-loop は dogfood 観測後に GO/NO-GO 判定)。

変更内容

A1 — fix facet の完了ゲート強化 (.takt/facets/instructions/fix.md)

  • test ファイル変更 or pub/pub(crate) 関数の挙動・signature 変更時は cargo test -- --ignored --test-threads=1 の PASS を convergence_verdict: fully_resolved の前提条件化
  • Honesty constraint / Test results 出力要件を更新 (pre-push-review / post-pr-review 共有 facet のため両パイプラインに有効)

B1 — auto-push 前の決定論 gate (src/cli-pr-monitor/src/stages/gate.rs 新設)

  • auto-push (jj git push 直 push) の前に push-runner-config.toml の [[quality_gate.groups]] (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 判定完了時に削除): 観測ログ・判断基準 (期限: merge + 6 週間 / gate FAIL 2 件 / auto-push 発火 10 回)・B1-loop 設計案 (gate-fix.yaml 方式、N=2、空振り検知) と不採用案を保存
  • todo13.md / todo-summary.md 順位 225 現在地更新、ADR-037 Mitigations + ADR-022 採用される構成要素に B1 gate を追記

検証

  • cargo clippy --workspace -- -D warnings PASS
  • cargo test (workspace) 全 PASS (新規 gate unit テスト 24 件含む)
  • cargo test -- --ignored --test-threads=1 (workspace) 14 件 PASS
  • pnpm lint:docs OK
  • pre-push review: simplicity-review / security-review ともに approved

Dogfood 証跡 (意図的破壊テスト)

#[ignore] 統合テストに意図的な assert!(false) を注入した状態で gate の第 3 コマンド (cargo test -- --ignored --test-threads=1) を実行し、exit 101 で FAIL 検出 = gate が push を中止し action_required に倒す経路を実証。復元後に全テスト green を再確認済み。PR #224 と同型の回帰は auto-push 前に遮断される。

🤖 Generated with Claude Code

Summary by CodeRabbit

  • 新機能

    • 自動 push 前に品質ゲートを実行し、失敗時は push を止めるようになりました。
    • 条件に応じて --ignored を含むテスト実行を必須化し、判定基準も明確になりました。
  • バグ修正

    • 検証不足のまま自動反映されるケースを防ぎ、失敗時は保留扱いにするよう改善しました。
  • ドキュメント

    • 自動 push の運用基準、判定条件、例外時の扱いを整理しました。

…ignored ゲート + B1 auto-push 前 quality gate (順位225)

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

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review Change Stack

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: 2e6f50f6-1b51-42c6-83b1-31cf4f31ac04

📥 Commits

Reviewing files that changed from the base of the PR and between f60146b and 77b1a93.

📒 Files selected for processing (12)
  • .takt/facets/instructions/fix.md
  • docs/adr/adr-022-automation-responsibility-separation.md
  • docs/adr/adr-037-takt-fix-trust-shortcut.md
  • docs/auto-push-gate-dogfood.md
  • docs/todo-summary.md
  • docs/todo13.md
  • pr-monitor-config.toml
  • src/cli-pr-monitor/src/config.rs
  • src/cli-pr-monitor/src/stages/gate.rs
  • src/cli-pr-monitor/src/stages/mod.rs
  • src/cli-pr-monitor/src/stages/repush.rs
  • templates/pr-monitor-config.toml

📝 Walkthrough

Walkthrough

fix.md の完了判定に --ignored 統合テストの条件付き必須ルールを追加し、cli-pr-monitor に auto-push 前の fail-closed 品質ゲート(gate.rs)を新規実装。FixConfig と設定ファイルに gate 設定を追加し、repush フローへ配線した。関連 ADR と todo ドキュメントも更新された。

Changes

Auto-push品質ゲート

Layer / File(s) Summary
fix.md の --ignored ゲート条件追加
.takt/facets/instructions/fix.md
テスト変更や pub 関数の振る舞い変更時に --ignored 統合テストを必須とし、未実行/失敗時は convergence_verdict を partial にする運用を追記。
gate.rs の品質ゲート実装
src/cli-pr-monitor/src/stages/gate.rs, src/cli-pr-monitor/src/stages/mod.rs
GateConfig/GateOutcome 定義、kill-switch、docs-only判定、push-runner-config.tomlパース、コマンド実行、evaluate_gate統合関数、ユニットテストを新規追加。
FixConfigへのgate設定追加
src/cli-pr-monitor/src/config.rs, pr-monitor-config.toml, templates/pr-monitor-config.toml
FixConfigにgateフィールドとデフォルト値を追加し、設定ファイルに[fix.gate]ブロックとガイダンスコメントを追記。
repush.rsへのgate配線
src/cli-pr-monitor/src/stages/repush.rs
run_auto_push/execute_repush_action/execute_repush_flowにpre_cidを伝搬し、gate失敗時にpushを中止してaction_requiredへ倒す処理を追加。
ADR・todoドキュメントの更新
docs/adr/adr-022-...md, docs/adr/adr-037-...md, docs/auto-push-gate-dogfood.md, docs/todo-summary.md, docs/todo13.md
ADRへgate追記、dogfood運用ドキュメント新規追加、todoの進捗状況更新。

Estimated code review effort: 4 (Complex) | ~60 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 A1の--ignored必須化とB1のauto-push前quality gate追加を具体的に示しており、変更の主旨と一致しています。
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.
✨ 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

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

@aloekun
aloekun merged commit 27ab7ca into master Jul 2, 2026
1 check passed
@aloekun
aloekun deleted the feat/auto-push-gate-pr1 branch July 2, 2026 20:19
aloekun added a commit that referenced this pull request Jul 3, 2026
…位251) (#239)

PR #238 で実観測した 3 欠陥 (repo 検出失敗 / checker JSON parse 停止 /
post-merge feedback silent 消失) と、GH_REPO による場当たり対処の部分故障を
構造的に解消する (ADR-045 恒久対策候補 1 の実装 + 防御 preset)。

(a) GIT_DIR 自動注入 (lib-jj-helpers::inject_git_dir_for_gh):
- .git 不在 + GIT_DIR 未設定のとき .jj/repo (secondary workspace では
  main store への相対パスファイル) → store/git_target を辿って main の
  .git を導出し、プロセス env に設定 (子プロセス gh 全体へ伝播)
- cli-pr-monitor / cli-merge-pipeline / check-ci-coderabbit の main() で
  注入。既存 env 尊重・導出失敗は warning + 続行 (fail-soft)
- tempdir 疑似 layout の unit test 6 件 + 実 jj (init --colocate +
  workspace add) の #[ignore] 統合テスト

(d) gh-repo-env-guard preset (hooks-pre-tool-validate、恒久):
- Bash / PowerShell の GH_REPO 環境変数代入を block し GIT_DIR / 自動注入 /
  repo 指定フラグへ誘導 (PowerShell 構文は matcher 拡張に備え先行)
- GH_REPO は引数なし gh repo view に効かず silent 部分故障を招くため

(b) checker 出力の stdout/stderr 分離 (run_cmd_capture 新設):
- invoke_checker は stdout のみ JSON parse、stderr は log 転送。checker の
  fail-soft stderr 警告が JSON に連結され trailing characters で監視停止
  した回帰の防止 (cmd 実プロセスの regression test 付き)

(c) owner_repo 検出失敗時の .failed marker (AiStepContext::SkipWithMarker):
- 従来は marker なしで skip し L2 recovery (ADR-030) が発火しなかった。
  skip でも marker を書き recovery 可能に

docs: ADR-045 改訂 (候補 1 実装済み化、手動 GIT_DIR を fallback に格下げ、
コマンド対応表更新)、todo13/todo-summary 順位 251 現在地更新 (dogfood 記録
と順位 225 dogfood 開始日記入を含む)

Co-authored-by: Claude Fable 5 <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