Skip to content

fix(shrink): a path spelled more precisely is not a path dropped - #28

Merged
DottytheHomeless merged 1 commit into
mainfrom
fix/shrink-guard-path-suffix
Aug 4, 2026
Merged

DottytheHomeless merged 1 commit into
mainfrom
fix/shrink-guard-path-suffix

Conversation

@MXAntian

@MXAntian MXAntian commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

The bug

The guard compared identifier sets directly, so writing memory/index.mjs out and E:/Project/ws/memory/index.mjs in read as a loss.

old (set difference)  dropped: ["memory/index.mjs", "scripts/run.sh"]
new (suffix aware)    dropped: []

Why it matters more than it looks

Three real merges in one night of memory curation each triggered this warning, and each warning was wrong for the same reason.

Consolidating entries almost always expands relative references into absolute ones. So the edit a maintainer performs most often is precisely the one that fired the most bogus warnings — on a guard whose entire value is being read rather than dismissed. That is how a detector gets trained into noise.

The fix

isStillCarried() — a token counts as present when the new text names it, or names something it is the tail of.

The boundary is a path separator, so this stays strict where it should:

old token new text has carried?
memory/index.mjs E:/Project/ws/memory/index.mjs ✅ same file
session-summarize.mjs E:/…/scripts/session-summarize.mjs ✅ same file
send.mjs E:/…/feishu-send.mjs different file — still warns
index.mjs reindex.mjs ❌ bare substring — still warns

Verified the genuinely-lossy case is unaffected: drop the URL and it still reports https://ops.example.com/dash.

Shared, not duplicated

Exported and imported into memory-health's (a3) audit rather than reimplemented there. Those two had already drifted apart once, and the nightly queue is only worth reading if it agrees with the gate that let the write through in the first place.

296 passed / 0 failed.

🤖 Generated with Claude Code

The guard compared identifier sets directly, so writing `memory/index.mjs` out
and `E:/Project/ws/memory/index.mjs` in read as a loss:

  old (set difference)  dropped: ["memory/index.mjs", "scripts/run.sh"]
  new (suffix aware)    dropped: []

Three real merges in one night of memory curation each warned, and each warning
was wrong for this reason. Consolidating entries almost always expands relative
references into absolute ones — so the edit a maintainer performs most often is
precisely the one that fired the most bogus warnings, on a guard whose entire
value is being read rather than dismissed.

isStillCarried() treats a token as present when the new text names it or names
something it is the tail of. The boundary is a path separator, so `send.mjs` is
still reported when only `feishu-send.mjs` remains — different file, real loss.
Verified the URL-actually-gone case still warns.

Exported and imported into memory-health's (a3) audit rather than reimplemented
there. Those two had already drifted apart once, and the nightly queue is only
worth reading if it agrees with the gate that let the write through.

296 passed / 0 failed.

Co-authored-by: 千夏 <qianxia@clawgamers.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@MXAntian
MXAntian marked this pull request as ready for review August 4, 2026 04:46
@DottytheHomeless
DottytheHomeless merged commit 468d27f into main Aug 4, 2026
2 checks passed
@DottytheHomeless
DottytheHomeless deleted the fix/shrink-guard-path-suffix branch August 4, 2026 05:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants