Skip to content

fix(merge-pipeline): transcript の読み取り順を timestamp ソートで決定論化する (nightly-todo 順位 239) - #391

Merged
aloekun merged 2 commits into
masterfrom
claude/nightly-239
Aug 14, 2026
Merged

fix(merge-pipeline): transcript の読み取り順を timestamp ソートで決定論化する (nightly-todo 順位 239)#391
aloekun merged 2 commits into
masterfrom
claude/nightly-239

Conversation

@nightly-todo-aloekun

@nightly-todo-aloekun nightly-todo-aloekun Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

台帳 (docs/claude-code-web-tasks.md) の無人可タスク 順位 239
夜間ループ (nightly-todo workflow) が無人で実装した PR です。

  • 内容: 'filter_transcripts' の 'read_dir' 非決定順を timestamp ソートで決定論化 + 回帰テスト
  • 事前フィルタ: 夜間 workflow が ubuntu 上で cargo test --workspace +
    cargo clippy --workspace --all-targets -- -D warnings を回して green を確認済み
    (agent の自己申告ではなく workflow が回し直した結果)。これはコストフィルタで
    品質の保証ではありません — 単一 OS で --ignored も hooks smoke も含みません
  • 品質の保証: 本 PR に紐づく ci.yml (windows-latest + ubuntu-latest) のチェックを見てください
  • ゲート: cli-autonomy-gate --operation autonomous-pr (kill-switch + 背圧) を通過

マージ判断は人間が行います (ADR-052 の commitment 点)。CI が緑で内容が台帳の
意図に沿っていればマージしてください。ずれている場合はクローズを —
採用率は WP-18 の受け入れ基準の測定対象です。

run: https://github.com/aloekun/claude-code-hook-test/actions/runs/31522018858

Summary by CodeRabbit

  • バグ修正

    • トランスクリプトのJSONLファイルを更新日時順に処理するよう改善しました。
    • ファイル名の並び順に左右されず、書き込み順に沿って正しく処理されます。
  • テスト

    • ファイル名の順序と書き込み順が異なる場合でも、正しい順序で処理されることを確認しました。

@aloekun

aloekun commented Aug 11, 2026

Copy link
Copy Markdown
Owner

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 3e2aa858-eae6-4dda-8baa-8aae29296f39

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

filter_transcripts.jsonl ファイルを更新時刻の昇順で処理します。メタデータ取得に失敗した場合は Unix epoch を使用します。追加テストは、ファイル名と処理順が一致しない場合を検証します。

Changes

Transcript の処理順序

Layer / File(s) Summary
更新時刻順の処理と検証
src/cli-merge-pipeline/src/feedback/transcript.rs
filter_transcripts.jsonl ファイルを収集し、更新時刻の昇順で処理します。メタデータ取得に失敗した場合は Unix epoch を使用します。追加テストは、逆順のファイル名でも書き込み順に処理されることと、処理件数を検証します。

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed タイトルは、filter_transcripts の読み取り順を timestamp ソートで決定論化する主要な変更を明確に示しています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/nightly-239

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

Copy link
Copy Markdown
Contributor

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

  • トリガー: issue_comment (created) / 実行 run
  • CI: pending — request は pass (35s)、rust (ubuntu-latest) / rust (windows-latest) は実行中
  • レビュー状況: 人間レビューなし。CodeRabbit はオーナーの @coderabbitai review コマンドを受けて "Currently processing new changes... please wait" (レビュー未着・進行中)
  • Verdict: user_decision (CI 完了待ち・CodeRabbit レビュー未着のため、指摘の有無を含め判定材料が揃っていない)

Applicable Findings (Critical / High / Major)

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

Applicable Findings (Medium 以下)

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

Filtered (not applicable)

該当なし

次のアクション

  • CI (rust (ubuntu-latest) / rust (windows-latest)) と CodeRabbit レビューの完了を待ってから再評価する
  • diff は src/cli-merge-pipeline/src/feedback/transcript.rs 1 ファイルのみ。fs::read_dir の非決定的な走査順を mtime ソートで決定論化する変更で、コード内コメントが ADR-030 の determinism 目標を明示的に参照しており、既存 ADR と整合的な意図的設計と判断できる。新規テスト filter_transcripts_orders_by_mtime_not_filename も追加済みで、ファイル名 alphabetical 順と mtime 順が逆になるケースを検証している

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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 `@src/cli-merge-pipeline/src/feedback/transcript.rs`:
- Around line 67-71: Update the jsonl_paths sorting in the transcript filtering
flow to use a deterministic secondary key, such as PathBuf, after the
modified-time key so equal mtimes and metadata failures are consistently
ordered. Extend filter_transcripts_orders_by_mtime_not_filename with two files
sharing the same mtime and assert their stable secondary-key order while
preserving mtime as the primary ordering.
🪄 Autofix

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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 5f27b4bd-b8d4-4e81-9583-86349c6f52b9

