The check at tests/path-replacement.test.cjs:163 used a naive content.includes(normalizedHomedir) to detect resolved homedir leaks in installed .md files. When os.homedir() is short (e.g. /root inside a Docker container), the substring false-matches inside ordinary tokens such as `</root_cause_analysis>` in agents/gsd-debug-session-manager.md, producing spurious failures with no actual path leak. Real path leaks are always followed by a path separator, so require `normalizedHomedir + '/'` instead. Extracted the predicate into a testable `containsResolvedHomedir` helper and added regression tests covering the /root case, a genuine /home/alice leak, /root followed by an actual separator, and the $HOME placeholder short-circuit. Fixes #3503 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
8.5 KiB
8.5 KiB