Files
Pulse/scripts/tests/test_cloud_migration_docs.py
pulse-triage[bot] 4b51fe15ff Align Unified Resources, Nav, Cloud, Relay, and Upgrade Help with UI
Align five drifted in-app Help guides and their shipped mirrors with
current main:

- docs/UNIFIED_RESOURCES.md: add VMware vSphere (vmware) and Availability
  checks (availability) to Data Sources, add top-level Availability
  (/availability) to Unified Navigation, and document the live
  GET /api/resources filter, pagination, and sort parameters
  (excludeSource, parent, cluster, namespace, page, limit, sort, order).
- docs/MIGRATION_UNIFIED_NAV.md: include Availability, Actions, and the
  live g c keyboard shortcut in the current v6 navigation summary.
- docs/CLOUD.md: remove retired Relay/Pulse Mobile onboarding pitches
  ("Mobile ready", "Set Up Mobile Access"), point phone alerts to ntfy,
  Gotify, or Pushover plus mobile browser access, point existing paired
  phones to Settings -> Security -> Pulse Mobile (/settings/system-relay),
  and match the Restore Configuration -> Restore Backup button label.
- docs/RELAY.md: update all five Settings -> Pulse Mobile paths to the
  shipped sidebar path Settings -> Security -> Pulse Mobile
  (/settings/system-relay).
- docs/UPGRADE_v6.md: point Agent Doctor to its canonical route
  /settings/infrastructure/agent-doctor (noting the legacy ?agentDoctor=1
  link still opens it) and include Availability and Actions in the v6
  top-level navigation summary.

Sync all five frontend-modern/public/docs/ mirrors and extend
scripts/tests/test_navigation_help_docs.py,
scripts/tests/test_cloud_migration_docs.py, and
scripts/tests/test_upgrade_v6_docs.py to bind every change directly to
live Go and TypeScript source.

Contract-Neutral: Aligns in-app Help prose, mirrors, and allowlisted Python doc-regression tests with existing shipped routes, navigation labels, API query parameters, and Pulse Mobile retirement posture with no runtime, API, schema, or subsystem contract changes.
Change-source: pulse-maintainer
2026-11-27 01:44:11 +00:00

108 lines
5.7 KiB
Python

#!/usr/bin/env python3
"""Keep the hosted migration entry point within the actual export/agent scope.
These check instructions, not installed Cloud recovery or provider access.
The real encrypted-archive control is TestConfigurationMigrationArchiveScope.
"""
from pathlib import Path
import unittest
ROOT = Path(__file__).resolve().parents[2]
def guide():
return (ROOT / "docs/CLOUD.md").read_text(encoding="utf-8")
def section(text, heading, level):
return " ".join(text.split(f"{level} {heading}\n", 1)[1].split(f"\n{level} ", 1)[0].split())
class CloudMigrationDocsTest(unittest.TestCase):
def test_in_app_guide_matches_canonical(self):
self.assertEqual(guide(), (ROOT / "frontend-modern/public/docs/CLOUD.md").read_text())
def test_export_scope_is_not_a_portable_installation_promise(self):
text = section(guide(), "Migrating To/From Cloud", "##")
for boundary in (
"not the full installation", "Metrics and audit history",
"incidents and queued notifications", "agent inventory and enrolment state",
"profiles and assignments", "TrueNAS, vSphere and Machine Availability",
"local login credentials or deployment overrides", "exporting version",
"MIGRATION.md#configuration-transfer", "do not reveal the original tokens",
"Hosted automatic backups and this downloaded export are different things",
"Do not assume access to the hosted filesystem", "MIGRATION.md#full-state-recovery",
"Do not mix encrypted files and keys", "Keep exports, passphrases and credentials private",
):
with self.subTest(boundary=boundary):
self.assertIn(boundary, text)
self.assertNotIn("fully portable", guide())
self.assertIn("not a complete copy of the hosted installation",
section(guide(), "Data & Privacy", "##"))
def test_cloud_guide_aligns_mobile_retirement_and_restore_button_with_source(self):
text = guide()
self.assertNotIn("Mobile ready", text)
self.assertNotIn("Set Up Mobile Access", text)
self.assertNotIn("**Settings → Pulse Mobile**", text)
for phrase in (
"Pulse Mobile is being retired on 31 March 2027",
"Relay is no longer sold",
"**ntfy**, **Gotify**, or **Pushover**",
"**Settings → Security → Pulse Mobile** (`/settings/system-relay`)",
"Restore Backup",
):
with self.subTest(phrase=phrase):
self.assertIn(phrase, text)
catalog = (ROOT / "frontend-modern/src/components/Settings/settingsNavCatalog.ts").read_text(encoding="utf-8")
security_group = catalog.split("id: 'security'", 1)[1]
self.assertIn("id: 'system-relay'", security_group)
self.assertIn("label: 'Pulse Mobile'", security_group)
recovery = (ROOT / "frontend-modern/src/components/Settings/RecoverySettingsPanel.tsx").read_text(encoding="utf-8")
self.assertIn("Restore Configuration", recovery)
self.assertIn("Restore Backup", recovery)
def test_both_directions_preserve_access_source_and_destination(self):
for heading in ("Self-Hosted → Cloud", "Cloud → Self-Hosted"):
text = section(guide(), heading, "###")
with self.subTest(direction=heading):
for boundary in ("destination-local administrator access", "notification destinations",
"API-token records", "not", "merge", "passphrase", "export",
"excluded connections and settings", "before retiring"):
self.assertIn(boundary, text)
hosted_exit = section(guide(), "Cloud → Self-Hosted", "###")
self.assertIn("do not cancel it or discard the source", hosted_exit)
self.assertIn("verify your Pro licence separately", hosted_exit)
def test_retargeting_preserves_identity_and_does_not_inherit_endpoint_trust(self):
text = section(guide(), "Migrating To/From Cloud", "##")
self.assertEqual(text.count("UNIFIED_AGENT.md#moving-pulse-to-a-new-address"), 2)
for boundary in ("saved identity and credential", "host's platform",
"rather than creating a replacement token", "HTTPS verification enabled",
"installer download", "agent connection", "certificate pin",
"not automatically trust for the new endpoint", "fresh ordinary reports",
"agent admission", "before enabling remote actions"):
with self.subTest(boundary=boundary):
self.assertIn(boundary, text)
self.assertNotIn("Update agent `--url` flags", text)
self.assertNotIn("```", text, "No generic credential, reinstall or hosted-filesystem recipe")
def test_import_errors_and_cutover_do_not_trigger_destructive_diagnostics(self):
text = section(guide(), "Migrating To/From Cloud", "##")
for boundary in ("Import can activate monitoring", "single-active cutover before importing",
"retain independent monitoring", "does not grant hosted filesystem",
"stop before importing", "reload/apply failure",
"settings may already have been written", "before repeating it",
"stop the trial destination", "intact source", "avoid two active writers",
"Do not induce alerts, replay a queue or run a workload action",
"not proof of full recovery", "Missing history", "does not prove collection failed"):
with self.subTest(boundary=boundary):
self.assertIn(boundary, text)
if __name__ == "__main__":
unittest.main()