Repository navigation
fix: 書き込めなかった更新を更新の件数に数えない - #23
Merged
Merged
Conversation
マニフェストへの書き込みに失敗した更新 (曖昧として拒否、update_version / update_git_tag の失敗、読み込みや保存の失敗) も、出力では更新済みとして 数えていた。check の段階の件数をそのまま出していたので、Cargo.toml を 1 バイトも書けていないのに「2 package(s) updated」と表示し、何が書き 換わったかを出力から読み取れなかった。 - writer は書き込めなかった更新を、results 上の位置と理由で記録する (WriteResult::failed_updates)。orchestrator はそれを UpdateResult の write_error へ書き込む。保存 (I/O) に失敗しても、それまでの個別の 理由は残す - summary の updates() / update_count() / has_updates() は書き込めなかった 更新を除き、failed_updates() / failed_count() / total_failed() で別に 数える。書き込みの段階は judged_updates() を使う - テキストは見出しに `K failed`、行末に `✗ failed`、Summary に `K package(s) failed to update` を出す。JSON は summary.failed と各 マニフェストの failed 配列 (理由は error) に分け、updates から外す。 diff は hunk を出さず、件数の行に `, K failed` を付ける - 全更新を書き込めなかったマニフェストは install の理由にしない。Rust の lock 監査も、書き込めなかった更新先を表示した更新先として扱わない Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
書き込めなかった更新の数え方 (見出しの `K failed`、行末の `✗ failed`、 Summary・JSON・diff の件数) と、install の対象にしないことを、 cli-reference と usage の英日に書く。終了コードの節にあった「書き込みに 失敗しても更新として表示され、--install も実行される」は今の振る舞いに 合わせて直す。JSON と diff の例は、実際の出力の形 (summary・failed・ name / kind / from / to、`--- a/...` と依存名の hunk、件数の行) に合わせる。 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
マニフェストへの書き込みに失敗した更新も、出力では更新済みとして数えていた。テキストの Summary の
N package(s) updated、マニフェストごとの見出しのN updates、--jsonのsummary.updatesのどれにも失敗した件が入り、エラー欄とは件数が食い違っていた。書き込めなかった更新を更新ごとに記録し、件数は「judge が決めた更新 − 書き込めなかった更新」で数える。書き込めなかった更新は
failedとして別に数え、テキスト・JSON・diff の 3 つで同じ数え方にする。原因
UpdateSummaryから数えていた。ManifestUpdateResult::update_count/UpdateSummary::total_updatesはUpdateResult::Updateの数で、書き込みの結果を見ていなかったManifestWriter::apply_updatesがWriteResultのupdates_failed(件数だけ) とerrorsに入れていたが、Orchestrator::write_phaseはエラーの文字列だけをerrorsへ移し、どの更新が失敗したかは summary に届いていなかった変更内容
results上の位置と理由で記録する (WriteResult::failed_updates。件数はupdates_failed())。保存 (I/O) に失敗してもErrにせず、書き換えた更新を書き込めなかったものとして記録し、保存の前に個別の理由で失敗した更新 (曖昧として拒否、など) はその理由を残す。Errは読み込み・解析に失敗してどの更新も試せなかったときだけで、apply_all_updatesがそれを全更新の失敗として記録する。Cargo.toml を書き換えない git の branch / rev / 既定ブランチの更新は、失敗にしないUpdateResult::Updateにwrite_errorを足す。summary は書き込みの前後で意味を分けるjudged_updates()/has_judged_updates(): judge が決めた更新 (writer が使う)updates()/update_count()/has_updates()/total_updates(): 書き込めなかった更新を除いたもの (出力・install・Rust の lock 監査が使う)failed_updates()/failed_count()/total_failed(): 書き込めなかった更新language_breakdown()は失敗の件数も返す (LanguageCounts)write_phaseで書き込めなかった更新を summary に記録するK failed(失敗があるときだけ)、行末に✗ failed(色なしは[failed])、Summary にK package(s) failed to update。-qはN updated, K failed、--verboseの言語別にも失敗の件数。全更新を書き込めなかったマニフェストも、スキップの要約にせず更新の行を出すsummary.failedと、各マニフェストのfailed配列 (理由はerror) を常に出し、updatesからは外す。summary.updatesがupdates配列の長さの和と一致する, K failedを付けるcargo update)。Rust の lock 監査も、書き込めなかった更新先を「表示した更新先」(差し戻し先の候補・食い違いの注記) に使わないdocs/cli-referenceとdocs/usageの英日、AGENTS.md。終了コードの節にあった「書き込みに失敗しても更新として表示され、--installも実行される」を直し、JSON と diff の例を実際の出力の形に合わせた設計の判断
codex と相談して決めた。
UpdateResultに持たせ、summary を唯一の正にする。出力・install・lock 監査が同じ判定を使え、各所でWriteResultと突き合わせずに済むcargo updateが lock 全体を上げるのは意外で、書き込めなかった更新先を監査の期待値にすると、反映していない版との差を注記してしまう)。文書に「--installも実行される」と明記されていた振る舞いを変えるので、文書も直したupdatesに残して印を付けるのではなく、failedに分ける。updatesの長さを更新件数として扱う利用者も誤らない-qの全失敗はNo updatesではなく0 updated, K failed検証
make ci(fmt-check・clippy・全テスト): pass (lib 2459 / e2e 26 / integration 75)test_apply_updates_records_failed_update_positions(位置と理由の記録)、test_apply_updates_write_permission_denied(保存の失敗でも個別の理由を残す)、test_apply_updates_dry_run_records_refused_updates、test_apply_all_updates_handles_missing_file、test_apply_all_updates_unreadable_manifest_keeps_unwritten_git_updatestest_write_errors_are_counted_apart_from_updates、test_record_write_error、test_serde_update_result_write_error(write_errorの無いデータも読み込める)test_format_counts_write_failures_apart_from_updates・test_format_shows_manifest_whose_updates_all_failed・test_format_without_write_failures_keeps_counts_unchanged(テキスト)、test_format_json_separates_write_failures・test_format_json_always_lists_failed(JSON)、test_format_diff_excludes_write_failures(diff)write_failures_are_recorded_in_summary(曖昧として拒否した更新が summary に記録され、件数から外れる。dry-run)build_install_map_skips_manifest_whose_updates_all_failed、audit_does_not_treat_an_unwritten_update_as_displayed— 1 update, 2 failed、Summary は1 package(s) updatedと2 package(s) failed to update、-qは1 updated, 2 failed、exit code 2。package.json の曖昧な宣言でも、テキスト・JSON (summary.updates1・failed1)・diff (# 1 package(s) would be updated, 1 failed) の件数がそろうことを確かめたCloses #21
🤖 Generated with Claude Code