#!/usr/bin/env bash # Regression harness for the boosted-nav link-rebinding bug (composition step polish). # Spins up an EPHEMERAL host server (this worktree's binary + lib + web + WASM), which on # boot seeds /compose-demo and the home footer's /tags link, runs boost-nav.spec.js in the # main worktree's Playwright, then tears down. No live-site dependency. # # bash lib/host/playwright/run-boost-nav-check.sh # # Requires: the OCaml binary built + Playwright + chromium in /root/rose-ash. set -uo pipefail cd "$(git rev-parse --show-toplevel)" ROOT=$(pwd) PORT="${BOOST_PORT:-8914}" PW_DIR="${PW_DIR:-/root/rose-ash}" USER="admin"; PASS="boost-check-pw"; SECRET="boost-check-secret" PDIR=$(mktemp -d) SPEC_SRC="lib/host/playwright/boost-nav.spec.js" SPEC_DST="$PW_DIR/tests/playwright/_boost-nav-check.spec.js" SERVE_LOG=$(mktemp) cleanup() { [ -n "${SVPID:-}" ] && kill "$SVPID" 2>/dev/null local pid pid=$(ss -lptn "sport = :$PORT" 2>/dev/null | grep -oE 'pid=[0-9]+' | head -1 | cut -d= -f2) [ -n "$pid" ] && kill "$pid" 2>/dev/null rm -f "$SPEC_DST" "$SERVE_LOG"; rm -rf "$PDIR" } trap cleanup EXIT echo "== starting ephemeral host server on :$PORT (persist=$PDIR) ==" SX_SERVING_JIT=1 HOST_PORT="$PORT" SX_PERSIST_DIR="$PDIR" \ SX_ADMIN_USER="$USER" SX_ADMIN_PASSWORD="$PASS" SX_SESSION_SECRET="$SECRET" \ bash lib/host/serve.sh >"$SERVE_LOG" 2>&1 & SVPID=$! for i in $(seq 1 60); do curl -sf -o /dev/null "http://127.0.0.1:$PORT/health" 2>/dev/null && break sleep 1 [ "$i" = "60" ] && { echo "server never came up:"; cat "$SERVE_LOG"; exit 1; } done echo "== server up ==" echo "== running Playwright ==" cp "$ROOT/$SPEC_SRC" "$SPEC_DST" cd "$PW_DIR" SX_TEST_URL="http://127.0.0.1:$PORT" SX_ADMIN_USER="$USER" SX_ADMIN_PASSWORD="$PASS" \ node_modules/.bin/playwright test _boost-nav-check.spec.js --workers=1 \ --config tests/playwright/playwright.config.js RC=$? echo "== done (exit $RC) ==" exit $RC