fix: コードレビューで見つかった 3 件の不具合を修正#264
Merged
Merged
Conversation
issue の title/milestone、memory の name/title はパース時に value 全体を trim していたため、前後に空白を持つ値が再読み込みで失われていた(リスト項目は \s エスケープで境界空白を厳密に保持しているのに対し非対称だった)。 書き出しは `key: <value>` と区切りスペース 1 個だけを前置するので、パース側も その 1 個だけを strip し、ユーザー自身の前後空白は保持するようにした。数値・ enum・リスト・タイムスタンプは従来どおり trim する。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
没入の埋め込みターミナルへの貼り付けを bracketed paste で囲む際、貼り付け テキスト自身に終端マーカー `ESC[201~` が含まれていると、受信プログラムが ペーストを途中で打ち切り、残りを生のキー入力として解釈してしまう (paste injection)。実端末と同様に、ラップ前に本文中の終端マーカーを除去する ようにした。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
discard_session は remove_worktree の結果を `let _ =` で握り潰してから `fs::remove_dir_all` を無条件に実行していた。remove の事前 dirty チェックを すり抜けた worktree(チェック後に dirty 化/locked)に対し非強制で remove_worktree が失敗しても、セッションディレクトリは削除され、未コミット 作業の消失と宙ぶらりんの worktree 登録が残り得た。 force 時は従来どおり best-effort のまま、非強制時は remove_worktree の失敗を 伝播してディレクトリ削除の前に中断するようにした。未登録/未構築のパスは Ok を返すため、部分的に解体済みのセッションは引き続き許容する。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
📊 Test Coverage
🎉✨ パーフェクト!全ファイル Lines カバレッジ 100% を達成しました 🏆🐰 |
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.
目的
コードベース全体レビューで確認した実害のある 3 件の不具合を修正する。いずれも独立した修正のためコミットを分けている。
変更内容
#1 非強制削除で未コミット作業を消さない (
fix(session))discard_sessionはgit::remove_worktreeの結果をlet _ =で握り潰したままfs::remove_dir_allを無条件に実行していた。removeの事前 dirty チェックをすり抜けた worktree(チェック後に dirty 化/locked)に対し非強制で削除が失敗しても、セッションディレクトリが削除され、未コミット作業の消失と宙ぶらりんの worktree 登録が残り得た。force時は従来どおり best-effort。非強制時はremove_worktreeの失敗を伝播し、ディレクトリ削除の前に中断するようにした。Okを返すため、部分的に解体済みのセッションは引き続き許容する。#2 bracketed-paste の終端マーカー除去 (
fix(tui))没入の埋め込みターミナルへの貼り付けを bracketed paste で囲む際、貼り付けテキスト自身に終端マーカー
ESC[201~が含まれていると、受信プログラムがペーストを途中で打ち切り、残りを生のキー入力として実行してしまう(paste injection)。実端末と同様に、ラップ前に本文中の終端マーカーを除去するようにした。#3 frontmatter スカラの前後空白を round-trip で保持 (
fix(domain))issue の
title/milestone、memory のname/titleはパース時に値全体をtrim()していたため、前後に空白を持つ値が再読み込みで失われていた(リスト項目は\sエスケープで境界空白を厳密に保持しているのに対し非対称だった)。書き出しの区切りスペース 1 個だけを strip し、ユーザー自身の前後空白は保持するようにした。数値・enum・リスト・タイムスタンプは従来どおり trim する。テスト・確認方法
cargo fmt/cargo clippy --all-targets -- -D warnings/cargo test(1453 passed)。scripts/coverage.shのcoverage_enforce、exit 0)。discard_session_without_force_aborts_on_a_dirty_worktree_and_keeps_it— dirty worktree での非強制削除が中断しディレクトリを残すこと。encode_paste_strips_an_embedded_end_markerほか — 終端マーカー除去・非ブラケット時の素通し・通常ラップ。title_and_milestone_preserve_boundary_spaces_on_round_trip/name_and_title_preserve_boundary_spaces_on_round_trip— 境界空白の round-trip。🤖 Generated with Claude Code