Files
Pulse/scripts/installtests
rcourtman 1404126afc Harden updater disk/download handling and warn on ephemeral /data (#4793)
## Why
2026-11-20 production telemetry showed two major operational failure
modes:
- **9.4%** of in-app updates failed over 30 days (394/4,182), led by
`disk_space` (113) and `download` (87).
- **11.5-18.5%** of persistent Docker installs never activated (vs 3.3%
on binary installs), frequently because containers run without a mounted
`/data` volume and silently lose state on recreate.

## What changed
- **Pre-update space reclamation (`internal/updates/manager.go`)**:
Prune stale `pulse-update-*` temp directories (older than 1 hour) and
expired retained backups *before* allocating update staging space, and
remove the downloaded archive immediately after extraction so pre-update
backups have maximum headroom on small LXC/single-disk installs.
- **Smarter temp-root & extraction headroom
(`internal/updates/manager.go`)**: Choose the managed temp root with the
largest free space for ephemeral staging (while preserving `dataDir`
priority for persistent rollback backups), and fall back to an alternate
managed temp root during extraction if the download root fills up.
- **Mid-stream download retry (`internal/updates/manager.go`)**: Retry
transient mid-stream disconnects, per-attempt client timeouts (when
caller context is active), and truncated transfers (`written !=
ContentLength`) up to `updateHTTPAttempts` times, cleaning up partial
files on every retry or failure.
- **Docker ephemeral `/data` warning (`docker-entrypoint.sh`)**: Check
`/proc/self/mountinfo` (with device-ID fallback) for the active
`PULSE_DATA_DIR` (or an ancestor mount) and log a clear non-fatal stderr
warning with `-v pulse-data:/data` unless
`PULSE_SUPPRESS_EPHEMERAL_DATA_WARNING` is set.
- **Tests & canonical contracts**: Added targeted tests in
`internal/updates/manager_retry_test.go`,
`internal/updates/manager_backup_runtime_test.go`, and
`scripts/installtests/docker_entrypoint_test.go`; updated
`deployment-installability.md` and `monitoring.md`.

## Verification
- `pulse-dev-validate`: full `go test -count=1 ./internal/updates/...`
and `go test -count=1 -v ./scripts/installtests -run
TestDockerEntrypoint` passed.
- `pulse-dev-validate`: canonical `.husky/pre-commit`, `commit-msg`, and
`.husky/pre-push` gates passed.
2026-11-21 09:24:18 +00:00
..