cdredfox on Discord saw magpie at 150% of a core. Their goroutine dump
shows AstrLink Guard running in Go (guard.geluRow) in a darwin/amd64
build on an 8-core Mac. That is the Intel build under Rosetta: no
CoreML, and Go's kernels are translated, several times slower than
Apple silicon's build. AppAsset and BinaryAsset named runtime.GOARCH,
so every update fetched the Intel build again, with no way off it.
- internal/rosetta: Translated (sysctl.proc_translated), moved out of
pii so the updater reads the same thing. pii's translated is now that
var; its tests still replace it.
- update: arch() is arm64 for darwin/amd64 under Rosetta. AppAsset and
BinaryAsset (the darwin CLI) use it. goos/goarch/translated are vars
that tests set.
Checked before switching: Stage downloads the zip, ditto unpacks it,
sameSigner wants the same team, and Install renames it over the
bundle. Nothing there reads the architecture, and the CLI's
InstallBinary is a rename too. An arm64 build runs natively on every
Mac that runs Rosetta.
- pii: Status.Rosetta, set on AstrLink Guard's Now() only. Privacy
Filter's pf-serve is already Apple silicon's there (target).
- GUI: Settings > Privacy's local model line, while AstrLink Guard runs
under Rosetta, says "On, slowly under Rosetta: the next update
installs magpie for Apple silicon" in place of "On, on the CPU". It
is the same one sub-line, with no new element. en/zh/zh-TW/ja/de.
Not done, as decided: skipping tool outputs for the model, or capping
its cores.
Run (on mote unless named):
- go test -count=1 ./internal/update ./internal/rosetta ./internal/pii:
ok. On WSL magpie-desktop: the same three, plus go vet of them, ok.
On Windows (xiaomi-gpu): -run "Rosetta|Asset|GuardNow" on update and
pii, ok.
- go vet ./... (darwin) and CGO_ENABLED=0 GOOS=windows go vet ./...: ok.
A Linux cross vet needs cgo for Wails, and WSL has no gtk4, so Linux
vet covered the changed packages only. gofmt -l: clean.
- node --test privacy-model, i18n-keys, i18n-en-no-cjk (chromium +
webkit, 5 languages, 1100/640px): 91 of 92. The new rosetta case
passed in every engine, language and width. The one red is "a
download is cancelled" (chromium). It passes alone, 1/1 at origin/main
8eb219354 and 2/2 with this change. Filed as #5292 (wheelTo/viewOf
return "" after a reload).
- go test -run "Budget|I18n|Lang" ./internal/gui: ok. Core scripts are
1,530,017, under 1,533,802; no raise.
Broken by hand:
- arch() always the build's: TestRosettaUpdatesToAppleSilicon red (4
cases), and TestRosettaStagesAppleSiliconsApp red, with Intel's
2.0-amd64 app installed.
- No Rosetta in guardModel.Now(): TestGuardNowSaysRosetta red.
- The app.js line off: privacy-model's rosetta case red ("On, on the
CPU").
Not tried:
- A real Rosetta process. mote has no Rosetta (no oahd); an x86_64 test
binary built there didn't start. The translated check is the sysctl
pii has used since the pf-serve fix, but this commit never saw it
return 1.
- A real update from an Intel release to an arm64 one. The stage test
swaps ad-hoc signed fake bundles through the real
Stage/sameSigner/Install.