golangLAKEHOUSE/scripts/d1_smoke.sh
Claw 1142f54f23 G0 D1 ships: skeleton + chi + /health × 5 binaries · acceptance gate PASSED
Phase G0 Day 1 executed end-to-end after a third-pass review by
qwen3-coder:480b consolidated all findings across Opus/Kimi/Qwen
lineages.

Cross-lineage review consolidation (3 model passes + 1 runtime pass):
- Opus 4.7: 9 findings · 7 fixed inline · 2 deferred
- Kimi K2.6: 2 BLOCKs (introduced by Opus fixes) · 2 fixed
- Qwen3-coder:480b: 2 WARNs · 1 fixed (D2.4 256 MiB cap + 4-slot
  semaphore on PUTs) · 1 deferred (Q2 view refresh batching)
- Runtime smoke: 1 finding (port 3100 collision with live Rust
  lakehouse) · fixed (Go dev ports shifted to 3110+)
- Total: 14 findings · 11 fixed · 3 deferred to G2

What landed in code:
- internal/shared/server.go — chi factory, slog JSON, /health,
  graceful shutdown via signal.NotifyContext
- internal/shared/config.go — TOML loader, DefaultConfig, -config flag
- cmd/{gateway,storaged,catalogd,ingestd,queryd}/main.go — five
  binaries, each ~30 lines using the shared factory
- lakehouse.toml — G0 dev defaults (3110-3214)
- scripts/d1_smoke.sh — repeatable smoke that exits 0 on PASS
- go.mod / go.sum — chi v5.2.5, pelletier/go-toml/v2 v2.3.0

Verified end-to-end via scripts/d1_smoke.sh:
- All 5 /health endpoints return 200 with correct service name
- Gateway /v1/ingest + /v1/sql stubs return 501 with X-Lakehouse-Stub
- Graceful shutdown logs cleanly on SIGTERM
- DuckDB cgo path verified separately (sql.Open("duckdb","") + ping)

D1 ACCEPTANCE GATE: PASSED.

Next: D2 — storaged S3 GET/PUT/LIST against MinIO.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 07:00:37 -05:00

57 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# D1 smoke — proves the Day 1 acceptance gate end-to-end.
# Builds all 5 binaries, launches them, hits /health on each, hits
# the gateway stubs, then shuts everything down. Exit 0 on success.
#
# Usage: ./scripts/d1_smoke.sh
# Cleanup: traps SIGINT and kills the background processes.
set -euo pipefail
cd "$(dirname "$0")/.."
export PATH="$PATH:/usr/local/go/bin"
echo "[d1-smoke] building..."
go build -o bin/ ./cmd/...
PIDS=()
trap 'echo "[d1-smoke] cleanup"; kill ${PIDS[@]} 2>/dev/null || true; wait 2>/dev/null || true' EXIT INT TERM
echo "[d1-smoke] launching..."
for SVC in gateway storaged catalogd ingestd queryd; do
./bin/$SVC > /tmp/${SVC}.log 2>&1 &
PIDS+=($!)
done
sleep 0.5
echo "[d1-smoke] /health probes:"
FAILED=0
for SPEC in "gateway:3110" "storaged:3211" "catalogd:3212" "ingestd:3213" "queryd:3214"; do
NAME="${SPEC%:*}"; PORT="${SPEC#*:}"
RESP="$(curl -sS --max-time 2 "http://127.0.0.1:$PORT/health" || echo FAIL)"
if echo "$RESP" | grep -q "\"service\":\"$NAME\""; then
echo "$NAME (:$PORT) → $RESP"
else
echo "$NAME (:$PORT) → $RESP"
FAILED=1
fi
done
echo "[d1-smoke] gateway 501 stub probes:"
for ROUTE in /v1/ingest /v1/sql; do
CODE="$(curl -sS -o /dev/null -w '%{http_code}' --max-time 2 -X POST "http://127.0.0.1:3110$ROUTE")"
HDR="$(curl -sS -i --max-time 2 -X POST "http://127.0.0.1:3110$ROUTE" | grep -i 'X-Lakehouse-Stub')"
if [ "$CODE" = "501" ] && [ -n "$HDR" ]; then
echo " ✓ POST $ROUTE → 501 + $HDR"
else
echo " ✗ POST $ROUTE → code=$CODE hdr=$HDR"
FAILED=1
fi
done
if [ "$FAILED" -ne 0 ]; then
echo "[d1-smoke] FAILED"
exit 1
fi
echo "[d1-smoke] D1 acceptance gate: PASSED"