Skip to content

feat(cli-push-runner): lint_screen stderr → report 取込 (Phase D 前提整備、順位 109)#144

Merged
aloekun merged 2 commits into
masterfrom
feature/rank-109-lint-screen-stderr-diagnostic
May 11, 2026
Merged

feat(cli-push-runner): lint_screen stderr → report 取込 (Phase D 前提整備、順位 109)#144
aloekun merged 2 commits into
masterfrom
feature/rank-109-lint-screen-stderr-diagnostic

Conversation

@aloekun
Copy link
Copy Markdown
Owner

@aloekun aloekun commented May 11, 2026

Summary

Phase D (real pipeline 経由 dogfood) の 前提整備 として、cli-push-runnerlint_screen stage が graceful fallback (exit 0) 時にも classifier の stderr を .takt/lint-screen-report.md## Diagnostic section に取り込むよう改修。Phase A (PR #142) で実装した num_ctx overflow 診断 warn log を real pipeline 経由で visible にする

  • 既存挙動: classifier exit 非 0 のみ stderr が Err message に含まれる。exit 0 (graceful fallback) では stderr が捨てられていた
  • 改修後: graceful fallback 経路でも stderr 非空なら report の ## Diagnostic section に転載、Phase A 診断 log + 将来の lib-ollama-client の warn 出力が visible になる
  • smoke test 5 件追加: non-empty/empty/whitespace-only/parse-error path/diagnostic content 各軸

変更内容

Commit 1: docs only (前 PR carry-over)

