Files
magpie/internal/redact/testdata
yetone 180cfb565e redact: an evaluation of the masking, with the rules, the model and both
TestMaskEval scores 38 made-up texts of the kinds agents send (prose,
code, logs, tool results, JSON, CSV, Chinese) with 34 values to mask
and 40 to keep. The cases start from what users reported masked
wrongly (#3144, #3143, #3029, #3538, #3577, d3db461bb, 611b9e173,
#1977) and add the values masking is for. It logs, by kind, how many
each way masked of those to mask and, wrongly, of those to keep:
the rules alone, the local model as it said it, and both with the
checks on what the model found, and lists every value one way got
wrong.

What the real model said is recorded in testdata/eval-model.json, so
the test replays "both" with no model and no network, and fails when
a value comes out wrong, or a Known one right. MAGPIE_EVAL_CACHE
points it at a downloaded model to record again.

Baseline (privacy-filter q8, M4 Pro):
  rules  16/34 masked, 0/40 wrongly
  model  32/34 masked, 8/40 wrongly
  both   30/34 masked, 0/40 wrongly
The checks take all 8 of the model's wrong ones off. Of the 4 misses,
3 are phones the model found with the delimiter before them
(`":"+86 …`, `,+81 …`), which the PHONE check turns down (#3591),
and 1 is 刘洋, which the model doesn't find (#3592). Both are Known.

Run: MAGPIE_EVAL_CACHE=$HOME/.cache go test -run TestMaskEval -v
./internal/redact against the installed model (recorded); go test
./internal/redact ./internal/pii ok; go vet for darwin, linux,
windows; gofmt -l clean. internal/proc's TestNoCommandBypassesProc is
red, on origin/main too: internal/tui/keep.go (#3567).
Broken by hand: modelFits off: 4 keeps masked and the 3 #3591 phones
reported right, red. A case's text changed: red, the recording is
stale. Taking snakeWord, epochNumber or madeID's SECRET check off
alone stays green: the model makes neither mistake on these texts,
or a second check catches it.
Not tried: the model on Linux or Windows, or on the CPU.
2026-10-25 17:41:10 +08:00
..