File size: 1,681 Bytes
f2e2b4c
 
 
 
 
 
 
 
 
 
 
 
 
 
049bd10
2dc9434
049bd10
2dc9434
 
049bd10
2dc9434
 
 
 
 
 
049bd10
f2e2b4c
 
 
 
 
 
 
 
 
049bd10
 
2dc9434
f2e2b4c
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
# Sealed smoke probe for the live HF Space.
# Verifies what we can verify without a browser: HTTP envelope, Streamlit
# health, response headers. Returns 0 on success, 1 on any failure.
#
# Usage: scripts/smoke_hf_space.sh [base_url]
#   default base_url: https://mekosotto-hackathon.hf.space

set -euo pipefail

BASE="${1:-https://mekosotto-hackathon.hf.space}"
FAIL=0

probe() {
  local label="$1" url="$2" expect="$3" method="${4:-GET}"
  local actual curl_exit=0
  if [[ "$method" == "POST" ]]; then
    actual="$(curl -sS --max-time 15 -o /dev/null -w "%{http_code}" \
      -X POST -H 'content-type: application/json' -d '{}' "$url")" || curl_exit=$?
  else
    actual="$(curl -sS --max-time 15 -o /dev/null -w "%{http_code}" "$url")" || curl_exit=$?
  fi
  if [[ "$curl_exit" -ne 0 ]]; then
    printf "  FAIL %-40s curl error %s\n" "$label" "$curl_exit"
    FAIL=1
    return
  fi
  if [[ "$actual" == "$expect" ]]; then
    printf "  OK   %-40s %s\n" "$label" "$actual"
  else
    printf "  FAIL %-40s expected=%s actual=%s\n" "$label" "$expect" "$actual"
    FAIL=1
  fi
}

echo "Probing $BASE"
probe "frontend root"             "$BASE/"                       "200" "GET"
probe "streamlit health"          "$BASE/_stcore/health"          "200" "GET"
probe "fastapi :8000 not publicly routed (POST)" "$BASE/predict/bbb"     "403" "POST"

echo
if [[ "$FAIL" == "0" ]]; then
  echo "Smoke OK — proceed to manual click-through checklist:"
  echo "  docs/superpowers/notes/2026-04-30-hf-smoke-checklist.md"
  exit 0
else
  echo "Smoke FAILED — see HF Space logs at:"
  echo "  https://huggingface.co/spaces/mekosotto/hackathon/discussions"
  exit 1
fi