Skip to content

Commit 0803fb0

Browse files
itcmsgrclaude
andcommitted
fix(smoke): V1 compat shim + V3 G20 CI gate — audit violations fixed
V1 (HIGH): Old smoke subcommands (run, lifecycle, verify, etc.) now print migration message directing to `nftban selftest`. Prevents silent breakage for operators upgrading from v1.94. V3 (MEDIUM): G20 Smoke Gate wired into ci-smoke.yml. Runs nftban-core smoke --json, validates JSON, fails on FAIL count > 0. SKIPs (expected in CI — no daemon/systemd) do not cause failure. Ref: V195_SMOKE_SELFTEST_AUDIT.md Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 8000021 commit 0803fb0

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

.github/workflows/ci-smoke.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,29 @@ jobs:
9898
9999
- name: Smoke test — fhs verify
100100
run: nftban fhs verify 2>&1 | head -20 || true
101+
102+
- name: "G20 Smoke Gate — registry-driven smoke"
103+
run: |
104+
# Run Go registry-driven smoke. CI environment will SKIP daemon/module
105+
# checks (no systemd, no live daemon) — that's correct behavior.
106+
# FAIL on: runtime errors, contract violations, malformed output.
107+
SMOKE_OUTPUT=$(bin/nftban-core smoke --json 2>&1) || true
108+
echo "$SMOKE_OUTPUT"
109+
110+
# Validate JSON parseable
111+
if ! echo "$SMOKE_OUTPUT" | jq empty 2>/dev/null; then
112+
echo "::error::G20 Smoke Gate: smoke --json output is not valid JSON"
113+
exit 1
114+
fi
115+
116+
# Check for FAIL or INTERNAL_ERROR
117+
FAIL_COUNT=$(echo "$SMOKE_OUTPUT" | jq -r '.summary.fail // 0')
118+
if [ "$FAIL_COUNT" != "0" ]; then
119+
echo "::error::G20 Smoke Gate: $FAIL_COUNT test(s) FAILED"
120+
echo "$SMOKE_OUTPUT" | jq '.tests[] | select(.status == "FAIL")'
121+
exit 1
122+
fi
123+
124+
PASS_COUNT=$(echo "$SMOKE_OUTPUT" | jq -r '.summary.pass // 0')
125+
SKIP_COUNT=$(echo "$SMOKE_OUTPUT" | jq -r '.summary.skip // 0')
126+
echo "G20 Smoke Gate: PASS ($PASS_COUNT pass, $SKIP_COUNT skip, 0 fail)"

cli/lib/nftban/cli/cmd_smoke.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,19 @@ readonly CMD_SMOKE_LOADED=1
4444
# =============================================================================
4545

4646
nftban_cmd_smoke() {
47+
# v1.95 compatibility shim: old destructive subcommands moved to selftest
48+
case "${1:-}" in
49+
run|test|quick|all|detailed|lifecycle|verify|config|configs|check|orphans|stats|trace)
50+
echo "NOTE: 'nftban smoke $1' was moved to 'nftban selftest' in v1.95." >&2
51+
echo "" >&2
52+
echo " nftban smoke = non-destructive system verification (CI-safe)" >&2
53+
echo " nftban selftest = extended validation with controlled state changes" >&2
54+
echo "" >&2
55+
echo "Run instead: nftban selftest $*" >&2
56+
return 1
57+
;;
58+
esac
59+
4760
local core_bin="${NFTBAN_CORE_BIN:-${NFTBAN_LIB_DIR}/bin/nftban-core}"
4861

4962
if [[ ! -x "$core_bin" ]]; then

0 commit comments

Comments
 (0)