Report restricted hot-dev probes as unavailable

Render managed runtime status probes as unavailable instead of 000 when a restricted shell can see loopback listeners but cannot run local HTTP probes. Refs architecture post-RC canonicalization follow-up.
This commit is contained in:
rcourtman 2026-05-21 15:51:40 +01:00
parent a77420e88a
commit 226f0bdf72
2 changed files with 12 additions and 2 deletions

View file

@ -755,10 +755,17 @@ status_bg() {
proxy_health_url="${browser_url}/api/health" proxy_health_url="${browser_url}/api/health"
backend_health_url="http://127.0.0.1:${PULSE_DEV_API_PORT}/api/health" backend_health_url="http://127.0.0.1:${PULSE_DEV_API_PORT}/api/health"
local frontend_code proxy_code backend_code local frontend_code proxy_code backend_code local_probe_unavailable
frontend_code="$(http_status_code "${frontend_url}")" frontend_code="$(http_status_code "${frontend_url}")"
proxy_code="$(http_status_code "${proxy_health_url}")" proxy_code="$(http_status_code "${proxy_health_url}")"
backend_code="$(http_status_code "${backend_health_url}")" backend_code="$(http_status_code "${backend_health_url}")"
local_probe_unavailable="false"
if process_inspection_restricted && [[ "${frontend_code}" == "000" && "${backend_code}" == "000" ]] && is_port_listening "${FRONTEND_DEV_PORT}" && is_port_listening "${PULSE_DEV_API_PORT}"; then
local_probe_unavailable="true"
frontend_code="unavailable"
proxy_code="unavailable"
backend_code="unavailable"
fi
log "Browser entrypoint: ${browser_url}" log "Browser entrypoint: ${browser_url}"
if [[ -n "${lan_browser_url}" ]]; then if [[ -n "${lan_browser_url}" ]]; then
log "LAN browser entrypoint: ${lan_browser_url}" log "LAN browser entrypoint: ${lan_browser_url}"
@ -782,7 +789,7 @@ status_bg() {
if http_status_ok "${frontend_code}" && http_status_ok "${proxy_code}" && http_status_ok "${backend_code}"; then if http_status_ok "${frontend_code}" && http_status_ok "${proxy_code}" && http_status_ok "${backend_code}"; then
log "Runtime summary: frontend shell, proxy, and backend are healthy. Use ${browser_url} in the browser." log "Runtime summary: frontend shell, proxy, and backend are healthy. Use ${browser_url} in the browser."
elif process_inspection_restricted && [[ "${frontend_code}" == "000" && "${backend_code}" == "000" ]] && is_port_listening "${FRONTEND_DEV_PORT}" && is_port_listening "${PULSE_DEV_API_PORT}"; then elif [[ "${local_probe_unavailable}" == "true" ]]; then
log "Runtime summary: local HTTP probes are unavailable from this restricted shell, but frontend and backend listeners are present. Use ${browser_url} in the browser or rerun status outside the restricted shell." log "Runtime summary: local HTTP probes are unavailable from this restricted shell, but frontend and backend listeners are present. Use ${browser_url} in the browser or rerun status outside the restricted shell."
elif http_status_blocked "${frontend_code}" || http_status_blocked "${proxy_code}" || http_status_blocked "${backend_code}"; then elif http_status_blocked "${frontend_code}" || http_status_blocked "${proxy_code}" || http_status_blocked "${backend_code}"; then
log "Runtime summary: local HTTP probes are blocked by this shell. Use ${browser_url} in the browser or rerun status outside the restricted shell." log "Runtime summary: local HTTP probes are blocked by this shell. Use ${browser_url} in the browser or rerun status outside the restricted shell."

View file

@ -954,6 +954,9 @@ test_hot_dev_bg_status_degrades_ownership_when_process_inspection_is_restricted(
)" )"
assert_contains "restricted status keeps the managed runtime pid" "${output}" "[hot-dev-bg] Running (pid: 4242)" assert_contains "restricted status keeps the managed runtime pid" "${output}" "[hot-dev-bg] Running (pid: 4242)"
assert_contains "restricted status renders frontend probe as unavailable" "${output}" "[hot-dev-bg] Frontend shell HTTP: unavailable"
assert_contains "restricted status renders proxy probe as unavailable" "${output}" "[hot-dev-bg] Frontend proxy /api/health: unavailable"
assert_contains "restricted status renders backend probe as unavailable" "${output}" "[hot-dev-bg] Backend /api/health: unavailable"
assert_contains "restricted status marks listener ownership as unknown" "${output}" "[hot-dev-bg] Port 5173: unknown listener pid=14111" assert_contains "restricted status marks listener ownership as unknown" "${output}" "[hot-dev-bg] Port 5173: unknown listener pid=14111"
assert_not_contains "restricted status does not accuse split ownership" "${output}" "Detected split ownership" assert_not_contains "restricted status does not accuse split ownership" "${output}" "Detected split ownership"
assert_contains "restricted status reports unavailable health probes without claiming a crash" "${output}" "local HTTP probes are unavailable from this restricted shell" assert_contains "restricted status reports unavailable health probes without claiming a crash" "${output}" "local HTTP probes are unavailable from this restricted shell"