From ecc1138647bafe0db85a9949447757fc2e324275 Mon Sep 17 00:00:00 2001 From: olaservo Date: Tue, 18 Aug 2026 19:44:09 -0700 Subject: [PATCH] Pin ANTHROPIC_API_KEY empty in the client smoke tests The client tests drive the path where no key is set: each client prints a notice and exits. They did not isolate the variable, so a key exported in the environment or sitting in a local .env sent the client into its interactive chat loop instead. Observed with a .env in mcp-client-ruby: the run reached "Query:" and waited on stdin. Empty rather than unset, because dotenv skips a name already present in ENV. All three clients check `nil? || empty?`, so an empty value takes the early exit. CI never hit this, having no key set. It affects local runs, and a run fed input rather than /dev/null would issue real API requests. Applied to the Python and TypeScript client tests too; all three share the pattern. Also correct the Ruby version comment: 3.3 is supported until March 2027, so 3.4 is not the oldest supported series. The tested version is unchanged. Co-Authored-By: Claude Opus 5 --- .github/workflows/ci.yml | 4 ++-- tests/smoke-test.sh | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0706ae3..a81a24b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,8 +41,8 @@ jobs: with: go-version: "1.25" - # 3.4 is the oldest series still supported; 3.2 reached end of life in - # March 2026. + # 3.4 is the current stable series. 3.3 is supported until March 2027; 3.2 + # reached end of life in March 2026. - name: Set up Ruby uses: ruby/setup-ruby@v1 with: diff --git a/tests/smoke-test.sh b/tests/smoke-test.sh index bb60d78..7aee057 100755 --- a/tests/smoke-test.sh +++ b/tests/smoke-test.sh @@ -84,11 +84,15 @@ test_weather_server_go() { node "${TEST_CLIENT}" "${server_bin}" } +# The client tests drive the no-API-key path, where each client prints a notice +# and exits. Empty rather than unset: dotenv skips a name already present in +# ENV, so a key in the environment or a local .env would start the chat loop. + # Test: Python MCP client test_mcp_client_python() { check_dependency uv || return 1 local client_dir="${PROJECT_ROOT}/mcp-client-python" - uv --directory "${client_dir}" run python "${client_dir}/client.py" "${MOCK_SERVER}" >/dev/null 2>&1 + ANTHROPIC_API_KEY= uv --directory "${client_dir}" run python "${client_dir}/client.py" "${MOCK_SERVER}" >/dev/null 2>&1 } # Test: TypeScript MCP client @@ -97,7 +101,7 @@ test_mcp_client_typescript() { check_dependency npm || return 1 local client_dir="${PROJECT_ROOT}/mcp-client-typescript" ensure_built "${client_dir}" || return 1 - node "${client_dir}/build/index.js" "${MOCK_SERVER}" >/dev/null 2>&1 + ANTHROPIC_API_KEY= node "${client_dir}/build/index.js" "${MOCK_SERVER}" >/dev/null 2>&1 } # Test: Ruby MCP client @@ -106,7 +110,7 @@ test_mcp_client_ruby() { check_dependency bundle || return 1 local client_dir="${PROJECT_ROOT}/mcp-client-ruby" ensure_bundled "${client_dir}" || return 1 - (cd "${client_dir}" && bundle exec ruby client.rb "${MOCK_SERVER}") >/dev/null 2>&1 + (cd "${client_dir}" && ANTHROPIC_API_KEY= bundle exec ruby client.rb "${MOCK_SERVER}") >/dev/null 2>&1 } # Run all tests