順位 114 (PR #143 T3-#1 採用) を docs/todo8.md 新設 + 登録、docs/todo6.md preamble の routing 移行 (新規エントリ → todo8.md)、todo-summary.md intro policy 更新。

Commit 2: 順位 109 実装 (Phase D 前提整備)

src/cli-push-runner/src/stages/lint_screen.rs

新 struct + 関数 signature 変更:

struct ClassifierOutput {
    stdout: String,
    stderr: String,
}

fn invoke_classifier(...) -> Result<ClassifierOutput, String>  // 旧: Result<String, String>
fn write_report(output_path: &str, classifier_json: &str, stderr: &str) -> Result<...>
fn format_report(classifier_json: &str, stderr: &str) -> String

新規 helper:

fn render_diagnostic(stderr: &str) -> String {
    // stderr 空 / whitespace-only → 空文字列を返す (Diagnostic section 不要)
    // 非空 → `\n## Diagnostic\n\n classifier exe からの stderr 出力 ...\n\n```text\n<stderr>\n```\n`
}

影響範囲

  • normal path (parse 成功): format_report## Diagnostic section を末尾に追加 (stderr 非空時のみ)
  • parse error path (render_parse_error): ## Diagnostic を JSON parse 失敗 section の後に追加
  • run_lint_screen: classifier 呼出結果から ClassifierOutput { stdout, stderr } を受け取り、両方を write_report に渡す

Test plan

  • cargo test -p cli-push-runner stages::lint_screen 14/14 pass (新規 4 件含む):
    • format_report_includes_diagnostic_section_when_stderr_non_empty (TP)
    • format_report_skips_diagnostic_section_when_stderr_empty (FP)
    • format_report_skips_diagnostic_section_when_stderr_whitespace_only (edge case)
    • format_report_appends_diagnostic_to_parse_error_path (parse error path)
  • cargo test workspace 全体 pass
  • takt pre-push-review 完了 (18m 44s)
  • markdownlint clean
  • 既存 10 件 lint_screen test (format_report_renders_findings_table 等) は signature 変更に伴い "" 第 2 引数を追加して全 pass

Phase D への接続

  • 本 PR land 後、.claude/cli-finding-classifier.exe を deploy しなおすと、real pipeline 経由でも Phase A 診断 log (prompt_eval_count / num_ctx / overflow hint) が .takt/lint-screen-report.md で visible になる
  • Phase D 実 dogfood (3 PRs baseline) はユーザー指示で (b) session-only opt-in 継続 = push-runner-config.toml[lint_screen] enabled = true を session 内で manual 切替、commit しない方針
  • Phase D の対象 PR は本 PR land 後の通常 PR (順位 110 = testing.md template / 順位 111 = docs-governance routing rule / 順位 112 = ADR-038 amendment 等の todo 実装 PR)

Out of scope

  • Phase D 実 dogfood 自体: 本 PR は前提整備のみ。dogfood は別 PR で
  • lint_screen.enabled = true の config 永続化: ユーザー方針 (b) で session-only opt-in 継続、本 PR では config 変更なし
  • 派生プロジェクト deploy: 本 PR の改修は cli-push-runner のため、deploy 戦略は ADR-026 (Cargo workspace) の現行ポリシー通り

Summary by CodeRabbit

リリースノート

  • Documentation

    • タスク管理ドキュメントを再構成し、新しいドキュメントファイルを追加しました。
  • New Features

    • リント画面レポートに診断情報セクションを追加し、エラー出力の詳細をレポートに含めるようにしました。

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 11, 2026

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: ab560d35-e15f-4819-b2c8-ef677e677f78

📥 Commits

Reviewing files that changed from the base of the PR and between 3f2274c and 0d865ef.

📒 Files selected for processing (4)
  • docs/todo-summary.md
  • docs/todo6.md
  • docs/todo8.md
  • src/cli-push-runner/src/stages/lint_screen.rs

📝 Walkthrough

ウォークスルー

このPRは、cli-push-runner の lint-screen ステージを拡張して分類器の stderr を診断セクションとして markdown レポートに含める機能を実装し、並行してタスク追跡ドキュメントを整理・再編成します。

変更内容

分類器診断レンダリング実装

レイヤー / ファイル 要約
分類器出力構造
src/cli-push-runner/src/stages/lint_screen.rs
ClassifierOutput 構造体で stdout と stderr を分離。invoke_classifier がサブプロセスの両パイプをキャプチャして返すように変更。
run_lint_screen エントリーポイント
src/cli-push-runner/src/stages/lint_screen.rs
構造化出力を抽出し、stdout と stderr の両ストリームを write_report に渡すように変更。
レポート書き込み層
src/cli-push-runner/src/stages/lint_screen.rs
write_report が stderr パラメータを受け付け、format_report(classifier_json, stderr) を呼び出すように更新。
レポートフォーマット化
src/cli-push-runner/src/stages/lint_screen.rs
format_report が stderr を受け取り、成功・JSON パース失敗の両パスで render_diagnostic を追加。空白以外の stderr のみ診断セクションをレンダリング。
診断セクション生成
src/cli-push-runner/src/stages/lint_screen.rs
render_diagnostic ヘルパー関数で stderr が非空の場合のみ「Diagnostic」セクションを条件付きレンダリング。
テスト・検証
src/cli-push-runner/src/stages/lint_screen.rs
format_report(json, stderr) シグネチャに対応するテスト更新、診断セクション出力の有無・無効JSON パスでの追加を検証する新テストケース。

タスク追跡ドキュメント再編

レイヤー / ファイル 要約
サマリードキュメント更新
docs/todo-summary.md
新規タスク記録先を docs/todo6.md から docs/todo8.md に変更。完了した stderr キャプチャ smoke test(順位 109)を削除し、ADR 関連タスクを繰り下げ・追加。
完了タスク削除と scope 更新
docs/todo6.md
ファイル位置づけを更新して新規エントリ移行先を docs/todo8.md に指定。cli-finding-classifier stderr smoke test エントリ一式を削除。
新規計画ドキュメント
docs/todo8.md
Part 8 として新規作成。50KB 超過対応と運用ルール・推奨参照順序を記載。PR #143 に基づく Local LLM Context Size と Resource Trade-off に関する新規 ADR タスク、作業計画、完了基準を追記。

コード審査の推定工数

🎯 3 (中程度) | ⏱️ ~20 分

関連する可能性のあるPR

  • aloekun/claude-code-hook-test#132: lint_screen ステージの同一関数群(format_report、テストシグネチャ)に対する直接的な拡張で、PR #132 で導入された動作に stderr 診断レンダリング機能を追加する。
  • aloekun/claude-code-hook-test#143: 当該 PR は cli-finding-classifier の stderr キャプチャ・レポート機能を実装し、PR #143 で記述された smoke test タスク・要件を直接実装する。
  • aloekun/claude-code-hook-test#124: 両 PR とも docs/todo6.md およびタスク番号付けの再編を変更し、タスク完了や新エントリの docs/todo8.md への移行を反映させる。
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 56.25% which is insufficient. The required threshold is 80.00%. 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のタイトルは、主な変更内容(lint_screenのstderr取込)を正確に反映しており、実装の核となるタスク(順位109)も明記されている。
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

@aloekun aloekun merged commit c4ad2c0 into master May 11, 2026
1 check passed
@aloekun aloekun deleted the feature/rank-109-lint-screen-stderr-diagnostic branch May 11, 2026 17:00
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