fix(cli-pr-monitor): --body 複数行引数の再結合 - #51
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 51 minutes and 45 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 (1)
📝 WalkthroughWalkthroughWindows環境での Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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 |
2902515 to
82d4305
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/cli-pr-monitor/src/stages/create_pr.rs (1)
25-35:--body直後が long フラグの場合の扱いを確認してください。現状
args[i] == "--body" && i + 1 < args.len()だけで分岐に入り、args[i+1]が--titleなど別の long フラグであっても無条件に body の最初のフラグメントとして取り込みます。結果として--body --title "x"のような (通常は想定されない) 入力で--titleが body 内容として消費され、--titleの値"x"だけが argv に残ります。実運用で発生しにくい入力ではありますが、後段 (
convert_body_to_file) の条件 (args[i+1]が存在すれば即採用) と同じ緩さを引き継いでいる点は明示テスト or ガードどちらかで担保しておくと安全です。- if args[i] == "--body" && i + 1 < args.len() { + if args[i] == "--body" && i + 1 < args.len() && !is_long_flag(&args[i + 1]) { result.push(args[i].clone()); let mut body_parts = vec![args[i + 1].clone()]; i += 2;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/cli-pr-monitor/src/stages/create_pr.rs` around lines 25 - 35, The body-parsing branch currently treats args[i+1] as body even if it's a long flag, so change the condition to only enter the "--body" branch when i + 1 < args.len() AND !is_long_flag(&args[i + 1]); inside the branch push the "--body" flag then collect body_parts starting from args[i+1] as before, advancing i; if the next token is a long flag, skip entering the branch (so "--body --title" leaves "--body" and "--title" intact) and ensure convert_body_to_file (and any callers) still handle the absence of a body token correctly. Reference symbols: args, is_long_flag, result, body_parts, convert_body_to_file, and the "--body" parsing block in create_pr.rs.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/cli-pr-monitor/src/stages/create_pr.rs`:
- Around line 16-41: The current is_long_flag treats any "--" prefix as a flag
(so lines like "---" or "--=foo" in markdown break reassemble_split_body);
change is_long_flag to require that after the leading "--" the next character
exists and is an ASCII alphabetic character (e.g. arg.starts_with("--") &&
arg.as_bytes().get(2).map_or(false, |b| b.is_ascii_alphabetic())), so
reassemble_split_body will not stop on markdown `---` or similar; update
is_long_flag (and any callers) accordingly and add tests like
reassemble_split_body_preserves_markdown_hr and is_long_flag_rejects_triple_dash
to cover the regression.
---
Nitpick comments:
In `@src/cli-pr-monitor/src/stages/create_pr.rs`:
- Around line 25-35: The body-parsing branch currently treats args[i+1] as body
even if it's a long flag, so change the condition to only enter the "--body"
branch when i + 1 < args.len() AND !is_long_flag(&args[i + 1]); inside the
branch push the "--body" flag then collect body_parts starting from args[i+1] as
before, advancing i; if the next token is a long flag, skip entering the branch
(so "--body --title" leaves "--body" and "--title" intact) and ensure
convert_body_to_file (and any callers) still handle the absence of a body token
correctly. Reference symbols: args, is_long_flag, result, body_parts,
convert_body_to_file, and the "--body" parsing block in create_pr.rs.
🪄 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: 51a6cdd6-0cf9-4c34-9aea-684b722535d3
📒 Files selected for processing (1)
src/cli-pr-monitor/src/stages/create_pr.rs
82d4305 to
aac8a67
Compare
ADR-028 (外部可視成果物の生成コマンドの実行ゲート) の運用フローを skill として明文化。 `pnpm push` 完了後の PR 作成で以下の 7 ステップを標準化する: 1. jj status + jj log -r master..@ で差分/bookmark 確認 2. commit description から PR title 初稿生成 (70 文字超は短縮、conventional prefix 維持) 3. diff + commit log から PR body 初稿生成 (Summary/Context/Validation/References) 4. Claude が提示 → AskUserQuestion で明示承認 (auto mode でも必須) 5. `pnpm prepare-pr-body` 経由で `.tmp-pr-body.md` に書き出し 6. `pnpm create-pr --title ... --body-file ...` foreground 実行 (permissions.ask で再確認) 7. `pnpm prepare-pr-body:cleanup` で一時ファイル削除 ## 設計ハイライト - **ADR-028 二層防衛の活用**: skill 内の AskUserQuestion (一次) + permissions.ask (二次) - **user-supplied text の尊重** (ADR-022): 承認済 draft の二重書き換えを禁止 - **body は必ず一時ファイル経由**: `--body "..."` 引数経由の切り詰めリスク回避 (PR #51 / memory `feedback_pnpm_create_pr_body.md`) - **automated actor から独立**: takt / cli-* の自律ループはこの skill を呼ばない ## ステータス 試験運用 (2026-04-19〜)。発火頻度・UX を半年観察して正式採用 / 改良 / 廃止を判断する。 ## ファイル - `.claude/skills/prepare-pr/SKILL.md` 新設 (178 行) ## docs/todo.md - PR-D 完了に伴い「セッション 247510ea 由来: 整備タスク群」ブロック全体を削除 - 雑務 task をリナンバー (#8 → #7) refs: ADR-028, ADR-022, PR #57 (PR-B body helper), memory `feedback_bookmark_auto_naming.md`
ADR-028 (外部可視成果物の生成コマンドの実行ゲート) の運用フローを skill として明文化。 `pnpm push` 完了後の PR 作成で以下の 7 ステップを標準化する: 1. jj status + jj log -r master..@ で差分/bookmark 確認 2. commit description から PR title 初稿生成 (70 文字超は短縮、conventional prefix 維持) 3. diff + commit log から PR body 初稿生成 (Summary/Context/Validation/References) 4. Claude が提示 → AskUserQuestion で明示承認 (auto mode でも必須) 5. `pnpm prepare-pr-body` 経由で `.tmp-pr-body.md` に書き出し 6. `pnpm create-pr --title ... --body-file ...` foreground 実行 (permissions.ask で再確認) 7. `pnpm prepare-pr-body:cleanup` で一時ファイル削除 ## 設計ハイライト - **ADR-028 二層防衛の活用**: skill 内の AskUserQuestion (一次) + permissions.ask (二次) - **user-supplied text の尊重** (ADR-022): 承認済 draft の二重書き換えを禁止 - **body は必ず一時ファイル経由**: `--body "..."` 引数経由の切り詰めリスク回避 (PR #51 / memory `feedback_pnpm_create_pr_body.md`) - **automated actor から独立**: takt / cli-* の自律ループはこの skill を呼ばない ## ステータス 試験運用 (2026-04-19〜)。発火頻度・UX を半年観察して正式採用 / 改良 / 廃止を判断する。 ## ファイル - `.claude/skills/prepare-pr/SKILL.md` 新設 (178 行) ## docs/todo.md - PR-D 完了に伴い「セッション 247510ea 由来: 整備タスク群」ブロック全体を削除 - 雑務 task をリナンバー (#8 → #7) refs: ADR-028, ADR-022, PR #57 (PR-B body helper), memory `feedback_bookmark_auto_naming.md`
ADR-028 (外部可視成果物の生成コマンドの実行ゲート) の運用フローを skill として明文化。 `pnpm push` 完了後の PR 作成で以下の 7 ステップを標準化する: 1. jj status + jj log -r master..@ で差分/bookmark 確認 2. commit description から PR title 初稿生成 (70 文字超は短縮、conventional prefix 維持) 3. diff + commit log から PR body 初稿生成 (Summary/Context/Validation/References) 4. Claude が提示 → AskUserQuestion で明示承認 (auto mode でも必須) 5. `pnpm prepare-pr-body` 経由で `.tmp-pr-body.md` に書き出し 6. `pnpm create-pr --title ... --body-file ...` foreground 実行 (permissions.ask で再確認) 7. `pnpm prepare-pr-body:cleanup` で一時ファイル削除 ## 設計ハイライト - **ADR-028 二層防衛の活用**: skill 内の AskUserQuestion (一次) + permissions.ask (二次) - **user-supplied text の尊重** (ADR-022): 承認済 draft の二重書き換えを禁止 - **body は必ず一時ファイル経由**: `--body "..."` 引数経由の切り詰めリスク回避 (PR #51 / memory `feedback_pnpm_create_pr_body.md`) - **automated actor から独立**: takt / cli-* の自律ループはこの skill を呼ばない ## ステータス 試験運用 (2026-04-19〜)。発火頻度・UX を半年観察して正式採用 / 改良 / 廃止を判断する。 ## ファイル - `.claude/skills/prepare-pr/SKILL.md` 新設 (178 行) ## docs/todo.md - PR-D 完了に伴い「セッション 247510ea 由来: 整備タスク群」ブロック全体を削除 - 雑務 task をリナンバー (#8 → #7) refs: ADR-028, ADR-022, PR #57 (PR-B body helper), memory `feedback_bookmark_auto_naming.md`
ADR-028 (外部可視成果物の生成コマンドの実行ゲート) の運用フローを skill として明文化。 `pnpm push` 完了後の PR 作成で以下の 7 ステップを標準化する: 1. jj status + jj log -r master..@ で差分/bookmark 確認 2. commit description から PR title 初稿生成 (70 文字超は短縮、conventional prefix 維持) 3. diff + commit log から PR body 初稿生成 (Summary/Context/Validation/References) 4. Claude が提示 → AskUserQuestion で明示承認 (auto mode でも必須) 5. `pnpm prepare-pr-body` 経由で `.tmp-pr-body.md` に書き出し 6. `pnpm create-pr --title ... --body-file ...` foreground 実行 (permissions.ask で再確認) 7. `pnpm prepare-pr-body:cleanup` で一時ファイル削除 ## 設計ハイライト - **ADR-028 二層防衛の活用**: skill 内の AskUserQuestion (一次) + permissions.ask (二次) - **user-supplied text の尊重** (ADR-022): 承認済 draft の二重書き換えを禁止 - **body は必ず一時ファイル経由**: `--body "..."` 引数経由の切り詰めリスク回避 (PR #51 / memory `feedback_pnpm_create_pr_body.md`) - **automated actor から独立**: takt / cli-* の自律ループはこの skill を呼ばない ## ステータス 試験運用 (2026-04-19〜)。発火頻度・UX を半年観察して正式採用 / 改良 / 廃止を判断する。 ## ファイル - `.claude/skills/prepare-pr/SKILL.md` 新設 (178 行) ## docs/todo.md - PR-D 完了に伴い「セッション 247510ea 由来: 整備タスク群」ブロック全体を削除 - 雑務 task をリナンバー (#8 → #7) refs: ADR-028, ADR-022, PR #57 (PR-B body helper), memory `feedback_bookmark_auto_naming.md`
Summary
--bodyの複数行テキストが分割される問題を修正reassemble_split_body前処理を追加:--bodyの次引数から次の--long-flagまでを改行で結合し、単一の body 引数に再構成convert_body_to_fileで--body-fileに自動変換されるTest plan
Summary by CodeRabbit
バグ修正