Repository navigation
Conversation
Windows の machine-global mise config (`~/.config/mise/config.toml`) が 0 bytes になると、managed marker の guard が「unmanaged」と判定して以後すべての apply を 拒否する。結果は mise shim が全滅し (No version is set for shim: ...)、旧 `%USERPROFILE%\.rustup` / `.cargo` が再生成される。実機では毎時 converge が `LastTaskResult = 1` のまま provision できない状態が続いていた。 - 書き込みを atomic 化 (一時ファイルへ書いてから置換)。WriteAllText の truncate 後に中断されると truncated config が残るため。 - 0 bytes の config は user content を持たないので採用する。空でない unmanaged config は従来どおり拒否する。 - backup (`config.toml.pc-setup-backup-*`) を直近 5 件に制限し、無制限増加を 止める。 - 保護ルールを副作用のない `scripts/mise-config-target.ps1` に切り出し、 `scripts/test-mise-config-target.ps1` で直接検証する。CI (ci.sh / ci.yml) にも追加。 Co-Authored-By: Claude Code <noreply@anthropic.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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. |
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.
Refs #281
問題
Windows の machine-global mise config (
~/.config/mise/config.toml) が 0 bytes になると、以降すべての apply がそのファイルを拒否する。scripts/apply-global-mise.ps1は既存 config の 1 行目が managed marker と一致しない場合 "refusing to overwrite unmanaged mise global config" で throw する。空ファイルは 1 行目が存在しないため同じ扱いになり、config を書き戻す経路が無い。pc-setup-convergeはmise-applyで error になりLastTaskResult = 1のまま継続する。mise ERROR No version is set for shim: gh)。gh/rustup/node/bun/claudeが同症状。[env]のRUSTUP_HOME/CARGO_HOME指定が消え、mise のcore:rustが既定 home を使い再開する。ADR-0015 / PR feat(rust): Windows の Rust toolchain も mise が管理する (#149) #150 で削除済みの%USERPROFILE%\.rustup/.cargoが再生成されていた。2026-11-30 実機観測 (Windows /
UUU\basic): config.toml = 0 bytes, mtime 2026-11-30 12:42。変更
scripts/mise-config-target.ps1に切り出す。Get-MiseConfigState— missing / empty / managed / unmanaged を判定。Assert-MiseConfigOverwritable— unmanaged のみ拒否。empty は採用可。Write-MiseConfigAtomic— 一時ファイルへ書いてから置換 (NTFS atomic replace、fallback は remove + move)。target を truncate しない。Copy-MiseFileAtomic— lock も原子的に置換する。Remove-StaleMiseConfigBackups— backup を直近 N 件に制限。scripts/apply-global-mise.ps1は上記ヘルパーを使う。config / lock とも atomic write。scripts/test-mise-config-target.ps1— 各规则的を直接検証 (missing / empty / managed / unmanaged / atomic write / atomic copy / backup 上限)。scripts/ci.shの pwsh 区画と.github/workflows/ci.ymlの powershell job に追加。加えて「0 bytes config から apply が回復する」end-to-end step (fake mise) を追加。検証
scripts/test-mise-config-target.ps1: 全項目 PASS。~/.config/mise/config.tomlを復旧し、mise which gh/mise which rustcが解決する状態へ戻した。含まれないもの
scripts/apply-global-mise.sh) の同種修正は POSIX: machine-global mise config/lock を配備用 checkout への symlink で持つため converge が恒久的に skip される #282 で別 PR。[env]の指定が戻るので再発しないが、regression 検知は verify 側の課題。Co-Authored-By: Claude Code noreply@anthropic.com