redact: eval cases that reach more of modelTakes/modelFits

TestMaskEval's cases reached 5 of the 36 checks on model spans: breaking
any other one by hand left it green. This adds 21 cases (39 to 60), most
of them texts from modelfits_test.go and vendorchecks_test.go, the
places the model was seen misreading, and records the real model's spans
on them (testdata/eval-model.json).

Breaking each check by hand (breaks.py: one replacement in model.go,
TestMaskEval run, file restored) now turns 13 red (5 before):
secret-madeID, person-2runes, email-realEmail, person-zhTrim,
person-assistant, account-numberLike, account-cue, address-letter,
secret-wordstart, secret-uuid, secret-hexwords, secret-hexcue,
edge-delimiter.

Still green, because the real model gives no such span on any text tried
(24 more probed) or another check catches the same span first:
secret-namesThing, secret-len8, person-snakeWord, account-madeID,
cut-from-word, person-chars, person-filedot, person-pathpart,
person-colon, person-lowerword (person-chars keeps the same lower-case
word), account-hex, account-version, the four phone checks, secret-pattern,
secret-json, secret-link, secret-base64, email-wordstart, email-modcache,
email-userinfo. Their unit tests in modelfits_test.go still cover them
with recorded spans.

A new real miss: "hex40 ok? 1 <sha1>" is one secret span "1 <sha1>" to
the model, and the hex-words check only looks at the first field. Filed
as #3597 and marked Known.

Totals at this head (rules / model / both, masked and wrongly):
16/40 0/89, 38/40 28/89, 39/40 1/89.

