📦 deps(thirdparty): update snapshots
This commit is contained in:
Executable
+52
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env bash
|
||||
# Smoke test every registered non-stack search domain.
|
||||
set -euo pipefail
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
SCRIPTS_DIR="$REPO_ROOT/src/ui-ux-pro-max/scripts"
|
||||
SEARCH="$SCRIPTS_DIR/search.py"
|
||||
QUERY="${1:-dashboard performance button typography chart icon animation}"
|
||||
EXPECTED_COUNT="${EXPECTED_DOMAIN_COUNT:-12}"
|
||||
|
||||
if [ ! -f "$SEARCH" ]; then
|
||||
echo "FAIL: search.py not found at $SEARCH" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
DOMAINS=()
|
||||
while IFS= read -r line; do
|
||||
line="${line%$'\r'}"
|
||||
[ -n "$line" ] && DOMAINS+=("$line")
|
||||
done < <(PYTHONPATH="$SCRIPTS_DIR" python3 -c "
|
||||
from core import CSV_CONFIG
|
||||
for domain in CSV_CONFIG:
|
||||
print(domain)
|
||||
")
|
||||
|
||||
if [ "${#DOMAINS[@]}" -ne "$EXPECTED_COUNT" ]; then
|
||||
echo "FAIL: CSV_CONFIG has ${#DOMAINS[@]} domains, expected $EXPECTED_COUNT" >&2
|
||||
echo " Set EXPECTED_DOMAIN_COUNT after an intentional registry change." >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
echo "Smoke-testing ${#DOMAINS[@]} domains with query '$QUERY':"
|
||||
fail=0
|
||||
for domain in "${DOMAINS[@]}"; do
|
||||
payload=$(python3 "$SEARCH" "$QUERY" --domain "$domain" -n 1 --json 2>/dev/null || true)
|
||||
count=$(printf '%s' "$payload" | python3 -c "import json,sys; data=json.load(sys.stdin); print(data.get('count',0) if not data.get('error') else 0)" 2>/dev/null || echo 0)
|
||||
if [ "${count:-0}" -gt 0 ]; then
|
||||
printf ' PASS %-14s %d\n' "$domain" "$count"
|
||||
else
|
||||
printf ' FAIL %-14s 0\n' "$domain"
|
||||
fail=$((fail + 1))
|
||||
fi
|
||||
done
|
||||
|
||||
total=${#DOMAINS[@]}
|
||||
echo
|
||||
if [ "$fail" -gt 0 ]; then
|
||||
echo "FAIL: $fail/$total domains returned 0 results for '$QUERY'" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "OK: $total/$total domains returned ≥1 result"
|
||||
Executable
+91
@@ -0,0 +1,91 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Validate UI/UX Pro Max CSV data files.
|
||||
|
||||
Checks every CSV under src/ui-ux-pro-max/data for structural issues that
|
||||
csv.DictReader otherwise accepts silently:
|
||||
- duplicate or blank header names
|
||||
- rows with too many fields (unquoted commas)
|
||||
- rows with too few fields (missing trailing columns)
|
||||
- unexpected empty rows inside the dataset
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import csv
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
DATA_DIR = REPO_ROOT / "src" / "ui-ux-pro-max" / "data"
|
||||
|
||||
# These files are retained as design/reference notes, not runtime datasets.
|
||||
# They intentionally use free-form CSV-ish content and are not loaded by core.py.
|
||||
REFERENCE_ONLY = {
|
||||
DATA_DIR / "design.csv",
|
||||
DATA_DIR / "draft.csv",
|
||||
}
|
||||
|
||||
|
||||
def validate_file(path: Path) -> list[str]:
|
||||
errors: list[str] = []
|
||||
rel = path.relative_to(REPO_ROOT)
|
||||
|
||||
with path.open("r", encoding="utf-8", newline="") as fh:
|
||||
reader = csv.reader(fh)
|
||||
try:
|
||||
header = next(reader)
|
||||
except StopIteration:
|
||||
errors.append(f"{rel}: empty file")
|
||||
return errors
|
||||
|
||||
if not header or all(not col.strip() for col in header):
|
||||
errors.append(f"{rel}: missing header")
|
||||
return errors
|
||||
|
||||
blank_headers = [idx + 1 for idx, col in enumerate(header) if not col.strip()]
|
||||
if blank_headers:
|
||||
errors.append(f"{rel}: blank header columns {blank_headers}")
|
||||
|
||||
duplicates = sorted({col for col in header if col and header.count(col) > 1})
|
||||
if duplicates:
|
||||
errors.append(f"{rel}: duplicate headers {duplicates}")
|
||||
|
||||
expected = len(header)
|
||||
for line_no, row in enumerate(reader, start=2):
|
||||
if not row or all(not cell.strip() for cell in row):
|
||||
errors.append(f"{rel}:{line_no}: blank row")
|
||||
continue
|
||||
actual = len(row)
|
||||
if actual != expected:
|
||||
errors.append(
|
||||
f"{rel}:{line_no}: expected {expected} fields, got {actual}"
|
||||
)
|
||||
|
||||
return errors
|
||||
|
||||
|
||||
def main() -> int:
|
||||
if not DATA_DIR.exists():
|
||||
print(f"CSV data directory not found: {DATA_DIR}", file=sys.stderr)
|
||||
return 2
|
||||
|
||||
errors: list[str] = []
|
||||
checked = 0
|
||||
for path in sorted(DATA_DIR.rglob("*.csv")):
|
||||
if path in REFERENCE_ONLY:
|
||||
continue
|
||||
checked += 1
|
||||
errors.extend(validate_file(path))
|
||||
|
||||
if errors:
|
||||
print("CSV validation failed:", file=sys.stderr)
|
||||
for error in errors:
|
||||
print(f" - {error}", file=sys.stderr)
|
||||
print(f"\nChecked {checked} runtime CSV files.", file=sys.stderr)
|
||||
return 1
|
||||
|
||||
print(f"CSV validation passed: {checked} runtime CSV files checked.")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user