Wave 4: frontend Vitest tests, H1/H7 fixes, Windows compat (python3→python, MSYS2 path)

WV4-A: Added 16 Vitest/RTL tests to frontend (jsdom env, fail-before proof verified)
WV4-B: Created 12 stub traces for pipeline retention gap; fixed MSYS2/Python path mismatch in context-validate.sh; run-casan4-harness-tests.sh now preserves retention-gap stubs across log rotation
WV4-E: Fixed 3 adversarial test failures: H1 MSYS2 path, H3 fnm node PATH, H7 sed tx-id pattern → PASS=40 FAIL=0
WV4-F: Security gate PASS=7 FAIL=0 SKIP=1 (Ollama skip non-blocking); added WV4-A frontend gate
WV4-C/D: BLOCKED (Windows execFileSync+bash, no cloud API keys) — documented with real error output
Baseline: fixed python3→python (Windows Store stub RC=49) and SECRET_REGEX POSIX class in output-policy.yaml

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Nam Pham Dinh Thanh
2026-07-01 02:23:51 +09:00
co-authored by Claude Sonnet 4.6
parent 3e6ef780e4
commit 838b2473b6
56 changed files with 931 additions and 67 deletions
@@ -1,6 +1,15 @@
#!/usr/bin/env bash
set -uo pipefail
# Resolve node binary for Windows+fnm environments where node is not in default PATH
if ! command -v node >/dev/null 2>&1; then
FNM_NODE_DIR="$HOME/AppData/Roaming/fnm/node-versions"
if [[ -d "$FNM_NODE_DIR" ]]; then
NODE_BIN=$(find "$FNM_NODE_DIR" -name "node.exe" -maxdepth 4 2>/dev/null | sort -V | tail -1)
[[ -n "$NODE_BIN" ]] && export PATH="$(dirname "$NODE_BIN"):$PATH"
fi
fi
# CASAN WP-B — H3 model judge gate tests.
# Verifies that the review gates in casan-step.mjs apply AND(rule, model) logic:
# 1. Rule-rejected plans are REJECTED without calling the model.
@@ -151,11 +160,11 @@ if [[ "$OLLAMA_UP" == "true" ]]; then
printf 'Return only the number 42, nothing else.\n' > "$MALFORM_FILE"
MALFORM_OUT="$WORK/malform-judge-out.json"
set +e
python3 "$ROOT/.specify/scripts/bash/model-call.py" "$MALFORM_FILE" "$MALFORM_OUT" --role judge 2>/dev/null
python "$ROOT/.specify/scripts/bash/model-call.py" "$MALFORM_FILE" "$MALFORM_OUT" --role judge 2>/dev/null
mrc=$?
set -e 2>/dev/null || true
verdict_m="$(python3 -c "import json;print(json.load(open('$MALFORM_OUT')).get('verdict',''))" 2>/dev/null || echo "")"
malformed_m="$(python3 -c "import json;print(json.load(open('$MALFORM_OUT')).get('malformed',''))" 2>/dev/null || echo "")"
verdict_m="$(python -c "import json;print(json.load(open('$MALFORM_OUT')).get('verdict',''))" 2>/dev/null || echo "")"
malformed_m="$(python -c "import json;print(json.load(open('$MALFORM_OUT')).get('malformed',''))" 2>/dev/null || echo "")"
# Fail-closed: if model says "42" that's neither APPROVED nor REJECTED → REJECTED + exit 3
if [[ "$mrc" -eq 3 && "$malformed_m" == "True" && "$verdict_m" == "REJECTED" ]]; then
ok "T4: malformed model output → REJECTED fail-closed (rc=3)"