Run: MAGPIE_EVAL_CACHE=$HOME/.cache go test -run TestMaskEval -v
./internal/redact (recorded, then replayed green); go test -count=1
./internal/redact ./internal/pii ok; go vet ./internal/redact for darwin,
linux and windows; gofmt -l clean; breaks.py over all 36 checks.
Not tried: the full suite (only test files changed in internal/redact).
This commit is contained in:
yetone
2026-10-25 19:17:53 +08:00
parent dc6f3d496c
commit db6d1540ef
2 changed files with 374 additions and 0 deletions
+110
View File
@@ -137,6 +137,116 @@ var evalCases = []evalCase{
Keep: []evalValue{{V: "函数", Kind: "PERSON"}, {V: "错误处理", Kind: "PERSON"}},
},
{
ID: "ci-table", From: "611b9e173",
Text: "| run | file | result |\n| 6123456789 | ci.yml | success |",
Keep: []evalValue{{V: "6123456789", Kind: "ACCOUNT"}, {V: "ci.yml", Kind: "PERSON"}},
},
{
ID: "git-log", From: "d3db461bb",
Text: "ba319a758 gateway: the lone tool_choice none goes to the Grok plugin only (#3110)\nUpdate to v0.1.1442 now",
Keep: []evalValue{{V: "ba319a758", Kind: "ACCOUNT"}, {V: "v0.1.1442", Kind: "ACCOUNT"}},
},
{
ID: "pixels", From: "d3db461bb",
Text: "Attached a screenshot of 1624x1487 pixels, 2048000 bytes.",
Keep: []evalValue{{V: "1624x1487", Kind: "ACCOUNT"}, {V: "2048000", Kind: "PHONE"}},
},
{
ID: "assistant-prose", From: "d3db461bb",
Text: "Thanks Claude, that fixed it. Also ask Gemini later. — Sam Lee\nHi Codex, please review. Opus said it looks good, Sonnet disagreed.",
Mask: []evalValue{{V: "Sam Lee", Kind: "PERSON"}},
Keep: []evalValue{{V: "Claude", Kind: "PERSON"}, {V: "Codex", Kind: "PERSON"}, {V: "Opus", Kind: "PERSON"}, {V: "Sonnet", Kind: "PERSON"}},
},
{
ID: "commit-login", From: "d3db461bb",
Text: "commit 919585d1700e515ac38da49e31bc60a527fc15c2\nAuthor: yetone <yetone@users.noreply.github.com>",
Keep: []evalValue{{V: "yetone", Kind: "PERSON"}, {V: "919585d1700e515ac38da49e31bc60a527fc15c2", Kind: "SECRET"}},
},
{
ID: "session-tokens", From: "d3db461bb",
Text: "session 019a2b3c-4d5e-7f60-8a9b-0c1d2e3f4a5b token 019a2b3c4d5e7f608a9b0c1d2e3f4a5b",
Keep: []evalValue{{V: "019a2b3c-4d5e-7f60-8a9b-0c1d2e3f4a5b", Kind: "SECRET"}},
},
{
ID: "user-path", From: "d3db461bb",
Text: "read /Users/yetone/workspace/projects/magpie/AGENTS.md and C:\\Users\\vdxz\\notes.txt, then /home/rina/.config/app.toml",
Keep: []evalValue{{V: "yetone", Kind: "PERSON"}, {V: "AGENTS.md", Kind: "PERSON"}, {V: "vdxz", Kind: "PERSON"}, {V: "rina", Kind: "PERSON"}},
},
{
ID: "skill-list", From: "d3db461bb",
Text: "- artifact-design: Design guidance\n- workflow-authoring: Reference for writing scripts\nUser yetone logged in; local LLM ready\nReviewer: Approved",
Keep: []evalValue{{V: "artifact-design", Kind: "PERSON"}, {V: "workflow-authoring", Kind: "PERSON"}, {V: "yetone", Kind: "PERSON"}, {V: "Reviewer: Approved", Kind: "PERSON"}},
},
{
ID: "one-letter", From: "true",
Text: "J said the build is fine; K and Q disagreed.",
Keep: []evalValue{{V: "J", Kind: "PERSON"}, {V: "K", Kind: "PERSON"}},
},
{
ID: "tool-use-ids", From: "d3db461bb",
Text: `{"type":"tool_result","tool_use_id":"toolu_01XyZabcDEF123456","id":"srvtoolu_01AbCdEfGhIjKlMnOp","call":"call_Qm7vT2xLk9RbW4nZ"}`,
Keep: []evalValue{{V: "toolu_01XyZabcDEF123456", Kind: "SECRET"}, {V: "srvtoolu_01AbCdEfGhIjKlMnOp", Kind: "SECRET"}, {V: "call_Qm7vT2xLk9RbW4nZ", Kind: "ACCOUNT"}},
},
{
ID: "task-ids", From: "d3db461bb",
Text: "<task-id>a97c9bc67cc1f1e27</task-id> wrote 31a4f944-e7cf-4f6f-acc7-eef50d9911dd.jsonl",
Keep: []evalValue{{V: "a97c9bc67cc1f1e27", Kind: "SECRET"}, {V: "31a4f944-e7cf-4f6f-acc7-eef50d9911dd", Kind: "SECRET"}},
},
{
ID: "hex-lines", From: "d3db461bb",
Text: "hex40 ok? 1 2f1d0c9b8a7e6f5d4c3b2a1908f7e6d5c4b3a291\n919585d1700e515ac38da49e31bc60a527fc15c2 ok? 1",
Keep: []evalValue{{V: "2f1d0c9b8a7e6f5d4c3b2a1908f7e6d5c4b3a291", Kind: "SECRET", Known: "#3597"}, {V: "919585d1700e515ac38da49e31bc60a527fc15c2", Kind: "SECRET"}},
},
{
ID: "go-caches", From: "d3db461bb",
Text: "open /Users/x/Library/Caches/go-build/63700b7ab65fd1d3@v63: no such file\nP=/Users/yetone/.npm/_npx/1e7f6d9597241db0 d6426ecaaf0a28de@v31",
Keep: []evalValue{{V: "63700b7ab65fd1d3@v63", Kind: "EMAIL"}, {V: "d6426ecaaf0a28de@v31", Kind: "EMAIL"}, {V: "1e7f6d9597241db0", Kind: "SECRET"}},
},
{
ID: "base64-image", From: "d3db461bb",
Text: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA+k5zM7Md7tM9ehxd51xF/isvM9",
Keep: []evalValue{{V: "k5zM7Md7tM9ehxd51xF", Kind: "SECRET"}, {V: "isvM9", Kind: "SECRET"}},
},
{
ID: "grep-alts", From: "d3db461bb",
Text: "rg 'modelTakes|modelFits|personFits' internal; join at discord.gg/Ab3dEf9h today",
Keep: []evalValue{{V: "modelTakes|modelFits|personFits", Kind: "SECRET"}, {V: "discord.gg/Ab3dEf9h", Kind: "SECRET"}},
},
{
ID: "json-settings", From: "d3db461bb",
Text: `settings: {"mode": "fast", "retries": "3", "theme": "dark"}`,
Keep: []evalValue{{V: `"mode": "fast"`, Kind: "SECRET"}, {V: `"retries": "3"`, Kind: "SECRET"}},
},
{
ID: "event-times", From: "#3577",
Text: `{"event": "tool_call", "timestamp": 1792903687, "ms": 1792903687123, "at": "2026-10-25T04:48:03.755Z", "desk": "+1 415 555 0132", "ext": "4821"}`,
Mask: []evalValue{{V: "415 555 0132", Kind: "PHONE"}},
Keep: []evalValue{{V: "1792903687", Kind: "PHONE"}, {V: "4821", Kind: "PHONE"}},
},
{
ID: "codex-meta", From: "#3144",
Text: `{"stream_options":{"reasoning_summary_delivery":"sequential_cutoff"},"session_id":"019a2b3c-4d5e-7f60-8a9b-0c1d2e3f4a5b","text":"set sequential_cutoff for Rina Kowalczyk, skill at /Users/vdxz/.codex/skills/wrangler/SKILL.md, my password is Tr0ub4dor&3xq"}`,
Mask: []evalValue{{V: "Rina Kowalczyk", Kind: "PERSON"}, {V: "Tr0ub4dor&3xq", Kind: "SECRET"}},
Keep: []evalValue{{V: "sequential_cutoff", Kind: "PERSON"}, {V: "reasoning_summary_delivery", Kind: "PERSON"}, {V: "019a2b3c-4d5e-7f60-8a9b-0c1d2e3f4a5b", Kind: "SECRET"}, {V: "vdxz", Kind: "PERSON"}},
},
{
ID: "short-values", From: "true",
Text: "office: Unit 5, postcode 94107",
Keep: []evalValue{{V: "94107", Kind: "ADDRESS"}},
},
{
ID: "url-login", From: "#3538",
Text: "git clone https://deploy-bot@git.acme-corp.cn/team/app.git and ssh ops@10.0.0.7",
Keep: []evalValue{{V: "deploy-bot@git.acme-corp.cn", Kind: "EMAIL"}},
},
{
ID: "zh-names-edge", From: "true",
Text: "这个问题请找王小明先生处理,抄送给李华老师。",
Mask: []evalValue{{V: "王小明", Kind: "PERSON"}, {V: "李华", Kind: "PERSON"}},
Keep: []evalValue{{V: "先生", Kind: "PERSON"}, {V: "老师", Kind: "PERSON"}},
},
// ---- what masking is for --------------------------------------------
{
ID: "prose-person", From: "true",
+264
View File
@@ -7,6 +7,35 @@
"text": "6f312259162fb240",
"found": []
},
"assistant-prose": {
"text": "2f09c57d2bcd4a33",
"found": [
{
"Start": 7,
"End": 13,
"Label": "private_person"
},
{
"Start": 57,
"End": 64,
"Label": "private_person"
},
{
"Start": 68,
"End": 73,
"Label": "private_person"
},
{
"Start": 115,
"End": 121,
"Label": "private_person"
}
]
},
"base64-image": {
"text": "88418a5daf6d9b9a",
"found": []
},
"bearer": {
"text": "708d72f298141a4c",
"found": [
@@ -26,6 +55,16 @@
"text": "7387f43ca5ce5824",
"found": []
},
"ci-table": {
"text": "059b37d552df2314",
"found": [
{
"Start": 26,
"End": 36,
"Label": "account_number"
}
]
},
"code-keys": {
"text": "d5f835bbf0a332b8",
"found": [
@@ -50,6 +89,26 @@
"text": "ebbde1d7b5199206",
"found": []
},
"codex-meta": {
"text": "4978726969792675",
"found": [
{
"Start": 83,
"End": 119,
"Label": "account_number"
},
{
"Start": 155,
"End": 169,
"Label": "private_person"
},
{
"Start": 240,
"End": 253,
"Label": "secret"
}
]
},
"colors-ports": {
"text": "252b9ce2e8df3e82",
"found": [
@@ -60,6 +119,21 @@
}
]
},
"commit-login": {
"text": "43e1522fcf559a62",
"found": [
{
"Start": 56,
"End": 62,
"Label": "private_person"
},
{
"Start": 64,
"End": 95,
"Label": "private_email"
}
]
},
"digests": {
"text": "3b3e688a54f12e96",
"found": [
@@ -85,6 +159,36 @@
}
]
},
"event-times": {
"text": "c1fe2fbd2701c75c",
"found": [
{
"Start": 36,
"End": 46,
"Label": "account_number"
},
{
"Start": 54,
"End": 67,
"Label": "account_number"
},
{
"Start": 76,
"End": 100,
"Label": "private_date"
},
{
"Start": 111,
"End": 127,
"Label": "private_phone"
},
{
"Start": 138,
"End": 142,
"Label": "private_address"
}
]
},
"example-mail": {
"text": "a1867625846dc315",
"found": [
@@ -110,6 +214,10 @@
}
]
},
"git-log": {
"text": "8fc8f17e8817539a",
"found": []
},
"git-user-url": {
"text": "b92e10fa6b923a00",
"found": [
@@ -120,10 +228,33 @@
}
]
},
"go-caches": {
"text": "e855cf322da328a9",
"found": []
},
"grep-alts": {
"text": "dab9d9ae2f7b6d01",
"found": []
},
"grep-pattern": {
"text": "0d38dbff0a086bdf",
"found": []
},
"hex-lines": {
"text": "b378b2965f1a80de",
"found": [
{
"Start": 10,
"End": 52,
"Label": "secret"
},
{
"Start": 53,
"End": 96,
"Label": "secret"
}
]
},
"home-path": {
"text": "4f79a2f3631db506",
"found": [
@@ -164,6 +295,10 @@
}
]
},
"json-settings": {
"text": "17b49a014daba2fc",
"found": []
},
"log-user": {
"text": "cda01fa1bd419b1d",
"found": [
@@ -188,6 +323,21 @@
"text": "271c7650b6474a19",
"found": []
},
"one-letter": {
"text": "0ff1555b12fd8004",
"found": [
{
"Start": 26,
"End": 27,
"Label": "private_person"
},
{
"Start": 32,
"End": 33,
"Label": "private_person"
}
]
},
"phone-intl": {
"text": "28bf596367da1b2b",
"found": [
@@ -203,6 +353,10 @@
}
]
},
"pixels": {
"text": "96d207f1a0461a94",
"found": []
},
"prose-password": {
"text": "b45e2539ee55a672",
"found": [
@@ -227,6 +381,16 @@
"text": "6210ece83f6b71ab",
"found": []
},
"session-tokens": {
"text": "6170ea7af28ec9e2",
"found": [
{
"Start": 0,
"End": 83,
"Label": "secret"
}
]
},
"session-uuid": {
"text": "45ff8afdbe77e369",
"found": [
@@ -237,10 +401,30 @@
}
]
},
"short-values": {
"text": "0133fede621b7801",
"found": [
{
"Start": 25,
"End": 30,
"Label": "private_address"
}
]
},
"sizes-versions": {
"text": "e08a850f552a995b",
"found": []
},
"skill-list": {
"text": "535fc5de908c39dd",
"found": [
{
"Start": 116,
"End": 125,
"Label": "private_address"
}
]
},
"snake-arg": {
"text": "7ade5b7b89a61dd4",
"found": []
@@ -249,6 +433,21 @@
"text": "89fcc6da0d4cc9fb",
"found": []
},
"task-ids": {
"text": "faff967171e2421d",
"found": [
{
"Start": 8,
"End": 26,
"Label": "account_number"
},
{
"Start": 43,
"End": 85,
"Label": "account_number"
}
]
},
"token-count": {
"text": "359c740b1ce9a3c5",
"found": [
@@ -313,6 +512,26 @@
"text": "6b9515c4bf396f51",
"found": []
},
"tool-use-ids": {
"text": "c83ab5e49cce4b75",
"found": [
{
"Start": 37,
"End": 60,
"Label": "account_number"
},
{
"Start": 68,
"End": 95,
"Label": "secret"
},
{
"Start": 105,
"End": 126,
"Label": "secret"
}
]
},
"unix-time": {
"text": "3e3d22cf38729962",
"found": []
@@ -321,6 +540,21 @@
"text": "7e29836c6aa4f105",
"found": []
},
"url-login": {
"text": "d6f5b2b60e384bb9",
"found": [
{
"Start": 10,
"End": 58,
"Label": "private_url"
},
{
"Start": 63,
"End": 79,
"Label": "private_url"
}
]
},
"url-userinfo": {
"text": "a74a01c8225d54da",
"found": [
@@ -346,6 +580,21 @@
}
]
},
"user-path": {
"text": "007eeda2f5ba95d3",
"found": [
{
"Start": 11,
"End": 54,
"Label": "private_url"
},
{
"Start": 84,
"End": 116,
"Label": "private_url"
}
]
},
"zh-contact": {
"text": "5d654b2bbdd23aa1",
"found": [
@@ -376,6 +625,21 @@
}
]
},
"zh-names-edge": {
"text": "709d9aa01117e001",
"found": [
{
"Start": 18,
"End": 39,
"Label": "private_person"
},
{
"Start": 51,
"End": 63,
"Label": "private_person"
}
]
},
"zh-password": {
"text": "ca3835176b202e40",
"found": [