feat(cli-push-runner): Bundle 2 — 順位 2 bookmark check stage + 順位 156/158 docs#175
Conversation
…ble に登録 PR #174 (Bundle 1) post-merge-feedback で採用判定された 4 件を docs/todo9.md に 新規エントリとして追加し、docs/todo-summary.md table に行追加。 - 順位 155 (T1 #1): cli-pr-monitor fix chain 末尾に空 commit 検査 + jj abandon step 追加 (PR #174 で観測した kqvluqyv 事例の構造化予防、Effort S) - 順位 156 (T2 #1): effective_patterns() の空 variant test 4 件直交化 (CR Minor finding 起点の 4 filter path 独立検証化、Effort S) - 順位 157 (T2 #2): Bundle 1 dogfood checklist 実行 — __test.ps1 block + override env 確認 (ADR-039 bounded lifetime data point #1、Effort XS) - 順位 158 (T3 #1): ADR-039 に bounded lifetime decision trigger 必須化パターン 追記 (PR #174 の 3-5 PR dogfood 実例を reusable rule に昇格、Effort S)
…158 docs 順位 2 (PR #85 T1-3) jj bookmark 未設定 early-exit を実装。jj 環境では新規ブランチ で bookmark を作成し忘れる落とし穴があり、PR #85 で初回 `pnpm push` が `Nothing changed` で終了し 158s かけた quality_gate + takt review が無駄になった 事象の構造的予防。 ## 実装 (順位 2) - src/cli-push-runner/src/stages/bookmark_check.rs (新規): 新 stage - src/cli-push-runner/src/stages/mod.rs: module register - src/cli-push-runner/src/main.rs: - Stage -1 として run_bookmark_check を pipeline 最早期に追加 - EXIT_BOOKMARK_MISSING = 7 を新設 - run_pipeline が 50 行制限を超えたため run_pre_checks を抽出して責務分離 設計: - 配置: scratch_file_warning より前の最早期 stage (push 自体不可能な状態を最優先で fail-fast) - 検出: `jj bookmark list` で非 trunk bookmark の有無を確認 (lib_jj_helpers::is_trunk_bookmark で filter) - 失敗時挙動: error 終了 + 推奨コマンド (`jj bookmark create <name> -r @`) 提示 - fail-open: jj 実行失敗時は warning ログのみで push を続行 (jj 不調で push 自体を止めない) - 設計上の non-config: jj git push が bookmark 必須仕様のため、本 stage をバイパスする 正当な use case なし。`[bookmark_check]` config section は追加せず常に有効 ## Bundled docs - 順位 156: effective_patterns() の空 variant test 4 件直交化。既存 3 test を filter path 直交命名 (all_blank / mixed_blank_and_valid / whitespace_padded) にリネーム + 4 番目 variant (mixed_filter_to_empty) を新規追加。1 path regression で 1 test だけ failed する構造 (memory feedback_test_dry_antipattern.md 適用)。 - 順位 158: ADR-039 § 3 Bounded lifetime に「明示的 decision trigger 必須化」要件を 追記。PR #174 を実例 (Bundle 1 = 3-5 PR dogfood trigger) として cite、formless な 「未来の判定」記述を ADR レベルで禁止する reusable pattern として codify。 ## Tests cargo test --manifest-path src/cli-push-runner/Cargo.toml: 133 passed 新規 test: bookmark_check 6 件 + effective_patterns 1 件 (variant #4)
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughPR ChangesBookmark Check Stage の実装と統合
タスク追跡と計画ドキュメント更新
Sequence DiagramsequenceDiagram
participant main as main.rs
participant pre as run_pre_checks()
participant bookmark as run_bookmark_check()
participant jj as "jj bookmark list"
participant parse as parse_non_trunk_bookmarks()
main->>pre: run_pre_checks(config)
pre->>bookmark: run_bookmark_check()
bookmark->>jj: spawn subprocess "jj bookmark list"
jj-->>bookmark: stdout/stderr
bookmark->>parse: parse output
parse-->>bookmark: non-trunk bookmark list
alt non-trunk found
bookmark-->>pre: true (continue)
else none found
bookmark-->>pre: false (halt)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
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.
Actionable comments posted: 2
🤖 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 `@docs/todo9.md`:
- Around line 464-465: The template uses description.first_line() but the filter
checks description = "", causing a mismatch; update the flow so the filter
matches the template output: either change the jj log template to emit the full
description (use -T 'description') so the existing description = "" check is
valid, or change the filter to test the first line (empty string) of the
template output (i.e. treat an empty first_line as a blank commit message), or
replace both with a revset predicate like empty() (e.g. jj log -r 'master..@ &
empty()') so selection and template are consistent; locate and update the jj log
invocation and the filter logic referencing description.first_line() and
description = "" accordingly.
In `@src/cli-push-runner/src/main.rs`:
- Around line 81-82: The user-visible Japanese message in main.rs contains
duplicated punctuation at the substring "検出。.gitignore"; locate the string
literal containing "パイプライン中断: scratch ファイル検出。.gitignore 修正 / ファイル削除 /
SCRATCH_FILE_WARNING_OVERRIDE=1 のいずれかで再実行してください。" and fix the punctuation by
removing the extra full stop so it reads e.g. "パイプライン中断: scratch ファイル検出:
.gitignore 修正 / ファイル削除 / SCRATCH_FILE_WARNING_OVERRIDE=1 のいずれかで再実行してください。" (or
otherwise remove the duplicated punctuation between "検出" and ".gitignore") to
produce a natural Japanese sentence.
🪄 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: cb7a8fe8-2c14-4cfa-a458-0230cab01167
📒 Files selected for processing (8)
docs/adr/adr-039-experimental-feature-standard-pattern.mddocs/todo-summary.mddocs/todo2.mddocs/todo9.mdsrc/cli-push-runner/src/main.rssrc/cli-push-runner/src/stages/bookmark_check.rssrc/cli-push-runner/src/stages/mod.rssrc/cli-push-runner/src/stages/scratch_file_warning.rs
💤 Files with no reviewable changes (1)
- docs/todo2.md
…ation + todo9.md 順位 155 design clarification)
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
…t rule⑪ + 順位 142 ADR-041 補強 (#176) * docs(todo): PR #175 post-merge-feedback 採用 1 件を todo9.md / summary table に登録 PR #175 (Bundle 2) post-merge-feedback で採用判定された Tier 1 #1 を docs/todo9.md 新規エントリとして追加し、docs/todo-summary.md table に行追加。 - 順位 159 (T1 #1): jj template 内で脆弱な `description.first_line()` パターン を lint で禁止する custom lint rule (rule ⑪) 追加 (PR #175 Minor finding 由来 の ad-hoc fix を構造化予防に格上げ、`empty` keyword 利用促進、Effort XS、 対象 ext = toml/yaml/md) * feat(cli-push-runner): Bundle 3 — 順位 5 _tmp_* pattern 追加 + 順位 159 lint rule⑪ + 順位 142 ADR-041 補強 順位 5 (PR #88 T1-2) AI 生成一時スクリプト pattern の pre-push 検出を実装。 Bundle 1 で確定した補完アプローチ (config-driven patterns extension) を採用、 `_tmp_*` pattern を `scratch_file_warning` stage の patterns に追加することで PR scope 外 scratch file の混入を構造的に防止する範囲を拡張。 ## 実装 (順位 5) - push-runner-config.toml: patterns に `_tmp_*` 追加、ADR-007 との責務分担を コメントで明示 (本 stage = pre-push @ commit 検査 / ADR-007 = edit 時 text 検査) - src/cli-push-runner/src/stages/scratch_file_warning.rs: module doc に Bundle 3 完了状況と ADR-007 関係を追記、_tmp_* pattern の 3 件 test 追加 (detects_tmp_prefix_pattern / combined patterns / does_not_match_underscore_only) ## 実装 (順位 159) - .claude/custom-lint-rules.toml: rule⑪ (no-jj-template-first-line) 追加。 jj template の `description` の `first_line` メソッド使用を error severity で禁止、`empty` keyword 利用を促進。 - extensions: toml / yaml / md (jj template が記述されうる主要 file 形式) - Self-exclusion: message / why / example / コメント内で pattern 文字列を連続 記述しない設計で self-trigger を回避 (rule⑥ no-ephemeral-todo-reference と 同パターン) - src/hooks-post-tool-linter/src/main.rs: rule⑪ test 5 件追加 (toml / yaml positive+negative + md positive) - rule_test_coverage_check meta validation 通過 ## 実装 (順位 142) - docs/adr/adr-041-test-isolation-patterns.md: § 関連 pattern: State Preservation Invariant (write-once 不変式) を追加。Multi-Condition Guards (本体) との別 pattern class として codify、PR #168/169/170 連続観測の write-once field (state.fix_push_time 等) 設計 + 3 variant 直交 test pattern (既存値 preservation / 新値 provision / 書き換え不可) を明文化。参照実装 = poll.rs の finalize_*_preserves_existing_fix_push_time + monitor.rs の resume_returns_fix_push_time_from_state_when_set を cite。 ## Tests - cargo test --manifest-path src/cli-push-runner/Cargo.toml: 136 passed (+3) - cargo test --manifest-path src/hooks-post-tool-linter/Cargo.toml no_jj_template_first_line: 5 passed (新規) - cargo test --manifest-path src/hooks-post-tool-linter/Cargo.toml rule_test_coverage_check: 1 passed (meta validation) - pnpm build:cli-push-runner / pnpm build:hooks-post-tool-linter: release profile build success * docs(todo): Bundle 3 完了に伴い 順位 5 / 159 / 142 を削除
Summary
Bundle 2 (案 A 第 2 PR): 順位 2 (cli-push-runner jj bookmark 未設定 early-exit) を実装し、PR #174 post-merge-feedback 採用済の Tier 2 / Tier 3 (順位 156 / 158) を同 PR に bundle 化。
bookmark_checkを pipeline 最早期に追加。jj bookmark listで非 trunk ローカル bookmark の有無を確認、未設定ならEXIT_BOOKMARK_MISSING = 7で error 終了し解決手順 (jj bookmark create <name> -r @) を提示。PR docs(todo): 順位 1-3 グローバルルール完了に伴い todo エントリを削除 #85 の初回pnpm pushで 158s 浪費した事象の構造的予防。effective_patterns()の test を 4 filter path 直交化 (all_blank/mixed_blank_and_valid/whitespace_padded/mixed_filter_to_empty)。CR Minor finding (PR feat(cli-push-runner): Bundle 1 — 順位 1 scratch file warning hook + 順位 116/134 docs + 順位 8 planning #174) の構造的フォローアップ、1 path regression で 1 test だけ failed する構造化 (memoryfeedback_test_dry_antipattern.md適用)。Commit Chain
sxpwlpnpdocs(todo): PR feat(cli-push-runner): Bundle 1 — 順位 1 scratch file warning hook + 順位 116/134 docs + 順位 8 planning #174 post-merge-feedback 採用 4 件を todo9.md / summary table に登録 (前セッション分)wxmxrorwfeat(cli-push-runner): Bundle 2 — 順位 2 bookmark check stage + 順位 156/158 docsrrxwvurvdocs(todo): Bundle 2 完了に伴い 順位 2 / 156 / 158 を削除Implementation Details (順位 2)
新 stage 配置:
run_pipelineの最早期 (Stage -1、scratch_file_warningStage 0 より前)。bookmark 不在は push 自体が不可能な状態のため、最優先で fail-fast。src/cli-push-runner/src/stages/bookmark_check.rs(新規、166 行): 新 stage 本体src/cli-push-runner/src/stages/mod.rs: module registersrc/cli-push-runner/src/main.rs:run_bookmark_checkを追加EXIT_BOOKMARK_MISSING = 7を新設run_pipelineが 50 行制限を超えたためrun_pre_checksを抽出 (Bundle Z #B-α 関数長 50 行制限準拠、bookmark + scratch の 2 check を責務統合)設計判断:
jj git pushが bookmark を必須とする仕様で、本 stage をバイパスする正当な use case が存在しない。[bookmark_check]config section は追加せず、常に有効is_trunk_bookmarkで master / main を filter (ADR-024 共通 jj ヘルパー継承)jj bookmark list実行失敗 (timeout / 起動失敗) 時は warning ログのみで push 続行 (jj 不調で push 自体を止めない、Bundle 1 と同設計)Implementation Details (順位 156)
scratch_file_warning.rsのeffective_patterns()test 群を 4 filter path 直交化:effective_patterns_all_blank_falls_back_to_default["", " ", "\t"]["__*"]effective_patterns_mixed_blank_and_valid_keeps_only_valid["", "__*", " ", "_tmp_*"]["__*", "_tmp_*"]effective_patterns_whitespace_padded_is_trimmed[" __* "]["__*"]effective_patterns_mixed_filter_to_empty_falls_back_to_default[" ", "\t"]["__*"]既存 3 test を新命名規約 (filter path 明示) にリネーム + variant #4 (
mixed_filter_to_empty) を新規追加。1 path のみ regression した場合に 1 test だけ failed する構造で、原因切り分けが即特定可能。Implementation Details (順位 158)
ADR-039 § 3 Bounded lifetime の既存 bullet list 末尾に「明示的 decision trigger の必須化」section を追加 (約 14 行):
Tests
cargo test --manifest-path src/cli-push-runner/Cargo.toml: 133 passed (新規: bookmark_check 6 件 + effective_patterns variant fix(hooks): Replace matcher追加 & deploy時のpermissions保持 #4 1 件)pnpm build:cli-push-runner(release profile): build success__test.ps1+ 「bookmark 削除して push」 の block 動作確認 (post-merge で実施)Out of Scope (案 A 後続 PR)
post-merge-feedback で発見された別 finding
なし (現時点の takt pre-push-review pass、CR 結果は post-PR で観察)
Summary by CodeRabbit
新機能
テスト
ドキュメント