refactor(infra,usecase): version envelope と設定セッターのボイラープレートを削減する#330
Merged
Conversation
永続化ファイルの version ラッパと設定セッターに横展開された同型コードを
1 か所へ集約する。
- json_file に `FILE_FORMAT_VERSION` と `read_versioned` / `write_versioned`
を新設。`{ "version": N, <payload…> }` envelope を 1 箇所で扱い、各ストアの
StateFile / LocalSettingsFile / WorkspacesFile / SettingsFile ラッパ構造体と
重複した version 定数を削除。
- write 側は payload を **借用**してシリアライズするため、version 付与のための
全件 clone(storage の settings.clone / workspaces.to_vec、workspace_store の
state.clone / settings.clone)が不要に(#40 の save clone 解消)。
- usecase/settings に `update_settings` / `update_local` 高階関数を導入し、
set_theme / set_default_workspace / set_notifications_enabled / set_agent_cli
とローカル 2 本を 1 行(`|s| s.theme = theme` 等)に集約。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
📊 Test Coverage
🎉✨ パーフェクト!全ファイル Lines カバレッジ 100% を達成しました 🏆🐰 |
kkyosuke
added a commit
that referenced
this pull request
Jun 24, 2026
## 目的 session 系のレビュー指摘(#69 / #63)の残件を解消する。 > **補足**: #49(セッション物理破棄の二重実装・worktree inspect の record/sync 重複・dirty 判定の二系統・reconcile の毎回全走査)と #40 の perf 項目(history JSONL 追記・検索の fold・固定 `.tmp` の pid 化・save 時の全件 clone・create の `source_repos` 再走査)は、レビュー修正および PR #330(version envelope)で**既に解消済み**でした(`discard_session` / `list_repo_worktrees` 共有、`inspect_worktrees` 共有、`worktree_status().dirty` への統一、strays 空での early-return)。本 PR はそれらに残っていた 2 点を仕上げます。 ## 変更内容 ### #69: 表示ラベル解決を presentation へ - `usecase::session::set_display_name` が `SessionRecord::display_label()`(override が無ければ branch 名にフォールバックするサイドバー表示ラベル)を決定して返していた層またぎを是正。 - usecase は**保存した override の生値**(`Option<String>`)だけを返し、「表示ラベル = override || branch 名」の fallback 解決は presentation(home の rename ログ)側に寄せる。 ### #63: new 画面の Mode キー統合 - ←/→ が別アームで同一の `toggle_mode()` を呼んでいたのを `Key::ArrowLeft | Key::ArrowRight if focus == Mode` の 1 アームに統合。2 値モードでは両方向 toggle で正しく、将来 3 値以上にしたとき片方だけ直し忘れる事故を防ぐ。 ## テスト・確認方法 - `cargo fmt` / `cargo clippy --all-targets -- -D warnings` / `cargo test` 全て通過。 - rename のサイドバーラベル・new 画面の Mode 切替は従来どおり。カバレッジ 100% 維持。 Closes #63 Closes #69 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Merged
kkyosuke
added a commit
that referenced
this pull request
Jun 25, 2026
## 目的 `1.2.0` → `1.2.1` のリリース。`Cargo.toml` の version を上げ、マージ時に `auto-release.yml` がタグ `v1.2.1` とリリースを自動生成する。 ## 変更内容 - `Cargo.toml` / `Cargo.lock` の version を `1.2.0` → `1.2.1` に更新。 ### このリリースに含まれる変更(v1.2.0 以降) - fix: コードレビュー指摘の修正(堅牢性・前方互換・セキュリティ) (#333) - feat(tui): 在席で agent を指定して起動できるようにする (#334) - refactor(session): 表示ラベル解決を presentation へ寄せ、new の Mode キーを統合する (#332) - refactor(infra,usecase): version envelope と設定セッターのボイラープレートを削減する (#330) - refactor(mcp): issue/memory の filter Args を flatten で一本化する (#329) - refactor(agent): program 名を AgentCli::command に一本化する (#328) - feat(tui): コマンド引数(サブコマンド・オプション)も Tab 補完する (#331) - refactor(tui): widgets から rabbit アセットを分離する (#323) - fix: コードレビュー指摘の修正(並行性・前方互換・堅牢性) (#327) - feat(error-log): 静かに握りつぶされる本物の失敗をログに記録 (#325) - fix: アップデート告知と更新後メッセージの文言を変更 (#324) ## テスト・確認方法 - version のみの変更。`release-build-check.yml` が 4 プラットフォームのリリースビルドを検証する。 - マージ後、`auto-release.yml` → `release.yml` でタグ `v1.2.1` と GitHub Release が自動生成される。 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
目的
永続化ファイルの version ラッパと設定セッターに横展開された同型コードを 1 か所へ集約する(issue #48、および #40 の save clone)。
変更内容
version envelope の集約(#48.2 + #40.3)
json_fileにFILE_FORMAT_VERSIONとread_versioned/write_versionedを新設。{ "version": N, <payload…> }envelope を 1 箇所で扱う。StateFile/LocalSettingsFile(workspace_store)・WorkspacesFile/SettingsFile(storage)ラッパ構造体と、重複したFILE_FORMAT_VERSION定数を削除。settings.clone()/workspaces.to_vec()/state.clone())が不要に(feat: state.json にセッション集約表現を追加(複数リポジトリ対応) #40 「save 時の全件 clone」を解消)。設定セッターの高階関数化(#48.1)
usecase/settingsにupdate_settings(storage, |s| …)/update_local(repo, |l| …)を導入。set_theme/set_default_workspace/set_notifications_enabled/set_agent_cliとローカル 2 本を「ロード→1 フィールド代入→保存→返す」1 行へ集約。残りの #40 / #41
テスト・確認方法
cargo fmt/cargo clippy --all-targets -- -D warnings/cargo test全て通過。Closes #48
🤖 Generated with Claude Code