feat(cli-merge-pipeline): PR detection を @-/@-- まで拡張 + trunk filter 追加 - #54
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 54 minutes and 22 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ 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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
docs/todo.md (1)
160-174: task 7 の番号参照が自己言及的で読みにくい点のみ確認。見出しが「cli-merge-pipeline の水平展開」であるのに対し、本文内で「cli-merge-pipeline で先に解消した task 7 (旧)」「先行実装: cli-merge-pipeline の同等対応 (task 7 旧、PR で完了済み)」と、同じ番号 7 の旧タスクを参照しています。PR 要約にもある通り「完了した旧 task 7 を削除し、新 task 7 としてポーティング作業を追加」という経緯で、git log を遡らないと「旧 task 7」の内容が分からない構造です。運用ルール冒頭の「過去の経緯は git log で追跡可能」とも整合する形ですが、将来の読者向けに「PR
#54で完了した@/@-/@--拡張」のように旧タスクの内容を一言添えておくと自己解決的になります(optional)。🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/todo.md` around lines 160 - 174, Update docs/todo.md to remove the self-referential “task 7 (旧)” phrasing and instead append a short clarifying note about the completed prior work; specifically, in the "cli-merge-pipeline の水平展開" section replace occurrences of "task 7 (旧)" with a one-line parenthetical like "(先行実装: PR #<number> — `@`/`@-`/`@--` 拡張済み)" or similar brief text, and adjust the PR summary line to state that the old task was completed in that PR and this entry is the new porting task so readers don’t need to inspect git history to understand the prior change; keep references to cli-pr-monitor, get_jj_bookmarks, and cli-merge-pipeline so the context stays clear.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@docs/todo.md`:
- Around line 160-174: Update docs/todo.md to remove the self-referential “task
7 (旧)” phrasing and instead append a short clarifying note about the completed
prior work; specifically, in the "cli-merge-pipeline の水平展開" section replace
occurrences of "task 7 (旧)" with a one-line parenthetical like "(先行実装: PR
#<number> — `@`/`@-`/`@--` 拡張済み)" or similar brief text, and adjust the PR
summary line to state that the old task was completed in that PR and this entry
is the new porting task so readers don’t need to inspect git history to
understand the prior change; keep references to cli-pr-monitor,
get_jj_bookmarks, and cli-merge-pipeline so the context stays clear.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c5492233-0af8-4bdd-a908-b07e776ba674
📒 Files selected for processing (2)
docs/todo.mdsrc/cli-merge-pipeline/src/main.rs
jj new 直後の「@ 空 / bookmark は @- 上」構成 (PR #53 実測) で PR detection が空振りする問題を解消。 - BOOKMARK_SEARCH_REVSETS = ["@", "@-", "@--"] で近い順に探索 - trunk bookmark (master/main/trunk/develop) を除外し、fresh checkout で @- が master を指す状態での false hit を防止 - get_jj_bookmarks を parse / query / select の 3 層に分割し、 select_from_revsets をクロージャ注入で単体テスト可能に docs/todo.md: task 7 完了削除 + cli-pr-monitor 側の水平展開タスク新設 refs: ADR-013
8b161d1 to
3117cb0
Compare
PR #54 で cli-merge-pipeline に適用した revset 拡張 + trunk filter を cli-pr-monitor/util.rs にも移植。get_jj_bookmarks が Strategy B の PR 検索と create_pr.rs の --head 自動補完の両方に使われているため、両経路に効く。 - util.rs を 3 層構造 (parse / query / select) に分割 - BOOKMARK_SEARCH_REVSETS = ["@", "@-", "@--"] で近い順に探索 - TRUNK_BOOKMARKS = ["main", "master", "trunk", "develop"] を除外 - create_pr.rs の --head 自動補完も改善 (master を誤って --head に渡す問題が消える) - unit テスト 11 件追加 (parse / priority / trunk filter) docs/todo.md: task 7 完了削除 → 雑務 cleanup を task 7 に繰り下げ refs: PR #54, ADR-013
PR #54 で cli-merge-pipeline に適用した revset 拡張 + trunk filter を cli-pr-monitor/util.rs にも移植。get_jj_bookmarks が Strategy B の PR 検索と create_pr.rs の --head 自動補完の両方に使われているため、両経路に効く。 - util.rs を 3 層構造 (parse / query / select) に分割 - BOOKMARK_SEARCH_REVSETS = ["@", "@-", "@--"] で近い順に探索 - TRUNK_BOOKMARKS = ["main", "master", "trunk", "develop"] を除外 - create_pr.rs の --head 自動補完も改善 (master を誤って --head に渡す問題が消える) - unit テスト 11 件追加 (parse / priority / trunk filter) docs/todo.md: task 7 完了削除 → 雑務 cleanup を task 7 に繰り下げ refs: PR #54, ADR-013
PR #54 で cli-merge-pipeline に適用した revset 拡張 + trunk filter を cli-pr-monitor/util.rs にも移植。get_jj_bookmarks が Strategy B の PR 検索と create_pr.rs の --head 自動補完の両方に使われているため、両経路に効く。 - util.rs を 3 層構造 (parse / query / select) に分割 - BOOKMARK_SEARCH_REVSETS = ["@", "@-", "@--"] で近い順に探索 - TRUNK_BOOKMARKS = ["main", "master", "trunk", "develop"] を除外 - create_pr.rs の --head 自動補完も改善 (master を誤って --head に渡す問題が消える) - unit テスト 11 件追加 (parse / priority / trunk filter) docs/todo.md: task 7 完了削除 → 雑務 cleanup を task 7 に繰り下げ refs: PR #54, ADR-013
… 更新) docs/todo.md の「セッション 247510ea 由来: 整備タスク群 (PR-A)」を反映。 - ADR-028 (新規): 外部可視成果物の生成コマンド (pnpm create-pr / pnpm merge-pr 等) の実行ゲート - ADR-021 (原則 5 追加): bookmark 検出標準 (BOOKMARK_SEARCH_REVSETS / TRUNK_BOOKMARKS) + option A/B/C 比較 - ADR-024 (本採用に格上げ): 3 箇所 port 完了 (cli-push-runner / cli-merge-pipeline / cli-pr-monitor) により早期達成 - ADR-019 (制約・可換性追記): CodeRabbit 無料枠 1h 3 回制約、ハイブリッド再定義、M5 不採用論拠 - CLAUDE.md: ADR-028 追加、ADR-024 試験運用マーカー除去 - docs/todo.md: PR-A タスク削除 + 後続リナンバー (PR-B/C/D → #7/8/9) refs: PR #54, PR #55, セッション 247510ea-3f24-4b87-8f68-3c860e1b1b4e
… 更新) docs/todo.md の「セッション 247510ea 由来: 整備タスク群 (PR-A)」を反映。 - ADR-028 (新規): 外部可視成果物の生成コマンド (pnpm create-pr / pnpm merge-pr 等) の実行ゲート - ADR-021 (原則 5 追加): bookmark 検出標準 (BOOKMARK_SEARCH_REVSETS / TRUNK_BOOKMARKS) + option A/B/C 比較 - ADR-024 (本採用に格上げ): 3 箇所 port 完了 (cli-push-runner / cli-merge-pipeline / cli-pr-monitor) により早期達成 - ADR-019 (制約・可換性追記): CodeRabbit 無料枠 1h 3 回制約、ハイブリッド再定義、M5 不採用論拠 - CLAUDE.md: ADR-028 追加、ADR-024 試験運用マーカー除去 - docs/todo.md: PR-A タスク削除 + 後続リナンバー (PR-B/C/D → #7/8/9) refs: PR #54, PR #55, セッション 247510ea-3f24-4b87-8f68-3c860e1b1b4e
… 更新) (#56) docs/todo.md の「セッション 247510ea 由来: 整備タスク群 (PR-A)」を反映。 - ADR-028 (新規): 外部可視成果物の生成コマンド (pnpm create-pr / pnpm merge-pr 等) の実行ゲート - ADR-021 (原則 5 追加): bookmark 検出標準 (BOOKMARK_SEARCH_REVSETS / TRUNK_BOOKMARKS) + option A/B/C 比較 - ADR-024 (本採用に格上げ): 3 箇所 port 完了 (cli-push-runner / cli-merge-pipeline / cli-pr-monitor) により早期達成 - ADR-019 (制約・可換性追記): CodeRabbit 無料枠 1h 3 回制約、ハイブリッド再定義、M5 不採用論拠 - CLAUDE.md: ADR-028 追加、ADR-024 試験運用マーカー除去 - docs/todo.md: PR-A タスク削除 + 後続リナンバー (PR-B/C/D → #7/8/9) refs: PR #54, PR #55, セッション 247510ea-3f24-4b87-8f68-3c860e1b1b4e
cli-pr-monitor / cli-merge-pipeline / cli-push-runner の 3 クレートで重複していた bookmark 検出ロジックを ADR-024 (本採用) に従い `src/lib-jj-helpers/` に集約。
## 新クレート
- `src/lib-jj-helpers/` 新設 (ADR-012 命名規約、ADR-026 workspace 準拠)
- 公開 API:
- 定数: `TRUNK_BOOKMARKS`, `BOOKMARK_SEARCH_REVSETS`
- 関数: `is_trunk_bookmark`, `parse_bookmark_list_output`, `query_bookmarks_at`, `select_from_revsets`, `get_jj_bookmarks`
- 型: `StderrMode { Silent, Piped(fn(&str)) }`
- 14 unit tests (fallback_log コールバック検証 2 件を新規追加)
## 設計方針
- **stderr ハンドリングを `StderrMode` で選択**: cli-pr-monitor は `Silent` (CI ログ汚染回避)、cli-merge-pipeline は `Piped(log_info)` (診断情報を出す)
- **log 関数は `fn(&str)` ポインタで注入**: 各クレート固有 prefix (`[post-pr-monitor]` / `[merge-pipeline]`) を崩さない
- **fallback_log は `Option<fn(&str)>`**: `@-` や `@--` で hit した場合のみ通知 (noise 抑制)
## 呼び出し側差し替え
- cli-pr-monitor (`util.rs`): `get_jj_bookmarks()` を lib 呼び出しに置換、重複テスト削除
- cli-merge-pipeline (`main.rs`): 同上、stderr は `Piped` で継続
- cli-push-runner (`push_jj_bookmark.rs`): `is_trunk_bookmark` のみ lib 借用、他ロジックは crate-local 保持 (`parse_bookmark_list_output` は `jj bookmark list` 出力用で semantics が異なる)
## 検証
- cargo test --workspace: 363 tests PASS (1 ignored)
- pnpm build:all: 全 9 exe ビルド成功
- cargo clippy: modified 4 クレートに warning なし
- 行数インパクト: +425 / -492 = net -67 行 (重複テスト集約効果)
## ADR 更新
- ADR-024: 実装フェーズを「実施済」に反映、`capture_commit_id` / `diff_is_empty` は将来 PR で段階的移設と明記
- ADR-021 原則 5: 「3 クレートで重複 → lib-jj-helpers に集約済」と完了反映
- ADR-028: PR-D 参照番号を #7 に更新 (PR-B/PR-C 完了で docs/todo.md がリナンバー)
refs: ADR-024, ADR-021, PR #56 (PR-A), PR #57 (PR-B), PR #54, PR #55
cli-pr-monitor / cli-merge-pipeline / cli-push-runner の 3 クレートで重複していた bookmark 検出ロジックを ADR-024 (本採用) に従い `src/lib-jj-helpers/` に集約。
## 新クレート
- `src/lib-jj-helpers/` 新設 (ADR-012 命名規約、ADR-026 workspace 準拠)
- 公開 API:
- 定数: `TRUNK_BOOKMARKS`, `BOOKMARK_SEARCH_REVSETS`
- 関数: `is_trunk_bookmark`, `parse_bookmark_list_output`, `query_bookmarks_at`, `select_from_revsets`, `get_jj_bookmarks`
- 型: `StderrMode { Silent, Piped(fn(&str)) }`
- 14 unit tests (fallback_log コールバック検証 2 件を新規追加)
## 設計方針
- **stderr ハンドリングを `StderrMode` で選択**: cli-pr-monitor は `Silent` (CI ログ汚染回避)、cli-merge-pipeline は `Piped(log_info)` (診断情報を出す)
- **log 関数は `fn(&str)` ポインタで注入**: 各クレート固有 prefix (`[post-pr-monitor]` / `[merge-pipeline]`) を崩さない
- **fallback_log は `Option<fn(&str)>`**: `@-` や `@--` で hit した場合のみ通知 (noise 抑制)
## 呼び出し側差し替え
- cli-pr-monitor (`util.rs`): `get_jj_bookmarks()` を lib 呼び出しに置換、重複テスト削除
- cli-merge-pipeline (`main.rs`): 同上、stderr は `Piped` で継続
- cli-push-runner (`push_jj_bookmark.rs`): `is_trunk_bookmark` のみ lib 借用、他ロジックは crate-local 保持 (`parse_bookmark_list_output` は `jj bookmark list` 出力用で semantics が異なる)
## 検証
- cargo test --workspace: 363 tests PASS (1 ignored)
- pnpm build:all: 全 9 exe ビルド成功
- cargo clippy: modified 4 クレートに warning なし
- 行数インパクト: +425 / -492 = net -67 行 (重複テスト集約効果)
## ADR 更新
- ADR-024: 実装フェーズを「実施済」に反映、`capture_commit_id` / `diff_is_empty` は将来 PR で段階的移設と明記
- ADR-021 原則 5: 「3 クレートで重複 → lib-jj-helpers に集約済」と完了反映
- ADR-028: PR-D 参照番号を #7 に更新 (PR-B/PR-C 完了で docs/todo.md がリナンバー)
refs: ADR-024, ADR-021, PR #56 (PR-A), PR #57 (PR-B), PR #54, PR #55
cli-pr-monitor / cli-merge-pipeline / cli-push-runner の 3 クレートで重複していた bookmark 検出ロジックを ADR-024 (本採用) に従い `src/lib-jj-helpers/` に集約。
## 新クレート
- `src/lib-jj-helpers/` 新設 (ADR-012 命名規約、ADR-026 workspace 準拠)
- 公開 API:
- 定数: `TRUNK_BOOKMARKS`, `BOOKMARK_SEARCH_REVSETS`
- 関数: `is_trunk_bookmark`, `parse_bookmark_list_output`, `query_bookmarks_at`, `select_from_revsets`, `get_jj_bookmarks`
- 型: `StderrMode { Silent, Piped(fn(&str)) }`
- 14 unit tests (fallback_log コールバック検証 2 件を新規追加)
## 設計方針
- **stderr ハンドリングを `StderrMode` で選択**: cli-pr-monitor は `Silent` (CI ログ汚染回避)、cli-merge-pipeline は `Piped(log_info)` (診断情報を出す)
- **log 関数は `fn(&str)` ポインタで注入**: 各クレート固有 prefix (`[post-pr-monitor]` / `[merge-pipeline]`) を崩さない
- **fallback_log は `Option<fn(&str)>`**: `@-` や `@--` で hit した場合のみ通知 (noise 抑制)
## 呼び出し側差し替え
- cli-pr-monitor (`util.rs`): `get_jj_bookmarks()` を lib 呼び出しに置換、重複テスト削除
- cli-merge-pipeline (`main.rs`): 同上、stderr は `Piped` で継続
- cli-push-runner (`push_jj_bookmark.rs`): `is_trunk_bookmark` のみ lib 借用、他ロジックは crate-local 保持 (`parse_bookmark_list_output` は `jj bookmark list` 出力用で semantics が異なる)
## 検証
- cargo test --workspace: 363 tests PASS (1 ignored)
- pnpm build:all: 全 9 exe ビルド成功
- cargo clippy: modified 4 クレートに warning なし
- 行数インパクト: +425 / -492 = net -67 行 (重複テスト集約効果)
## ADR 更新
- ADR-024: 実装フェーズを「実施済」に反映、`capture_commit_id` / `diff_is_empty` は将来 PR で段階的移設と明記
- ADR-021 原則 5: 「3 クレートで重複 → lib-jj-helpers に集約済」と完了反映
- ADR-028: PR-D 参照番号を #7 に更新 (PR-B/PR-C 完了で docs/todo.md がリナンバー)
refs: ADR-024, ADR-021, PR #56 (PR-A), PR #57 (PR-B), PR #54, PR #55
Summary
pnpm merge-prの bookmark 検出を@のみ →@,@-,@--の順で検索する方式に拡張jj new直後の「@ が空、bookmark は @- 上」構成 (PR chore: 作業環境整理 (settings.json 環境変数 + todo.md 完了タスク削除) #53 で実測) で PR detection が空振りする問題を解消Changes
src/cli-merge-pipeline/src/main.rsget_jj_bookmarksを 3 層構造に分割parse_bookmark_list_output(純粋): jj log 出力から bookmark 名を抽出、trunk 除外query_bookmarks_at(I/O): 指定 revset に対し jj log を実行select_from_revsets(優先度): 複数 revset を近い順に試行、最初のヒットで停止BOOKMARK_SEARCH_REVSETS = ["@", "@-", "@--"](近い順 = 優先順)TRUNK_BOOKMARKS = ["main", "master", "trunk", "develop"]を PR 検索対象から除外select_from_revsetsはクロージャ注入で単体テスト可能if *revset != "@"をif i > 0に置換し、関数をよりジェネリックにdocs/todo.md@限定 bookmark 検出の修正) を新 task 7 として追加Test Plan
cargo test -p cli-merge-pipelineで 19 テスト passparse_bookmark_list_output_*: 7 件 (空 / 単一 / CSV / 複数行 / 重複 / trim / trunk 除外)select_from_revsets_*: 4 件 (全空 / 現在優先 / 親フォールバック / 早期終了)is_trunk_bookmark_known_names_rejected: 1 件cargo test --workspaceで 363 テスト pass (既存含む)cargo clippy -p cli-merge-pipeline --tests -- -D warnings通過.claude/cli-merge-pipeline.exe再ビルド済み@空 /@-= master 状態で safe に "PR not found" 終了 (trunk filter が効いている)@-状態にしてpnpm merge-prが PR 検出成功することを次回マージ時に実地確認References
docs/todo.md新 task 7 (cli-pr-monitor 側の水平展開)Summary by CodeRabbit
Documentation
Tests