Files
dacli/scripts/quality-gate.sh
T
sswandClaude 891a600245 test(guards): P2.5 — verify guards effective, reconcile stale test, un-quarantine
Verified (evidence, not guess): the guards ARE effective — command-scoped by design,
wired into form/create, form/release, dm/create, menu/create; BS-47/BS-50 fire
correctly when called with their command (as all production callers + verify_option.test.ts do).
The 12 failures were a STALE test, not broken guards:
- 8 'should-trigger' used pre-command-scoping calls → added command args (BS-47 'dict typeCreate', BS-50 'menu create')
- BS-15b / BS-28 / BS-32b: guards removed from registry long ago → dropped stale assertions
- BS-5: real check is ctx===null (not 'empty existingEnCodes') → fixed test
- BS-51 WARN / BS-44 INFO / BS-60 ERROR: test asserted wrong levels → fixed
- BS-60 repurposed (invalid jnpfKey / placeholder columnOptions, not missing vmodel) → fixed trigger
Impl: fixed objective dup-id bug — renamed 2nd 'BS-14' (type=4 view-release WARN) → 'BS-14b'.
Un-quarantined: removed --exclude from scripts/quality-gate.sh.

Verified: full gate green WITH blindspot_guards (tsc 0 + all unit incl. 41/41 guards + smoke).

Co-Authored-By: Claude <[email protected]>
2026-07-24 13:45:48 +08:00

38 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
# dacli 真质量门 (P3, 2026-07-24) — 取代"仪式门"作为唯一阻塞门
#
# 三道阻塞/半阻塞检查, 呼应 docs/dacliv2/DESIGN.md §1 质量契约:
# [1] tsc --noEmit → 0 错误 (硬阻断)
# [2] vitest run tests/unit → 全绿 (硬阻断)
# [3] backend smoke → 有 live 后端才跑 (本地 advisory, CI 强制)
#
# 无仪式: 不 grep 魔法串 / 不查注释出处 / 不看行数下限.
# 紧急绕过: DACLI_SKIP_GATE=1 git commit ... (不推荐)
# 复用: pre-commit 与 CI 都调本脚本 (单一真相源).
set -e
ROOT="$(git rev-parse --show-toplevel)"
cd "$ROOT"
if [ "$DACLI_SKIP_GATE" = "1" ]; then
echo "⚠️ dacli 质量门跳过 (DACLI_SKIP_GATE=1)"
exit 0
fi
echo "🔒 dacli 质量门 [1/3] tsc --noEmit ..."
npx tsc --noEmit --project tsconfig.json
echo " ✓ tsc: 0 错误"
echo "🔒 dacli 质量门 [2/3] vitest run tests/unit ..."
npx vitest run tests/unit
echo " ✓ vitest unit: 全绿"
echo "🔒 dacli 质量门 [3/3] backend smoke ..."
if command -v dacli >/dev/null 2>&1 && dacli form list >/dev/null 2>&1; then
echo " ✓ smoke: dacli form list 返回真实数据"
else
echo " ⚠ smoke 跳过: 无 live 后端/dacli 不在 PATH (本地 advisory; CI 必须强制)"
fi
echo "✅ dacli 质量门通过"