Files
magpie/internal/pii/guard/coreml
yetone 1b7a087565 privacy: Settings names what reads AstrLink Guard, CoreML on its device or the CPU
yyhhyyyyyy (Discord, 10-27) saw Settings say "On, on the CPU" while Guard
read through CoreML. The status now names the backend in use: CoreML on the
device most of the compiled program's estimated cost is on, read from
CoreML's own compute plan (MLComputePlan, macOS 14.4+; coreml.Plan,
coreml.Most, Model.Device), or the CPU, and after a CoreML read fails the
CPU with why (guard.Backend, mlFail; Status.Via, Device, GPUError; pmSub in
app.js, 5 words in zh, zh-TW, ja and de).

On mote (M5 Pro, macOS 27) the plan reads Neural Engine 0.000, GPU 1.000,
CPU 0.000, so Settings says "On, with CoreML on the GPU".

No budget raised: on main after #4133 moved Web search's rows out, app.js
is 1,294,410 bytes with this change, under its 1,311,735.

Tests: coreml/plan_test.go TestMost; guard/coreml_test.go TestBackend,
TestFailedCoreMLReadIsSaid, TestCoreMLPlanNamesADevice (real model);
astrlink_test.go TestGuardNowNamesItsBackend; privacy-model.test.cjs
"AstrLink Guard says what runs it".

Run:
- mote-run: gofmt -l internal clean; GOOS=darwin/linux/windows go vet
  ./internal/pii/... ok; MAGPIE_GUARD_DIR=real model go test
  ./internal/pii/... ok; go test -run Budget ./internal/gui ok (again after the rebase
  onto d5eac64f2).
- wsl-run (mote's pboard is down, #4125, browser launches hang there):
  privacy-model, i18n-keys, gui-de, gui-ja, gui-zh-tw,
  privacy-hides-accounts: 101 of 101 pass, the new test in chromium and
  webkit, en/zh/zh-TW/ja/de at 1100px and 640px.
- mote-run full go test -timeout 45m ./... with the next commit: reds named
  there, each with an issue.
Not tried: a Mac whose plan picks the Neural Engine.
2026-10-29 13:45:01 +08:00
..