Skip to content

fix(cli-pr-monitor): 不正ペイロードで既存 state を消さない - #39

Merged
aloekun merged 1 commit into
masterfrom
fix/preserve-state-on-invalid-payload
Apr 15, 2026
Merged

fix(cli-pr-monitor): 不正ペイロードで既存 state を消さない#39
aloekun merged 1 commit into
masterfrom
fix/preserve-state-on-invalid-payload

Conversation

@aloekun

@aloekun aloekun commented Apr 15, 2026

Copy link
Copy Markdown
Owner

Summary\

\

変更内容\


serde_json::from_value(...).ok() を if let Ok(...) パターンに変更。デシリアライズ失敗時は既存値を保持する。findings フィールドは既にこのパターンで書かれており、ci / coderabbit も同じパターンに統一。
\

Test plan\

\

  • cargo test -- 全45テストパス (新規2件追加)\
  • update_state_invalid_ci_preserves_existing\
  • update_state_invalid_coderabbit_preserves_existing

Summary by CodeRabbit

リリースノート

  • バグ修正

    • 無効なデータに遭遇した際、システムが既存の状態情報を保持するよう改善しました。
  • テスト

    • 無効なデータシナリオに対する新しいユニットテストを追加しました。

update_state_from_check_result で serde_json::from_value(...).ok() を
if let Ok(...) パターンに変更。デシリアライズ失敗時に既存の
state.ci / state.coderabbit が None で上書きされる問題を修正。

CodeRabbit PR #38 指摘への対応。テスト2件追加。
@coderabbitai

coderabbitai Bot commented Apr 15, 2026

Copy link
Copy Markdown

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: 781a48e8-f6d0-4544-9eaa-033cc4512b83

📥 Commits

Reviewing files that changed from the base of the PR and between 5fb3f0d and e423423.

📒 Files selected for processing (1)
  • src/cli-pr-monitor/src/state.rs

📝 Walkthrough

Walkthrough

update_state_from_check_result関数の動作を改善し、JSON フィールドの"ci""coderabbit"がデシリアライゼーション失敗した場合、既存の状態値を保持するように変更されました。これまでは失敗時にNoneが設定されていました。また、この挙動を検証する 2 つの新しいユニットテストが追加されています。

Changes

Cohort / File(s) Summary
State deserialization logic
src/cli-pr-monitor/src/state.rs
update_state_from_check_resultstate.cistate.coderabbitの更新を条件付きに行うよう改善。デシリアライゼーション失敗時は既存値を保持。無効な型が渡された場合の値保存を検証する 2 つのユニットテストを追加。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Pull request title clearly describes the main fix: preventing existing state from being deleted when receiving invalid payloads.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ 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 commented Apr 15, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Apr 15, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

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.

@aloekun
aloekun merged commit 587eb30 into master Apr 15, 2026
1 check passed
@aloekun
aloekun deleted the fix/preserve-state-on-invalid-payload branch April 15, 2026 06:39
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