fix(graphify): split the private-path predicate so the report gate stops flagging documented ~/ references - #53
Merged
KimYx0207 merged 1 commit intoAug 8, 2026
Conversation
GRAPH_REPORT.md 会忠实引用已跟踪文件里的注释,其中 canonical/runtime-assets/claude/commands/save-progress/SKILL.md 含一句 `~/.claude/hooks/`,导致 hasPrivateLocalPath 命中、整个 meta:graphify:check 恒失败。 裸 `~/` 在每台机器上字节相同、不含任何身份信息,与 /Users/<name>/、C:\、UNC 主机名不是同一类对象。新增只认身份绑定 路径的 revealsMachineIdentity,用于 GRAPH_REPORT.md 的两处闸; hasPrivateLocalPath 保持零改动,其 tilde 分支继续为别名 sanitizer 拒绝改写的路径做 fail-closed 兜底。 差集反证:旧谓词拦得住而新谓词放行的字符串中,真能识别用户或 机器的为 0 条;五类身份路径全部仍被拦截。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
meta:graphify:checkfails unconditionally on a clean checkout, at the second gate:There is no private path in the report.
GRAPH_REPORT.mdfaithfully quotes comments from tracked repository files, andcanonical/runtime-assets/claude/commands/save-progress/SKILL.mdcontains the line:# Detect the Python hook path — it lives in ~/.claude/hooks/hasPrivateLocalPathhas a~[\\/]branch, so that documented reference trips the gate. The gate is checking a tracked, machine-independent string and calling it a leak.Why this is a type confusion, not a regex bug
The two call sites in
graphify-cli.mjs(checkGraphFreshnessandstampGraphFreshness) ask a narrower question than the predicate answers.A bare
~/is byte-identical on every machine and embeds no user or host name. A drive letter, a UNC host, or an absolute home root (/Users/…,/home/…,/root/…) all embed a real identity. These are two different object classes; only the second is a privacy leak in published report output.So this adds
revealsMachineIdentityfor the identity-bearing class and uses it at the twoGRAPH_REPORT.mdgates.hasPrivateLocalPathis unchanged — its broader tilde branch stays as the fail-closed backstop for home-relative strings thatsanitizeKnownMetaKimHomeAliasesdeclined to rewrite, and it keeps guarding every other call site.Difference-set justification
I enumerated the strings the old predicate blocks that the new one admits. Of those, the number that can actually identify a user or a machine is zero — they are all bare-
~forms (~/,~\AppData,file:///~/notes). All five identity-bearing classes remain blocked:revealsMachineIdentity/Users/Kim/private.txtC:/Users/Kim/private.txtpath=C:\Users\Kim\private.txt\\server\share\private.txt/home/kim/private.txt,/root/.config/private~/,~\AppData,file:///~/noteshttps://www.aiking.dev/Tests
tests/setup/graphify-output-sanitize.test.mjsgains a case covering both directions, including the exactsave-progress/SKILL.mdline that triggers the failure.node --test tests/setup/graphify-output-sanitize.test.mjs→ 18/18 pass on this branch head.Scope and limitations — please read before merging
This commit alone does not turn
meta:graphify:checkgreen. An earlier gate short-circuits before this one and fails on macOS; that is fix(graphify): canonicalize temp base so the isolated-cwd assertion is satisfiable on macOS #52. Both are needed for a green run on macOS. This PR is cut fromorigin/mainand is independent of fix(graphify): canonicalize temp base so the isolated-cwd assertion is satisfiable on macOS #52 — the two touch disjoint files (graphify-unicode-normalize.mjsvs.graphify-private-path.mjs/graphify-cli.mjs) and can merge in either order.I could not run the full
meta:graphify:checkend to end. It requires a workingGEMINI_API_KEY, which I do not have. That is an environment limitation on my side, unrelated to this change. Verification here is the unit-level regression above plus reading the two call sites.~jamie/,~root/, and lowercase/users/are pre-existing gaps that this PR does not fix. To be explicit, since it would be easy to misread this as a narrowing I introduced: the existinghasPrivateLocalPathtilde branch is~[\\/], which requires the tilde to be immediately followed by a separator, so~jamie/xalready returnsfalsetoday. Measured on this branch:Both predicates miss them equally. Widening that is a separate decision about the sanitizer's threat model, and I did not want to smuggle it into a fix for a false positive. Happy to send it as a follow-up if you want it.
The 8 call sites in
graphify-node-identity.mjsare out of scope. I have no reproduction showing they suffer the same confusion, and I did not want to change gates I could not exercise.Environment
macOS 26.5.2, Node v24.12.0. Not tested on Windows or Linux; the change is a pure-function predicate with no platform-specific behavior, but the added
/(Users|home|root)/and UNC branches are unchanged from the original expression.