Files
magpie/internal/redact/testdata/eval-astrlink.json
T
yetone ea7c0067e0 privacy: each local model's confidence threshold is the user's to set
Yayoi_no_yume on X asked for the privacy model's threshold to be
adjustable: they read it as fixed at 0.5, and from their own use find
0.85-0.95 right for AstrLink. The 0.5 is Privacy Filter's (pf-serve's
argv default); AstrLink Guard already masked at its publisher's 0.8.

Both models now find at a floor of 0.5 (pii.Floor) and give each span
its score: Guard's least token probability (rounded through float32,
so a span read back from the cache file sits on the same side of a
threshold), pf-serve's own. masking.model keeps the spans at
pii.Threshold or over: settings.RedactModelScore[model] when it is in
[0.5, 1), else the model's MinScore (Privacy Filter 0.5, AstrLink
Guard 0.8). Settings -> Privacy shows a Confidence threshold row under
the model (app menu, 0.5 to 0.95 and Default), /api/privacy-model
takes do:"score". The setting is this computer's own, like the model.

The defaults stay. TestMaskEval's cases, rules + model + magpie's
checks, by threshold:

  Privacy Filter 0.5-0.8   masked 41/42  kept 112/113
  Privacy Filter 0.85-0.95 masked 40/42  (a Chinese name lost)
  AstrLink Guard 0.5-0.7   masked 42/42  kept 112/113
  AstrLink Guard 0.8-0.85  masked 41/42  (a phone in a tool result)
  AstrLink Guard 0.9       masked 40/42
  AstrLink Guard 0.95      masked 40/42  kept 113/113

The model alone does raise fewer false alarms higher up (Privacy
Filter's found-in-keep falls from 47 at 0.5 to 27 at 0.95, Guard's
from 8 to 2), but the checks after it drop most of those already, so
a higher threshold mostly costs values that should be masked.

Cache file: found-<model>.bin is now "pfound02" with a float32 score
per span. A "pfound01" file is still read, each span with score 1, so
texts cached before mask as they did and aren't asked again. For those
texts a higher threshold drops nothing and a lower one doesn't add a
Guard span scored 0.5-0.8 until the cache turns over (20000 answers).
merge() keeps the surer score of spans it joins. The eval recordings
(eval-model.json, eval-astrlink.json) were made again with scores,
from a scratch cache, the live found files untouched.

Run in the worktree at 11dcc743f + this change:
- go vet / gofmt -l on the touched packages: clean
- go test -count=1 -timeout 45m ./internal/pii/... ./internal/masking
  ./internal/redact ./internal/settings ./internal/gui ./internal/gateway: all ok (gateway 546s, rerun
  after an earlier run hit "no space left on device" on this machine;
  every failure in that run was a TempDir mkdir). This run caught
  TestSettingsSaveKeepsWhatItDoesNotSend wanting RedactModelScore set;
  it is now
