From 327442a1e7578a39c8e811cee4a8b6fe483266f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Mon, 24 Aug 2026 21:01:54 -0400 Subject: [PATCH] AI tests: restricted PATH guarantees installer branch coverage Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01QKxGW1raAWaqeU8WdHsMsp --- test/shell.d/omarchycn-ai-test.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/shell.d/omarchycn-ai-test.sh b/test/shell.d/omarchycn-ai-test.sh index e67ef5ed..2fd1c60d 100755 --- a/test/shell.d/omarchycn-ai-test.sh +++ b/test/shell.d/omarchycn-ai-test.sh @@ -149,7 +149,12 @@ chmod +x "$TEST_HOME/stubs/omarchy-mise-install" echo "sk-secret-1" | omarchy-cn-ai-secret set deepseek > /dev/null mkdir -p "$HOME/.claude" printf '{"permissions":{"allow":["Bash"]},"env":{"KEEP":"1"}}' > "$HOME/.claude/settings.json" -omarchy-cn-ai-default good > /dev/null +# Restricted PATH guarantees claude is absent so the installer branch runs +restricted="$TEST_HOME/stubs:$ROOT/bin:/usr/bin:/bin" +if PATH="$restricted" command -v claude > /dev/null 2>&1; then + fail "precondition: claude must not be visible on the restricted PATH" +fi +PATH="$restricted" omarchy-cn-ai-default good > /dev/null [[ $(jq -r '.env.KEEP' "$HOME/.claude/settings.json") == 1 ]] || fail "ai-default preserves user env" [[ $(jq -r '.permissions.allow[0]' "$HOME/.claude/settings.json") == Bash ]] || fail "ai-default preserves permissions" [[ $(jq -r '.env.ANTHROPIC_BASE_URL' "$HOME/.claude/settings.json") == "https://api.deepseek.com/anthropic" ]] || fail "ai-default env written"