Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Fix managed hot-dev LAN browser binding

rcourtman391cea1b136a
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.md
index eabb9e3575..1841864e9f 100644
--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md
+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md
@@ -182,6 +182,11 @@ server-side update execution surfaces.
the deterministic dev user/hash. `tests/integration/scripts/run-playwright.mjs`
owns the run-scoped `HOT_DEV_VERIFY_LOCK_FILE` handoff so overlapping browser
proof cannot reuse stale first-run credentials.
+ The managed and foreground hot-dev entrypoints must share one network-default
+ contract: Vite binds `FRONTEND_DEV_HOST=0.0.0.0` by default so LAN devices can
+ open the dev browser shell, while local browser/proof URLs normalize wildcard
+ binds back to `127.0.0.1` and advertise the detected LAN browser entrypoint
+ separately.
6. Add or change governed release-promotion workflow inputs, operator-facing promotion metadata, the canonical version file, prerelease feedback intake prompts, artifact publication lineage enforcement, release note or changelog packet composition, or stable-promotion rehearsal summaries through `.github/workflows/create-release.yml`, `.github/workflows/helm-pages.yml`, `.github/workflows/publish-docker.yml`, `.github/workflows/publish-helm-chart.yml`, `.github/workflows/promote-floating-tags.yml`, `.github/workflows/release-dry-run.yml`, `.github/workflows/update-demo-server.yml`, `.github/ISSUE_TEMPLATE/v6_rc_feedback.yml`, `docs/RELEASE_NOTES.md`, `docs/releases/`, `docs/release-control/v6/internal/RELEASE_PROMOTION_POLICY.md`, `docs/release-control/v6/internal/PRE_RELEASE_CHECKLIST.md`, `docs/release-control/v6/internal/RC_TO_GA_REHEARSAL_TEMPLATE.md`, `scripts/check-workflow-dispatch-inputs.py`, `scripts/release_control/render_release_body.py`, `scripts/release_control/record_rc_to_ga_rehearsal.py`, `scripts/release_control/internal/record_rc_to_ga_rehearsal.py`, `scripts/release_control/release_promotion_policy_support.py`, `scripts/trigger-release.sh`, and `scripts/trigger-release-dry-run.sh`
That release-promotion boundary also owns prerelease note packet lineage:
shipped RC notes must remain historically accurate, the top-level
diff --git a/scripts/hot-dev-bg.sh b/scripts/hot-dev-bg.sh
index 28ea572142..67903597d8 100755
--- a/scripts/hot-dev-bg.sh
+++ b/scripts/hot-dev-bg.sh
@@ -16,16 +16,15 @@ set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
+# shellcheck disable=SC1091
+source "${SCRIPT_DIR}/lib/hot-dev-runtime.sh"
+
PID_FILE="${HOT_DEV_BG_PID_FILE:-${ROOT_DIR}/tmp/hot-dev.bg.pid}"
LOG_FILE="${HOT_DEV_BG_LOG_FILE:-${ROOT_DIR}/tmp/hot-dev.bg.log}"
HOT_DEV_VERIFY_LOCK="${HOT_DEV_VERIFY_LOCK_FILE:-${ROOT_DIR}/tmp/hot-dev.verify.lock}"
-FRONTEND_DEV_HOST="${FRONTEND_DEV_HOST:-127.0.0.1}"
-FRONTEND_DEV_PORT="${FRONTEND_DEV_PORT:-5173}"
-PULSE_DEV_API_HOST="${PULSE_DEV_API_HOST:-127.0.0.1}"
-PULSE_DEV_API_PORT="${PULSE_DEV_API_PORT:-7655}"
-PULSE_DEV_API_URL="${PULSE_DEV_API_URL:-http://${PULSE_DEV_API_HOST}:${PULSE_DEV_API_PORT}}"
-PULSE_DEV_WS_URL="${PULSE_DEV_WS_URL:-ws://${PULSE_DEV_API_HOST}:${PULSE_DEV_API_PORT}}"
+hot_dev_configure_network_defaults
+
MACOS_HOT_DEV_LABEL="com.pulse.hot-dev"
log() {
@@ -541,6 +540,7 @@ PY
start_bg() {
local takeover="${1:-false}"
+ local browser_url lan_browser_url
require_python
mkdir -p "$(dirname "${PID_FILE}")"
touch "${LOG_FILE}"
@@ -598,7 +598,12 @@ start_bg() {
log "Check logs with: npm run dev:logs"
fi
- log "Browser entrypoint: http://127.0.0.1:${FRONTEND_DEV_PORT}"
+ browser_url="$(hot_dev_local_browser_url "${FRONTEND_DEV_HOST}" "${FRONTEND_DEV_PORT}")"
+ lan_browser_url="$(hot_dev_lan_browser_url "${FRONTEND_DEV_HOST}" "${FRONTEND_DEV_PORT}" "${LAN_IP}")"
+ log "Browser entrypoint: ${browser_url}"
+ if [[ -n "${lan_browser_url}" ]]; then
+ log "LAN browser entrypoint: ${lan_browser_url}"
+ fi
log "Managed backend: http://127.0.0.1:${PULSE_DEV_API_PORT}"
log "Logs: ${LOG_FILE}"
}
@@ -654,8 +659,9 @@ status_bg() {
log "Backend port ${PULSE_DEV_API_PORT} is not listening"
fi
- local browser_url frontend_url proxy_health_url backend_health_url
- browser_url="http://127.0.0.1:${FRONTEND_DEV_PORT}"
+ local browser_url lan_browser_url frontend_url proxy_health_url backend_health_url
+ browser_url="$(hot_dev_local_browser_url "${FRONTEND_DEV_HOST}" "${FRONTEND_DEV_PORT}")"
+ lan_browser_url="$(hot_dev_lan_browser_url "${FRONTEND_DEV_HOST}" "${FRONTEND_DEV_PORT}" "${LAN_IP}")"
frontend_url="${browser_url}/"
proxy_health_url="${browser_url}/api/health"
backend_health_url="http://127.0.0.1:${PULSE_DEV_API_PORT}/api/health"
@@ -665,6 +671,9 @@ status_bg() {
proxy_code="$(http_status_code "${proxy_health_url}")"
backend_code="$(http_status_code "${backend_health_url}")"
log "Browser entrypoint: ${browser_url}"
+ if [[ -n "${lan_browser_url}" ]]; then
+ log "LAN browser entrypoint: ${lan_browser_url}"
+ fi
log "Frontend shell HTTP: ${frontend_code}"
log "Frontend proxy /api/health: ${proxy_code}"
log "Backend /api/health: ${backend_code}"
diff --git a/scripts/hot-dev.sh b/scripts/hot-dev.sh
index 0059f325b2..9a35b11b97 100755
--- a/scripts/hot-dev.sh
+++ b/scripts/hot-dev.sh
@@ -153,13 +153,21 @@ sync_runtime_auth_env_overrides() {
}
show_startup_banner() {
+ local local_frontend_url lan_frontend_url
+ local_frontend_url="$(hot_dev_local_browser_url "${FRONTEND_DEV_HOST}" "${FRONTEND_DEV_PORT}")"
+ lan_frontend_url="$(hot_dev_lan_browser_url "${FRONTEND_DEV_HOST}" "${FRONTEND_DEV_PORT}" "${LAN_IP}")"
+
cat <<BANNER
=========================================
Starting HOT-RELOAD development mode
=========================================
-Frontend: http://${FRONTEND_DEV_HOST}:${FRONTEND_DEV_PORT} (Local)
- http://${LAN_IP}:${FRONTEND_DEV_PORT} (LAN)
+Frontend: ${local_frontend_url} (Local)
+BANNER
+ if [[ -n "${lan_frontend_url}" ]]; then
+ printf ' %s (LAN)\n' "${lan_frontend_url}"
+ fi
+ cat <<BANNER
Backend API: ${PULSE_DEV_API_URL}
Dev Credentials: $(hot_dev_auth_banner_line "${PULSE_AUTH_USER:-}" "${PULSE_AUTH_PASS:-}")
@@ -179,69 +187,7 @@ load_env_file "${ROOT_DIR}/.env"
load_env_file "${ROOT_DIR}/.env.local"
load_env_file "${ROOT_DIR}/.env.dev"
-FRONTEND_PORT=${FRONTEND_PORT:-${PORT:-5173}}
-PORT=${PORT:-${FRONTEND_PORT}}
-
-# Detect LAN IP
-if [[ -z ${LAN_IP:-} ]]; then
- if command -v hostname >/dev/null 2>&1 && hostname -I >/dev/null 2>&1; then
- LAN_IP=$(hostname -I | awk '{print $1}')
- fi
- if [[ -z ${LAN_IP:-} ]]; then
- LAN_IP=$(ipconfig getifaddr en0 2>/dev/null || echo "")
- fi
- if [[ -z ${LAN_IP:-} ]]; then
- LAN_IP="0.0.0.0"
- fi
-fi
-
-FRONTEND_DEV_HOST=${FRONTEND_DEV_HOST:-0.0.0.0}
-FRONTEND_DEV_PORT=${FRONTEND_DEV_PORT:-${FRONTEND_PORT}}
-PULSE_DEV_API_HOST=${PULSE_DEV_API_HOST:-${LAN_IP}}
-PULSE_DEV_API_PORT=${PULSE_DEV_API_PORT:-7655}
-
-if [[ -z ${PULSE_DEV_API_URL:-} ]]; then
- PULSE_DEV_API_URL="http://${PULSE_DEV_API_HOST}:${PULSE_DEV_API_PORT}"
-fi
-
-if [[ -z ${PULSE_DEV_WS_URL:-} ]]; then
- if [[ ${PULSE_DEV_API_URL} == http://* ]]; then
- PULSE_DEV_WS_URL="ws://${PULSE_DEV_API_URL#http://}"
- elif [[ ${PULSE_DEV_API_URL} == https://* ]]; then
- PULSE_DEV_WS_URL="wss://${PULSE_DEV_API_URL#https://}"
- else
- PULSE_DEV_WS_URL=${PULSE_DEV_API_URL}
- fi
-fi
-
-# Set specific allowed origin for CORS with credentials
-# Use the frontend dev URL so cross-port SSE requests work with auth cookies
-# Added localhost and 127.0.0.1 by default for flexibility (both 7655 and 5173)
-ALLOWED_ORIGINS="http://${PULSE_DEV_API_HOST:-127.0.0.1}:${FRONTEND_DEV_PORT:-7655}"
-ALLOWED_ORIGINS="${ALLOWED_ORIGINS},http://localhost:${FRONTEND_DEV_PORT:-7655},http://127.0.0.1:${FRONTEND_DEV_PORT:-7655}"
-ALLOWED_ORIGINS="${ALLOWED_ORIGINS},http://localhost:5173,http://127.0.0.1:5173"
-
-# Detect and add all system IPs (V4)
-if [[ "$(uname -s)" == "Darwin" ]]; then
- # macOS: get IPs from ifconfig
- ALL_IPS=$(ifconfig 2>/dev/null | grep "inet " | awk '{print $2}' | grep -v "^127\.")
-else
- # Linux: use hostname -I
- ALL_IPS=$(hostname -I 2>/dev/null || echo "")
-fi
-for ip in $ALL_IPS; do
- if [[ "${ip}" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
- if [[ "${ip}" != "127.0.0.1" ]]; then
- ALLOWED_ORIGINS="${ALLOWED_ORIGINS},http://${ip}:${FRONTEND_DEV_PORT:-7655}"
- ALLOWED_ORIGINS="${ALLOWED_ORIGINS},http://${ip}:5173"
- fi
- fi
-done
-
-export FRONTEND_PORT PORT
-export FRONTEND_DEV_HOST FRONTEND_DEV_PORT
-export PULSE_DEV_API_HOST PULSE_DEV_API_PORT PULSE_DEV_API_URL PULSE_DEV_WS_URL
-export ALLOWED_ORIGINS
+hot_dev_configure_network_defaults
EXTRA_CLEANUP_PORT=$((PULSE_DEV_API_PORT + 1))
HOT_DEV_RESTART_SENTINEL="${ROOT_DIR}/tmp/hot-dev.restart"
diff --git a/scripts/lib/hot-dev-runtime.sh b/scripts/lib/hot-dev-runtime.sh
index b76c878f85..a1a75e2c31 100644
--- a/scripts/lib/hot-dev-runtime.sh
+++ b/scripts/lib/hot-dev-runtime.sh
@@ -20,6 +20,80 @@ hot_dev_pulse_process_count() {
printf '%s\n' "${count}"
}
+hot_dev_detect_lan_ip() {
+ local detected=""
+
+ if command -v hostname >/dev/null 2>&1 && hostname -I >/dev/null 2>&1; then
+ detected="$(hostname -I 2>/dev/null | awk '{print $1}')"
+ fi
+
+ if [[ -z "${detected}" ]] && command -v ipconfig >/dev/null 2>&1; then
+ detected="$(ipconfig getifaddr en0 2>/dev/null || true)"
+ fi
+
+ printf '%s\n' "${detected}"
+}
+
+hot_dev_detect_all_ipv4s() {
+ if [[ "$(uname -s)" == "Darwin" ]]; then
+ ifconfig 2>/dev/null | awk '/inet / {print $2}' | grep -v "^127\." || true
+ return 0
+ fi
+
+ hostname -I 2>/dev/null || true
+}
+
+hot_dev_configure_network_defaults() {
+ FRONTEND_PORT="${FRONTEND_PORT:-${PORT:-5173}}"
+ PORT="${PORT:-${FRONTEND_PORT}}"
+
+ if [[ -z "${LAN_IP:-}" ]]; then
+ LAN_IP="$(hot_dev_detect_lan_ip)"
+ fi
+ LAN_IP="${LAN_IP:-0.0.0.0}"
+
+ FRONTEND_DEV_HOST="${FRONTEND_DEV_HOST:-0.0.0.0}"
+ FRONTEND_DEV_PORT="${FRONTEND_DEV_PORT:-${FRONTEND_PORT}}"
+ PULSE_DEV_API_HOST="${PULSE_DEV_API_HOST:-${LAN_IP}}"
+ PULSE_DEV_API_PORT="${PULSE_DEV_API_PORT:-7655}"
+
+ if [[ -z "${PULSE_DEV_API_URL:-}" ]]; then
+ PULSE_DEV_API_URL="http://${PULSE_DEV_API_HOST}:${PULSE_DEV_API_PORT}"
+ fi
+
+ if [[ -z "${PULSE_DEV_WS_URL:-}" ]]; then
+ if [[ "${PULSE_DEV_API_URL}" == http://* ]]; then
+ PULSE_DEV_WS_URL="ws://${PULSE_DEV_API_URL#http://}"
+ elif [[ "${PULSE_DEV_API_URL}" == https://* ]]; then
+ PULSE_DEV_WS_URL="wss://${PULSE_DEV_API_URL#https://}"
+ else
+ PULSE_DEV_WS_URL="${PULSE_DEV_API_URL}"
+ fi
+ fi
+
+ ALL_IPS="${ALL_IPS:-$(hot_dev_detect_all_ipv4s)}"
+
+ ALLOWED_ORIGINS="http://${PULSE_DEV_API_HOST:-127.0.0.1}:${FRONTEND_DEV_PORT:-7655}"
+ ALLOWED_ORIGINS="${ALLOWED_ORIGINS},http://localhost:${FRONTEND_DEV_PORT:-7655},http://127.0.0.1:${FRONTEND_DEV_PORT:-7655}"
+ ALLOWED_ORIGINS="${ALLOWED_ORIGINS},http://localhost:5173,http://127.0.0.1:5173"
+
+ local ip
+ for ip in ${ALL_IPS:-}; do
+ if [[ "${ip}" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
+ if [[ "${ip}" != "127.0.0.1" ]]; then
+ ALLOWED_ORIGINS="${ALLOWED_ORIGINS},http://${ip}:${FRONTEND_DEV_PORT:-7655}"
+ ALLOWED_ORIGINS="${ALLOWED_ORIGINS},http://${ip}:5173"
+ fi
+ fi
+ done
+
+ export FRONTEND_PORT PORT
+ export LAN_IP ALL_IPS
+ export FRONTEND_DEV_HOST FRONTEND_DEV_PORT
+ export PULSE_DEV_API_HOST PULSE_DEV_API_PORT PULSE_DEV_API_URL PULSE_DEV_WS_URL
+ export ALLOWED_ORIGINS
+}
+
hot_dev_normalize_host() {
local host="${1:-}"
@@ -71,6 +145,43 @@ hot_dev_bind_address_is_loopback() {
hot_dev_host_is_loopback "${1:-}"
}
+hot_dev_browser_host_for_bind() {
+ local host="${1:-}"
+ local normalized
+
+ normalized="$(hot_dev_normalize_host "${host}")"
+ case "${normalized}" in
+ ""|0.0.0.0|::)
+ printf '127.0.0.1\n'
+ return 0
+ ;;
+ esac
+
+ printf '%s\n' "${host}"
+}
+
+hot_dev_local_browser_url() {
+ local host="${1:-${FRONTEND_DEV_HOST:-127.0.0.1}}"
+ local port="${2:-${FRONTEND_DEV_PORT:-5173}}"
+
+ printf 'http://%s:%s\n' "$(hot_dev_browser_host_for_bind "${host}")" "${port}"
+}
+
+hot_dev_lan_browser_url() {
+ local bind_host="${1:-${FRONTEND_DEV_HOST:-127.0.0.1}}"
+ local port="${2:-${FRONTEND_DEV_PORT:-5173}}"
+ local lan_ip="${3:-${LAN_IP:-}}"
+
+ if hot_dev_bind_address_is_loopback "${bind_host}"; then
+ return 0
+ fi
+ if [[ -z "${lan_ip}" || "${lan_ip}" == "0.0.0.0" ]]; then
+ return 0
+ fi
+
+ printf 'http://%s:%s\n' "${lan_ip}" "${port}"
+}
+
hot_dev_host_matches_local_interface() {
local host="${1:-}"
local candidate
diff --git a/scripts/tests/test-hot-dev-bg.sh b/scripts/tests/test-hot-dev-bg.sh
index 1eabd04e4e..84c070b033 100755
--- a/scripts/tests/test-hot-dev-bg.sh
+++ b/scripts/tests/test-hot-dev-bg.sh
@@ -210,6 +210,27 @@ EOF
assert_contains "default verify proof keeps chromium project pin" "${output}" "--project=chromium"
}
+test_managed_wrapper_defaults_to_lan_capable_frontend() {
+ local output
+ output="$(
+ LAN_IP=192.168.50.10 \
+ ALL_IPS="192.168.50.10" \
+ HOT_DEV_BG_PATH="${HOT_DEV_BG}" \
+ bash -lc '
+ source "${HOT_DEV_BG_PATH}"
+ printf "frontend_host=%s\n" "${FRONTEND_DEV_HOST}"
+ printf "api_host=%s\n" "${PULSE_DEV_API_HOST}"
+ printf "browser=%s\n" "$(hot_dev_local_browser_url "${FRONTEND_DEV_HOST}" "${FRONTEND_DEV_PORT}")"
+ printf "lan_browser=%s\n" "$(hot_dev_lan_browser_url "${FRONTEND_DEV_HOST}" "${FRONTEND_DEV_PORT}" "${LAN_IP}")"
+ '
+ )"
+
+ assert_contains "managed wrapper exposes Vite on all interfaces by default" "${output}" "frontend_host=0.0.0.0"
+ assert_contains "managed wrapper uses the shared LAN API default" "${output}" "api_host=192.168.50.10"
+ assert_contains "managed wrapper keeps local browser entrypoint on loopback" "${output}" "browser=http://127.0.0.1:5173"
+ assert_contains "managed wrapper advertises a LAN browser entrypoint" "${output}" "lan_browser=http://192.168.50.10:5173"
+}
+
test_verify_bg_holds_runtime_lock_for_proof_duration() {
local output
output="$(
@@ -358,6 +379,8 @@ test_start_bg_reports_browser_entrypoint() {
source "${HOT_DEV_BG_PATH}"
PID_FILE="'"${test_dir}"'/hot-dev-bg.pid"
LOG_FILE="'"${test_dir}"'/hot-dev-bg.log"
+ LAN_IP=192.168.50.10
+ FRONTEND_DEV_HOST=0.0.0.0
FRONTEND_DEV_PORT=5173
PULSE_DEV_API_PORT=7655
has_unmanaged_listeners(){ return 1; }
@@ -370,6 +393,7 @@ test_start_bg_reports_browser_entrypoint() {
assert_contains "start reports managed runtime supervisor pid" "${output}" "Started managed runtime supervisor (pid: 4242)"
assert_contains "start reports browser entrypoint" "${output}" "Browser entrypoint: http://127.0.0.1:5173"
+ assert_contains "start reports LAN browser entrypoint" "${output}" "LAN browser entrypoint: http://192.168.50.10:5173"
assert_contains "start reports managed backend" "${output}" "Managed backend: http://127.0.0.1:7655"
assert_not_contains "start no longer reports generic frontend url" "${output}" "Frontend: http://127.0.0.1:5173"
}
@@ -760,6 +784,8 @@ test_hot_dev_bg_script_advertises_managed_entrypoint() {
assert_contains "hot-dev-bg usage points to managed runtime first" "${output}" "npm run dev # Canonical managed dev runtime"
assert_contains "hot-dev-bg documents direct launcher as troubleshooting only" "${output}" "./scripts/hot-dev-bg.sh <command> # Direct troubleshooting only"
+ assert_contains "hot-dev-bg sources shared runtime helpers" "${output}" 'source "${SCRIPT_DIR}/lib/hot-dev-runtime.sh"'
+ assert_contains "hot-dev-bg uses shared network defaults" "${output}" "hot_dev_configure_network_defaults"
assert_contains "hot-dev-bg routes log guidance to managed wrapper" "${output}" "Check logs with: npm run dev:logs"
assert_contains "hot-dev-bg routes verify guidance to managed wrapper" "${output}" "Rerun with: npm run dev:verify"
assert_contains "hot-dev-bg routes launchd supervision guidance to managed wrapper" "${output}" "Rerun with: npm run dev"
@@ -1247,6 +1273,7 @@ main() {
test_cli_parses_takeover_flag
test_verify_command_injects_managed_runtime_env
test_default_verify_command_runs_runtime_and_layout_proofs
+ test_managed_wrapper_defaults_to_lan_capable_frontend
test_verify_bg_holds_runtime_lock_for_proof_duration
test_managed_dev_runtime_restarts_existing_session_for_verification
test_takeover_avoids_killing_current_shell_lineage
diff --git a/scripts/tests/test-hot-dev-runtime.sh b/scripts/tests/test-hot-dev-runtime.sh
index f01ca66ee0..12fa0d36c6 100755
--- a/scripts/tests/test-hot-dev-runtime.sh
+++ b/scripts/tests/test-hot-dev-runtime.sh
@@ -136,12 +136,64 @@ test_hot_dev_avoids_self_killing_npm_wrapper() {
assert_not_contains "hot-dev no longer broad-kills npm dev wrappers" "${output}" 'pkill -f "npm run dev"'
}
+test_hot_dev_network_defaults_are_lan_capable() {
+ local output
+ output="$(
+ HOT_DEV_RUNTIME_LIB="${HOT_DEV_RUNTIME_LIB}" \
+ bash -c '
+ set -euo pipefail
+ source "${HOT_DEV_RUNTIME_LIB}"
+ unset FRONTEND_PORT PORT FRONTEND_DEV_HOST FRONTEND_DEV_PORT
+ unset PULSE_DEV_API_HOST PULSE_DEV_API_PORT PULSE_DEV_API_URL PULSE_DEV_WS_URL
+ unset ALLOWED_ORIGINS
+ LAN_IP=192.168.50.10
+ ALL_IPS="192.168.50.10 10.10.10.5"
+ hot_dev_configure_network_defaults
+ printf "frontend_host=%s\n" "${FRONTEND_DEV_HOST}"
+ printf "frontend_port=%s\n" "${FRONTEND_DEV_PORT}"
+ printf "api_host=%s\n" "${PULSE_DEV_API_HOST}"
+ printf "api_url=%s\n" "${PULSE_DEV_API_URL}"
+ printf "ws_url=%s\n" "${PULSE_DEV_WS_URL}"
+ printf "origins=%s\n" "${ALLOWED_ORIGINS}"
+ '
+ )"
+
+ assert_contains "network defaults expose the frontend on all interfaces" "${output}" "frontend_host=0.0.0.0"
+ assert_contains "network defaults keep the canonical frontend dev port" "${output}" "frontend_port=5173"
+ assert_contains "network defaults target the detected LAN API host" "${output}" "api_host=192.168.50.10"
+ assert_contains "network defaults derive the API URL" "${output}" "api_url=http://192.168.50.10:7655"
+ assert_contains "network defaults derive the websocket URL" "${output}" "ws_url=ws://192.168.50.10:7655"
+ assert_contains "network defaults allow the detected LAN frontend origin" "${output}" "http://192.168.50.10:5173"
+ assert_contains "network defaults retain loopback frontend origins" "${output}" "http://127.0.0.1:5173"
+}
+
+test_hot_dev_browser_urls_distinguish_bind_and_browser_hosts() {
+ local output
+ output="$(
+ HOT_DEV_RUNTIME_LIB="${HOT_DEV_RUNTIME_LIB}" \
+ bash -c '
+ set -euo pipefail
+ source "${HOT_DEV_RUNTIME_LIB}"
+ LAN_IP=192.168.50.10
+ printf "local=%s\n" "$(hot_dev_local_browser_url 0.0.0.0 5173)"
+ printf "lan=%s\n" "$(hot_dev_lan_browser_url 0.0.0.0 5173 "${LAN_IP}")"
+ printf "loopback_lan=%s\n" "$(hot_dev_lan_browser_url 127.0.0.1 5173 "${LAN_IP}")"
+ '
+ )"
+
+ assert_contains "local browser URL maps wildcard binds to loopback" "${output}" "local=http://127.0.0.1:5173"
+ assert_contains "LAN browser URL uses detected LAN IP for wildcard binds" "${output}" "lan=http://192.168.50.10:5173"
+ assert_contains "loopback binds do not advertise a LAN browser URL" "${output}" "loopback_lan="
+}
+
source "${HOT_DEV_RUNTIME_LIB}"
test_pulse_process_count_handles_zero_matches_under_pipefail
test_pulse_process_count_counts_matching_processes
test_hot_dev_uses_resilient_backend_process_count
test_hot_dev_keeps_backend_launch_errors_in_debug_log
test_hot_dev_avoids_self_killing_npm_wrapper
+test_hot_dev_network_defaults_are_lan_capable
+test_hot_dev_browser_urls_distinguish_bind_and_browser_hosts
if (( failures > 0 )); then
echo "FAIL: ${failures} hot-dev runtime assertions failed" >&2
diff --git a/tests/integration/scripts/managed-dev-runtime.mjs b/tests/integration/scripts/managed-dev-runtime.mjs
index c4158cff85..d5c040d928 100644
--- a/tests/integration/scripts/managed-dev-runtime.mjs
+++ b/tests/integration/scripts/managed-dev-runtime.mjs
@@ -9,6 +9,13 @@ const truthy = (value) =>
['1', 'true', 'yes', 'on'].includes(String(value || '').trim().toLowerCase());
const trim = (value) => String(value || '').trim();
+const browserHostForBind = (host) => {
+ const normalized = trim(host).toLowerCase().replace(/^\[/, '').replace(/\]$/, '');
+ if (normalized === '' || normalized === '0.0.0.0' || normalized === '::') {
+ return '127.0.0.1';
+ }
+ return trim(host);
+};
const HOT_DEV_DEFAULT_AUTH_USER = 'admin';
const HOT_DEV_DEFAULT_AUTH_HASH = '$2a$12$J/Vu6FlBUJDTK.VAkysjB.AnvFOcijDbETyumhCB.nJVes5gvpiI6';
@@ -26,7 +33,7 @@ function managedVerifyLockPath(env = process.env) {
}
function hotDevBrowserURL(env = process.env) {
- const host = trim(env.FRONTEND_DEV_HOST) || '127.0.0.1';
+ const host = browserHostForBind(env.FRONTEND_DEV_HOST || '127.0.0.1');
const port = trim(env.FRONTEND_DEV_PORT) || '5173';
return `http://${host}:${port}`;
}
diff --git a/tests/integration/scripts/runtime-defaults.test.mjs b/tests/integration/scripts/runtime-defaults.test.mjs
index 35139514bd..dae2e26f8f 100644
--- a/tests/integration/scripts/runtime-defaults.test.mjs
+++ b/tests/integration/scripts/runtime-defaults.test.mjs
@@ -80,3 +80,21 @@ test('managedDevBrowserBaseURL keeps the configured host and port when a managed
fs.rmSync(repoRoot, { recursive: true, force: true });
}
});
+
+test('managedDevBrowserBaseURL maps wildcard bind hosts to a local browser URL', () => {
+ const repoRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'pulse-managed-dev-runtime-'));
+ fs.mkdirSync(path.join(repoRoot, 'tmp'), { recursive: true });
+ fs.writeFileSync(path.join(repoRoot, 'tmp', 'hot-dev.bg.pid'), `${process.pid}\n`);
+
+ try {
+ const resolved = managedDevBrowserBaseURL({
+ FRONTEND_DEV_HOST: '0.0.0.0',
+ FRONTEND_DEV_PORT: '5173',
+ PULSE_E2E_REPO_ROOT: repoRoot,
+ });
+
+ assert.equal(resolved, 'http://127.0.0.1:5173');
+ } finally {
+ fs.rmSync(repoRoot, { recursive: true, force: true });
+ }
+});
diff --git a/tests/integration/tests/runtime-defaults.ts b/tests/integration/tests/runtime-defaults.ts
index 4874371d19..9581e5d948 100644
--- a/tests/integration/tests/runtime-defaults.ts
+++ b/tests/integration/tests/runtime-defaults.ts
@@ -12,6 +12,13 @@ export type RuntimeState = {
const trim = (value: unknown): string => String(value ?? '').trim();
const firstNonEmpty = (...values: readonly unknown[]): string =>
values.map(trim).find((value) => value !== '') || '';
+const browserHostForBind = (host: unknown): string => {
+ const normalized = trim(host).toLowerCase().replace(/^\[/, '').replace(/\]$/, '');
+ if (normalized === '' || normalized === '0.0.0.0' || normalized === '::') {
+ return '127.0.0.1';
+ }
+ return trim(host);
+};
export const repoRootFromEnv = (env: NodeJS.ProcessEnv = process.env): string =>
trim(env.PULSE_E2E_REPO_ROOT) || path.resolve(__dirname, '..', '..', '..');
@@ -58,7 +65,7 @@ export const managedDevBrowserBaseURL = (
return null;
}
process.kill(pid, 0);
- const host = trim(env.FRONTEND_DEV_HOST) || '127.0.0.1';
+ const host = browserHostForBind(env.FRONTEND_DEV_HOST || '127.0.0.1');
const port = trim(env.FRONTEND_DEV_PORT) || '5173';
return `http://${host}:${port}`;
} catch {