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 stable demo runtime profile convergence

rcourtmanb34a3d816497
diff --git a/.github/scripts/recover-demo-runtime.sh b/.github/scripts/recover-demo-runtime.sh
new file mode 100755
index 0000000000..2abc4e2ce3
--- /dev/null
+++ b/.github/scripts/recover-demo-runtime.sh
@@ -0,0 +1,264 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+if [ "$#" -ne 6 ]; then
+ echo "usage: recover-demo-runtime.sh EXPECTED_HOSTNAME LOCAL_BASE_URL EXPECTED_VERSION MOCK_NODES MOCK_SEED_DURATION MOCK_UPDATE_INTERVAL" >&2
+ exit 2
+fi
+
+EXPECTED_HOSTNAME="$1"
+LOCAL_BASE_URL="${2%/}"
+EXPECTED_VERSION="${3#v}"
+MOCK_NODES="$4"
+MOCK_SEED_DURATION="$5"
+MOCK_UPDATE_INTERVAL="$6"
+SERVICE_NAME="pulse"
+RELAY_SERVICE_NAME="pulse-relay"
+EXPECTED_BINARY="/opt/pulse/bin/pulse"
+EXPECTED_UNIT="/etc/systemd/system/pulse.service"
+MUTATED=false
+BACKUP_DIR=""
+
+[[ "$MOCK_NODES" =~ ^[1-9][0-9]*$ ]]
+[[ "$MOCK_SEED_DURATION" =~ ^[1-9][0-9]*[smhd]$ ]]
+[[ "$MOCK_UPDATE_INTERVAL" =~ ^[1-9][0-9]*[smh]$ ]]
+
+log() {
+ printf '[demo-recovery] %s\n' "$*" >&2
+}
+
+unit_hash() {
+ sudo sha256sum "$EXPECTED_UNIT" | awk '{print $1}'
+}
+
+binary_hash() {
+ sudo sha256sum "$EXPECTED_BINARY" | awk '{print $1}'
+}
+
+dropin_manifest_hash() {
+ local paths path
+ paths="$(systemctl show "$SERVICE_NAME" --property=DropInPaths --value)"
+ if [ -z "$paths" ]; then
+ printf '%s' 'none' | sha256sum | awk '{print $1}'
+ return
+ fi
+ for path in $paths; do
+ sudo test -f "$path"
+ printf '%s\t' "$path"
+ sudo sha256sum "$path" | awk '{print $1}'
+ done | sort | sha256sum | awk '{print $1}'
+}
+
+runtime_config_hash() {
+ local path
+ for path in /etc/pulse/.env /etc/pulse/billing.json; do
+ sudo test -f "$path"
+ printf '%s\t' "$path"
+ sudo sha256sum "$path" | awk '{print $1}'
+ done | sha256sum | awk '{print $1}'
+}
+
+set_env_value() {
+ local key="$1"
+ local value="$2"
+ local env_file="/etc/pulse/.env"
+ if sudo grep -Eq "^[[:space:]]*${key}=" "$env_file"; then
+ sudo sed -i "s|^[[:space:]]*${key}=.*|${key}=${value}|" "$env_file"
+ else
+ printf '\n%s=%s\n' "$key" "$value" | sudo tee -a "$env_file" >/dev/null
+ fi
+}
+
+runtime_profile_matches() {
+ sudo grep -Fxq "PULSE_MOCK_NODES=${MOCK_NODES}" /etc/pulse/.env &&
+ sudo grep -Fxq "PULSE_MOCK_TRENDS_SEED_DURATION=${MOCK_SEED_DURATION}" /etc/pulse/.env &&
+ sudo grep -Fxq "PULSE_MOCK_UPDATE_INTERVAL=${MOCK_UPDATE_INTERVAL}" /etc/pulse/.env
+}
+
+cleanup_config_backup() {
+ [ -n "$BACKUP_DIR" ] || return 0
+ sudo unlink "$BACKUP_DIR/runtime.env" 2>/dev/null || true
+ sudo unlink "$BACKUP_DIR/billing.json" 2>/dev/null || true
+ rmdir "$BACKUP_DIR" 2>/dev/null || true
+ BACKUP_DIR=""
+}
+
+restore_runtime_config() {
+ [ -n "$BACKUP_DIR" ] || return 0
+ sudo cp --archive "$BACKUP_DIR/runtime.env" /etc/pulse/.env
+ sudo cp --archive "$BACKUP_DIR/billing.json" /etc/pulse/billing.json
+}
+
+local_version() {
+ curl --connect-timeout 3 --max-time 8 -fsS \
+ "${LOCAL_BASE_URL}/api/version" | jq -er '.version'
+}
+
+local_healthy() {
+ curl --connect-timeout 3 --max-time 8 -fsS \
+ "${LOCAL_BASE_URL}/api/health" >/dev/null && local_version >/dev/null
+}
+
+emit_evidence() {
+ local status="$1"
+ local before_pid="$2"
+ local after_pid="$3"
+ local before_relay_pid="$4"
+ local after_relay_pid="$5"
+ local before_binary_sha="$6"
+ local after_binary_sha="$7"
+ local before_unit_sha="$8"
+ local after_unit_sha="$9"
+ local before_dropins_sha="${10}"
+ local after_dropins_sha="${11}"
+ local version="${12}"
+ local before_config_sha="${13}"
+ local after_config_sha="${14}"
+ jq -n \
+ --arg status "$status" \
+ --argjson mutated "$MUTATED" \
+ --arg hostname "$(hostname)" \
+ --arg service "$SERVICE_NAME" \
+ --arg before_pid "$before_pid" \
+ --arg after_pid "$after_pid" \
+ --arg relay_service "$RELAY_SERVICE_NAME" \
+ --arg before_relay_pid "$before_relay_pid" \
+ --arg after_relay_pid "$after_relay_pid" \
+ --arg binary "$EXPECTED_BINARY" \
+ --arg before_binary_sha256 "$before_binary_sha" \
+ --arg after_binary_sha256 "$after_binary_sha" \
+ --arg unit "$EXPECTED_UNIT" \
+ --arg before_unit_sha256 "$before_unit_sha" \
+ --arg after_unit_sha256 "$after_unit_sha" \
+ --arg before_dropins_sha256 "$before_dropins_sha" \
+ --arg after_dropins_sha256 "$after_dropins_sha" \
+ --arg before_runtime_config_sha256 "$before_config_sha" \
+ --arg after_runtime_config_sha256 "$after_config_sha" \
+ --arg version "$version" \
+ --arg expected_version "$EXPECTED_VERSION" \
+ --arg mock_nodes "$MOCK_NODES" \
+ --arg mock_seed_duration "$MOCK_SEED_DURATION" \
+ --arg mock_update_interval "$MOCK_UPDATE_INTERVAL" \
+ '{schema_version: 1, status: $status, mutated: $mutated,
+ hostname: $hostname, service: $service,
+ before_pid: $before_pid, after_pid: $after_pid,
+ relay_service: $relay_service,
+ before_relay_pid: $before_relay_pid,
+ after_relay_pid: $after_relay_pid,
+ binary: $binary,
+ before_binary_sha256: $before_binary_sha256,
+ after_binary_sha256: $after_binary_sha256,
+ unit: $unit,
+ before_unit_sha256: $before_unit_sha256,
+ after_unit_sha256: $after_unit_sha256,
+ before_dropins_sha256: $before_dropins_sha256,
+ after_dropins_sha256: $after_dropins_sha256,
+ before_runtime_config_sha256: $before_runtime_config_sha256,
+ after_runtime_config_sha256: $after_runtime_config_sha256,
+ version: $version, expected_version: $expected_version,
+ runtime_profile: {mock_nodes: $mock_nodes,
+ mock_seed_duration: $mock_seed_duration,
+ mock_update_interval: $mock_update_interval}}'
+}
+
+[ "$(hostname)" = "$EXPECTED_HOSTNAME" ] || {
+ log "target hostname does not match the governed demo environment"
+ exit 1
+}
+[ "$(systemctl show "$SERVICE_NAME" --property=FragmentPath --value)" = "$EXPECTED_UNIT" ]
+[ "$(systemctl show "$SERVICE_NAME" --property=User --value)" = "pulse" ]
+[ "$(systemctl show "$SERVICE_NAME" --property=Group --value)" = "pulse" ]
+[ "$(systemctl is-enabled "$SERVICE_NAME")" = "enabled" ]
+[ "$(systemctl is-active "$RELAY_SERVICE_NAME")" = "active" ]
+systemctl show "$SERVICE_NAME" --property=ExecStart --value | grep -Fq "$EXPECTED_BINARY"
+sudo test -x "$EXPECTED_BINARY"
+sudo test -f "$EXPECTED_UNIT"
+
+BEFORE_PID="$(systemctl show "$SERVICE_NAME" --property=MainPID --value)"
+BEFORE_RELAY_PID="$(systemctl show "$RELAY_SERVICE_NAME" --property=MainPID --value)"
+BEFORE_BINARY_SHA="$(binary_hash)"
+BEFORE_UNIT_SHA="$(unit_hash)"
+BEFORE_DROPINS_SHA="$(dropin_manifest_hash)"
+BEFORE_CONFIG_SHA="$(runtime_config_hash)"
+
+if local_healthy && runtime_profile_matches; then
+ VERSION="$(local_version)"
+ [ "${VERSION#v}" = "$EXPECTED_VERSION" ]
+ emit_evidence healthy_noop "$BEFORE_PID" "$BEFORE_PID" \
+ "$BEFORE_RELAY_PID" "$BEFORE_RELAY_PID" \
+ "$BEFORE_BINARY_SHA" "$BEFORE_BINARY_SHA" \
+ "$BEFORE_UNIT_SHA" "$BEFORE_UNIT_SHA" \
+ "$BEFORE_DROPINS_SHA" "$BEFORE_DROPINS_SHA" "$VERSION" \
+ "$BEFORE_CONFIG_SHA" "$BEFORE_CONFIG_SHA"
+ exit 0
+fi
+
+rollback_on_error() {
+ local rc=$?
+ trap - ERR
+ if [ "$MUTATED" = true ]; then
+ log "recovery validation failed; compensating by stopping only pulse.service"
+ sudo systemctl stop "$SERVICE_NAME" || true
+ restore_runtime_config || true
+ fi
+ emit_evidence compensated_unavailable "$BEFORE_PID" \
+ "$(systemctl show "$SERVICE_NAME" --property=MainPID --value || true)" \
+ "$BEFORE_RELAY_PID" \
+ "$(systemctl show "$RELAY_SERVICE_NAME" --property=MainPID --value || true)" \
+ "$BEFORE_BINARY_SHA" "$(binary_hash || true)" \
+ "$BEFORE_UNIT_SHA" "$(unit_hash || true)" \
+ "$BEFORE_DROPINS_SHA" "$(dropin_manifest_hash || true)" "" \
+ "$BEFORE_CONFIG_SHA" "$(runtime_config_hash || true)"
+ cleanup_config_backup
+ exit "$rc"
+}
+BACKUP_DIR="$(mktemp -d)"
+sudo cp --archive /etc/pulse/.env "$BACKUP_DIR/runtime.env"
+sudo cp --archive /etc/pulse/billing.json "$BACKUP_DIR/billing.json"
+trap rollback_on_error ERR
+
+log "applying the target-compatible demo runtime profile and restarting only pulse.service"
+MUTATED=true
+set_env_value PULSE_MOCK_NODES "$MOCK_NODES"
+set_env_value PULSE_MOCK_TRENDS_SEED_DURATION "$MOCK_SEED_DURATION"
+set_env_value PULSE_MOCK_UPDATE_INTERVAL "$MOCK_UPDATE_INTERVAL"
+sudo chown pulse:pulse /etc/pulse/.env
+sudo chmod 600 /etc/pulse/.env
+sudo systemctl restart "$SERVICE_NAME"
+
+for _ in $(seq 1 12); do
+ if [ "$(systemctl is-active "$SERVICE_NAME" || true)" = "active" ] && local_healthy; then
+ break
+ fi
+ sleep 5
+done
+
+[ "$(systemctl is-active "$SERVICE_NAME")" = "active" ]
+[ "$(systemctl show "$SERVICE_NAME" --property=SubState --value)" = "running" ]
+local_healthy
+runtime_profile_matches
+
+AFTER_PID="$(systemctl show "$SERVICE_NAME" --property=MainPID --value)"
+AFTER_RELAY_PID="$(systemctl show "$RELAY_SERVICE_NAME" --property=MainPID --value)"
+AFTER_BINARY_SHA="$(binary_hash)"
+AFTER_UNIT_SHA="$(unit_hash)"
+AFTER_DROPINS_SHA="$(dropin_manifest_hash)"
+AFTER_CONFIG_SHA="$(runtime_config_hash)"
+VERSION="$(local_version)"
+
+[ "$AFTER_PID" -gt 0 ]
+[ "$AFTER_PID" != "$BEFORE_PID" ]
+[ "$AFTER_RELAY_PID" = "$BEFORE_RELAY_PID" ]
+[ "$AFTER_BINARY_SHA" = "$BEFORE_BINARY_SHA" ]
+[ "$AFTER_UNIT_SHA" = "$BEFORE_UNIT_SHA" ]
+[ "$AFTER_DROPINS_SHA" = "$BEFORE_DROPINS_SHA" ]
+[ "${VERSION#v}" = "$EXPECTED_VERSION" ]
+
+trap - ERR
+cleanup_config_backup
+emit_evidence recovered "$BEFORE_PID" "$AFTER_PID" \
+ "$BEFORE_RELAY_PID" "$AFTER_RELAY_PID" \
+ "$BEFORE_BINARY_SHA" "$AFTER_BINARY_SHA" \
+ "$BEFORE_UNIT_SHA" "$AFTER_UNIT_SHA" \
+ "$BEFORE_DROPINS_SHA" "$AFTER_DROPINS_SHA" "$VERSION" \
+ "$BEFORE_CONFIG_SHA" "$AFTER_CONFIG_SHA"
diff --git a/.github/scripts/resolve-demo-runtime-profile.sh b/.github/scripts/resolve-demo-runtime-profile.sh
new file mode 100755
index 0000000000..598d84bbc4
--- /dev/null
+++ b/.github/scripts/resolve-demo-runtime-profile.sh
@@ -0,0 +1,39 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+if [ "$#" -ne 1 ]; then
+ echo "usage: resolve-demo-runtime-profile.sh TAG_REF" >&2
+ exit 2
+fi
+
+TAG_REF="$1"
+git rev-parse -q --verify "${TAG_REF}^{commit}" >/dev/null || {
+ echo "demo runtime profile ref does not resolve to a commit: ${TAG_REF}" >&2
+ exit 1
+}
+
+# Reusable workflows execute from the caller revision, while the installed
+# binary comes from TAG_REF. The large-estate profile is safe only when that
+# exact runtime implements both required scaling boundaries.
+if git grep -q 'mockEagerHistoryPVEGuestLimit' "${TAG_REF}" -- internal/monitoring/mock_metrics_history.go && \
+ git grep -q 'UpdateMetricCohort' "${TAG_REF}" -- internal/mock/integration.go; then
+ PROFILE="large-estate"
+ MOCK_NODES=50
+ MOCK_SEED_DURATION=48h
+ MOCK_UPDATE_INTERVAL=2s
+else
+ PROFILE="legacy-bounded"
+ MOCK_NODES="$({
+ git show "${TAG_REF}:.github/workflows/update-demo-server.yml" 2>/dev/null || true
+ } | sed -n -E 's/^[[:space:]]*set_env_value PULSE_MOCK_NODES ([0-9]+)[[:space:]]*$/\1/p' | tail -1)"
+ if [[ ! "${MOCK_NODES}" =~ ^[1-9][0-9]*$ ]]; then
+ MOCK_NODES=32
+ fi
+ MOCK_SEED_DURATION=6h
+ MOCK_UPDATE_INTERVAL=10s
+fi
+
+printf 'profile=%s\n' "$PROFILE"
+printf 'mock_nodes=%s\n' "$MOCK_NODES"
+printf 'mock_seed_duration=%s\n' "$MOCK_SEED_DURATION"
+printf 'mock_update_interval=%s\n' "$MOCK_UPDATE_INTERVAL"
diff --git a/.github/workflows/recover-demo-server.yml b/.github/workflows/recover-demo-server.yml
new file mode 100644
index 0000000000..7536750b79
--- /dev/null
+++ b/.github/workflows/recover-demo-server.yml
@@ -0,0 +1,174 @@
+name: Recover Stable Demo Runtime
+
+on:
+ workflow_dispatch:
+
+permissions:
+ contents: read
+
+concurrency:
+ group: stable-demo-runtime-recovery
+ cancel-in-progress: false
+
+jobs:
+ recover:
+ runs-on: ubuntu-24.04
+ environment: demo-stable
+ env:
+ DEMO_EXPECTED_HOSTNAME: ${{ vars.DEMO_EXPECTED_HOSTNAME }}
+ DEMO_LOCAL_BASE_URL: ${{ vars.DEMO_LOCAL_BASE_URL }}
+ DEMO_PUBLIC_HEALTH_URL: ${{ vars.DEMO_PUBLIC_HEALTH_URL }}
+
+ steps:
+ - name: Checkout exact recovery implementation
+ uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
+ with:
+ fetch-depth: 0
+ fetch-tags: true
+
+ - name: Validate fixed recovery boundary
+ env:
+ DEMO_SERVER_HOST: ${{ secrets.DEMO_SERVER_HOST }}
+ DEMO_SERVER_USER: ${{ secrets.DEMO_SERVER_USER }}
+ DEMO_SERVER_SSH_KEY: ${{ secrets.DEMO_SERVER_SSH_KEY }}
+ run: |
+ set -euo pipefail
+ [ -n "$DEMO_SERVER_HOST" ]
+ [ -n "$DEMO_SERVER_USER" ]
+ [ -n "$DEMO_SERVER_SSH_KEY" ]
+ [ -n "$DEMO_EXPECTED_HOSTNAME" ]
+ [ -n "$DEMO_LOCAL_BASE_URL" ]
+ [ -n "$DEMO_PUBLIC_HEALTH_URL" ]
+
+ - name: Resolve current committed stable version
+ id: stable
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: |
+ set -euo pipefail
+ TAG="$(gh api "repos/${GITHUB_REPOSITORY}/releases/latest" --jq '.tag_name')"
+ [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]
+ echo "tag=$TAG" >> "$GITHUB_OUTPUT"
+
+ - name: Resolve target-compatible recovery profile
+ id: runtime_profile
+ run: |
+ set -euo pipefail
+ TAG="${{ steps.stable.outputs.tag }}"
+ PROFILE_OUTPUT="$(bash .github/scripts/resolve-demo-runtime-profile.sh "refs/tags/${TAG}")"
+ printf '%s\n' "$PROFILE_OUTPUT" >> "$GITHUB_OUTPUT"
+ printf 'Resolved stable demo recovery profile for %s:\n%s\n' "$TAG" "$PROFILE_OUTPUT"
+
+ - name: Connect to the governed demo network
+ id: tailscale
+ uses: tailscale/github-action@306e68a486fd2350f2bfc3b19fcd143891a4a2d8 # v4
+ with:
+ oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
+ oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
+ tags: tag:infra
+ version: '1.94.2'
+ ping: ${{ secrets.DEMO_SERVER_HOST }}
+
+ - name: Diagnose network setup failure
+ if: failure() && steps.tailscale.outcome == 'failure'
+ env:
+ DEMO_SERVER_HOST: ${{ secrets.DEMO_SERVER_HOST }}
+ run: bash .github/scripts/check-demo-reachability.sh diagnose
+
+ - name: Verify demo network path
+ env:
+ DEMO_SERVER_HOST: ${{ secrets.DEMO_SERVER_HOST }}
+ run: bash .github/scripts/check-demo-reachability.sh
+
+ - name: Set up pinned SSH identity
+ env:
+ DEMO_SERVER_HOST: ${{ secrets.DEMO_SERVER_HOST }}
+ DEMO_SERVER_SSH_KEY: ${{ secrets.DEMO_SERVER_SSH_KEY }}
+ run: bash .github/scripts/setup-demo-ssh.sh
+
+ - name: Recover current installed runtime
+ id: recovery
+ env:
+ DEMO_SERVER_HOST: ${{ secrets.DEMO_SERVER_HOST }}
+ DEMO_SERVER_USER: ${{ secrets.DEMO_SERVER_USER }}
+ EXPECTED_VERSION: ${{ steps.stable.outputs.tag }}
+ MOCK_NODES: ${{ steps.runtime_profile.outputs.mock_nodes }}
+ MOCK_SEED_DURATION: ${{ steps.runtime_profile.outputs.mock_seed_duration }}
+ MOCK_UPDATE_INTERVAL: ${{ steps.runtime_profile.outputs.mock_update_interval }}
+ run: |
+ set -euo pipefail
+ ssh -i ~/.ssh/id_ed25519 \
+ -o IdentitiesOnly=yes \
+ -o StrictHostKeyChecking=yes \
+ -o UserKnownHostsFile=~/.ssh/known_hosts \
+ "$DEMO_SERVER_USER@$DEMO_SERVER_HOST" \
+ "bash -s -- $(printf '%q ' "$DEMO_EXPECTED_HOSTNAME" "$DEMO_LOCAL_BASE_URL" "$EXPECTED_VERSION" "$MOCK_NODES" "$MOCK_SEED_DURATION" "$MOCK_UPDATE_INTERVAL")" \
+ < .github/scripts/recover-demo-runtime.sh \
+ > demo-runtime-recovery.json
+ jq -e '.schema_version == 1 and (.status == "recovered" or .status == "healthy_noop")' \
+ demo-runtime-recovery.json
+ echo "mutated=$(jq -r '.mutated' demo-runtime-recovery.json)" >> "$GITHUB_OUTPUT"
+
+ - name: Verify public health
+ run: curl --connect-timeout 5 --max-time 20 -fsS "$DEMO_PUBLIC_HEALTH_URL"
+
+ - name: Verify public frontend parity
+ env:
+ DEMO_SERVER_HOST: ${{ secrets.DEMO_SERVER_HOST }}
+ DEMO_SERVER_USER: ${{ secrets.DEMO_SERVER_USER }}
+ run: |
+ set -euo pipefail
+ case "$DEMO_PUBLIC_HEALTH_URL" in
+ */api/health) PUBLIC_ROOT_URL="${DEMO_PUBLIC_HEALTH_URL%/api/health}/" ;;
+ *) echo "::error::DEMO_PUBLIC_HEALTH_URL must end with /api/health"; exit 1 ;;
+ esac
+ extract_asset() {
+ python3 -c 'import re,sys; h=sys.stdin.read(); m=re.search(r"<script\b[^>]*\bsrc=\"(/assets/index-[^\"]*\.js)\"",h); sys.exit(1) if m is None else sys.stdout.write(m.group(1))'
+ }
+ REMOTE_ROOT_URL="${DEMO_LOCAL_BASE_URL%/}/"
+ REMOTE_ASSET="$(ssh -i ~/.ssh/id_ed25519 \
+ -o IdentitiesOnly=yes \
+ -o StrictHostKeyChecking=yes \
+ -o UserKnownHostsFile=~/.ssh/known_hosts \
+ "$DEMO_SERVER_USER@$DEMO_SERVER_HOST" \
+ "curl -fsS -- $(printf '%q' "$REMOTE_ROOT_URL")" | extract_asset)"
+ PUBLIC_ASSET="$(curl -fsS "$PUBLIC_ROOT_URL" | extract_asset)"
+ [ "$REMOTE_ASSET" = "$PUBLIC_ASSET" ]
+
+ - name: Verify public browser smoke
+ run: |
+ set -euo pipefail
+ export PULSE_PUBLIC_SITE_URL="${DEMO_PUBLIC_HEALTH_URL%/api/health}/"
+ ./scripts/run_demo_public_browser_smoke.sh
+
+ - name: Compensate failed mutated recovery
+ if: failure() && steps.recovery.outputs.mutated == 'true'
+ env:
+ DEMO_SERVER_HOST: ${{ secrets.DEMO_SERVER_HOST }}
+ DEMO_SERVER_USER: ${{ secrets.DEMO_SERVER_USER }}
+ run: |
+ set -euo pipefail
+ BEFORE="$(ssh -i ~/.ssh/id_ed25519 "$DEMO_SERVER_USER@$DEMO_SERVER_HOST" \
+ "systemctl show pulse --property=ActiveState,SubState,MainPID --value | paste -sd, -")"
+ ssh -i ~/.ssh/id_ed25519 "$DEMO_SERVER_USER@$DEMO_SERVER_HOST" \
+ "sudo systemctl stop pulse"
+ AFTER="$(ssh -i ~/.ssh/id_ed25519 "$DEMO_SERVER_USER@$DEMO_SERVER_HOST" \
+ "systemctl show pulse --property=ActiveState,SubState,MainPID --value | paste -sd, -")"
+ jq -n --arg before "$BEFORE" --arg after "$AFTER" \
+ '{schema_version: 1, status: "compensated_unavailable", before: $before, after: $after}' \
+ > demo-runtime-rollback.json
+
+ - name: Retain bounded recovery evidence
+ if: always()
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ with:
+ name: stable-demo-runtime-recovery-${{ github.run_id }}
+ path: |
+ demo-runtime-recovery.json
+ demo-runtime-rollback.json
+ if-no-files-found: warn
+ retention-days: 14
+
+ - name: Cleanup SSH material
+ if: always()
+ run: rm -f ~/.ssh/id_ed25519 ~/.ssh/known_hosts
diff --git a/.github/workflows/update-demo-server.yml b/.github/workflows/update-demo-server.yml
index 6fdb07e731..a6dc42c725 100644
--- a/.github/workflows/update-demo-server.yml
+++ b/.github/workflows/update-demo-server.yml
@@ -49,6 +49,9 @@ jobs:
target: ${{ steps.target.outputs.target }}
environment_name: ${{ steps.target.outputs.environment_name }}
skip: ${{ steps.target.outputs.skip || 'false' }}
+ mock_nodes: ${{ steps.runtime_profile.outputs.mock_nodes }}
+ mock_seed_duration: ${{ steps.runtime_profile.outputs.mock_seed_duration }}
+ mock_update_interval: ${{ steps.runtime_profile.outputs.mock_update_interval }}
steps:
- name: Resolve target tag and demo environment
@@ -145,6 +148,16 @@ jobs:
echo "[OK] ${TAG} validated for governed demo deployment on ${REQUIRED_BRANCH}"
+ - name: Resolve target-compatible demo runtime profile
+ id: runtime_profile
+ run: |
+ set -euo pipefail
+ TAG="${{ steps.target.outputs.tag }}"
+ TAG_REF="refs/tags/${TAG}"
+ PROFILE_OUTPUT="$(bash .github/scripts/resolve-demo-runtime-profile.sh "${TAG_REF}")"
+ printf '%s\n' "$PROFILE_OUTPUT" >> "$GITHUB_OUTPUT"
+ printf 'Resolved target-compatible demo runtime profile for %s:\n%s\n' "$TAG" "$PROFILE_OUTPUT"
+
update-demo:
needs: resolve
if: needs.resolve.outputs.skip != 'true'
@@ -531,10 +544,16 @@ jobs:
run: |
set -euo pipefail
SERVICE_NAME="${{ steps.config.outputs.service_name }}"
+ MOCK_NODES="${{ needs.resolve.outputs.mock_nodes }}"
+ MOCK_SEED_DURATION="${{ needs.resolve.outputs.mock_seed_duration }}"
+ MOCK_UPDATE_INTERVAL="${{ needs.resolve.outputs.mock_update_interval }}"
REMOTE_SCRIPT=$(cat <<'EOF'
set -euo pipefail
SERVICE_NAME="${1:-pulse}"
DEMO_LOCAL_BASE_URL="$2"
+ MOCK_NODES="$3"
+ MOCK_SEED_DURATION="$4"
+ MOCK_UPDATE_INTERVAL="$5"
CONFIG_DIR="/etc/${SERVICE_NAME:-pulse}"
SERVICE_USER="$(systemctl show "$SERVICE_NAME" --property=User --value 2>/dev/null || true)"
SERVICE_GROUP="$(systemctl show "$SERVICE_NAME" --property=Group --value 2>/dev/null || true)"
@@ -616,7 +635,7 @@ jobs:
set_env_value DEMO_MODE true
set_env_value PULSE_MOCK_MODE true
- set_env_value PULSE_MOCK_NODES 50
+ set_env_value PULSE_MOCK_NODES "$MOCK_NODES"
set_env_value PULSE_MOCK_VMS_PER_NODE 10
set_env_value PULSE_MOCK_LXCS_PER_NODE 8
set_env_value PULSE_MOCK_DOCKER_HOSTS 5
@@ -628,6 +647,8 @@ jobs:
set_env_value PULSE_MOCK_K8S_DEPLOYMENTS 14
set_env_value PULSE_MOCK_RANDOM_METRICS true
set_env_value PULSE_MOCK_STOPPED_PERCENT 6
+ set_env_value PULSE_MOCK_TRENDS_SEED_DURATION "$MOCK_SEED_DURATION"
+ set_env_value PULSE_MOCK_UPDATE_INTERVAL "$MOCK_UPDATE_INTERVAL"
ensure_demo_fixture_entitlement
@@ -648,7 +669,8 @@ jobs:
exit 1
EOF
)
- ssh -i ~/.ssh/id_ed25519 "$DEMO_SERVER_USER@$DEMO_SERVER_HOST" "bash -s -- $(printf '%q ' "$SERVICE_NAME" "$DEMO_LOCAL_BASE_URL")" <<<"$REMOTE_SCRIPT"
+ ssh -i ~/.ssh/id_ed25519 "$DEMO_SERVER_USER@$DEMO_SERVER_HOST" \
+ "bash -s -- $(printf '%q ' "$SERVICE_NAME" "$DEMO_LOCAL_BASE_URL" "$MOCK_NODES" "$MOCK_SEED_DURATION" "$MOCK_UPDATE_INTERVAL")" <<<"$REMOTE_SCRIPT"
- name: Verify demo runtime
env:
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.md
index 28f4c258ac..07bbaf96bc 100644
--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md
+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md
@@ -69,6 +69,9 @@ discarding existing explicit disk exclusions.
21. `.github/workflows/release-dry-run.yml`
22. `.github/workflows/retry-release-convergence.yml`
23. `.github/workflows/update-demo-server.yml`
+23a. `.github/workflows/recover-demo-server.yml`
+23b. `.github/scripts/recover-demo-runtime.sh`
+23c. `.github/scripts/resolve-demo-runtime-profile.sh`
24. `.github/workflows/validate-release-assets.yml`
25. `.github/workflows/install-sh-smoke.yml`
26. `scripts/release_control/customer_promotion_lease.sh`
@@ -2717,6 +2720,24 @@ the matching `scripts/tests/test-toggle-mock.sh` fixtures) so toggle
CLIs, managed runtime restarts, public demo convergence, and the in-binary
default never drift apart. Existing installations with explicit custom
`PULSE_MOCK_*` values retain those values during legacy-sidecar migration.
+Because the reusable deployment workflow executes from its caller revision
+while installing an exact tagged binary, it must inspect that tag before
+converging the runtime environment. The 50-node profile is permitted only when
+the tagged runtime contains both bounded eager guest history and cohort-based
+metric updates. A stable tag that predates either capability must receive the
+bounded compatibility profile (the estate size declared by that tag's own demo
+workflow, six hours of eager history, and a ten-second full-estate update
+cadence), preventing newer workflow defaults from imposing an unqualified
+memory and CPU load on an older binary. Tags without a readable numeric demo
+node declaration fall back to the last legacy stable baseline of 32 nodes.
+The manually dispatched stable-demo recovery path consumes that same resolver
+and may mutate only the three bounded mock-profile values before restarting the
+already-installed `pulse` service. It must retain the current stable binary,
+unit, drop-ins, Relay process, and billing state; prove the expected hostname
+and release version plus public health, frontend parity, and browser readiness;
+and restore the prior runtime configuration while stopping the failed service
+if post-mutation validation fails. It must not install artifacts, invoke release
+convergence, or accept caller-selected target/version inputs.
Mock toggles are runtime transitions, not just environment-file edits. A
successful `scripts/toggle-mock.sh on|off` run must leave the managed browser
entrypoint serving the requested `/api/system/mock-mode` state through the
diff --git a/docs/release-control/v6/internal/subsystems/monitoring.md b/docs/release-control/v6/internal/subsystems/monitoring.md
index 7561145bdc..9a0bb1e4c4 100644
--- a/docs/release-control/v6/internal/subsystems/monitoring.md
+++ b/docs/release-control/v6/internal/subsystems/monitoring.md
@@ -701,7 +701,13 @@ cleanup so readers cannot retain orphaned runtime or alert projections.
across the estate, while every omitted guest continues to receive the same
canonical timeline through deterministic on-demand chart synthesis. Dashboard
chart prewarming is limited per workload family and must never rebuild an
- estate-sized guest chart cache on each mock sampler tick.
+ estate-sized guest chart cache on each mock sampler tick. The eager-history
+ limit must be applied inside the seed preparation boundary itself, before
+ either the active tenant history or reusable seed template allocates series,
+ so a caller cannot accidentally cache the complete fixture graph. The
+ reusable template exists only for the bounded tenant-startup window and must
+ then be released; a single-tenant runtime may not pin a duplicate history for
+ the lifetime of the process.
`POLL_TASK_WORKERS` is a process-wide scheduled-task concurrency ceiling,
not a per-monitor pool size. Each monitor may own one queue dispatcher, but
all dispatchers must acquire the shared bounded limiter before executing a
diff --git a/docs/release-control/v6/internal/subsystems/registry.json b/docs/release-control/v6/internal/subsystems/registry.json
index a5e95cac38..0a3e4a4183 100644
--- a/docs/release-control/v6/internal/subsystems/registry.json
+++ b/docs/release-control/v6/internal/subsystems/registry.json
@@ -4246,6 +4246,8 @@
".dockerignore",
".github/ISSUE_TEMPLATE/v6_rc_feedback.yml",
".github/scripts/check-demo-reachability.sh",
+ ".github/scripts/recover-demo-runtime.sh",
+ ".github/scripts/resolve-demo-runtime-profile.sh",
".github/scripts/setup-demo-ssh.sh",
".github/workflows/backfill-release-assets.yml",
".github/workflows/build-and-test.yml",
@@ -4258,6 +4260,7 @@
".github/workflows/publish-docker.yml",
".github/workflows/publish-helm-chart.yml",
".github/workflows/qualify-release-containers.yml",
+ ".github/workflows/recover-demo-server.yml",
".github/workflows/recover-release-activation.yml",
".github/workflows/release-convergence.yml",
".github/workflows/release-dry-run.yml",
@@ -4452,6 +4455,8 @@
"match_files": [
".github/ISSUE_TEMPLATE/v6_rc_feedback.yml",
".github/scripts/check-demo-reachability.sh",
+ ".github/scripts/recover-demo-runtime.sh",
+ ".github/scripts/resolve-demo-runtime-profile.sh",
".github/scripts/setup-demo-ssh.sh",
".github/workflows/backfill-release-assets.yml",
".github/workflows/build-release-candidate.yml",
@@ -4463,6 +4468,7 @@
".github/workflows/publish-docker.yml",
".github/workflows/publish-helm-chart.yml",
".github/workflows/qualify-release-containers.yml",
+ ".github/workflows/recover-demo-server.yml",
".github/workflows/recover-release-activation.yml",
".github/workflows/release-convergence.yml",
".github/workflows/release-dry-run.yml",
@@ -5665,7 +5671,8 @@
"internal/monitoring/metrics_history_memory_regression_test.go",
"internal/monitoring/metrics_history_test.go",
"internal/monitoring/metrics_test.go",
- "internal/monitoring/mock_metrics_history_test.go"
+ "internal/monitoring/mock_metrics_history_test.go",
+ "internal/monitoring/mock_metrics_seed_cache_test.go"
]
},
{
diff --git a/internal/monitoring/mock_metrics_history.go b/internal/monitoring/mock_metrics_history.go
index de6e9b5484..37f9a48ebc 100644
--- a/internal/monitoring/mock_metrics_history.go
+++ b/internal/monitoring/mock_metrics_history.go
@@ -36,6 +36,11 @@ const (
// Keep a representative cross-estate sample warm and let the existing chart
// fallback produce an equivalent canonical series for every other guest.
mockEagerHistoryPVEGuestLimit = 64
+ // Seed reuse is useful while tenant monitors initialize together, but the
+ // template duplicates every retained MetricPoint. Release it promptly after
+ // the startup burst so a single-tenant demo does not pin a second complete
+ // history for the lifetime of the process.
+ mockMetricsSeedCacheTTL = 30 * time.Second
)
type mockMetricsSamplerConfig struct {
@@ -58,10 +63,21 @@ type mockMetricsSeedCacheKey struct {
var mockMetricsSeedCache = struct {
sync.Mutex
- key mockMetricsSeedCacheKey
- history *MetricsHistory
+ key mockMetricsSeedCacheKey
+ history *MetricsHistory
+ generation uint64
}{}
+func expireMockMetricsSeedCache(generation uint64) {
+ mockMetricsSeedCache.Lock()
+ defer mockMetricsSeedCache.Unlock()
+ if mockMetricsSeedCache.generation != generation {
+ return
+ }
+ mockMetricsSeedCache.key = mockMetricsSeedCacheKey{}
+ mockMetricsSeedCache.history = nil
+}
+
func mockMetricsSamplerConfigFromEnv() mockMetricsSamplerConfig {
seedDuration := parseDurationEnv("PULSE_MOCK_TRENDS_SEED_DURATION", defaultMockSeedDuration)
sampleInterval := parseDurationEnv("PULSE_MOCK_TRENDS_SAMPLE_INTERVAL", defaultMockSampleInterval)
@@ -1090,6 +1106,11 @@ func prepareMockMetricsHistory(
maxDataPoints int,
storeSink *metrics.Store,
) (*MetricsHistory, bool) {
+ // Enforce the eager-history cardinality limit at the allocation/cache
+ // boundary. Callers may retain the complete fixture graph for inventory and
+ // realtime updates, but neither the active history nor the reusable seed
+ // template may ever materialize every guest in a large estate.
+ graph = boundMockMetricsHistoryGraph(graph)
seedAt := normalizeMockMetricTimestamp(now, interval)
if storeSink != nil {
history := NewMetricsHistory(maxDataPoints, seedDuration)
@@ -1115,6 +1136,11 @@ func prepareMockMetricsHistory(
seedMockMetricsHistory(template, nil, graph, seedAt, seedDuration, interval)
mockMetricsSeedCache.key = key
mockMetricsSeedCache.history = template
+ mockMetricsSeedCache.generation++
+ generation := mockMetricsSeedCache.generation
+ time.AfterFunc(mockMetricsSeedCacheTTL, func() {
+ expireMockMetricsSeedCache(generation)
+ })
return template.clone(), false
}
diff --git a/internal/monitoring/mock_metrics_seed_cache_test.go b/internal/monitoring/mock_metrics_seed_cache_test.go
index b5cb40a4b2..3f2bddf583 100644
--- a/internal/monitoring/mock_metrics_seed_cache_test.go
+++ b/internal/monitoring/mock_metrics_seed_cache_test.go
@@ -4,6 +4,7 @@ import (
"testing"
"time"
+ "github.com/rcourtman/pulse-go-rewrite/internal/mock"
"github.com/rcourtman/pulse-go-rewrite/internal/models"
)
@@ -12,13 +13,19 @@ func resetMockMetricsSeedCacheForTest(t *testing.T) {
mockMetricsSeedCache.Lock()
previousKey := mockMetricsSeedCache.key
previousHistory := mockMetricsSeedCache.history
+ previousGeneration := mockMetricsSeedCache.generation
+ mockMetricsSeedCache.generation++
mockMetricsSeedCache.key = mockMetricsSeedCacheKey{}
mockMetricsSeedCache.history = nil
mockMetricsSeedCache.Unlock()
t.Cleanup(func() {
mockMetricsSeedCache.Lock()
+ mockMetricsSeedCache.generation++
mockMetricsSeedCache.key = previousKey
mockMetricsSeedCache.history = previousHistory
+ if previousHistory != nil {
+ mockMetricsSeedCache.generation = previousGeneration
+ }
mockMetricsSeedCache.Unlock()
})
}
@@ -73,16 +80,9 @@ func TestPrepareMockMetricsHistoryReusesRevisionSeedWithIndependentHistories(t *
t.Fatal("cached seed returned shared mutable MetricsHistory pointers")
}
- firstCPU := first.GetGuestMetrics("vm-cache", "cpu", seedDuration)
- secondCPU := second.GetGuestMetrics("vm-cache", "cpu", seedDuration)
- if len(firstCPU) == 0 || len(firstCPU) != len(secondCPU) {
- t.Fatalf("cached seed coverage mismatch: first=%d second=%d", len(firstCPU), len(secondCPU))
- }
-
- first.AddGuestMetric("vm-cache", "cpu", 99, now.Add(sampleInterval))
- if got := len(second.GetGuestMetrics("vm-cache", "cpu", seedDuration)); got != len(secondCPU) {
- t.Fatalf("mutating one tenant history changed cached sibling coverage: got=%d want=%d", got, len(secondCPU))
- }
+ mockMetricsSeedCache.Lock()
+ firstGeneration := mockMetricsSeedCache.generation
+ mockMetricsSeedCache.Unlock()
_, revisionCacheHit := prepareMockMetricsHistory(
graph,
@@ -96,4 +96,100 @@ func TestPrepareMockMetricsHistoryReusesRevisionSeedWithIndependentHistories(t *
if revisionCacheHit {
t.Fatal("new fixture revision reused a stale seed")
}
+ mockMetricsSeedCache.Lock()
+ replacementGeneration := mockMetricsSeedCache.generation
+ mockMetricsSeedCache.Unlock()
+
+ expireMockMetricsSeedCache(firstGeneration)
+ mockMetricsSeedCache.Lock()
+ replacementRetained := mockMetricsSeedCache.history != nil && mockMetricsSeedCache.key.fixtureRevision == fixtureRevision+1
+ mockMetricsSeedCache.Unlock()
+ if !replacementRetained {
+ t.Fatal("stale seed expiry cleared a newer cached fixture revision")
+ }
+
+ expireMockMetricsSeedCache(replacementGeneration)
+ mockMetricsSeedCache.Lock()
+ cacheReleased := mockMetricsSeedCache.history == nil
+ mockMetricsSeedCache.Unlock()
+ if !cacheReleased {
+ t.Fatal("seed template remained cached after its startup reuse window expired")
+ }
+
+ firstCPU := first.GetGuestMetrics("vm-cache", "cpu", seedDuration)
+ secondCPU := second.GetGuestMetrics("vm-cache", "cpu", seedDuration)
+ if len(firstCPU) == 0 || len(firstCPU) != len(secondCPU) {
+ t.Fatalf("cached seed coverage mismatch: first=%d second=%d", len(firstCPU), len(secondCPU))
+ }
+
+ first.AddGuestMetric("vm-cache", "cpu", 99, now.Add(sampleInterval))
+ if got := len(second.GetGuestMetrics("vm-cache", "cpu", seedDuration)); got != len(secondCPU) {
+ t.Fatalf("mutating one tenant history changed cached sibling coverage: got=%d want=%d", got, len(secondCPU))
+ }
+
+}
+
+func TestPrepareMockMetricsHistoryBoundsFullDemoEstateBeforeCaching(t *testing.T) {
+ resetMockMetricsSeedCacheForTest(t)
+
+ cfg := mock.DefaultConfig
+ cfg.NodeCount = 50
+ cfg.VMsPerNode = 10
+ cfg.LXCsPerNode = 8
+
+ previousEnabled := mock.IsMockEnabled()
+ previousConfig := mock.GetConfig()
+ t.Cleanup(func() {
+ mustSetMockEnabled(t, false)
+ mock.SetMockConfig(previousConfig)
+ if previousEnabled {
+ mustSetMockEnabled(t, true)
+ }
+ })
+ mustSetMockEnabled(t, false)
+ mock.SetMockConfig(cfg)
+ mustSetMockEnabled(t, true)
+
+ full := mock.CurrentFixtureGraph()
+ fullPVEGuests := make(map[string]struct{}, len(full.State.VMs)+len(full.State.Containers))
+ for _, vm := range full.State.VMs {
+ fullPVEGuests[vm.ID] = struct{}{}
+ }
+ for _, container := range full.State.Containers {
+ fullPVEGuests[container.ID] = struct{}{}
+ }
+ if len(fullPVEGuests) <= mockEagerHistoryPVEGuestLimit {
+ t.Fatalf("fixture contains %d PVE guests, want more than eager limit %d", len(fullPVEGuests), mockEagerHistoryPVEGuestLimit)
+ }
+
+ now := time.Now().UTC().Truncate(time.Minute)
+ history, cacheHit := prepareMockMetricsHistory(full, 99, now, time.Hour, time.Minute, 3500, nil)
+ if cacheHit {
+ t.Fatal("first full-estate seed unexpectedly reported a cache hit")
+ }
+
+ countEagerPVEGuests := func(name string, candidate *MetricsHistory) int {
+ t.Helper()
+ candidate.mu.RLock()
+ defer candidate.mu.RUnlock()
+ count := 0
+ for id := range candidate.guestMetrics {
+ if _, exists := fullPVEGuests[id]; exists {
+ count++
+ }
+ }
+ if count != mockEagerHistoryPVEGuestLimit {
+ t.Fatalf("%s eagerly retained %d PVE guests, want %d", name, count, mockEagerHistoryPVEGuestLimit)
+ }
+ return count
+ }
+
+ countEagerPVEGuests("active history", history)
+ mockMetricsSeedCache.Lock()
+ cached := mockMetricsSeedCache.history
+ mockMetricsSeedCache.Unlock()
+ if cached == nil {
+ t.Fatal("full-estate seed did not populate the reusable cache")
+ }
+ countEagerPVEGuests("cached template", cached)
}
diff --git a/scripts/installtests/build_release_assets_test.go b/scripts/installtests/build_release_assets_test.go
index 82de988a15..ce0ca9cb35 100644
--- a/scripts/installtests/build_release_assets_test.go
+++ b/scripts/installtests/build_release_assets_test.go
@@ -1703,7 +1703,11 @@ func TestUpdateDemoWorkflowUsesGovernedNetworkPath(t *testing.T) {
t.Fatalf("read update-demo-server workflow: %v", err)
}
- workflow := string(workflowBytes)
+ profileBytes, err := os.ReadFile(repoFile(".github", "scripts", "resolve-demo-runtime-profile.sh"))
+ if err != nil {
+ t.Fatalf("read demo runtime profile resolver: %v", err)
+ }
+ workflow := string(workflowBytes) + "\n" + string(profileBytes)
required := []string{
`- name: Tailscale`,
`uses: tailscale/github-action@306e68a486fd2350f2bfc3b19fcd143891a4a2d8 # v4`,
@@ -1733,12 +1737,27 @@ func TestUpdateDemoWorkflowUsesGovernedNetworkPath(t *testing.T) {
`Removing demo volatile store: %s`,
`Demo host does not have enough free space to back up $CONFIG_DIR before install.`,
`Restore demo runtime configuration`,
+ `Resolve target-compatible demo runtime profile`,
+ `git grep -q 'mockEagerHistoryPVEGuestLimit'`,
+ `git grep -q 'UpdateMetricCohort'`,
+ `PROFILE="large-estate"`,
+ `MOCK_NODES=50`,
+ `MOCK_SEED_DURATION=48h`,
+ `MOCK_UPDATE_INTERVAL=2s`,
+ `PROFILE="legacy-bounded"`,
+ `git show "${TAG_REF}:.github/workflows/update-demo-server.yml"`,
+ `set_env_value PULSE_MOCK_NODES ([0-9]+)`,
+ `if [[ ! "${MOCK_NODES}" =~ ^[1-9][0-9]*$ ]]`,
+ `MOCK_SEED_DURATION=6h`,
+ `MOCK_UPDATE_INTERVAL=10s`,
`resolve_config_dir`,
`set_env_value DEMO_MODE true`,
`set_env_value PULSE_MOCK_MODE true`,
- `set_env_value PULSE_MOCK_NODES 50`,
+ `set_env_value PULSE_MOCK_NODES "$MOCK_NODES"`,
`set_env_value PULSE_MOCK_VMS_PER_NODE 10`,
`set_env_value PULSE_MOCK_LXCS_PER_NODE 8`,
+ `set_env_value PULSE_MOCK_TRENDS_SEED_DURATION "$MOCK_SEED_DURATION"`,
+ `set_env_value PULSE_MOCK_UPDATE_INTERVAL "$MOCK_UPDATE_INTERVAL"`,
`ensure_demo_fixture_entitlement`,
`"demo_fixtures"`,
`del(.integrity)`,
diff --git a/scripts/release_control/release_promotion_policy_test.py b/scripts/release_control/release_promotion_policy_test.py
index eaab17f3bf..28d539f5c1 100644
--- a/scripts/release_control/release_promotion_policy_test.py
+++ b/scripts/release_control/release_promotion_policy_test.py
@@ -1810,6 +1810,7 @@ class ReleasePromotionPolicyTest(unittest.TestCase):
publish = read(".github/workflows/publish-docker.yml")
promote = read(".github/workflows/promote-floating-tags.yml")
demo = read(".github/workflows/update-demo-server.yml")
+ demo_profile = read(".github/scripts/resolve-demo-runtime-profile.sh")
preview_deploy = read(".github/workflows/deploy-demo-server.yml")
release_workflow = read(".github/workflows/create-release.yml")
candidate_workflow = read(".github/workflows/build-release-candidate.yml")
@@ -1876,9 +1877,16 @@ class ReleasePromotionPolicyTest(unittest.TestCase):
self.assertIn("Verify target host identity", demo)
self.assertIn("Demo environment points at host $REMOTE_HOSTNAME but expected $DEMO_EXPECTED_HOSTNAME.", demo)
self.assertIn("Restore demo runtime configuration", demo)
+ self.assertIn("Resolve target-compatible demo runtime profile", demo)
+ self.assertIn("mockEagerHistoryPVEGuestLimit", demo_profile)
+ self.assertIn("UpdateMetricCohort", demo_profile)
+ self.assertIn('PROFILE="legacy-bounded"', demo_profile)
self.assertIn("resolve_config_dir", demo)
self.assertIn("set_env_value DEMO_MODE true", demo)
self.assertIn("set_env_value PULSE_MOCK_MODE true", demo)
+ self.assertIn('set_env_value PULSE_MOCK_NODES "$MOCK_NODES"', demo)
+ self.assertIn('set_env_value PULSE_MOCK_TRENDS_SEED_DURATION "$MOCK_SEED_DURATION"', demo)
+ self.assertIn('set_env_value PULSE_MOCK_UPDATE_INTERVAL "$MOCK_UPDATE_INTERVAL"', demo)
self.assertIn("ensure_demo_fixture_entitlement", demo)
self.assertIn('"demo_fixtures"', demo)
self.assertIn("del(.integrity)", demo)
@@ -1980,6 +1988,51 @@ class ReleasePromotionPolicyTest(unittest.TestCase):
self.assertIn("getByRole('button', { name: 'Sign in to Pulse' }).waitFor({ state: 'visible', timeout: 120000 })", demo_smoke)
self.assertNotIn("waitUntil: 'networkidle'", demo_smoke)
+ def test_stable_demo_recovery_is_fixed_current_bits_only(self) -> None:
+ workflow = read(".github/workflows/recover-demo-server.yml")
+ recovery = read(".github/scripts/recover-demo-runtime.sh")
+
+ self.assertIn("workflow_dispatch:", workflow)
+ self.assertNotIn("workflow_call:", workflow)
+ self.assertNotIn("inputs:", workflow)
+ self.assertIn("environment: demo-stable", workflow)
+ self.assertIn("contents: read", workflow)
+ self.assertIn("cancel-in-progress: false", workflow)
+ self.assertIn('gh api "repos/${GITHUB_REPOSITORY}/releases/latest"', workflow)
+ self.assertIn("Resolve target-compatible recovery profile", workflow)
+ self.assertIn("resolve-demo-runtime-profile.sh", workflow)
+ self.assertIn(".github/scripts/recover-demo-runtime.sh", workflow)
+ self.assertIn("Verify public health", workflow)
+ self.assertIn("Verify public frontend parity", workflow)
+ self.assertIn("./scripts/run_demo_public_browser_smoke.sh", workflow)
+ self.assertIn("Compensate failed mutated recovery", workflow)
+ self.assertIn("sudo systemctl stop pulse", workflow)
+ self.assertIn("Retain bounded recovery evidence", workflow)
+ self.assertNotIn("release-convergence.yml", workflow)
+ self.assertNotIn("install.sh", workflow)
+ self.assertNotIn("scp ", workflow)
+
+ self.assertIn('if [ "$#" -ne 6 ]', recovery)
+ self.assertIn('SERVICE_NAME="pulse"', recovery)
+ self.assertIn('RELAY_SERVICE_NAME="pulse-relay"', recovery)
+ self.assertIn('EXPECTED_BINARY="/opt/pulse/bin/pulse"', recovery)
+ self.assertIn('EXPECTED_UNIT="/etc/systemd/system/pulse.service"', recovery)
+ self.assertIn('set_env_value PULSE_MOCK_NODES "$MOCK_NODES"', recovery)
+ self.assertIn('set_env_value PULSE_MOCK_TRENDS_SEED_DURATION "$MOCK_SEED_DURATION"', recovery)
+ self.assertIn('set_env_value PULSE_MOCK_UPDATE_INTERVAL "$MOCK_UPDATE_INTERVAL"', recovery)
+ self.assertIn('sudo systemctl restart "$SERVICE_NAME"', recovery)
+ self.assertIn('sudo systemctl stop "$SERVICE_NAME"', recovery)
+ self.assertIn('AFTER_RELAY_PID" = "$BEFORE_RELAY_PID', recovery)
+ self.assertIn('AFTER_BINARY_SHA" = "$BEFORE_BINARY_SHA', recovery)
+ self.assertIn('AFTER_UNIT_SHA" = "$BEFORE_UNIT_SHA', recovery)
+ self.assertIn('AFTER_DROPINS_SHA" = "$BEFORE_DROPINS_SHA', recovery)
+ self.assertNotIn('AFTER_CONFIG_SHA" = "$BEFORE_CONFIG_SHA', recovery)
+ self.assertIn("/etc/pulse/.env /etc/pulse/billing.json", recovery)
+ self.assertIn("restore_runtime_config", recovery)
+ self.assertIn("sudo cp --archive", recovery)
+ self.assertNotIn("eval ", recovery)
+ self.assertNotIn("sudo bash", recovery)
+
def test_blocked_record_tracks_current_target_and_candidate_version(self) -> None:
blocked_record_surface = {
"VERSION",