Skip to content

Commit 810d677

Browse files
committed
test(smoke): follow the DeusData#1180 Hermes home and Claude detection
The client-detection fix moved the Windows Hermes home to %LOCALAPPDATA%\hermes and stopped counting a bare ~/.claude directory as a Claude Code install. The smoke script followed only part of the way. Hermes: 8x and 8x-i read the new HERMES_HOME_DIR, but 8x-ii still looked for the pre_llm_call hook in ~/.hermes/config.yaml, and the uninstall absence checks 9m and 9n still named ~/.hermes. On Linux and macOS HERMES_HOME_DIR is ~/.hermes, so the stale paths pointed at the right directory and nothing showed. Only on Windows do the two differ: 8x-ii failed on a hook that install had written to the new home, and 9m and 9n passed without looking at any file install had produced. All three now use HERMES_HOME_DIR. The assertions are unchanged. Claude Code: the fixtures of 9b-2, 9b-3, 9b-8 and both Phase 13 legs created only an empty ~/.claude, which is no longer a Claude Code home. Wherever no claude executable is installed, 9b-2 then finds no .claude.json entry and 13e finds no agent config, and 9b-3, 9b-8 and the install.ps1 leg stop exercising the Claude paths without saying so. The Linux test container reproduces both failures. The Windows job never got that far, because 8x-ii stops it in Phase 8. The fixtures now seed the .claude.json user config through one helper, the same seed the unit tests use. 9b-1b pins the new rule end to end: where the empty-home control shows no Claude Code, a home with only a bare ~/.claude gets no Claude config. A venue that has a claude executable skips it, with the reason at the case. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent 2b329fe commit 810d677

1 file changed

Lines changed: 57 additions & 13 deletions

File tree

‎scripts/smoke-test.sh‎

Lines changed: 57 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,16 @@ copy_smoke_binary() {
116116
cp "$BINARY" "$destination"
117117
}
118118

119+
# A fixture home that belongs to a Claude Code user. An empty ~/.claude is not
120+
# evidence of one (#1180: other tools create that directory, and install then
121+
# configured a client the user never had); the user config Claude Code itself
122+
# writes is. Same seed as test_mark_claude_code_installed in tests/test_cli.c.
123+
mark_claude_code_installed() {
124+
local home="$1"
125+
mkdir -p "$home/.claude"
126+
echo '{}' > "$home/.claude.json"
127+
}
128+
119129
# Retire this run's private account daemon (if one is running) and wait until
120130
# it reports not-running. Install/uninstall flows leave an ephemeral daemon
121131
# draining asynchronously whose mapped generation backing and open logs
@@ -2149,10 +2159,10 @@ if ! grep -q '^name: codebase-memory$' "$HERMES_HOME_DIR/skills/codebase-memory/
21492159
exit 1
21502160
fi
21512161
echo "OK 8x-i: Hermes durable delegation skill"
2152-
if ! grep -q '^hooks:' "$FAKE_HOME/.hermes/config.yaml" 2>/dev/null ||
2153-
! grep -q '^ pre_llm_call:' "$FAKE_HOME/.hermes/config.yaml" 2>/dev/null ||
2154-
! grep -q 'hook-augment' "$FAKE_HOME/.hermes/config.yaml" 2>/dev/null ||
2155-
! grep -q -- '--dialect hermes' "$FAKE_HOME/.hermes/config.yaml" 2>/dev/null; then
2162+
if ! grep -q '^hooks:' "$HERMES_HOME_DIR/config.yaml" 2>/dev/null ||
2163+
! grep -q '^ pre_llm_call:' "$HERMES_HOME_DIR/config.yaml" 2>/dev/null ||
2164+
! grep -q 'hook-augment' "$HERMES_HOME_DIR/config.yaml" 2>/dev/null ||
2165+
! grep -q -- '--dialect hermes' "$HERMES_HOME_DIR/config.yaml" 2>/dev/null; then
21562166
echo "FAIL 8x-ii: Hermes pre_llm_call context hook missing"
21572167
exit 1
21582168
fi
@@ -3154,8 +3164,8 @@ fi
31543164
echo "OK 9l: JSON agents, lifecycle hooks, and Kilo cleaned; foreign settings preserved"
31553165

