Files
yetone ca87ae9c59 update: an x64 magpie emulated on Windows on Arm updates to the arm64 build (EV_John_Liu on X)
EV_John_Liu on X: "能不能出个windows on arm的版本啊…看到magpie是转译的".
magpie ships magpie-windows-arm64.exe and magpie-cli-windows-arm64.exe,
and the site's Windows button offers it on Arm, but an x64 install on an
Arm64 computer fetched the x64 build on every update and stayed emulated.
update's arch() swapped only an Intel Mac under Rosetta.

- internal/winarm: Emulated() asks IsWow64Process2 (x/sys/windows) once;
  an amd64 build whose nativeMachine is IMAGE_FILE_MACHINE_ARM64 runs
  emulated. A failed call (no IsWow64Process2 before Windows 10 1709)
  means not emulated. false off Windows.
- update: arch() gives arm64 for windows/amd64 when emulated, so
  BinaryAsset picks magpie-windows-arm64.exe (GUI) and
  magpie-cli-windows-arm64.exe (CLI). The swap is the x64 one: canStart
  starts the downloaded exe (it runs natively there), the running exe is
  moved aside, the arm64 one renamed in under the same name, and
  magpie.com is rewritten from the new app's own launcher.
- pii (sibling found on the way): pf-serve has no windows-arm64 build.
  After the switch an arm64 magpie looked for a windows-arm64 pf-serve,
  found none, and left Privacy Filter / AstrLink Guard "not downloaded"
  while on. target() now maps windows-arm64 to the x64 pf-serve Windows 11
  runs emulated; candidates() runs it on the CPU (the x64
  pf-serve-vulkan has no x64 Vulkan driver there), then pf-serve-base
  for an emulation without AVX2. The guard's status says emulated
  (Status.Emulated), and its row reads "On, slowly under x64 emulation:
  the next update installs magpie for Arm" in all five languages, like
  the Rosetta line. app.js's and the core's script budgets grow by its
  66 bytes.
- gui feedback: the diagnostics block's Arch line says
  "amd64 (emulated on arm64)" / "amd64 (under Rosetta on arm64)".

Checked, not changed:
- site/public/index.html: the Windows main button already turns to
  /download/windows-arm64 when userAgentData's architecture is "arm".
  Run in Playwright Chromium and WebKit with a Windows Edge UA and
  injected userAgentData: arm -> windows-arm64; x86 and no
  userAgentData -> windows-amd64.
- telemetry (stats "arch") sends the build's GOARCH; left so, since what
  is sent and the privacy text stay as they are. After the update it is
  arm64 by itself.
- rtk: an arm64 magpie no longer upgrades a standalone x64 rtk.exe
  (rtkArch == "amd64" only), filed as #6896.
- claudecode (win32-arm64) and Bun (windows-aarch64) downloads already
  have arm64 builds.

Run (worktree at origin/main 17da22414):
- mote: go test -count=1 ./internal/winarm ./internal/update
  ./internal/pii ok; ./internal/gui -run Feedback ok.
- mote: go vet ./... ok; GOOS=linux go vet -tags nogui ./... ok;
  GOOS=windows go vet ./... ok; GOOS=windows GOARCH=arm64 go vet of
  winarm, update, pii, gui ok; darwin, windows and linux builds ok;
  gofmt -l clean.
- mote: node --test privacy-model.test.cjs (Chromium and WebKit, five
  languages, two widths) ok; i18n-keys' "a plugin's words are its own"
  is red at this base on claude_image_budget_test.go's ", with an
  image", already #6877.
- xiaomi-gpu (x64 Windows 11, real IsWow64Process2 saying not
  emulated): win-run go test ./internal/winarm, ./internal/update -run
  'WindowsOnArm|Rosetta|Asset|InstallBinary', ./internal/pii -run
  'ArmWindows|GuardNow|Base', ./internal/gui -run Feedback ok.
- magpie-desktop (WSL2): winarm, update, pii ok; gui -tags nogui -run
  Feedback ok.
- mote: go test -count=1 -tags nogui -timeout 45m ./... : every
  package ok but internal/gui's TestCoreScriptBudget (app.js 66 bytes
  over: the new pmSub line). The budgets are raised by those 66 with
  why (pmSub draws every Privacy row, no lazy page to move it to);
  internal/gui then ok in full.
- mote: gui-de, gui-ja, gui-zh-tw, i18n-en-no-cjk and the three other
  privacy-*.test.cjs, in Chromium and WebKit: 28 of 28 each. Not the
  whole GUI suite: the change is one string in one row, no API,
  selector, CSS or layout.

Broken by hand (each red, then restored):
- arch() without the windows clause: TestWindowsOnArmUpdatesToArm64
  (BinaryAsset magpie-windows-amd64.exe) and
  TestWindowsOnArmInstallsArm64Exe (magpie.exe still "2.0 for x64").
- pii target() without the mapping: TestArmWindowsRunsX64Serve
  (target windows-arm64, Supported false); candidates() without the
  Arm branch: its subtests start pf-serve-vulkan.
- Status without Emulated: TestGuardNowSaysEmulated.
- archNote without the emulated case: TestFeedbackArchSaysTranslated.
- app.js without the emulated line: privacy-model's "AstrLink Guard
  says what runs it" red in every language.

Not tried: real Windows on ARM (no such machine); detection is injected
in the tests, and the real call was only seen saying "not emulated" on
x64 Windows.
2026-11-17 04:29:02 +08:00
..