Repository navigation
feat(adopt): make the diagnostics work on Windows - #138
Merged
Merged
Conversation
Two of the adoption diagnostics only knew how to look at a Unix machine. Same-name variables. On Windows nothing is exported from a shell file; the variable lives in the registry, either per user (HKCU\Environment) or for the whole machine (HKLM\...\Session Manager\Environment). Both are read, because a machine-level value overrides our config just as well and the report would otherwise say "nothing else sets it". Only the name is reported, never the value. Each conflict now carries its own fix, because the two platforms fix it differently: a `sed` line delete on Unix, `reg delete` on Windows (with a note that the machine key needs an administrator terminal). Deleting, not blanking: an empty variable still counts as set. The location went into an English sentence, so it is English again: a path on Unix, a registry key on Windows. The line number stays in the sed command where it is actually used. Process start times. `ps` does not exist on Windows; processes are enumerated with a ToolHelp snapshot and their creation time read with GetProcessTimes, skipping the ones this user cannot open. The tests that write a .zshrc or parse `ps` output are Unix-only now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
resolve() is the same code on both platforms, so the tests that cover it should be as well. A machine that cannot create symlinks (Windows without admin or developer mode) skips them; CI runs as admin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fylorn
added a commit
that referenced
this pull request
Sep 23, 2026
#138 folded the Unix and Windows findings about same-name variables into one message: `adopt.diag.shell_export` lost its `line` argument and got a new English sentence, and `no_exports.detail` gained a `looked` argument. lite translates by code with the arguments of the released version, so its Chinese would have read "line undefined" and claimed .zshrc was checked on Windows. The Unix messages are back exactly as in v0.30.0. Windows says different sentences, so it gets its own codes instead of sharing one: adopt.diag.registry_env, adopt.diag.registry_env.overrides, adopt.diag.no_registry_env and adopt.diag.no_registry_env.detail. Each platform branch now builds its whole sentences; the shared finding code only assembles them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fylorn
added a commit
that referenced
this pull request
Sep 23, 2026
#138 folded the Unix and Windows findings about same-name variables into one message: `adopt.diag.shell_export` lost its `line` argument and got a new English sentence, and `no_exports.detail` gained a `looked` argument. lite translates by code with the arguments of the released version, so its Chinese would have read "line undefined" and claimed .zshrc was checked on Windows. The Unix messages are back exactly as in v0.30.0. Windows says different sentences, so it gets its own codes instead of sharing one: adopt.diag.registry_env, adopt.diag.registry_env.overrides, adopt.diag.no_registry_env and adopt.diag.no_registry_env.detail. Each platform branch now builds its whole sentences; the shared finding code only assembles them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fylorn
added a commit
that referenced
this pull request
Sep 23, 2026
#138 folded the Unix and Windows findings about same-name variables into one message: `adopt.diag.shell_export` lost its `line` argument and got a new English sentence, and `no_exports.detail` gained a `looked` argument. lite translates by code with the arguments of the released version, so its Chinese would have read "line undefined" and claimed .zshrc was checked on Windows. The Unix messages are back exactly as in v0.30.0. Windows says different sentences, so it gets its own codes instead of sharing one: adopt.diag.registry_env, adopt.diag.registry_env.overrides, adopt.diag.no_registry_env and adopt.diag.no_registry_env.detail. Each platform branch now builds its whole sentences; the shared finding code only assembles them. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Merged
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.
Two adoption diagnostics only knew how to look at a Unix machine.
Same-name environment variables. Windows has no shell rc files; the variable lives in the registry. Both
HKCU\EnvironmentandHKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environmentare checked, since a machine-level value overrides the client config just the same. Only names are reported, never values.Each conflict now carries its own fix instead of the shared finding building a
sedcommand:sed -i '' '{line}d' {path}(unchanged)reg delete "HKCU\Environment" /v NAME /f, and for the machine key a note that it needs an administrator terminal. It deletes rather than blanks the value, because an empty variable still counts as set.The location (
{path}in "{name} is already set in {path}") is back to plain English: a file path on Unix, a registry key on Windows.New message codes for lite to translate:
adopt.diag.unset_env,adopt.diag.unset_env_machine.Process start times.
psdoes not exist on Windows. Processes are enumerated withCreateToolhelp32Snapshotand their creation time read withGetProcessTimes; processes this user cannot open are skipped.Tests that write a
.zshrcor parsepsoutput are gated to non-Windows.Verification
cargo fmt,cargo clippy --all-targets -D warnings,cargo test --workspaceall pass.cargo clippy --target x86_64-pc-windows-msvc --all-targets -D warnings(a planted type error was caught, so the check is real). The Windows CI job here is the full check.🤖 Generated with Claude Code