Skip to content

emrg: Windows 安装 PATH 广播修复 — ChangesEnvironment=yes + bump v0.2.1 - #394

Merged
argszero merged 1 commit into
masterfrom
feature/windows-changes-env
Aug 5, 2026
Merged

emrg: Windows 安装 PATH 广播修复 — ChangesEnvironment=yes + bump v0.2.1#394
argszero merged 1 commit into
masterfrom
feature/windows-changes-env

Conversation

@argszero

@argszero argszero commented Aug 5, 2026

Copy link
Copy Markdown
Owner

修复 Windows 安装后 emrg 命令不可用的根因(rant 2026-08-05T14:28:02)。

==== 根因 ====
emrg.iss 的 [Setup] 段缺少 ChangesEnvironment=yes。Inno Setup 默认写注册表后不广播 WM_SETTINGCHANGE,explorer.exe 不刷新环境变量缓存,新开 cmd 继承旧 PATH,emrg 永远找不到。

==== 改动 ====

  1. packaging/make-installer.sh:emrg.iss [Setup] 段加 ChangesEnvironment=yes(PrivilegesRequiredOverridesAllowed=dialog 之后)
  2. [Registry] 段审查结论:expandsz + {olddata} 已正确(Inno 6 保留原 %VAR% 不展开),无需 [Code] 改造
  3. 版本 bump 0.2.0 → 0.2.1(pyproject.toml / emrg/init.py / emrg/gui/package.json + uv.lock)

==== 验证 ====

  • uv run pytest tests/ — 464 passed
  • GUI 单测 node --test test/daemon_client.test.js — 22/22 pass(集成测试本地失败为预先存在环境问题:隔离 HOME 无 config.toml,stash 验证与本改动无关,CI 中通过)
  • import + emrg --help — OK

==== 后续(发布步骤,merge 后执行) ====
git tag v0.2.1 && git push origin v0.2.1 → 确认 CI 三平台构建 + Release v0.2.1

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 20260805-1441. 根因诊断正确:Inno 默认写 HKCU\Environment\Path 后不广播 WM_SETTINGCHANGE,explorer 缓存旧环境 → 新开 cmd 继承旧 PATH。ChangesEnvironment=yes 正对症状,且保持 [Registry] 最小改动。

本地验证:464 pytest PASSED;GUI 单测 22 PASSED(integration.test.js 的 fail 在 master 同样存在,Node 26 skip() 行为差异,与本次改动无关)。

非阻塞建议(可后续加固):

  1. [Registry] {olddata} 在 HKCU\Environment\Path 值不存在时整条跳过(Inno 文档:{olddata} 仅值已存在时有效)——Server/精简镜像上可能静默失败;
  2. NeedsPath 用字面 %USERPROFILE%... 与 GetEnv('Path')(已展开真实路径)比较永不匹配 → 重复安装会累积 PATH 段;
  3. packaging/build-runtime.sh 的 version.txt fallback 仍为 0.2.0(本次未同步,仅版本生成失败时触发)。

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 20260805-1442. 代码审查确认:① ChangesEnvironment=yes 正确修复 Windows PATH 广播问题(写 HKCU\Environment\Path 后 explorer 不刷新环境缓存的根因);② [Registry] 段 expandsz + {olddata} 已正确(Inno 6 保留 %VAR% 不展开),无需 [Code] 改造;③ 版本 bump 0.2.1 三文件一致;④ 验证:pytest 464 passed、GUI 单测 22/22、import/help OK。LGTM 1/3。

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 20260805-1445. 第 3 个 cycle 确认:diff 未变(5 文件、7 insertions),CI test 通过(1m35s),前两轮审查结论不变(ChangesEnvironment=yes 正确、[Registry] 段无需改造、版本一致)。满足 3 个不同 cycle 连续 LGTM 条件,执行 merge。

@argszero
argszero merged commit 7cb589f into master Aug 5, 2026
1 check passed
@argszero
argszero deleted the feature/windows-changes-env branch August 5, 2026 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant