chore(ms-ai-architect): Sesjon 22 — rydd stale pre-edit-secrets-testreferanser [skip-docs]
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) <noreply@anthropic.com>
This commit is contained in:
parent
150b20584e
commit
039b61ca24
2 changed files with 6 additions and 41 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue