Files
msd-core/tests
Tom Boucher 86101ee612 fix(#3133): keep global Claude @-references on tilde, not $HOME (#3393)
* test(#3133): global Claude @-references must resolve on tilde, not $HOME

Regression for #3133: on a global Claude install, _applyRuntimeRewrites
rewrites @~/.claude/... -> @$HOME/.claude/..., but Claude Code does not
expand $HOME in @-file references, so the include silently resolves to
nothing and the skill loads an empty execution_context. Rows 1/2/6/9 fail
RED on next; rows 3-5/7-8 guard #1284 (shell $HOME), local redirect,
#3503 (no homedir leak), and non-Claude isolation.

* fix(#3133): keep global Claude @-references on tilde, not $HOME

On a global Claude install, _applyRuntimeRewrites rewrote every @~/.claude/
include to @$HOME/.claude/ because computePathPrefix returns the $HOME form
for shell-context correctness (#1284: ~ does not expand inside double quotes).
Claude Code does not expand $HOME in @-file references, so the rewritten
include silently resolved to nothing and skills loaded an empty
execution_context. Add a normalization pass in the claude case: when the
prefix is the $HOME (global) form, restore @$HOME/.claude/ -> @~/.claude/
(the form Claude expands and the shipped tarball uses). Shell contexts keep
$HOME; local installs (absolute prefix) are unaffected; computePathPrefix is
untouched (all its tests stay green).

* test(#3133): fix row 9 assertion — drop end-of-string anchor

Row 9's regex used $ (end-of-string) but a realistic @-ref line ends with
a newline, so the anchor could not match. The fix under test produces the
correct @~/.claude/gsd-core/references/ui-brand.md tail; only the assertion
was wrong. Drop the anchor and assert the tail + no @$HOME.

* docs(#3133): add changeset

* docs(#3133): backfill changeset PR number (3393)

---------

Co-authored-by: sim <sim@local>
2026-08-12 18:30:56 -04:00
..