Files
Pulse/scripts/tests/test_cloud_migration_docs.py
pulse-triage[bot] c466f3c468 Align Cloud MSP cap, Patrol digest retries, and Agent API Access Help
Recovers and completes the Help and v6 pricing alignment from closed PR #5466
by updating the stale Patrol digest frontend unit test assertions alongside the
shipped guides:

- Remove retired request-assisted Pulse-hosted MSP and MSP Enterprise (40+)
  claims from docs/CLOUD.md and docs/architecture/v6-pricing-and-tiering.md,
  recording Scale (40 client workspaces) as the largest MSP plan today and
  noting that provider-hosted MSP leases include white_label report branding.
- Align docs/AI.md Weekly summary and email with internal/api/report_schedules.go
  and reportingSchedulesModel.ts: HTTP 400 email_not_ready validation, 24-hour
  missed-run grace, Retry scheduled (retrying) automatic 3-attempt (1m/5m)
  retries, Delivery unconfirmed (unconfirmed) duplicate-check guidance, Run /
  Retry (?retry=true), and Email accepted (ok/sent).
- Update frontend-modern/src/utils/__tests__/patrolDigestHelp.test.ts to assert
  the current Run / Retry and mail-server-acceptance wording instead of retired
  Run now and sender-returned-success copy.
- Update docs/UNIFIED_AGENT.md agent 401/403 token triage links from
  Settings → API Access to Settings → Security → API Access (/settings/security/api).
- Sync mirrored Help copies under frontend-modern/public/docs/ and add
  source-bound regression tests in scripts/tests/.

Contract-Neutral: Documentation and docs-regression test alignment only; no runtime, API, schema, UI, or subsystem contract changes.
Change-source: pulse-maintainer
2026-11-29 03:04:50 +00:00

122 lines
6.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_cloud_availability_matches_docs_index_without_unscheduled_promises(self):
text = " ".join(guide().split())
docs_index = " ".join((ROOT / "docs/README.md").read_text(encoding="utf-8").split())
self.assertIn("Pulse Cloud is not generally available.", docs_index)
self.assertIn("Pulse Cloud is not generally available.", text)
self.assertIn("Ordinary self-hosted Pulse remains the primary installation path", text)
self.assertIn("Custom domains are not supported.", text)
self.assertNotIn("planned for a future release", text)
self.assertIn("capped at Scale (40 client workspaces)", text)
self.assertIn("There is no larger MSP plan or Pulse-hosted MSP service today.", text)
self.assertNotIn("Pulse-hosted MSP is available only as a request-assisted option", text)
features_go = (ROOT / "pkg/licensing/features.go").read_text(encoding="utf-8")
self.assertIn('"msp_scale": 40', features_go)
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()