With the local model on, 白名单 went out as a name placeholder 821 times
in three days: the model took it for a name, and the reader's list of
ordinary words (zhWords, zhNounEnds), which every Chinese-name find is
checked against (zhWordNotName), had no word for it. 白名 is now in
zhWords and 单 in zhNounEnds, so the model's find goes as written and
never becomes a known value.
Of the report's other rows: node_modules and 连续 are already left as
written at this tree (probed with a fake model finding each as a name
and a path). 时按 and 时隐藏, the model's finds cut across two words
(超时+按住, 超时+隐藏), are still masked; this change does not cover them.
Changed from the contributor's patch: its second half, a gate in
knownSpans that let a known PERSON value go wherever it reads as a word,
is not taken. Every PERSON finder already asks zhWordNotName, so the
only values that gate let go are names masked where a role said a person
was meant: with it, "联系人:白名单" masked and the next request's
"白名单说明天到" went out as written. The test now checks that case and
resets the known values around itself.
Run (mote): go test -tags nogui ./internal/redact/... ./internal/pii/...
./internal/masking/... (ok), -shuffle=on ./internal/redact/ (ok);
go vet -tags nogui ./internal/redact/...; gofmt -l (empty).
Broken by hand: with the old zhname.go, TestModelMisreadsNotMasked and
TestKnownWordTakenForANameGoesAsWritten fail (开启{{PERSON_…}}之后);
with the patch's knownSpans gate put back, TestKnownWordTakenForANameGoes
AsWritten fails ("a name masked once left as written: 白名单说明天到").
Not tried: the reporter's real AstrLink Guard model on their requests.
Co-authored-by: ggbdpq <ggbdpq@gmail.com>