31563166
# 9m: YAML/TOML new agents are cleaned.
3157-
if grep -q '^ codebase-memory-mcp:' "$FAKE_HOME/.hermes/config.yaml" 2>/dev/null ||
3158-
grep -q '^ pre_llm_call:' "$FAKE_HOME/.hermes/config.yaml" 2>/dev/null ||
3167+
if grep -q '^ codebase-memory-mcp:' "$HERMES_HOME_DIR/config.yaml" 2>/dev/null ||
3168+
grep -q '^ pre_llm_call:' "$HERMES_HOME_DIR/config.yaml" 2>/dev/null ||
31593169
grep -q '^ codebase-memory-mcp:' "$GOOSE_CFG" 2>/dev/null ||
31603170
grep -q 'codebase-memory-mcp' "$FAKE_HOME/.grok/config.toml" 2>/dev/null ||
31613171
grep -q '^name = "codebase-memory-mcp"' "$FAKE_HOME/.vibe/config.toml" 2>/dev/null; then
@@ -3209,7 +3219,7 @@ echo "OK 9m-i: durable instruction blocks removed"
32093219

32103220
# 9n: Skills removed (consolidated skill dir)
32113221
if [ -d "$FAKE_HOME/.claude/skills/codebase-memory" ] ||
3212-
[ -d "$FAKE_HOME/.hermes/skills/codebase-memory" ] ||
3222+
[ -d "$HERMES_HOME_DIR/skills/codebase-memory" ] ||
32133223
[ -d "$FAKE_HOME/.agents/skills/codebase-memory" ] ||
32143224
[ -d "$FAKE_HOME/.qoder/skills/codebase-memory" ] ||
32153225
[ -d "$CUSTOM_KIMI_HOME/skills/codebase-memory" ] ||
@@ -3287,9 +3297,40 @@ echo "OK 9b-1: install with minimal agents exits cleanly"
32873297
retire_account_daemon "9b-1-cleanup"
32883298
smoke_rmtree "$EMPTY_HOME"
32893299

3300+
# 9b-1b (#1180): an empty ~/.claude directory is not a Claude Code install.
3301+
# The empty home above is this venue's control: where it showed no Claude Code,
3302+
# the same home plus a bare ~/.claude must not be configured for it either.
3303+
#
3304+
# SKIP_WHITELIST: a venue with a claude executable (a developer machine) detects
3305+
# Claude Code in every home, so there is nothing for the bare directory to
3306+
# change. Narrowing PATH for this one install does not make such a venue
3307+
# claude-free: with HOME as the scanned home the product also probes fixed
3308+
# locations (/usr/local/bin, /opt/homebrew/bin). A venue without one, such as
3309+
# the Linux test image, runs the check.
3310+
if grep -q 'Detected agents:.* Claude-Code' <<<"$INSTALL_OUT"; then
3311+
echo "SKIP 9b-1b: a claude executable is installed in this venue (whitelisted above)"
3312+
else
3313+
BARE_HOME=$(smoke_mktemp_dir)
3314+
mkdir -p "$BARE_HOME/.claude" "$BARE_HOME/.local/bin"
3315+
BARE_RC=0
3316+
BARE_OUT=$(HOME="$BARE_HOME" LOCALAPPDATA="$BARE_HOME/AppData/Local" "$BINARY" install -y 2>&1) || BARE_RC=$?
3317+
if [ "$BARE_RC" -ge 128 ] ||
3318+
! grep -q 'Detected agents:' <<<"$BARE_OUT" ||
3319+
grep -q 'Detected agents:.* Claude-Code' <<<"$BARE_OUT" ||
3320+
[ -e "$BARE_HOME/.claude.json" ] ||
3321+
[ -n "$(ls -A "$BARE_HOME/.claude" 2>/dev/null)" ]; then
3322+
echo "FAIL 9b-1b: a bare ~/.claude directory was configured as a Claude Code install"
3323+
exit 1
3324+
fi
3325+
echo "OK 9b-1b: a bare ~/.claude directory is not configured as Claude Code"
3326+
retire_account_daemon "9b-1b-cleanup"
3327+
smoke_rmtree "$BARE_HOME"
3328+
fi
3329+
32903330
# 9b-2: Install twice (idempotent)
32913331
IDEM_HOME=$(smoke_mktemp_dir)
3292-
mkdir -p "$IDEM_HOME/.claude" "$IDEM_HOME/.local/bin"
3332+
mkdir -p "$IDEM_HOME/.local/bin"
3333+
mark_claude_code_installed "$IDEM_HOME"
32933334
copy_smoke_binary "$IDEM_HOME/.local/bin/codebase-memory-mcp"
32943335
run_no_crash 9b-2 env HOME="$IDEM_HOME" LOCALAPPDATA="$IDEM_HOME/AppData/Local" "$BINARY" install -y
32953336
IDEM_INSTALLER="$BINARY"
@@ -3313,7 +3354,8 @@ smoke_rmtree "$IDEM_HOME"
33133354

