From add83bbd6c0fad0dbcef5f2d0b38372ac5a64d23 Mon Sep 17 00:00:00 2001 From: A <258483684+la14-1@users.noreply.github.com> Date: Sun, 1 Mar 2026 08:45:24 -0800 Subject: [PATCH] refactor: Remove dead code and stale references (#2062) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove orphaned sh/test/fixtures/ directory. These shell fixture files (_shared_agent_assertions.sh, hetzner/_env.sh, hetzner/_api_assertions.sh, digitalocean/_env.sh, digitalocean/_api_assertions.sh) were part of a mock test harness (mock.sh) that was removed from the repository. The fixture files reference `assert_api_called` and `MOCK_LOG` variables that are never defined anywhere, confirming they are unreachable dead code. Scan results: - Dead code (sh/test/fixtures/): 5 orphaned fixture files removed - Dead code (sh/shared, packages/cli/src/): none found - Stale references to non-existent files: none found - Python usage (python3 -c / python -c): none found - Duplicate utilities across cloud modules: loadTokenFromConfig pattern exists in hetzner/daytona/digitalocean but reads from different cloud- specific config paths — cannot be consolidated (confirmed intentional) - Stale comments: none found beyond those already fixed in prior PRs -- qa/code-quality Co-authored-by: spawn-qa-bot Co-authored-by: Claude Sonnet 4.6 --- sh/test/fixtures/_shared_agent_assertions.sh | 51 ------------------- .../fixtures/digitalocean/_api_assertions.sh | 2 - sh/test/fixtures/digitalocean/_env.sh | 4 -- sh/test/fixtures/hetzner/_api_assertions.sh | 2 - sh/test/fixtures/hetzner/_env.sh | 4 -- 5 files changed, 63 deletions(-) delete mode 100644 sh/test/fixtures/_shared_agent_assertions.sh delete mode 100644 sh/test/fixtures/digitalocean/_api_assertions.sh delete mode 100644 sh/test/fixtures/digitalocean/_env.sh delete mode 100644 sh/test/fixtures/hetzner/_api_assertions.sh delete mode 100644 sh/test/fixtures/hetzner/_env.sh diff --git a/sh/test/fixtures/_shared_agent_assertions.sh b/sh/test/fixtures/_shared_agent_assertions.sh deleted file mode 100644 index 9264ce81..00000000 --- a/sh/test/fixtures/_shared_agent_assertions.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Shared per-agent install assertions -# Verifies each agent script uses the correct install method -# -# Source this file and call assert_agent_install CLOUD AGENT. Expects: -# MOCK_LOG — path to the mock call log -# PASSED / FAILED — counters (updated in-place) -# GREEN / RED / NC — color codes - -# Internal: assert a grep pattern appears in MOCK_LOG -_assert_install_pattern() { - local pattern="$1" - local msg="$2" - if grep -qE "${pattern}" "${MOCK_LOG}" 2>/dev/null; then - printf '%b\n' " ${GREEN}✓${NC} ${msg}" - PASSED=$((PASSED + 1)) - else - printf '%b\n' " ${RED}✗${NC} ${msg}" - FAILED=$((FAILED + 1)) - fi -} - -assert_agent_install() { - local cloud="$1" - local agent="$2" - - case "$agent" in - claude) - # install_claude_code finalization always runs "claude install --force" - # (mock claude binary is pre-installed, so curl installer is skipped) - _assert_install_pattern "claude.*install" "installs claude code" ;; - openclaw) - # npm install -g openclaw (Node runtime needs standard node_modules layout) - _assert_install_pattern "npm.*install.*openclaw" "installs openclaw via npm" ;; - codex) - # npm install -g @openai/codex - _assert_install_pattern "npm.*install.*codex" "installs codex via npm" ;; - opencode) - # curl to download opencode tarball (via opencode_install_cmd) - _assert_install_pattern "opencode" "installs opencode" ;; - kilocode) - # npm install -g @kilocode/cli - _assert_install_pattern "npm.*install.*kilocode" "installs kilocode via npm" ;; - zeroclaw) - # curl installer from zeroclaw-labs/zeroclaw repo - _assert_install_pattern "zeroclaw" "installs zeroclaw" ;; - *) - # Unknown agent — skip assertion (no failure) - return 0 ;; - esac -} diff --git a/sh/test/fixtures/digitalocean/_api_assertions.sh b/sh/test/fixtures/digitalocean/_api_assertions.sh deleted file mode 100644 index f6143c6e..00000000 --- a/sh/test/fixtures/digitalocean/_api_assertions.sh +++ /dev/null @@ -1,2 +0,0 @@ -assert_api_called "GET" "/account/keys" "fetches SSH keys" -assert_api_called "POST" "/droplets" "creates droplet" diff --git a/sh/test/fixtures/digitalocean/_env.sh b/sh/test/fixtures/digitalocean/_env.sh deleted file mode 100644 index b325c016..00000000 --- a/sh/test/fixtures/digitalocean/_env.sh +++ /dev/null @@ -1,4 +0,0 @@ -export DO_API_TOKEN="test-token-do" -export DO_DROPLET_NAME="test-srv" -export DO_DROPLET_SIZE="s-2vcpu-2gb" -export DO_REGION="nyc3" diff --git a/sh/test/fixtures/hetzner/_api_assertions.sh b/sh/test/fixtures/hetzner/_api_assertions.sh deleted file mode 100644 index e736386f..00000000 --- a/sh/test/fixtures/hetzner/_api_assertions.sh +++ /dev/null @@ -1,2 +0,0 @@ -assert_api_called "GET" "/ssh_keys" "fetches SSH keys" -assert_api_called "POST" "/servers" "creates server" diff --git a/sh/test/fixtures/hetzner/_env.sh b/sh/test/fixtures/hetzner/_env.sh deleted file mode 100644 index 6a25f0c0..00000000 --- a/sh/test/fixtures/hetzner/_env.sh +++ /dev/null @@ -1,4 +0,0 @@ -export HCLOUD_TOKEN="test-token-hetzner" -export HETZNER_SERVER_NAME="test-srv" -export HETZNER_SERVER_TYPE="cx23" -export HETZNER_LOCATION="fsn1"