From 039b61ca24e7e582b49314b0ebb8ee930e9c487d Mon Sep 17 00:00:00 2001 From: Kjell Tore Guttormsen Date: Sat, 20 Jun 2026 23:08:11 +0200 Subject: [PATCH] =?UTF-8?q?chore(ms-ai-architect):=20Sesjon=2022=20?= =?UTF-8?q?=E2=80=94=20rydd=20stale=20pre-edit-secrets-testreferanser=20[s?= =?UTF-8?q?kip-docs]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pre-edit-secrets.mjs-hooken ble bevisst fjernet i v1.7.0 (secrets scanning consolidated to llm-security, CHANGELOG l.413), men 2 testfiler refererte den fortsatt og ga falske feil. - tests/test-hooks.sh: fjernet pre-edit-secrets-testblokk (5 tester) → 6/6 grønn. - tests/test-plugin-discovery.sh: fjernet pre-edit-secrets fra CLAUDE.md-dok-loop. Separat funn (IKKE fikset, scope-guard): test-plugin-discovery.sh har 1 gjenværende feil `auto_discover is not true` — plugin.json mangler feltet; ikke hook-relatert, krever søk-først (gjeldende felt vs stale test). Flagget → task #44. De 4 sporede suitene uendret (validate 239 · kb-update 155 · kb-eval 100 · kb-integrity 192/192). Co-Authored-By: Claude Opus 4.8 (1M context) --- tests/test-hooks.sh | 43 +++------------------------------- tests/test-plugin-discovery.sh | 4 +++- 2 files changed, 6 insertions(+), 41 deletions(-) diff --git a/tests/test-hooks.sh b/tests/test-hooks.sh index 7ab0b88..f302790 100644 --- a/tests/test-hooks.sh +++ b/tests/test-hooks.sh @@ -15,46 +15,9 @@ fail() { echo -e "\033[0;31m ✗ $1\033[0m"; FAIL=$((FAIL + 1)); } echo "=== Hook Script Tests ===" echo "" -# ------------------------------------------------------- -# pre-edit-secrets.mjs -# ------------------------------------------------------- -echo "--- pre-edit-secrets.mjs ---" - -# Test 1: clean content passes -echo '{"tool_input":{"content":"Hello world","file_path":"readme.md"}}' \ - | node "$SCRIPTS_DIR/pre-edit-secrets.mjs" 2>/dev/null \ - && pass "Clean content: exit 0" \ - || fail "Clean content: expected exit 0" - -# Test 2: Azure Storage key blocked (constructed at runtime to avoid hook self-trigger) -AZURE_KEY_PAYLOAD=$(printf '{"tool_input":{"content":"%s","file_path":"config.ts"}}' \ - "DefaultEndpointsProtocol=https;AccountName=test;AccountKey=$(printf 'a%.0s' {1..44})=") -echo "$AZURE_KEY_PAYLOAD" \ - | node "$SCRIPTS_DIR/pre-edit-secrets.mjs" 2>/dev/null \ - && fail "Azure Storage key: expected exit 2 (blocked)" \ - || pass "Azure Storage key: blocked correctly" - -# Test 3: GitHub token blocked (constructed at runtime) -GH_TOKEN="ghp_$(printf 'a%.0s' {1..40})" -printf '{"tool_input":{"content":"token: %s","file_path":"ci.yml"}}' "$GH_TOKEN" \ - | node "$SCRIPTS_DIR/pre-edit-secrets.mjs" 2>/dev/null \ - && fail "GitHub token: expected exit 2 (blocked)" \ - || pass "GitHub token: blocked correctly" - -# Test 4: empty content passes -echo '{"tool_input":{"content":"","file_path":"empty.md"}}' \ - | node "$SCRIPTS_DIR/pre-edit-secrets.mjs" 2>/dev/null \ - && pass "Empty content: exit 0" \ - || fail "Empty content: expected exit 0" - -# Test 5: test files skipped (constructed at runtime) -printf '{"tool_input":{"content":"api_key = \\"%s\\"","file_path":"auth.test.ts"}}' \ - "$(printf 'x%.0s' {1..25})" \ - | node "$SCRIPTS_DIR/pre-edit-secrets.mjs" 2>/dev/null \ - && pass "Test file: skipped (exit 0)" \ - || fail "Test file: should be skipped" - -echo "" +# NB: the pre-edit-secrets.mjs hook was removed in v1.7.0 (secrets scanning +# consolidated to the llm-security plugin — see CHANGELOG). Its tests were +# removed with it; secrets-scanning coverage now lives in llm-security. # ------------------------------------------------------- # session-start-context.mjs diff --git a/tests/test-plugin-discovery.sh b/tests/test-plugin-discovery.sh index 2e2b544..c3cfb33 100644 --- a/tests/test-plugin-discovery.sh +++ b/tests/test-plugin-discovery.sh @@ -140,7 +140,9 @@ else fail "CLAUDE.md missing Hooks section" fi -for script in pre-edit-secrets session-start-context stop-assessment-reminder; do +# pre-edit-secrets removed in v1.7.0 (consolidated to llm-security); only the +# two live hooks are documented. +for script in session-start-context stop-assessment-reminder; do if grep -q "$script" "$CLAUDE_MD" 2>/dev/null; then pass "CLAUDE.md documents $script" else