Tomyu_2034 on X: "magpie 里面的 masking 很容易把参数变量名当成 user name
给 mask 掉". No sample was given, so the class was measured: with "User
name in home folders" and "User and computer names" on, two finders took
names in code for the user's.
- Known values (known.go). A user name the home rule found once
(/Users/developer/…) is known from then on when it is 8 bytes or more,
and standsAlone's default bound is a letter or a digit only, so it was
masked wherever the word stood between anything else: def
run(developer, developer_dir), developer_mode = True, const developer
= 1, {"developer": true}, - developer_count := 0 in a diff, a tool
call's old_string. A user name such as developer or workspace1 is a
word code has too.
- The "User:" line rule (more.go). Its unquoted value was any
login-shaped word, so user = current_user, user: UserInfo, login =
loginName, username = target_name, a Go struct's "\tUser UserProfile"
and a TS interface's "user: CurrentUser" went as made-up names.
nameAlone now decides a known USERNAME: it is the user's name as a word
of its own in text (a path's part, name@host, --author=name, ls -l's
owner, uid=501(name), prose, a quoted string, chown name:staff), and
code's where it is joined to another part (_ $ a letter or digit beside
it, or a . or - with one past it), declared (const/let/var/def/func/
class/return/import…), assigned or called (name =, name(, name[,
name :=, x = name), a JSON key ("name":), or a parameter ((name, ,name)
name: str, name string), but for id's 501(name)). Nothing is exempted
by a key's name: a tool call's arguments are read by the same rule as
any text, and a quoted value in them is masked as before. The "User:"
rule leaves an unquoted value made of two or more words (split at _ .
and camel humps) one of which says it holds a user (identParts: user,
name, login, current, target, info, obj, id…); a quoted one, and a
login of words of its own (deploy_bot, john_doe), are masked still.
The boundary costs this: prose that puts the name alone in a list
"(developer, alice)" or before "=" now goes as written; such text reads
as code to this rule. A name under 8 bytes was never matched as known,
so for those only the "User:" half changes anything.
Tests (identname_test.go), with "developer" (a common word) and
"rinakato" (a handle), known from a working directory first:
- TestUserNameInCodeIsNoUserName: a Python and a JS file read, a JSON
file, Go code, a diff and an edit tool call's arguments go as written;
a home path, --author=, ls -l, uid=501(), prose, a quoted string, a
JSON value, chown and a bash tool call's ~name go as the made-up name.
- TestUserLineInCodeIsNoUserName: seven code lines unmasked; User:
deploy_bot, USER=rinak, user: "current_user", ssh config's User and
user = john_doe masked.
Broken by hand: with more.go and known.go as on main both tests are red
(12 and 7 failures); with standsAlone's USERNAME case returning true,
TestUserNameInCodeIsNoUserName alone is red.
Run at this head (on origin/main 89ffc58f5; nothing since touches
internal/redact or the doc), on mote:
- gofmt -l clean; go vet ./internal/redact ./internal/masking, and
GOOS=linux -tags nogui and GOOS=windows go vet ./internal/redact: clean.
- go test ./internal/redact ./internal/masking ./internal/otlp
./internal/pii ./internal/sessions ./internal/settings: ok.
- go test ./internal/gateway -run '(?i)mask|redact|privacy|personal|
standin|restore': ok.
- go test ./internal/gui: TestMainWindowCorners/macOS_26_SDK red, the
AppKit title bar on mote's macOS 27 (#3949, open); nothing else.
Not tried: the full internal/gateway package and go test ./... (the
gateway takes ~45 min; pushed at once per the owner's ship rule); the
local model's PERSON finds, which already leave snake_case and
lower-case words (modelTakes, programWords); the home rule's
"/home/<segment>" in a web route ('/home/dashboard'), which reads as a
home folder and is unchanged; a real request with the reporter's code.