📥 Commits

Reviewing files that changed from the base of the PR and between afbd6b3 and 2def305.

📒 Files selected for processing (1)
  • src/cli-merge-pipeline/src/feedback/transcript.rs

Comment thread src/cli-merge-pipeline/src/feedback/transcript.rs Outdated
@github-actions

Copy link
Copy Markdown
Contributor

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

  • トリガー: pull_request_review (submitted) / 実行 run
  • CI: pending — rust (ubuntu-latest) は pass (1m34s)、request は pass (35s)、rust (windows-latest) は実行中、analyze (本 workflow) は実行中
  • レビュー状況: CodeRabbit が COMMENTED レビューを提出 (actionable comment 1件、Major)。人間レビューなし (reviewDecision 未設定)
  • Verdict: needs_fix

Applicable Findings (Critical / High / Major)

# File (Line) Reviewer Issue Recommended Action
1 src/cli-merge-pipeline/src/feedback/transcript.rs:67-71 CodeRabbit jsonl_paths.sort_by_key は mtime のみをキーにしており、sort_by_key は同キー要素の入力順を保持する (stable) 一方 fs::read_dir の走査順は OS/filesystem 依存で非決定的。同一 mtime (または metadata 取得失敗で揃う UNIX_EPOCH) のファイルが複数ある場合、処理順が非決定的になり得る mtime の後に PathBuf 等の安定した二次キーをソートキーに追加する。filter_transcripts_orders_by_mtime_not_filename に同一 mtime の2ファイルの順序を検証するケースを追加する

Applicable Findings (Medium 以下)

該当なし

Filtered (not applicable)

該当なし

次のアクション

  • CodeRabbit の Major 指摘 (二次ソートキー欠如) への対応 — sort_by_key(mtime, path.clone()) のようなタプルキーに変更し、同一 mtime ケースのテストを追加する
  • rust (windows-latest) CI の完了を待って全体のグリーン化を確認する
  • 本 diff は変更ファイル1件 (transcript.rs)。mtime ソート導入自体はコード内コメントで ADR-030 determinism 目標を明示参照しており意図的設計と判断できるが、上記 Major 指摘はその実装の不完全性 (同順位タイブレーク欠如) を突く妥当な指摘

@github-actions

Copy link
Copy Markdown
Contributor

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

  • トリガー: pull_request_review (submitted) / 実行 run
  • CI: green — rust (ubuntu-latest) pass (1m38s) / rust (windows-latest) pass (3m54s)、いずれも最新 commit e9e65d44 に対して実施済み。CodeRabbit check は pass (incremental reviews disabled のため skip)。fix check は fail 表示だが、これは本 pr-monitor workflow 自身の内部ジョブが「より優先度の高い新規トリガー (今回の analyze run) の待機」により canceled になったもので、PR の diff やアプリケーションコードの CI 失敗ではない
  • レビュー状況:
    • CodeRabbit: 2026-08-11 に Major 指摘 1 件 (transcript.rs:67-71, sort_by_key の二次キー欠如による mtime 同値時の非決定順序) を提出済み → オーナー aloekun が 2026-08-14T05:58 commit e9e65d44(mtime, PathBuf) タプルキーへ変更し対応、同一 mtime タイブレークを検証する新規テスト filter_transcripts_breaks_mtime_ties_by_path_deterministically を追加。返信コメントで対応内容を説明
    • CodeRabbit は 2026-08-14T06:15 に該当スレッドで "指摘は解消されています" と確認し resolve 済み
    • 人間レビュー: aloekun 自身が返信のみ (COMMENTED)、正式な APPROVE は無し。reviewDecision は空欄
  • Verdict: user_decision (指摘は解消済みで CI もグリーンだが、mergeStateStatus: BLOCKED かつ reviewDecision 未設定であり、正式な人間レビューの承認待ちと見られる — コード上の追加対応は不要)

Applicable Findings (Critical / High / Major)

該当なし (唯一の Major 指摘は commit e9e65d44 で対応済み・CodeRabbit が解消確認済み)

Applicable Findings (Medium 以下)

該当なし

Filtered (not applicable)

該当なし

次のアクション

  • CodeRabbit の Major 指摘は解消済み・CI もグリーンのため、マージ可否は人間の approve 判断待ち (mergeStateStatus: BLOCKED, reviewDecision 未設定) — オーナーまたはレビュアーによる正式な approve を推奨
  • fix check の fail 表示は本 workflow 自身の内部キャンセルによるものであり、追加対応不要 (アプリケーションコードの CI とは無関係)

