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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Admit archive binaries before stopping Pulse and replace them atomically
pulse-triage[bot]c0772f0d7d47
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.mdindex 4ee954dbc9..cd2f359277 100644--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md@@ -15,29 +15,46 @@## Purpose-### Server replacement requires a confirmed inactive service--The server installer's archive and source-build paths stage their inputs before-stopping Pulse. Manual version changes, menu updates and reinstalls must not stop-the service before staging, so a download/build failure does not create an outage.-Immediately before binary replacement, the detected service must return an-explicit `inactive` state. An `active` or `failed` unit is stopped with the-existing five-second command bound and read back; only an `inactive` result+### Server replacement requires admitted bytes and a confirmed inactive service++The server installer's archive path verifies the signature, extracts the+payload, checks its target architecture, copies the executable to a private+staging directory on the destination filesystem, sets its permissions/owner,+and checks its successful, five-second-bounded version result **before**+stopping Pulse. A missing/unreadable or mismatched version fails admission.+This applies to downloads and local `--archive` inputs; rejected local archives+are retained. No failed admission changes installed binary bytes/modes,+VERSION, source-build marker or persistent configuration. Temporary extraction+and executable staging are removed. Signed-file checks remain mandatory.++Manual version changes, menu updates and reinstalls must not stop the service+before archive admission or source compilation, so staging failures do not+create an outage. Immediately before binary replacement, the detected service+must return an explicit `inactive` state. An `active` or `failed` unit is stopped+with the existing five-second command bound and read back; only `inactive`admits replacement. A failed unit does not imply prior workload liveness.Failed/timed-out reads or stops, transitional states and malformed/empty results-refuse replacement without an automatic restart or retry. Retain the installed-binary, version and source-build marker on this refusal; temporary downloaded-archives are cleaned up. Preserve the prior-active flag across a successful stop-for the existing post-update liveness check. This does not establish restoration-after a later installation failure, filesystem/data rollback or native systemd-acceptance.--`scripts/tests/test_server_installer_stop.py` exercises both real replacement-paths with fixture-only external producers and a local service-command shim,-including actual command timeouts, bytes/modes, liveness attribution and all-three manual staging-failure flows. The existing root-installer ordering and-update-resilience tests remain independent controls.+refuse replacement without an automatic restart or retry. The archive path+atomically renames its fully prepared executable over the live path, rather than+moving away the old executable or retrying extraction after deleting it. A+failed rename leaves the previous binary and metadata intact; only a service+confirmed stopped after being `active` is started again, with bounded active+readback. An inactive/failed service is not started by this failure recovery.+Recovery cannot turn the failed update into success. Successful replacement+preserves prior-active attribution for the existing post-update liveness check.++`scripts/tests/test_server_installer_stop.py` now executes the actual archive+installer with real tar/copy/rename bytes and fixture-only signing/architecture,+service and ownership boundaries. Download/local admission failures, partial+staging copies, version exits/timeouts, uncertain stops, atomic rename faults,+prior-active-only recovery/readback and retained bytes/modes/configuration are+checked, along with source-build and all three manual staging-failure flows.+The existing root-installer ordering and update-resilience tests remain+independent controls. These ordinary-user fixtures do not establish signature+cryptography, native systemd/installed upgrade acceptance, ancillary-agent+transaction rollback or filesystem/data rollback; those obligations remain+separate.### Shipped documentation is checked before CI dependency workdiff --git a/install.sh b/install.shindex 2e92d00cb9..97672c02a5 100755--- a/install.sh+++ b/install.sh@@ -628,6 +628,21 @@ stop_pulse_for_replacement() {esac}+# Called only after a confirmed stop and a failed atomic rename. The previous+# executable is still in place. An uncertain stop never reaches this recovery,+# and an intentionally inactive/failed service must not be started for the user.+recover_pulse_after_failed_replacement() {+ local service_name="$1"+ [[ "$PULSE_WAS_ACTIVE" == "true" ]] || return 0+ if safe_systemctl start "$service_name" && wait_for_service_active "$service_name" 20; then+ PULSE_WAS_ACTIVE="false"+ print_info "Previous Pulse binary is running again; the update failed"+ else+ print_error "The update failed and the previous Pulse service could not be confirmed running. Check systemctl status $service_name before retrying."+ return 1+ fi+}+# Detect existing service name (pulse or pulse-backend)detect_service_name() {if [[ "$SERVICE_NAME_EXPLICIT" == "true" ]]; then@@ -3326,7 +3341,9 @@ install_pulse_archive() {local expected_release="${2:-}"local signature_path="${archive_path}.sshsig"local temp_extract=""- local temp_extract2=""+ local binary_stage=""+ local version_output=""+ local service_name=""local installed_version=""local pulse_binary_path=""local target_arch=""@@ -3356,7 +3373,10 @@ install_pulse_archive() {expected_release=$(infer_release_from_archive_name "$archive_path" 2>/dev/null || true)fi- temp_extract=$(mktemp -d /tmp/pulse-extract-XXXXXX)+ if ! temp_extract=$(mktemp -d /tmp/pulse-extract-XXXXXX); then+ print_error "Could not prepare archive extraction; Pulse has not been stopped"+ return 1+ fi# --no-same-owner: do not honor uid/gid stored in the archive (extract as root, owned by root)# --no-overwrite-dir: refuse to replace existing directory metadata with archive entriesif ! tar --no-same-owner --no-overwrite-dir -xzf "$archive_path" -C "$temp_extract"; then@@ -3384,33 +3404,52 @@ install_pulse_archive() {return 1fi- mkdir -p "$INSTALL_DIR/bin"-- if [[ -f "$INSTALL_DIR/bin/pulse" ]]; then- mv "$INSTALL_DIR/bin/pulse" "$INSTALL_DIR/bin/pulse.old" 2>/dev/null || true+ # Prepare the final executable on the destination filesystem while the old+ # service keeps running. Copy/permissions/version failures must not create+ # an outage, and rename must never expose a partially copied live binary.+ if ! mkdir -p "$INSTALL_DIR/bin" || ! binary_stage=$(mktemp -d "$INSTALL_DIR/bin/.pulse-stage-XXXXXX"); then+ print_error "Could not stage the Pulse binary; Pulse has not been stopped"+ rm -rf "$temp_extract"+ return 1+ fi+ if ! cp "$pulse_binary_path" "$binary_stage/pulse" || ! chmod 755 "$binary_stage/pulse" || ! chown pulse:pulse "$binary_stage/pulse"; then+ print_error "Could not prepare the Pulse binary; Pulse has not been stopped"+ rm -rf "$binary_stage" "$temp_extract"+ return 1+ fi+ if ! version_output=$(timeout 5 "$binary_stage/pulse" --version 2>/dev/null); then+ print_error "Staged Pulse binary could not report its version; Pulse has not been stopped"+ rm -rf "$binary_stage" "$temp_extract"+ return 1+ fi+ installed_version=$(printf '%s\n' "$version_output" | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9\.]+)?' | head -1 || true)+ if [[ -z "$installed_version" || ( -n "$expected_release" && "$installed_version" != "$expected_release" ) ]]; then+ print_error "Staged Pulse version ${installed_version:-unknown} does not match ${expected_release:-a release version}; Pulse has not been stopped"+ rm -rf "$binary_stage" "$temp_extract"+ return 1fi- if ! cp "$pulse_binary_path" "$INSTALL_DIR/bin/pulse"; then- print_error "Failed to copy new binary to $INSTALL_DIR/bin/pulse"- [[ -f "$INSTALL_DIR/bin/pulse.old" ]] && mv "$INSTALL_DIR/bin/pulse.old" "$INSTALL_DIR/bin/pulse"- rm -rf "$temp_extract"+ service_name=$(detect_service_name)+ PULSE_WAS_ACTIVE="false"+ if ! stop_pulse_for_replacement "$service_name"; then+ rm -rf "$binary_stage" "$temp_extract"return 1fi- if [[ ! -f "$INSTALL_DIR/bin/pulse" ]]; then- print_error "Binary installation failed - file not found after copy"- [[ -f "$INSTALL_DIR/bin/pulse.old" ]] && mv "$INSTALL_DIR/bin/pulse.old" "$INSTALL_DIR/bin/pulse"- rm -rf "$temp_extract"+ # Both paths are on the same filesystem. If rename fails the old binary is+ # untouched; do not move it aside, delete it or re-extract an admitted file.+ if ! mv -fT "$binary_stage/pulse" "$INSTALL_DIR/bin/pulse"; then+ print_error "Failed to replace Pulse; the previous binary is unchanged"+ rm -rf "$binary_stage" "$temp_extract"+ recover_pulse_after_failed_replacement "$service_name"return 1fi+ rm -rf "$binary_stage"install_additional_agent_binaries "$expected_release" "$temp_extract"deploy_agent_scripts "$temp_extract"-- chmod +x "$INSTALL_DIR/bin/pulse"chown -R pulse:pulse "$INSTALL_DIR"- rm -f "$INSTALL_DIR/bin/pulse.old"print_success "Pulse binary installed to $INSTALL_DIR/bin/pulse"install_binary_symlink "$INSTALL_DIR/bin/pulse" "$BINARY_LINK_PATH"@@ -3418,43 +3457,7 @@ install_pulse_archive() {cp "$temp_extract/VERSION" "$INSTALL_DIR/VERSION"chown pulse:pulse "$INSTALL_DIR/VERSION"fi-- installed_version=$("$INSTALL_DIR/bin/pulse" --version 2>/dev/null | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9\.]+)?' | head -1 || echo "unknown")- if [[ -n "$expected_release" && "$installed_version" != "$expected_release" ]]; then- print_warn "Version verification issue: Expected $expected_release but binary reports $installed_version"- print_info "This can happen if the binary wasn't properly replaced. Trying to fix..."-- rm -f "$INSTALL_DIR/bin/pulse"- temp_extract2=$(mktemp -d /tmp/pulse-extract2-XXXXXX)- if ! tar --no-same-owner --no-overwrite-dir -xzf "$archive_path" -C "$temp_extract2"; then- print_warn "Failed to re-extract archive for version verification retry"- else- pulse_binary_path=$(find_pulse_binary_in_dir "$temp_extract2" 2>/dev/null || true)- if [[ -n "$pulse_binary_path" ]]; then- cp -f "$pulse_binary_path" "$INSTALL_DIR/bin/pulse"- fi-- install_additional_agent_binaries "$expected_release" "$temp_extract2"- deploy_agent_scripts "$temp_extract2"-- chmod +x "$INSTALL_DIR/bin/pulse"- chown -R pulse:pulse "$INSTALL_DIR"- fi- rm -rf "$temp_extract2"-- installed_version=$("$INSTALL_DIR/bin/pulse" --version 2>/dev/null | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9\.]+)?' | head -1 || echo "unknown")- if [[ "$installed_version" == "$expected_release" ]]; then- print_success "Version issue resolved - now running $installed_version"- else- print_warn "Version mismatch persists. You may need to restart the service or reboot."- fi- elif [[ -n "$expected_release" ]]; then- print_success "Version verified: $installed_version"- elif [[ "$installed_version" != "unknown" ]]; then- print_success "Version installed: $installed_version"- else- print_warn "Installed Pulse version could not be verified"- fi+ print_success "Version verified: $installed_version"restore_selinux_contextsrm -rf "$temp_extract"@@ -3543,15 +3546,8 @@ download_pulse() {exit 1fi- # Stage first, then require a confirmed stop before any binary replacement.- EXISTING_SERVICE=$(detect_service_name)- if ! stop_pulse_for_replacement "$EXISTING_SERVICE"; then- if [[ "$archive_from_temp" == "true" ]]; then- rm -f "$archive_path" "${archive_path}.sshsig"- fi- exit 1- fi-+ # Archive admission and destination staging own the confirmed stop:+ # local signature/content/architecture/version failures leave Pulse up.if ! install_pulse_archive "$archive_path" "$expected_release"; thenif [[ "$archive_from_temp" == "true" ]]; thenrm -f "$archive_path" "${archive_path}.sshsig"diff --git a/scripts/installtests/root_install_sh_test.go b/scripts/installtests/root_install_sh_test.goindex be92bb2678..9d1bb38749 100644--- a/scripts/installtests/root_install_sh_test.go+++ b/scripts/installtests/root_install_sh_test.go@@ -112,7 +112,6 @@ func TestRootInstallScriptStagesUpdateBeforeStoppingService(t *testing.T) {`ensure_update_disk_headroom "/tmp" "$INSTALL_DIR"`,`download_release_archive "$LATEST_RELEASE" "$pulse_arch" "$archive_path"`,`run_upgrade_readiness_preflight "$CURRENT_VERSION" "$expected_release"`,- `stop_pulse_for_replacement "$EXISTING_SERVICE"`,`install_pulse_archive "$archive_path" "$expected_release"`,}@@ -127,6 +126,29 @@ func TestRootInstallScriptStagesUpdateBeforeStoppingService(t *testing.T) {}previous = position}+ if strings.Contains(downloadPulse, "stop_pulse_for_replacement") {+ t.Fatal("download_pulse must not stop Pulse before archive admission")+ }+ archiveInstall := extractRootInstallShellFunction(t, "install_pulse_archive")+ previous = -1+ for _, step := range []string{+ `verify_release_signature "$archive_path"`,+ `tar --no-same-owner --no-overwrite-dir -xzf`,+ `validate_pulse_binary_architecture "$pulse_binary_path"`,+ `cp "$pulse_binary_path" "$binary_stage/pulse"`,+ `timeout 5 "$binary_stage/pulse" --version`,+ `stop_pulse_for_replacement "$service_name"`,+ `mv -fT "$binary_stage/pulse" "$INSTALL_DIR/bin/pulse"`,+ } {+ position := strings.Index(archiveInstall, step)+ if position <= previous {+ t.Fatalf("archive admission/replacement steps are out of order or missing at %s", step)+ }+ previous = position+ }+ if strings.Contains(archiveInstall, "pulse.old") || strings.Contains(archiveInstall, "temp_extract2") {+ t.Fatal("archive replacement must not move/delete the old binary or blindly re-extract")+ }}func TestRootInstallScriptInstallsSignatureVerificationDependencies(t *testing.T) {diff --git a/scripts/tests/test_server_installer_stop.py b/scripts/tests/test_server_installer_stop.pyindex 6053837e29..aa1dae482b 100644--- a/scripts/tests/test_server_installer_stop.py+++ b/scripts/tests/test_server_installer_stop.py@@ -8,6 +8,7 @@ from pathlib import Pathimport osimport subprocessimport tempfile+import tarfileimport unittest@@ -38,7 +39,11 @@ case "$1" inesacfi;;- is-active) [[ "$CASE" != inactive && "$CASE" != failed ]] ;;+ is-active) [[ -f "$FIXTURE/restarted" ]] ;;+ start)+ [[ "$FAULT" != recovery_start ]] || exit 1+ [[ "$FAULT" == recovery_inactive ]] || touch "$FIXTURE/restarted"+ ;;stop)case "$CASE" instop_error) exit 1 ;;@@ -58,7 +63,7 @@ BUILD_FROM_SOURCE_MARKER="$INSTALL_DIR/BUILD_FROM_SOURCE"BINARY_LINK_PATH="$FIXTURE/link"CURRENT_VERSION=v6.5.0PULSE_WAS_ACTIVE=false-print_info() { :; }+print_info() { echo "$*"; }print_success() { :; }print_error() { echo "$*" >&2; }detect_service_name() { echo pulse-custom; }@@ -69,12 +74,47 @@ detect_pulse_architecture() { echo amd64; }run_upgrade_readiness_preflight() { return 0; }resolve_target_release() { LATEST_RELEASE=v6.6.0; }create_temp_archive_path() { printf '%s\n' "$FIXTURE/archive.tgz"; }-download_release_archive() { touch "$3" "${3}.sshsig"; }-install_pulse_archive() {- echo REPLACED >> "$FIXTURE/calls"- cp "$FIXTURE/new-binary" "$INSTALL_DIR/bin/pulse"- echo v6.6.0 > "$INSTALL_DIR/VERSION"+download_release_archive() {+ command cp "$FIXTURE/input.tgz" "$3"+ [[ "$FAULT" == missing_signature ]] || touch "${3}.sshsig"+}+verify_release_signature() {+ echo SIGNATURE >> "$FIXTURE/calls"+ [[ "$FAULT" != signature ]]+}+validate_pulse_binary_architecture() {+ echo ARCHITECTURE >> "$FIXTURE/calls"+ [[ "$FAULT" != architecture ]]+}+install_additional_agent_binaries() { echo AGENTS >> "$FIXTURE/calls"; }+deploy_agent_scripts() { echo SCRIPTS >> "$FIXTURE/calls"; }+restore_selinux_contexts() { :; }+cp() {+ if [[ "$*" == *'.pulse-stage-'* && "$FAULT" == copy ]]; then+ printf partial > "${@: -1}"+ return 1+ fi+ command cp "$@"+}+chmod() {+ [[ "$FAULT" != permissions ]] || return 1+ command chmod "$@"}+mktemp() {+ [[ "$FAULT" != extract_directory || "$*" != *pulse-extract-* ]] || return 1+ [[ "$FAULT" != stage_directory || "$*" != *'.pulse-stage-'* ]] || return 1+ local created+ created=$(command mktemp "$@") || return 1+ printf '%s\n' "$created" >> "$FIXTURE/temporary-paths"+ printf '%s\n' "$created"+}+mv() {+ echo RENAME >> "$FIXTURE/calls"+ case "$FAULT" in rename|recovery_start|recovery_inactive) return 1 ;; esac+ command mv "$@"+}+sleep() { :; }+apt-get() { return 0; }go() { echo 'go version go1.99.0 linux/amd64'; }npm() { return 0; }@@ -88,9 +128,13 @@ git() {echo abc1234fi}-chown() { return 0; }+chown() { [[ "$FAULT" != ownership ]]; }install_binary_symlink() { echo REPLACED >> "$FIXTURE/calls"; }-if [[ "$FLOW" == archive ]]; then+if [[ "$FLOW" == archive || "$FLOW" == local_archive ]]; then+ if [[ "$FLOW" == local_archive ]]; then+ ARCHIVE_OVERRIDE="$FIXTURE/input.tgz"+ FORCE_VERSION=v6.6.0+ fidownload_pulseelsebuild_from_source fixture@@ -127,7 +171,7 @@ mainclass ServerInstallerStopTest(unittest.TestCase):- def exercise(self, script, flow, case):+ def exercise(self, script, flow, case, fault=""):with tempfile.TemporaryDirectory() as temporary:fixture = Path(temporary)(fixture / "bin").mkdir()@@ -143,16 +187,39 @@ class ServerInstallerStopTest(unittest.TestCase):for path, content in originals.items():path.write_bytes(content)path.chmod(0o600)- (fixture / "new-binary").write_bytes(b"new executable\n")+ new_binary = b"#!/bin/sh\necho VERSION_PROBE >> \"$FIXTURE/calls\"\n"+ if fault == "version_timeout":+ new_binary += b"sleep 10\n"+ elif fault == "version_exit":+ new_binary += b"echo v6.6.0; exit 1\n"+ else:+ version = "v6.5.0" if fault == "version_mismatch" else "unknown" if fault == "version_unknown" else "v6.6.0"+ new_binary += ("echo " + version + "\n").encode()+ (fixture / "new-binary").write_bytes(new_binary)+ (fixture / "new-binary").chmod(0o700)+ with tarfile.open(fixture / "input.tgz", "w:gz") as archive:+ if fault != "missing_binary":+ archive.add(fixture / "new-binary", arcname="bin/pulse")+ version_file = fixture / "candidate-version"+ version_file.write_text("v6.6.0\n")+ archive.add(version_file, arcname="VERSION")+ if fault != "missing_signature":+ (fixture / "input.tgz.sshsig").touch()+ if fault == "extraction":+ (fixture / "input.tgz").write_bytes(b"not a tarball")(fixture / "bin/systemctl").write_text(SYSTEMCTL)(fixture / "bin/systemctl").chmod(0o700)env = {**os.environ, "FIXTURE": str(fixture), "CASE": case,- "FLOW": flow, "INSTALLER": str(INSTALLER),+ "FLOW": flow, "INSTALLER": str(INSTALLER), "FAULT": fault,"PATH": str(fixture / "bin") + ":" + os.environ["PATH"]}result = subprocess.run(["bash", "-c", script], env=env,capture_output=True, text=True, timeout=30)return {"result": result,+ "new_binary": new_binary,+ "stage_paths": list(installed.glob("bin/.pulse-stage-*")),+ "temporary_paths_remaining": [p for p in (fixture / "temporary-paths").read_text().splitlines() if Path(p).exists()] if (fixture / "temporary-paths").exists() else [],+ "local_archive_retained": (fixture / "input.tgz").exists(),"files": {str(p.relative_to(fixture)): p.read_bytes() if p.exists() else None for p in originals},"modes": {str(p.relative_to(fixture)): p.stat().st_mode & 0o777 if p.exists() else None for p in originals},"originals": {str(p.relative_to(fixture)): b for p, b in originals.items()},@@ -173,6 +240,9 @@ class ServerInstallerStopTest(unittest.TestCase):self.assertEqual(observation["files"], observation["originals"])self.assertTrue(all(m == 0o600 for m in observation["modes"].values()))self.assertNotIn("REPLACED", observation["calls"])+ self.assertNotIn("RENAME", observation["calls"])+ self.assertEqual(observation["stage_paths"], [])+ self.assertEqual(observation["temporary_paths_remaining"], [])self.assertNotRegex(observation["calls"], r"(?m)^(start|restart)\b")self.assertFalse(observation["archive_retained"])@@ -183,12 +253,67 @@ class ServerInstallerStopTest(unittest.TestCase):observation = self.exercise(REPLACEMENT, flow, case)result = observation["result"]self.assertEqual(result.returncode, 0, result.stderr)- self.assertEqual(observation["files"]["install/bin/pulse"], b"new executable\n")+ self.assertEqual(observation["files"]["install/bin/pulse"], observation["new_binary"])self.assertEqual(observation["files"]["config/private-state"], b"fixture persistent state\n")self.assertIn("WAS_ACTIVE=" + str(case == "active").lower(), result.stdout)self.assertEqual(observation["calls"].count("stop pulse-custom"), int(case != "inactive"))self.assertFalse(observation["archive_retained"])+ def test_archive_admission_failures_never_stop_or_mutate_pulse(self):+ for flow in ("archive", "local_archive"):+ for fault in ("missing_signature", "signature", "extract_directory", "extraction",+ "missing_binary", "architecture", "stage_directory", "copy",+ "permissions", "ownership", "version_exit", "version_timeout",+ "version_unknown", "version_mismatch"):+ with self.subTest(flow=flow, fault=fault):+ observation = self.exercise(REPLACEMENT, flow, "active", fault)+ self.assertNotEqual(observation["result"].returncode, 0)+ self.assertEqual(observation["files"], observation["originals"])+ self.assertTrue(all(m == 0o600 for m in observation["modes"].values()))+ self.assertNotRegex(observation["calls"], r"(?m)^(show|stop|start|restart|RENAME|AGENTS|SCRIPTS)\b")+ self.assertEqual(observation["stage_paths"], [])+ self.assertEqual(observation["temporary_paths_remaining"], [])+ self.assertFalse(observation["archive_retained"])+ self.assertTrue(observation["local_archive_retained"])++ def test_atomic_rename_failure_restores_only_a_previously_active_service(self):+ for state in ("active", "inactive", "failed"):+ for fault in ("rename", "recovery_start", "recovery_inactive"):+ with self.subTest(state=state, fault=fault):+ observation = self.exercise(REPLACEMENT, "archive", state, fault)+ result = observation["result"]+ self.assertNotEqual(result.returncode, 0)+ self.assertEqual(observation["files"], observation["originals"])+ self.assertTrue(all(m == 0o600 for m in observation["modes"].values()))+ self.assertEqual(observation["calls"].count("start pulse-custom"), int(state == "active"))+ self.assertNotIn("AGENTS", observation["calls"])+ self.assertNotIn("SCRIPTS", observation["calls"])+ if state == "active":+ if fault == "rename":+ self.assertIn("Previous Pulse binary is running again; the update failed", result.stdout)+ else:+ self.assertIn("could not be confirmed running", result.stderr)+ self.assertEqual(observation["stage_paths"], [])+ self.assertEqual(observation["temporary_paths_remaining"], [])+ self.assertFalse(observation["archive_retained"])++ def test_archive_success_admits_bytes_before_stop_and_commits_once(self):+ observation = self.exercise(REPLACEMENT, "archive", "active")+ self.assertEqual(observation["result"].returncode, 0, observation["result"].stderr)+ calls = observation["calls"]+ self.assertLess(calls.index("SIGNATURE"), calls.index("ARCHITECTURE"))+ self.assertLess(calls.index("ARCHITECTURE"), calls.index("VERSION_PROBE"))+ self.assertLess(calls.index("VERSION_PROBE"), calls.index("stop pulse-custom"))+ self.assertLess(calls.index("stop pulse-custom"), calls.index("RENAME"))+ self.assertLess(calls.index("RENAME"), calls.index("AGENTS"))+ self.assertEqual(calls.count("RENAME"), 1)+ self.assertEqual(calls.count("VERSION_PROBE"), 1)+ self.assertEqual(observation["files"]["install/bin/pulse"], observation["new_binary"])+ self.assertEqual(observation["modes"]["install/bin/pulse"], 0o755)+ self.assertEqual(observation["stage_paths"], [])+ self.assertEqual(observation["temporary_paths_remaining"], [])+ self.assertNotIn("start pulse-custom", calls)+def test_all_manual_update_flows_leave_service_running_when_staging_fails(self):for flow in ("version", "update", "reinstall"):with self.subTest(flow=flow):