33143355
# 9b-3: Uninstall without prior install
33153356
CLEAN_HOME=$(smoke_mktemp_dir)
3316-
mkdir -p "$CLEAN_HOME/.claude" "$CLEAN_HOME/.local/bin"
3357+
mkdir -p "$CLEAN_HOME/.local/bin"
3358+
mark_claude_code_installed "$CLEAN_HOME"
33173359
UNINSTALL_RC=0
33183360
UNINSTALL_OUT=$(HOME="$CLEAN_HOME" "$BINARY" uninstall -y -n 2>&1) || UNINSTALL_RC=$?
33193361
if [ "$UNINSTALL_RC" -ge 128 ]; then
@@ -3337,7 +3379,8 @@ smoke_rmtree "$CORRUPT_HOME"
33373379

33383380
# 9b-8: Double uninstall
33393381
DBL_HOME=$(smoke_mktemp_dir)
3340-
mkdir -p "$DBL_HOME/.claude" "$DBL_HOME/.local/bin"
3382+
mkdir -p "$DBL_HOME/.local/bin"
3383+
mark_claude_code_installed "$DBL_HOME"
33413384
copy_smoke_binary "$DBL_HOME/.local/bin/codebase-memory-mcp"
33423385
run_no_crash 9b-8-install env HOME="$DBL_HOME" "$BINARY" install -y
33433386
DBL_UNINSTALLER="$BINARY"
@@ -3834,7 +3877,7 @@ if [ "$DL_OS" != "windows" ] && [ -f "$REPO_ROOT/install.sh" ]; then
38343877
echo "--- Phase 13: install.sh E2E ---"
38353878
INSTALL_TEST_HOME=$(smoke_mktemp_dir)
38363879
INSTALL_TEST_DIR=$(smoke_mktemp_dir)
3837-
mkdir -p "$INSTALL_TEST_HOME/.claude"
3880+
mark_claude_code_installed "$INSTALL_TEST_HOME"
38383881
mkdir -p "$INSTALL_TEST_HOME/.local/bin"
38393882

38403883
# 13a: run install.sh with local URL + isolated HOME
@@ -3871,7 +3914,8 @@ if [ "$DL_OS" != "windows" ] && [ -f "$REPO_ROOT/install.sh" ]; then
38713914
echo "OK 13d: no signing needed ($DL_OS)"
38723915
fi
38733916

3874-
# 13e: agent configs created (at least Claude Code since we made ~/.claude)
3917+
# 13e: agent configs created (at least Claude Code: the fixture home is a
3918+
# Claude Code user's)
38753919
if [ -f "$INSTALL_TEST_HOME/.claude.json" ] && grep -q 'codebase-memory-mcp' "$INSTALL_TEST_HOME/.claude.json" 2>/dev/null; then
38763920
echo "OK 13e: agent configs created by install.sh"
38773921
else
@@ -3898,7 +3942,7 @@ elif [ -f "$REPO_ROOT/install.ps1" ] && command -v powershell.exe &>/dev/null; t
38983942
echo "--- Phase 13: install.ps1 E2E (Windows) ---"
38993943
PS1_TEST_HOME=$(smoke_mktemp_dir)
39003944
PS1_TEST_DIR=$(smoke_mktemp_dir)
3901-
mkdir -p "$PS1_TEST_HOME/.claude"
3945+
mark_claude_code_installed "$PS1_TEST_HOME"
39023946

39033947
# Convert MSYS paths to Windows paths for PowerShell
39043948
if command -v cygpath &>/dev/null; then

0 commit comments

Comments
 (0)