Skip to content

feat(ci): 夜間 PR に台帳の後始末が含まれているかをマージ境界で検査する - #468

Merged
aloekun merged 1 commit into
masterfrom
feat/nightly-ledger-removal-check
Sep 2, 2026
Merged

feat(ci): 夜間 PR に台帳の後始末が含まれているかをマージ境界で検査する#468
aloekun merged 1 commit into
masterfrom
feat/nightly-ledger-removal-check

Conversation

@aloekun

@aloekun aloekun commented Sep 2, 2026

Copy link
Copy Markdown
Owner

何を止めるか

完了を表現するのは台帳削除コミットのマージだけ (ADR-072 決定 19) だが、その削除はブランチに載って運ばれるデータなので、失われても検知する層が無かった。

2026-08-30、jj rebase -r <先端> が親の chore(ledger) コミットを置き去りにし、#427 / #459 / #461 の 3 本すべてで実装だけがマージされた (衝突は 1 度も起きていない。捨てたのではなく拾い忘れた形)。順位 324 / 412 / 457 が 3 箇所とも残り、2026-09-01 の夜間 run が 324 を再選択して空 diff red になった。

既存の防御はどれも当たらない — 除外集合はブランチ存在だけを見る (マージで消える)、順位 table 照合は台帳と順位 table が両方残ると素通り、cli-ledger-cleanup の採点はブランチの diff しか見ない。

何を足すか

新 crate cli-ledger-removal-checkclaude/nightly-<順位> の PR に対し、その順位が台帳・順位 table・詳細エントリのどこにも残っていないことを CI (ci.ymlVerify nightly ledger cleanup) で要求する。

  • diff ではなく head の状態を順位で見る → 行番号・文脈行・運び方 (リベース / squash / 手作業) に依存しない
  • 書式の解釈を増やさない → 見出し判定は消す側と同じ関数 (lib_ledger::detail_entry_ranks)、順位 table の識別は cli_docs_lint::docs_files を借りる
  • fail-closed (docs が読めなければ exit 2)、夜間ブランチ以外は early-success で緑 (job/step の skip は required check で pending になるため使わない)
  • 失敗時は jj rebase -bcli-ledger-cleanup --apply の 2 経路を出力で案内する

検証

  • 実データ: 後始末済みの 324 → 緑 / 台帳に在る 455 → 3 箇所すべてを名指しで NG / master → SKIP
  • unit test 12 件 (incident 再現・部分残り・派生ブランチ名の誤読防止)
  • ミューテーション: residue の判定を潰すと incident 再現テスト 2 件が落ちる
  • workspace test / clippy -D warnings / lint:md / lint:docs / lint:workflows すべて green

射程外

人間が別名ブランチで実装して後始末を忘れた場合は、ブランチ名から順位が引けないため検査できない。この経路は次の PR (A1 / A3: merged PR × 台帳の照合を weekly-review / 夜間 preflight へ) が受け持つ。

Summary by CodeRabbit

  • 新機能

    • 夜間ブランチの後始末漏れを自動検証するチェックを追加しました。
    • 台帳、順位一覧、詳細エントリに不要な順位が残っている場合、CIで検出できるようになりました。
  • ドキュメント

    • 夜間処理の後始末をマージ時に検証する運用方針を追加しました。
  • ビルド

    • 全体ビルドで新しい検証ツールも自動的にビルドされるようになりました。

完了を表現するのは台帳削除コミットのマージだけ (ADR-072 決定 19) だが、
その削除はブランチに載って運ばれるデータなので失われても検知層が無かった。
2026-08-30 の jj rebase -r が親の chore(ledger) コミットを置き去りにし、
#427/#459/#461 の 3 本で実装だけがマージされ、2026-09-01 の夜間 run が
順位 324 を再選択して空 diff red になった。

claude/nightly-<順位> を head とする PR に対し、その順位が台帳・順位 table・
詳細エントリのどこにも残っていないことを CI で要求する。diff のテキストでは
なく head の状態を順位で見るので、運び方にも行番号にも依存しない。

ADR-072 に決定 21 として記録。
@coderabbitai

coderabbitai Bot commented Sep 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: c862a233-b29b-448e-9367-090b1d920741

📥 Commits