- GUI: privacy-model.test.cjs 64/64 (chromium + webkit, 5 languages,
  1100 and 640px; the new threshold menu test among them),
  i18n-keys 4/4, redact-kinds, redact-rule-edit,
  redact-rule-row, redact-shape, redact-words-any-case all pass.
  masking-records 82/82, routing-masking 10/10, privacy-usage-stats 4/4,
  mask-actions 22/22. privacy-hides-accounts was 3/4 once (webkit en,
  page.goto's 5s at load ~290, the class of #3525, commented there),
  then 4/4 three times. Not run: the rest of the GUI suite.
Rebased on 508911e43 (which touched internal/pii fetch and mirror): at
that head, go build ./..., Linux and Windows go vet of pii, masking,
settings and redact, gofmt -l, and go test of pii/..., masking, redact,
settings and gui all ok; gateway not run again after the rebase.
Broken by hand: masking.model keeping every span (TestModelThreshold
  red); Threshold taking any value (TestModelThreshold red); the cache
  writing 1 for every score (TestRestartReadsWhatWasFound red); merge
  not keeping the surer score (TestMergeAcrossPieces red, after its
  joined span was made surer than the one it joins).
Not tried: the real app's window, Windows, Privacy Filter on a GPU
with the new score read (pf-serve itself is unchanged; it always sent
the score).
2026-10-27 14:10:33 +08:00

730 lines
12 KiB
JSON

{
"asset-files": {
"text": "8b019ca5e2af716b",
"found": []
},
"assistant-names": {
"text": "6f312259162fb240",
"found": []
},
"assistant-prose": {
"text": "2f09c57d2bcd4a33",
"found": [
{
"Start": 7,
"End": 13,
"Label": "private_person",
"score": 0.6422655582427979
},
{
"Start": 57,
"End": 64,
"Label": "private_person",
"score": 0.8788238167762756
},
{
"Start": 72,
"End": 73,
"Label": "private_person",
"score": 0.5269465446472168
},
{
"Start": 92,
"End": 94,
"Label": "private_person",
"score": 0.5114759802818298
}
]
},
"background-tasks": {
"text": "1a8c290d9137f372",
"found": []
},
"base64-image": {
"text": "88418a5daf6d9b9a",
"found": []
},
"bearer": {
"text": "708d72f298141a4c",
"found": [
{
"Start": 31,
"End": 148,
"Label": "secret",
"score": 0.9962389469146729
},
{
"Start": 150,
"End": 180,
"Label": "private_url",
"score": 0.99592125415802
}
]
},
"card": {
"text": "7387f43ca5ce5824",
"found": [
{
"Start": 30,
"End": 49,
"Label": "account_number",
"score": 0.9930477142333984
},
{
"Start": 58,
"End": 63,
"Label": "private_date",
"score": 0.9923847317695618
}
]
},
"ci-table": {
"text": "059b37d552df2314",
"found": []
},
"code-keys": {
"text": "d5f835bbf0a332b8",
"found": [
{
"Start": 12,
"End": 50,
"Label": "secret",
"score": 0.7978969812393188
},
{
"Start": 67,
"End": 108,
"Label": "secret",
"score": 0.9611479640007019
},
{
"Start": 135,
"End": 175,
"Label": "secret",
"score": 0.9937745928764343
}
]
},
"code-locations": {
"text": "ebbde1d7b5199206",
"found": []
},
"codex-meta": {
"text": "4978726969792675",
"found": [
{
"Start": 155,
"End": 169,
"Label": "private_person",
"score": 0.995353639125824
},
{
"Start": 240,
"End": 253,
"Label": "secret",
"score": 0.995952844619751
}
]
},
"colors-ports": {
"text": "252b9ce2e8df3e82",
"found": [
{
"Start": 45,
"End": 54,
"Label": "ip_address",
"score": 0.9942322373390198
}
]
},
"commit-login": {
"text": "43e1522fcf559a62",
"found": [
{
"Start": 56,
"End": 62,
"Label": "account_number",
"score": 0.8200094699859619
},
{
"Start": 64,
"End": 95,
"Label": "private_email",
"score": 0.9951349496841431
}
]
},
"digests": {
"text": "3b3e688a54f12e96",
"found": []
},
"env-file": {
"text": "c1f1a7ab84f78373",
"found": [
{
"Start": 15,
"End": 63,
"Label": "secret",
"score": 0.9948821663856506
},
{
"Start": 76,
"End": 90,
"Label": "secret",
"score": 0.9570835828781128
}
]
},
"event-times": {
"text": "c1fe2fbd2701c75c",
"found": [
{
"Start": 112,
"End": 127,
"Label": "private_phone",
"score": 0.9948705434799194
}
]
},
"example-mail": {
"text": "a1867625846dc315",
"found": [
{
"Start": 14,
"End": 30,
"Label": "private_email",
"score": 0.9941899180412292
}
]
},
"gateway-ids": {
"text": "e911ab18a1116ef5",
"found": []
},
"git-author": {
"text": "94a966005e2adee1",
"found": [
{
"Start": 23,
"End": 33,
"Label": "private_person",
"score": 0.9949986338615417
},
{
"Start": 35,
"End": 55,
"Label": "private_email",
"score": 0.9958543181419373
}
]
},
"git-log": {
"text": "8fc8f17e8817539a",
"found": []
},
"git-user-url": {
"text": "b92e10fa6b923a00",
"found": [
{
"Start": 10,
"End": 55,
"Label": "private_url",
"score": 0.9963787198066711
}
]
},
"go-caches": {
"text": "e855cf322da328a9",
"found": []
},
"grep-alts": {
"text": "dab9d9ae2f7b6d01",
"found": []
},
"grep-pattern": {
"text": "0d38dbff0a086bdf",
"found": []
},
"hex-lines": {
"text": "b378b2965f1a80de",
"found": []
},
"home-path": {
"text": "4f79a2f3631db506",
"found": []
},
"iban": {
"text": "cf32ccaec3a1dfc1",
"found": [
{
"Start": 24,
"End": 51,
"Label": "account_number",
"score": 0.9904018640518188
}
]
},
"json-contact": {
"text": "8b8300472a287a74",
"found": [
{
"Start": 21,
"End": 30,
"Label": "private_person",
"score": 0.9956386089324951
},
{
"Start": 41,
"End": 62,
"Label": "private_email",
"score": 0.9967396855354309
},
{
"Start": 73,
"End": 90,
"Label": "private_phone",
"score": 0.9951627850532532
}
]
},
"json-settings": {
"text": "17b49a014daba2fc",
"found": []
},
"log-user": {
"text": "cda01fa1bd419b1d",
"found": [
{
"Start": 40,
"End": 52,
"Label": "private_email",
"score": 0.9952855706214905
},
{
"Start": 68,
"End": 76,
"Label": "ip_address",
"score": 0.9939125776290894
}
]
},
"ls-files": {
"text": "df52e0f6fb986b33",
"found": []
},
"metric-decimals": {
"text": "36c335311d2812ab",
"found": []
},
"model-names": {
"text": "1ddc9e9ff3476549",
"found": []
},
"noreply": {
"text": "271c7650b6474a19",
"found": [
{
"Start": 50,
"End": 56,
"Label": "private_email",
"score": 0.5142685174942017
},
{
"Start": 60,
"End": 63,
"Label": "private_email",
"score": 0.5299198627471924
}
]
},
"one-letter": {
"text": "0ff1555b12fd8004",
"found": [
{
"Start": 0,
"End": 1,
"Label": "private_person",
"score": 0.6900092959403992
}
]
},
"phone-intl": {
"text": "28bf596367da1b2b",
"found": [
{
"Start": 36,
"End": 39,
"Label": "private_person",
"score": 0.9818559288978577
},
{
"Start": 43,
"End": 58,
"Label": "private_phone",
"score": 0.9949420094490051
}
]
},
"pixels": {
"text": "96d207f1a0461a94",
"found": []
},
"pr-checks": {
"text": "e95e64e5f1c74ae9",
"found": [
{
"Start": 67,
"End": 103,
"Label": "private_url",
"score": 0.996593177318573
}
]
},
"prose-password": {
"text": "b45e2539ee55a672",
"found": [
{
"Start": 27,
"End": 38,
"Label": "secret",
"score": 0.9967206716537476
}
]
},
"prose-person": {
"text": "7090b229a3288b42",
"found": [
{
"Start": 13,
"End": 27,
"Label": "private_person",
"score": 0.9951192736625671
},
{
"Start": 61,
"End": 67,
"Label": "private_date",
"score": 0.6461724638938904
}
]
},
"retina-file": {
"text": "6210ece83f6b71ab",
"found": []
},
"run-ids": {
"text": "eb2807913ed4300b",
"found": [
{
"Start": 46,
"End": 98,
"Label": "private_url",
"score": 0.9966269731521606
},
{
"Start": 111,
"End": 112,
"Label": "account_number",
"score": 0.5739760994911194
}
]
},
"rust-toolchain": {
"text": "5e982c7d912ab858",
"found": []
},
"session-tokens": {
"text": "6170ea7af28ec9e2",
"found": [
{
"Start": 51,
"End": 83,
"Label": "secret",
"score": 0.9945904016494751
}
]
},
"session-uuid": {
"text": "45ff8afdbe77e369",
"found": []
},
"settings-model": {
"text": "24b9db62bf272ec3",
"found": [
{
"Start": 26,
"End": 31,
"Label": "secret",
"score": 0.985226035118103
},
{
"Start": 85,
"End": 110,
"Label": "private_url",
"score": 0.9965609908103943
}
]
},
"short-values": {
"text": "0133fede621b7801",
"found": [
{
"Start": 13,
"End": 14,
"Label": "private_address",
"score": 0.6322974562644958
}
]
},
"sizes-versions": {
"text": "e08a850f552a995b",
"found": []
},
"skill-list": {
"text": "535fc5de908c39dd",
"found": []
},
"snake-arg": {
"text": "7ade5b7b89a61dd4",
"found": []
},
"snake-words": {
"text": "89fcc6da0d4cc9fb",
"found": []
},
"task-ids": {
"text": "faff967171e2421d",
"found": []
},
"team-notes": {
"text": "6141f843b721d582",
"found": [
{
"Start": 41,
"End": 55,
"Label": "private_person",
"score": 0.9950873255729675
},
{
"Start": 118,
"End": 123,
"Label": "private_person",
"score": 0.9923510551452637
}
]
},
"token-count": {
"text": "359c740b1ce9a3c5",
"found": [
{
"Start": 31,
"End": 39,
"Label": "secret",
"score": 0.9052966833114624
}
]
},
"tool-ids": {
"text": "50c8c97e610d704c",
"found": []
},
"tool-result-mixed": {
"text": "f5a49344e0e7f392",
"found": [
{
"Start": 36,
"End": 50,
"Label": "private_person",
"score": 0.9953241944313049
},
{
"Start": 51,
"End": 70,
"Label": "private_email",
"score": 0.9960401058197021
},
{
"Start": 71,
"End": 88,
"Label": "private_phone",
"score": 0.759522557258606
},
{
"Start": 88,
"End": 99,
"Label": "private_person",
"score": 0.9947472810745239
},
{
"Start": 100,
"End": 121,
"Label": "private_email",
"score": 0.9956356287002563
},
{
"Start": 122,
"End": 137,
"Label": "private_phone",
"score": 0.9943153858184814
}
]
},
"tool-servers": {
"text": "6b9515c4bf396f51",
"found": []
},
"tool-use-ids": {
"text": "c83ab5e49cce4b75",
"found": []
},
"transcript-path": {
"text": "28861a2d1fee2589",
"found": []
},
"unix-time": {
"text": "3e3d22cf38729962",
"found": []
},
"unix-time-ms": {
"text": "7e29836c6aa4f105",
"found": []
},
"url-login": {
"text": "d6f5b2b60e384bb9",
"found": [
{
"Start": 10,
"End": 58,
"Label": "private_url",
"score": 0.9965047836303711
},
{
"Start": 67,
"End": 70,
"Label": "account_number",
"score": 0.5625114440917969
},
{
"Start": 71,
"End": 79,
"Label": "ip_address",
"score": 0.5526543259620667
}
]
},
"url-userinfo": {
"text": "a74a01c8225d54da",
"found": [
{
"Start": 13,
"End": 67,
"Label": "private_url",
"score": 0.9906603097915649
}
]
},
"us-address": {
"text": "d73e7386a905373e",
"found": [
{
"Start": 24,
"End": 68,
"Label": "private_address",
"score": 0.9942578077316284
},
{
"Start": 78,
"End": 92,
"Label": "private_phone",
"score": 0.9951914548873901
}
]
},
"user-path": {
"text": "007eeda2f5ba95d3",
"found": []
},
"zh-contact": {
"text": "5d654b2bbdd23aa1",
"found": [
{
"Start": 12,
"End": 18,
"Label": "private_person",
"score": 0.9953292012214661
},
{
"Start": 28,
"End": 39,
"Label": "private_phone",
"score": 0.994989275932312
},
{
"Start": 51,
"End": 93,
"Label": "private_address",
"score": 0.9943665266036987
}
]
},
"zh-id": {
"text": "f058f91bb1800cbe",
"found": []
},
"zh-names-edge": {
"text": "709d9aa01117e001",
"found": [
{
"Start": 18,
"End": 27,
"Label": "private_person",
"score": 0.9911744594573975
},
{
"Start": 51,
"End": 57,
"Label": "private_person",
"score": 0.993349015712738
}
]
},
"zh-password": {
"text": "ca3835176b202e40",
"found": [
{
"Start": 19,
"End": 29,
"Label": "secret",
"score": 0.9968122839927673
}
]
},
"zh-prose": {
"text": "c75e8925f3dddfc7",
"found": [
{
"Start": 0,
"End": 6,
"Label": "private_person",
"score": 0.9937225580215454
},
{
"Start": 6,
"End": 15,
"Label": "private_date",
"score": 0.903574526309967
},
{
"Start": 66,
"End": 72,
"Label": "private_person",
"score": 0.994594931602478
}
]
},
"zh-words": {
"text": "dfccf70c683fe55b",
"found": []
}
}