@aloekun
aloekun merged commit dd1d8d9 into master Aug 14, 2026
5 of 7 checks passed
@aloekun
aloekun deleted the claude/nightly-239 branch August 14, 2026 07:08
aloekun added a commit that referenced this pull request Aug 14, 2026
夜間 todo ループの PR 2 本について、マージ後の台帳後始末が滞留していた。実体を検証
したところ完了状況が分かれた。

## 順位 239 (#391) — 完了を確認して削除

transcript.rs に sort_by_key が存在することを確認し、台帳・todo-summary2.md・
todo13.md の 3 箇所を削除して根拠を § 棚卸し履歴 に記帳。

## 順位 216 (#394) — 未完了だったので完成させてから削除

#394 は fixture 2 ファイルだけを追加して CI green でマージされており、rule 定義・
rule test・E2E case・dogfood がいずれも入っていなかった。

原因は既存 3 検査 (rule_test_coverage_check / incident_fixture_coverage_check /
cases_cover_every_incident_rule) がすべて rule を起点に回る一方向の設計で、rule を
伴わない孤児 fixture を素通りしていたこと。逆向きの orphan_fixture_check を追加し
「fixture があるなら必ず rule がある」を fail-closed で強制する (追加時点で孤児 2 件を
実際に検出することを確認済み。この検査があれば #394 は CI で止まっていた)。

そのうえで残り作業を実装した:
- rule 定義 (pattern \bPR-[0-9]+\b、toml/yaml/yml/jsonc/json、warning)
- rule test 5 件 (主要拡張子ごとの positive + PR #NNN 形式の negative)
- incident_eval.rs の E2E case
- dogfood: .claude/hooks-config.toml の workstream 連番 2 箇所を除去

rule 自身の説明文が自分の pattern に反応したため、rule⑥ が docs/todoN.md と書くのと
同じ placeholder 方式 (PR-N) で回避している。

完了基準を満たしたので台帳・todo-summary.md・todo18.md から削除し、
§ 未完了のままマージされた順位 には事例と対処を残した (「マージ ≠ 完了」の失敗モードは
他タスククラスに残るため)。
aloekun added a commit that referenced this pull request Aug 14, 2026
* fix(post-tool-linter): 孤児 fixture を CI で検出し、順位 216/239 の後始末を完了する

夜間 todo ループの PR 2 本について、マージ後の台帳後始末が滞留していた。実体を検証
したところ完了状況が分かれた。

## 順位 239 (#391) — 完了を確認して削除

transcript.rs に sort_by_key が存在することを確認し、台帳・todo-summary2.md・
todo13.md の 3 箇所を削除して根拠を § 棚卸し履歴 に記帳。

## 順位 216 (#394) — 未完了だったので完成させてから削除

#394 は fixture 2 ファイルだけを追加して CI green でマージされており、rule 定義・
rule test・E2E case・dogfood がいずれも入っていなかった。

原因は既存 3 検査 (rule_test_coverage_check / incident_fixture_coverage_check /
cases_cover_every_incident_rule) がすべて rule を起点に回る一方向の設計で、rule を
伴わない孤児 fixture を素通りしていたこと。逆向きの orphan_fixture_check を追加し
「fixture があるなら必ず rule がある」を fail-closed で強制する (追加時点で孤児 2 件を
実際に検出することを確認済み。この検査があれば #394 は CI で止まっていた)。

そのうえで残り作業を実装した:
- rule 定義 (pattern \bPR-[0-9]+\b、toml/yaml/yml/jsonc/json、warning)
- rule test 5 件 (主要拡張子ごとの positive + PR #NNN 形式の negative)
- incident_eval.rs の E2E case
- dogfood: .claude/hooks-config.toml の workstream 連番 2 箇所を除去

rule 自身の説明文が自分の pattern に反応したため、rule⑥ が docs/todoN.md と書くのと
同じ placeholder 方式 (PR-N) で回避している。

完了基準を満たしたので台帳・todo-summary.md・todo18.md から削除し、
§ 未完了のままマージされた順位 には事例と対処を残した (「マージ ≠ 完了」の失敗モードは
他タスククラスに残るため)。

* fix(review): apply CodeRabbit fixes for #402

- orphan_fixture_check の宣言集合を bad/good で分離 (跨ぎ名で孤児を見逃す欠陥) + 回帰テスト
- fixture 列挙の entry エラー / 非 UTF-8 名を panic に (false-green 防止、ADR-043)
- rule の extensions から json を除去 (JSON は comment 構文を持たず、順位 216 の設計決定でも除外されていた)
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