Reviewing files that changed from the base of the PR and between dc39b70 and 0832898.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (9)
  • .github/workflows/ci.yml
  • Cargo.toml
  • docs/adr/adr-072-nightly-todo-loop.md
  • package.json
  • src/cli-ledger-removal-check/Cargo.toml
  • src/cli-ledger-removal-check/src/detect.rs
  • src/cli-ledger-removal-check/src/main.rs
  • src/lib-ledger/src/lib.rs
  • src/lib-ledger/src/removal.rs

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

夜間ブランチの順位を台帳、順位テーブル、詳細エントリから検出するCLIを追加しました。CLIをworkspace、ビルドスクリプト、UbuntuのCIに接続し、順位解析APIとテストを追加しました。

Changes

夜間台帳後始末検証

Layer / File(s) Summary
順位解析APIとパッケージ構成
Cargo.toml, src/cli-ledger-removal-check/Cargo.toml, src/lib-ledger/src/lib.rs, src/lib-ledger/src/removal.rs
詳細エントリの順位を抽出するdetail_entry_ranksを追加しました。新しいバイナリクレートとworkspace構成を追加しました。
順位残骸の検出
src/cli-ledger-removal-check/src/detect.rs
夜間ブランチ名から順位を抽出し、台帳、順位テーブル、詳細エントリに残る順位を検出するロジックとテストを追加しました。
検証CLIの実装
src/cli-ledger-removal-check/src/main.rs
--branch--docs-dirを解析し、docsを走査します。検証結果に応じて終了コード0、1、または2を返します。
ビルドとCIへの接続
package.json, .github/workflows/ci.yml, docs/adr/adr-072-nightly-todo-loop.md
ビルドスクリプトを追加しました。UbuntuのCIで夜間ブランチを検証し、設計をADRに記録しました。

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: ⚪ Minimal · up to 08328

This change adds a CI check to verify that nightly ledger cleanup is present at the merge boundary. No actionable merge-blocking risk remains after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant GitHubActions
  participant cli-ledger-removal-check
  participant docs
  GitHubActions->>cli-ledger-removal-check: --branch と --docs-dir を渡す
  cli-ledger-removal-check->>docs: 台帳・順位テーブル・詳細エントリを走査する
  docs-->>cli-ledger-removal-check: 順位集合を返す
  cli-ledger-removal-check-->>GitHubActions: 終了コードを返す
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 70.37% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 27 functions across 4 files. (5 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed タイトルは、夜間 PR に対する台帳後始末の CI 検査をマージ境界で追加する主変更を明確かつ簡潔に示しています。
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 70.37% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 27 functions across 4 files. (5 skipped: 5 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/nightly-ledger-removal-check

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.

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🤖 PR Monitor 分析 (GitHub Actions バックストップ)

  • トリガー: issue_comment (created) / 実行 run
  • CI: rust (ubuntu-latest) pending / rust (windows-latest) pending / request skipping / CodeRabbit pass (実体は「Review skipped: manual review required for this OSS repository」— レビュー未実施の通知であり pass ではない)
  • レビュー状況: 未実施 (陽性証拠なし)。reviews API は空配列、インライン指摘も無し。会話コメントは CodeRabbit の定型 skip 通知 (「10 stars 未満のため自動レビュー対象外」) のみで、これはレビューの陽性証拠に数えない (analyze-coderabbit.md の Review evidence gate, ADR-064)。human review も 0 件。
  • Verdict: user_decision (レビュー未実施のため approved にしない。CI も pending で確定していない)

Applicable Findings (Critical / High / Major)

該当なし (レビュー指摘 0 件)

Applicable Findings (Medium 以下)

該当なし

Filtered (not applicable)

該当なし

diff 概要 (軽量サマリー)

次のアクション

  • CI (rust (ubuntu-latest) / rust (windows-latest)) の完了を待ち、特に新規追加した Verify nightly ledger cleanup ステップの初回実行結果 (このブランチ自体は claude/nightly- プレフィックスではないため SKIP 終了する見込み) を確認する。
  • 本リポジトリは CodeRabbit の自動レビュー対象外 (10 stars 未満) のため、実質的なレビューが人間にしか行われない。マージ前に人間によるレビューを明示的に依頼することを推奨する。

@aloekun
aloekun merged commit 44274bf into master Sep 2, 2026
4 checks passed
@aloekun
aloekun deleted the feat/nightly-ledger-removal-check branch September 2, 2026 10:03
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