feat: introduce new quality gates, Node.js syntax checks, and manual smoke test status validation

This commit is contained in:
CJACK
2026-02-22 18:33:30 +08:00
parent 8de87fb9e0
commit acf39f2823
13 changed files with 307 additions and 9 deletions

View File

@@ -0,0 +1,38 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
TARGETS_FILE="${1:-$ROOT_DIR/plans/node-syntax-gate-targets.txt}"
if [[ ! -f "$TARGETS_FILE" ]]; then
echo "missing targets file: $TARGETS_FILE" >&2
exit 1
fi
checked=0
missing=0
invalid=0
while IFS= read -r file; do
[[ -z "$file" ]] && continue
[[ "${file:0:1}" == "#" ]] && continue
checked=$((checked + 1))
abs="$ROOT_DIR/$file"
if [[ ! -f "$abs" ]]; then
echo "MISSING $file"
missing=$((missing + 1))
continue
fi
if ! node --check "$abs"; then
echo "INVALID $file"
invalid=$((invalid + 1))
fi
done < "$TARGETS_FILE"
echo "checked=$checked missing=$missing invalid=$invalid"
if (( missing > 0 || invalid > 0 )); then
exit 1
fi

View File

@@ -0,0 +1,52 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
SMOKE_FILE="${1:-$ROOT_DIR/plans/stage6-manual-smoke.md}"
if [[ ! -f "$SMOKE_FILE" ]]; then
echo "missing smoke file: $SMOKE_FILE" >&2
exit 1
fi
extract_field() {
local field="$1"
local line
line="$(grep -E "^[[:space:]]*-[[:space:]]*$field:" "$SMOKE_FILE" | head -n 1 || true)"
if [[ -z "$line" ]]; then
echo ""
return
fi
printf '%s' "$line" | sed -E "s/^[[:space:]]*-[[:space:]]*$field:[[:space:]]*//" | sed -E 's/`//g;s/^[[:space:]]+//;s/[[:space:]]+$//'
}
date_value="$(extract_field "Date")"
tester_value="$(extract_field "Tester")"
env_value="$(extract_field "Environment")"
status_value="$(extract_field "Status")"
status_upper="$(printf '%s' "$status_value" | tr '[:lower:]' '[:upper:]')"
failed=0
if [[ -z "$date_value" ]]; then
echo "invalid smoke file: Date is empty"
failed=1
fi
if [[ -z "$tester_value" ]]; then
echo "invalid smoke file: Tester is empty"
failed=1
fi
if [[ -z "$env_value" ]]; then
echo "invalid smoke file: Environment is empty"
failed=1
fi
if [[ "$status_upper" != "PASS" ]]; then
echo "invalid smoke file: Status must be PASS (got: ${status_value:-<empty>})"
failed=1
fi
if (( failed != 0 )); then
exit 1
fi
echo "stage6_manual_smoke=PASS file=$SMOKE_FILE"

View File

@@ -4,4 +4,5 @@ set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
cd "$ROOT_DIR"
./tests/scripts/check-node-split-syntax.sh
node --test api/helpers/stream-tool-sieve.test.js api/chat-stream.test.js api/compat/js_compat_test.js "$@"