mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-11-28 16:58:31 +01:00
Document the hardened configuration-import authority boundary
(KeepAccessCredentials / accessCredentialsRestored=false) and tenant
outbound and Apprise CLI refusals from 83f17f12d2 in MIGRATION.md, plus
the 31 March 2027 Pulse Mobile/Relay retirement path.
Update ZFS_MONITORING.md to link TRUENAS.md, use the live NodeDrawer
Details -> Storage disclosure label, and list all pool critical states
(FAULTED, OFFLINE, REMOVED, UNAVAIL, SUSPENDED) and individual ZFS
device alerts from storagehealth and alerts.
Resolve the stale request-assisted MSP contradiction in
DEPLOYMENT_MODELS.md and PULSE_PRO.md against MSP.md, and add the six
omitted persisted config files plus optional split-port agent ingest to
DEPLOYMENT_MODELS.md.
Add source-bound documentation regression tests covering all four guides
and their shipped frontend-modern/public/docs/ mirrors.
Contract-Neutral: Documentation and shipped in-app Help alignment with existing runtime behavior; no runtime, API, or subsystem contract delta.
Change-source: pulse-maintainer
208 lines
12 KiB
Python
208 lines
12 KiB
Python
#!/usr/bin/env python3
|
|
"""Keep the deployment entry point from bypassing the safe update procedures.
|
|
|
|
These are documentation regression checks, not installed update/restore proof.
|
|
The linked Compose recipe has executable controls in test_update_recovery_docs;
|
|
the production Docs navigation is exercised by deployment-update-help.cjs.
|
|
"""
|
|
|
|
from pathlib import Path
|
|
import re
|
|
import unittest
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
|
|
|
|
def guide(name):
|
|
return (ROOT / "docs" / f"{name}.md").read_text(encoding="utf-8")
|
|
|
|
|
|
def overview():
|
|
return guide("DEPLOYMENT_MODELS")
|
|
|
|
|
|
class DeploymentUpdateDocsTest(unittest.TestCase):
|
|
def test_docker_summary_routes_to_recreation_not_a_restart(self):
|
|
summary = overview().split("## Summary\n", 1)[1].split("\n## ", 1)[0]
|
|
rows = [line for line in summary.splitlines() if line.startswith("| Docker |")]
|
|
self.assertEqual(len(rows), 1)
|
|
cells = [cell.strip() for cell in rows[0].strip("|").split("|")]
|
|
self.assertEqual(cells[:3], ["Docker", "Quick evaluation and container stacks",
|
|
"`/data` (bind mount / volume)"])
|
|
self.assertEqual(cells[3], "[Pull + recreate](#docker)")
|
|
# Keep the short entry connected to the existing state-preserving
|
|
# procedure rather than adding a second update recipe to the table.
|
|
docker = overview().split("### Docker\n", 1)[1].split("\n### ", 1)[0]
|
|
self.assertIn("](DOCKER.md#-updates)", docker)
|
|
self.assertIn("Pull and recreate only the Pulse service", docker)
|
|
self.assertIn("stopping if the pull fails", docker)
|
|
|
|
def test_shipped_overview_matches_the_reviewed_guide(self):
|
|
self.assertEqual(overview(), (ROOT / "frontend-modern/public/docs/DEPLOYMENT_MODELS.md")
|
|
.read_text(encoding="utf-8"))
|
|
|
|
def test_default_paths_are_not_a_complete_backup_inventory(self):
|
|
text = " ".join(overview().split())
|
|
for phrase in ("Default data/config path", "defaults, not a backup inventory",
|
|
"`PULSE_DATA_DIR`", "external stores", "`PULSE_METRICS_DB_PATH`"):
|
|
self.assertIn(phrase, text)
|
|
self.assertIn("METRICS_HISTORY.md#storage-location", text)
|
|
self.assertIn("AUDIT_LOGGING.md#storage", text)
|
|
|
|
def test_backup_and_rollback_claims_preserve_state_and_limits(self):
|
|
text = " ".join(overview().split())
|
|
for phrase in ("running version and edition", "consistent private backup",
|
|
"matching `.encryption.key` and audit signing key",
|
|
"stopped, consistent filesystem/volume backup", "SQLite sidecar files",
|
|
"Do not post configuration files, environment dumps or Helm secret values",
|
|
"snapshot is not necessarily a complete data backup",
|
|
"does not undo data migrations", "backup path alone does not establish",
|
|
"Keep the failed state", "before retrying a failed update"):
|
|
self.assertIn(phrase, text)
|
|
self.assertNotIn("swapping binaries/config safely", text)
|
|
|
|
def test_overview_routes_to_the_maintained_procedures_not_a_shortcut(self):
|
|
updates = overview().split("## Updates by Model", 1)[1]
|
|
# A second shorthand can skip durable image selection, backup checks,
|
|
# fail-fast pulling or the actual release/namespace and saved values.
|
|
self.assertNotRegex(updates, r"```(?:bash|sh|shell)\b")
|
|
for link in ("AUTO_UPDATE.md#rollback", "AUTO_UPDATE.md", "DOCKER.md#-updates",
|
|
"KUBERNETES.md"):
|
|
self.assertIn(f"]({link})", updates)
|
|
self.assertTrue((ROOT / "frontend-modern/public/docs" / link.split("#")[0]).is_file())
|
|
self.assertIn("## 🔄 Updates", guide("DOCKER"))
|
|
self.assertIn("## Rollback", guide("AUTO_UPDATE"))
|
|
|
|
def test_deployment_specific_context_survives_the_handoff(self):
|
|
updates = " ".join(overview().split("## Updates by Model", 1)[1].split())
|
|
for phrase in ("inside the container, not on the Proxmox host",
|
|
"original Compose project", "Persist the exact target",
|
|
"pulling a different tag alone does not change the configured image",
|
|
"Paid Pro installs must keep their private image",
|
|
"only the Pulse service, stopping if the pull fails",
|
|
"no need to restart unrelated Compose services",
|
|
"existing Helm release and namespace", "chosen chart version",
|
|
"saved deployment values", "current PVC, keys and settings",
|
|
"does not guarantee restoration of Pulse data"):
|
|
self.assertIn(phrase, updates)
|
|
|
|
def test_memory_limited_lxc_baseline_precedes_the_update_action(self):
|
|
linux = overview().split("### systemd and Proxmox LXC\n", 1)[1].split(
|
|
"\n### Docker", 1)[0]
|
|
before, action, after = linux.partition("**Settings → System → Updates**")
|
|
self.assertTrue(action)
|
|
self.assertIn("[server update guidance](AUTO_UPDATE.md)", after)
|
|
self.assertIn("inside the container, not on the Proxmox host", " ".join(after.split()))
|
|
before = " ".join(before.split())
|
|
for detail in ("**before** starting the update", "Pulse version and uptime",
|
|
"usual busy polls", "peak memory for that window",
|
|
"process RSS separate", "guest History timestamp",
|
|
"archive count and date at an existing backup location",
|
|
"same length at similar uptime",
|
|
"same limit, swap allowance and workload",
|
|
"leave memory headroom unverified",
|
|
"Do not change limits, reset counters or start another backup"):
|
|
with self.subTest(detail=detail):
|
|
self.assertIn(detail, before)
|
|
|
|
def test_install_entry_point_has_no_unscoped_update_shortcuts(self):
|
|
install = guide("INSTALL").split("#### Manual Update\n", 1)[1].split(
|
|
"\n### Pulse Agent updates", 1)[0]
|
|
for shortcut in ("docker compose pull &&", "docker compose up -d`",
|
|
"helm repo update &&", "docker stop pulse && docker rm pulse",
|
|
"re-run your original `docker run` command"):
|
|
with self.subTest(shortcut=shortcut):
|
|
self.assertNotIn(shortcut, install)
|
|
for link in ("DOCKER.md#-updates", "DEPLOYMENT_MODELS.md#kubernetes-helm",
|
|
"DEPLOYMENT_MODELS.md#updates-by-model",
|
|
"MIGRATION.md#full-state-recovery", "#rollback"):
|
|
with self.subTest(link=link):
|
|
self.assertIn(f"]({link})", install)
|
|
self.assertIn("`sudo /bin/update`", install)
|
|
self.assertIn("helper is absent or its owner is unknown", install)
|
|
|
|
def test_manual_linux_update_keeps_community_and_pro_routes_separate(self):
|
|
manual = guide("INSTALL").split("#### Manual Update\n", 1)[1].split(
|
|
"\n### Pulse Agent updates", 1)[0]
|
|
platform = "| **Systemd / Proxmox LXC** |"
|
|
rows = [line for line in manual.splitlines() if line.startswith(platform)]
|
|
self.assertEqual(len(rows), 1)
|
|
self.assertLess(manual.index("MIGRATION.md#full-state-recovery"), manual.index(rows[0]))
|
|
procedure = rows[0].removeprefix(platform).strip().removesuffix("|").strip()
|
|
community, separator, pro = procedure.partition("**Pro:**")
|
|
self.assertEqual(community.strip(), "**Community:** `sudo /bin/update` (Pulse-owned helper only).")
|
|
self.assertTrue(separator, "Manual Linux updates need an explicit Pro route")
|
|
self.assertIn("matching signed Linux archive", pro)
|
|
self.assertIn("[Pulse Pro downloads](https://pulserelay.pro/download.html)", pro)
|
|
self.assertEqual(manual.count("`sudo /bin/update`"), 1)
|
|
self.assertIn(
|
|
"For an exact Community target, use `/bin/update --version vX.Y.Z` only when the "
|
|
"Pulse server installer installed that helper.",
|
|
" ".join(manual.split()),
|
|
)
|
|
|
|
def test_install_update_preserves_storage_edition_and_failure_evidence(self):
|
|
install = " ".join(guide("INSTALL").split("#### Manual Update\n", 1)[1].split(
|
|
"\n### Pulse Agent updates", 1)[0].split())
|
|
for phrase in ("interrupts monitoring and alert delivery",
|
|
"running version and edition", "deployment definition privately",
|
|
"every effective data path with its matching keys",
|
|
"not a complete data backup", "only the Pulse service",
|
|
"existing release, namespace, saved values and PVC",
|
|
"chosen chart version and image edition",
|
|
"pull it successfully before stopping",
|
|
"same data mount, ports, credentials and other settings",
|
|
"not a fresh example command", "container's writable layer",
|
|
"anonymous volume", "`--rm`", "stop here until",
|
|
"Do not delete or prune volumes", "start a second Pulse",
|
|
"ordinary monitoring and alert delivery",
|
|
"check the current state before retrying",
|
|
"reverting an image restores data",
|
|
"are Community builds, even with a matching version and valid signature",
|
|
"Keep your current Pro runtime until the matching private image or signed Linux archive "
|
|
"is available from [Pulse Pro downloads](https://pulserelay.pro/download.html)",
|
|
"A public build removes the private runtime hooks"):
|
|
with self.subTest(phrase=phrase):
|
|
self.assertIn(phrase, install)
|
|
|
|
def test_install_shipped_copy_matches_the_checked_update_entry_point(self):
|
|
self.assertEqual(guide("INSTALL"),
|
|
(ROOT / "frontend-modern/public/docs/INSTALL.md").read_text())
|
|
|
|
def test_config_inventory_ports_and_msp_self_serve_match_runtime(self):
|
|
text = " ".join(overview().split())
|
|
persistence = (ROOT / "internal/config/persistence.go").read_text(encoding="utf-8")
|
|
for filename in (
|
|
"alerts.json",
|
|
"alert_intent_policies.json",
|
|
"deadman.enc",
|
|
"vmware.enc",
|
|
"availability_targets.enc",
|
|
"report_schedules.json",
|
|
"truenas.enc",
|
|
):
|
|
with self.subTest(filename=filename):
|
|
self.assertIn(f'resolveLeaf("{filename}")', persistence)
|
|
self.assertIn(f"`{filename}`", text)
|
|
self.assertIn("PULSE_AGENT_INGEST_PORT", text)
|
|
self.assertIn("31 March 2027", text)
|
|
for doc_name in ("DEPLOYMENT_MODELS", "PULSE_PRO"):
|
|
with self.subTest(doc=doc_name):
|
|
doc_text = " ".join(guide(doc_name).split())
|
|
self.assertEqual(
|
|
guide(doc_name),
|
|
(ROOT / "frontend-modern/public/docs" / f"{doc_name}.md").read_text(encoding="utf-8"),
|
|
)
|
|
self.assertIn("60-day, two-workspace evaluation", doc_text)
|
|
self.assertIn("self-serve", doc_text)
|
|
self.assertIn("MSP.md", doc_text)
|
|
self.assertNotIn("Provider-hosted MSP is request-assisted", doc_text)
|
|
self.assertNotIn("Access is request-assisted while MSP is staged for rollout", doc_text)
|
|
msp = " ".join(guide("MSP").split())
|
|
self.assertIn("60-day, two-workspace evaluation and every paid plan are self-service", msp)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|