tools/ui/build.sh and serve.sh still cd'd into the app/ directory the flattening removed, so make test-e2e / ui-dev / ui-smoke died at the first line. The staged Gitea workflow had the same stale cd in every job, plus a coverage gate with no coverage run before it — it now goes through the make targets (tooling discipline: the make layer owns env setup) with make test-coverage feeding make coverage-gate. Fixing the paths exposed the real break: flutter build web --wasm cannot compile the tree since the dart:ffi pivot (tree-sitter, native PTY) — dart:ffi does not exist on the wasm target. Fence vs park vs drop is filed as Q-50; the workflow's e2e job is withheld with a pointer there, and T-384 sits in review until Q-50 resolves. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
43 lines
1.6 KiB
Bash
Executable File
43 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Serve the WASM bundle on http://localhost:$PORT (default 4280) in the
|
|
# background. Robust against orphaned servers: before starting, any
|
|
# existing listener on the port (from a previous run whose pidfile got
|
|
# lost or overwritten) is killed. The pidfile is advisory — `stop.sh`
|
|
# uses port-based kill as the source of truth.
|
|
set -euo pipefail
|
|
|
|
PORT=${CLIDE_UI_PORT:-4280}
|
|
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
DIR="$HERE/../../build/web"
|
|
PID_FILE="$HERE/.serve.pid"
|
|
|
|
if [[ ! -d "$DIR" ]]; then
|
|
echo "serve: web build not found at $DIR — run tools/ui/build.sh first" >&2
|
|
exit 2
|
|
fi
|
|
|
|
# Port-based orphan kill. Handles the case where the recorded pidfile
|
|
# was overwritten by an earlier failed call and the previous server
|
|
# is still bound to the port.
|
|
existing=""
|
|
if command -v lsof >/dev/null 2>&1; then
|
|
existing=$(lsof -ti:"$PORT" 2>/dev/null || true)
|
|
elif command -v fuser >/dev/null 2>&1; then
|
|
existing=$(fuser -n tcp "$PORT" 2>/dev/null | tr -d ' /tcp' || true)
|
|
fi
|
|
if [[ -n "$existing" ]]; then
|
|
echo "serve: reclaiming port $PORT from stale listener(s) $existing"
|
|
echo "$existing" | xargs -r kill 2>/dev/null || true
|
|
sleep 0.2
|
|
fi
|
|
|
|
# Flutter web WASM requires Cross-Origin Opener/Embedder headers on the
|
|
# server for `SharedArrayBuffer`. A vanilla python http.server misses
|
|
# them, so CanvasKit still works but WasmGC-accelerated Skwasm may not.
|
|
# For Tier 0 driver-script automation this is fine; revisit when we
|
|
# need Skwasm performance parity.
|
|
cd "$DIR"
|
|
nohup python3 -m http.server "$PORT" >/tmp/clide-ui-serve.log 2>&1 &
|
|
echo $! > "$PID_FILE"
|
|
echo "serve: http://localhost:$PORT (pid $(cat "$PID_FILE"), log /tmp/clide-ui-serve.log)"
|