Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

docs(api): govern Pulse Account bootstrap contract

rcourtmand9f78810ca3c
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index b4ea251d4e..d1e89caeb4 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -189,6 +189,14 @@ Own canonical runtime payload shapes between backend and frontend.
The API layer already uses contract tests in many places, but every major live
contract should continue moving toward canonical-only runtime shapes.
+The Pulse Account commercial shell now also owns a dedicated bootstrap
+contract in `internal/cloudcp/portal/page.go`, `internal/cloudcp/portal/handlers.go`,
+and `internal/cloudcp/portal/handlers_test.go`. `/api/portal/bootstrap` and
+the in-page `pulse-account-bootstrap` payload must stay shape-identical for
+account identity context, workspace summaries, and renderer-owned public,
+commercial, and control-plane route configuration. New account frontend work
+must extend that shared contract rather than inventing a second local payload
+shape or hardcoding production URLs and route prefixes in static assets.
Hosted Pulse Cloud tenant-org AI reads now also follow that same canonical
rule: `internal/api/ai_hosted_runtime.go`, `internal/api/ai_handlers.go`,
`internal/api/ai_handler.go`, and `internal/api/hosted_billing_state.go`
diff --git a/internal/cloudcp/portal/handlers_test.go b/internal/cloudcp/portal/handlers_test.go
index c02097ceb6..61a3c36805 100644
--- a/internal/cloudcp/portal/handlers_test.go
+++ b/internal/cloudcp/portal/handlers_test.go
@@ -958,6 +958,23 @@ func TestHandlePortalBootstrap_RequiresAuth(t *testing.T) {
}
}
+func TestHandlePortalBootstrap_RevokedSessionUnauthorized(t *testing.T) {
+ reg, sessionSvc, token, _, userID := newPortalSessionFixture(t)
+
+ if _, err := reg.RevokeUserSessions(userID); err != nil {
+ t.Fatalf("RevokeUserSessions: %v", err)
+ }
+
+ req := httptest.NewRequest(http.MethodGet, "/api/portal/bootstrap", nil)
+ req.Header.Set("Authorization", "Bearer "+token)
+ rec := httptest.NewRecorder()
+ HandlePortalBootstrap(sessionSvc, reg).ServeHTTP(rec, req)
+
+ if rec.Code != http.StatusUnauthorized {
+ t.Fatalf("status = %d, want %d", rec.Code, http.StatusUnauthorized)
+ }
+}
+
func TestPortalLoginTemplate_UsesPulseAccountBranding(t *testing.T) {
html := renderLoginHTML(t, "test-nonce")