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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Harden quickstart contract compatibility
rcourtmanb9d8f7974033
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex bc0ce780ab..53fb74f3ae 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -142,9 +142,10 @@ helpers; it must not persist anonymous bootstrap identity or revive localcounter truth. `internal/ai/providers/quickstart.go` must authenticate Patrolproxy calls with `Authorization: Bearer <quickstart_token>`, sync`credits_remaining` / `credits_total` back into that cache on every server-response, and invalidate the cached token on auth rejection. Explicit BYOK-provider credentials still outrank Patrol quickstart whenever both are-present.+response, accept both `quickstart_token_expires_at` and the older+`token_expires_at` response field while mixed quickstart deployments exist,+and invalidate the cached token on auth rejection. Explicit BYOK provider+credentials still outrank Patrol quickstart whenever both are present.Public-facing copy that reflects those runtime fields must therefore speak inPatrol quickstart runs on activated or trial-backed installs and Patrol-onlyno-key activation, not in generic AI credits, anonymous Community bootstrap,diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.mdindex d269a0588c..63543dd351 100644--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md@@ -251,7 +251,11 @@ installation-scoped activation state, whether the install is activatedself-hosted or hosted/trial-backed, and there is no anonymous`client_installation_id` fallback in the v6 runtime contract. Local runtimecache files may memoize the returned token and counts but may not treat those-cached counts as commercial authority.+cached counts as commercial authority. The transport must also remain+mixed-version compatible while quickstart rolls out: Pulse may send optional+binding metadata such as `instance_name` and `use_case=patrol`, and the server+must not reject that additive metadata or rely on one expiry field spelling+only when returning the quickstart token snapshot.That quickstart allowance is therefore activation support, not the maincommercial pitch: self-hosted pricing and docs may promise Patrol-onlyquickstart runs with no API key for activated or trial-backed installs, butdiff --git a/internal/ai/providers/quickstart.go b/internal/ai/providers/quickstart.goindex 632c79bd27..0362285152 100644--- a/internal/ai/providers/quickstart.go+++ b/internal/ai/providers/quickstart.go@@ -98,6 +98,7 @@ type quickstartResponse struct {CreditsRemaining int `json:"credits_remaining,omitempty"`CreditsTotal int `json:"credits_total,omitempty"`QuickstartTokenExpiresAt string `json:"quickstart_token_expires_at,omitempty"`+ TokenExpiresAt string `json:"token_expires_at,omitempty"`Code string `json:"code,omitempty"`// Error is set when the server returns a structured error.Error string `json:"error,omitempty"`@@ -346,7 +347,7 @@ func (c *QuickstartClient) syncServerState(result quickstartResponse) {CreditsRemaining: result.CreditsRemaining,CreditsTotal: result.CreditsTotal,}- if rawExpiry := strings.TrimSpace(result.QuickstartTokenExpiresAt); rawExpiry != "" {+ if rawExpiry := firstNonEmpty(result.QuickstartTokenExpiresAt, result.TokenExpiresAt); rawExpiry != "" {if parsed, err := time.Parse(time.RFC3339, rawExpiry); err == nil {state.TokenExpiresAt = &parsed}diff --git a/internal/ai/providers/quickstart_test.go b/internal/ai/providers/quickstart_test.goindex 6f5bbc13bb..1b4180274b 100644--- a/internal/ai/providers/quickstart_test.go+++ b/internal/ai/providers/quickstart_test.go@@ -114,6 +114,42 @@ func TestQuickstartClientWithToken_UsesBearerAuthAndSyncsServerState(t *testing.}}+func TestQuickstartClientWithToken_AcceptsTokenExpiresAtAlias(t *testing.T) {+ var synced QuickstartServerState++ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ w.Header().Set("Content-Type", "application/json")+ if err := json.NewEncoder(w).Encode(quickstartResponse{+ Content: "hello",+ Model: quickstartModel,+ StopReason: "end_turn",+ CreditsRemaining: 24,+ CreditsTotal: 25,+ TokenExpiresAt: "2026-04-03T19:00:00Z",+ }); err != nil {+ t.Fatalf("encode response: %v", err)+ }+ }))+ defer server.Close()++ t.Setenv("PULSE_AI_QUICKSTART_PROXY_URL", server.URL)++ client := NewQuickstartClientWithToken("qst_live_test", func(state QuickstartServerState) {+ synced = state+ }, nil)+ if _, err := client.Chat(context.Background(), ChatRequest{+ Messages: []Message{{Role: "user", Content: "Hi"}},+ }); err != nil {+ t.Fatalf("Chat(): %v", err)+ }+ if synced.TokenExpiresAt == nil {+ t.Fatal("expected token expiry sync")+ }+ if got := synced.TokenExpiresAt.UTC().Format(time.RFC3339); got != "2026-04-03T19:00:00Z" {+ t.Fatalf("TokenExpiresAt=%q want 2026-04-03T19:00:00Z", got)+ }+}+func TestQuickstartClientWithToken_ExhaustionSyncsStateAndReturnsTypedError(t *testing.T) {var synced QuickstartServerStatevar syncCalls intdiff --git a/pkg/licensing/license_server_client.go b/pkg/licensing/license_server_client.goindex 685d4c96b6..bd43af0813 100644--- a/pkg/licensing/license_server_client.go+++ b/pkg/licensing/license_server_client.go@@ -182,6 +182,9 @@ func (c *LicenseServerClient) BootstrapQuickstart(ctx context.Context, bearerTokif err := json.NewDecoder(io.LimitReader(resp.Body, 1<<20)).Decode(&result); err != nil {return nil, fmt.Errorf("decode quickstart bootstrap response: %w", err)}+ if strings.TrimSpace(result.QuickstartTokenExpiresAt) == "" {+ result.QuickstartTokenExpiresAt = strings.TrimSpace(result.TokenExpiresAt)+ }return &result, nil}diff --git a/pkg/licensing/license_server_client_test.go b/pkg/licensing/license_server_client_test.goindex 00d472fb9b..659d4bda4b 100644--- a/pkg/licensing/license_server_client_test.go+++ b/pkg/licensing/license_server_client_test.go@@ -392,6 +392,30 @@ func TestClientBootstrapQuickstart(t *testing.T) {}})+ t.Run("accepts token_expires_at alias from the server", func(t *testing.T) {+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ w.WriteHeader(http.StatusCreated)+ json.NewEncoder(w).Encode(map[string]any{+ "quickstart_token": "qst_live_456",+ "token_expires_at": "2026-04-03T18:30:00Z",+ "credits_remaining": 25,+ "credits_total": 25,+ })+ }))+ defer server.Close()++ client := NewLicenseServerClient(server.URL)+ resp, err := client.BootstrapQuickstart(context.Background(), "pit_live_token", QuickstartBootstrapRequest{+ InstanceFingerprint: "fp-123",+ })+ if err != nil {+ t.Fatalf("BootstrapQuickstart failed: %v", err)+ }+ if resp.QuickstartTokenExpiresAt != "2026-04-03T18:30:00Z" {+ t.Fatalf("QuickstartTokenExpiresAt = %q, want 2026-04-03T18:30:00Z", resp.QuickstartTokenExpiresAt)+ }+ })+t.Run("requires installation bearer token", func(t *testing.T) {server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {t.Fatal("bootstrap request should not reach the server without an installation token")diff --git a/pkg/licensing/quickstart_bootstrap.go b/pkg/licensing/quickstart_bootstrap.goindex 281750db8d..50d99d83bd 100644--- a/pkg/licensing/quickstart_bootstrap.go+++ b/pkg/licensing/quickstart_bootstrap.go@@ -16,6 +16,7 @@ type QuickstartBootstrapRequest struct {type QuickstartBootstrapResponse struct {QuickstartToken string `json:"quickstart_token"`QuickstartTokenExpiresAt string `json:"quickstart_token_expires_at,omitempty"`+ TokenExpiresAt string `json:"token_expires_at,omitempty"`CreditsRemaining int `json:"credits_remaining"`CreditsTotal int `json:"credits_total"`}diff --git a/tests/integration/tests/10-v6-license-activation.spec.ts b/tests/integration/tests/10-v6-license-activation.spec.tsindex f81fb11802..0693eb4292 100644--- a/tests/integration/tests/10-v6-license-activation.spec.ts+++ b/tests/integration/tests/10-v6-license-activation.spec.ts@@ -1,5 +1,5 @@import { test, expect } from '@playwright/test';-import { apiRequest, ensureAuthenticated, navigateToSettings } from './helpers';+import { apiRequest, ensureAuthenticated } from './helpers';/*** V6 License Activation E2E Test@@ -34,6 +34,23 @@ type EntitlementPayload = {limits?: Array<{ key: string; limit: number; current: number; state: string }>;};+type AISettingsPayload = {+ enabled?: boolean;+ model?: string;+ patrol_model?: string;+ quickstart_credits_total?: number;+ quickstart_credits_remaining?: number;+ quickstart_credits_available?: boolean;+ quickstart_blocked_reason?: string;+};++type PatrolStatusPayload = {+ using_quickstart?: boolean;+ quickstart_credits_total?: number;+ quickstart_credits_remaining?: number;+ runtime_state?: string;+};+test.describe.serial('V6 license activation flow', () => {/** Issued license ID — used for cleanup/revocation. */let issuedLicenseId = '';@@ -136,11 +153,9 @@ test.describe.serial('V6 license activation flow', () => {test.skip(!activationKey, 'No activation key from previous step');await ensureAuthenticated(page);- await navigateToSettings(page);-- // Navigate to the Pulse Pro panel.- await page.getByRole('button', { name: /pulse pro/i }).first().click();- await expect(page.getByRole('heading', { name: 'Current License' })).toBeVisible();+ await page.goto('/settings/system/billing');+ await expect(page.getByRole('heading', { name: 'Pulse Pro' }).first()).toBeVisible();+ await expect(page.getByRole('heading', { name: 'Activation' })).toBeVisible();// Fill in the activation key.const textarea = page.locator('#pulse-pro-license-key');@@ -168,32 +183,12 @@ test.describe.serial('V6 license activation flow', () => {test.skip(!activationKey, 'No activation key from previous step');await ensureAuthenticated(page);- await navigateToSettings(page);-- // Open the Pulse Pro panel.- await page.getByRole('button', { name: /pulse pro/i }).first().click();- await expect(page.getByRole('heading', { name: 'Current License' })).toBeVisible();-- // Status badge should show "Active".- await expect(- page.locator('span').filter({ hasText: /^Active$/ }).first(),- ).toBeVisible({ timeout: 10_000 });-- // Tier should show "Pro" (DOM text is title-case "Tier", CSS renders uppercase).- const tierValue = page- .locator('p')- .filter({ hasText: /^Tier$/ })- .first()- .locator('xpath=following-sibling::p[1]');- await expect(tierValue).toContainText(/Pro/i);-- // Included Monitored Systems should show 15.- const monitoredSystemsValue = page- .locator('p')- .filter({ hasText: /^Included Monitored Systems$/ })- .first()- .locator('xpath=following-sibling::p[1]');- await expect(monitoredSystemsValue).toHaveText('15');+ await page.goto('/settings/system/billing');+ await expect(page.getByRole('heading', { name: 'Pulse Pro' }).first()).toBeVisible();+ await expect(page.getByRole('heading', { name: 'Plan' })).toBeVisible();+ await expect(page.getByText(/^Active$/).first()).toBeVisible({ timeout: 10_000 });+ await expect(page.getByText('No Pro license is active.')).toHaveCount(0);+ await expect(page.getByText('15').first()).toBeVisible();// Verify entitlements API agrees.const entRes = await apiRequest(page, '/api/license/entitlements');@@ -216,17 +211,86 @@ test.describe.serial('V6 license activation flow', () => {expect(guestLimit!.limit).toBe(5);});- test('clears license via UI and verifies free tier', async ({ page }, testInfo) => {+ test('surfaces activated-install quickstart readiness without requiring BYOK', async ({+ page,+ }, testInfo) => {test.skip(!ADMIN_TOKEN, 'PULSE_LICENSE_ADMIN_TOKEN not set');test.skip(testInfo.project.name.startsWith('mobile-'), 'Desktop-only');test.skip(!activationKey, 'No activation key from previous step');await ensureAuthenticated(page);- await navigateToSettings(page);- // Open the Pulse Pro panel.- await page.getByRole('button', { name: /pulse pro/i }).first().click();- await expect(page.getByRole('heading', { name: 'Current License' })).toBeVisible();+ const entRes = await apiRequest(page, '/api/license/entitlements');+ expect(entRes.ok(), `Entitlements request failed: ${entRes.status()}`).toBeTruthy();+ const ent = (await entRes.json()) as EntitlementPayload;+ expect(ent.subscription_state).toBe('active');++ await page.goto('/settings/system-ai');+ await expect(page.getByRole('heading', { name: 'AI Services' }).first()).toBeVisible();++ const preSettingsRes = await apiRequest(page, '/api/settings/ai');+ expect(preSettingsRes.ok(), `AI settings request failed: ${preSettingsRes.status()}`).toBeTruthy();+ const preSettings = (await preSettingsRes.json()) as AISettingsPayload;+ expect(preSettings.quickstart_credits_available).toBe(true);+ expect(preSettings.quickstart_credits_total).toBe(25);+ expect(preSettings.quickstart_credits_remaining).toBe(25);+ expect(preSettings.quickstart_blocked_reason || '').toBe('');++ const enableAI = page.getByRole('button', { name: 'Enable AI services' });+ await expect(enableAI).toBeVisible();+ if (await page.getByText(/^Disabled$/).isVisible()) {+ await enableAI.click();+ }++ await expect+ .poll(async () => {+ const res = await apiRequest(page, '/api/settings/ai');+ if (!res.ok()) return null;+ const body = (await res.json()) as AISettingsPayload;+ return {+ enabled: body.enabled === true,+ model: body.model || '',+ quickstart_credits_available: body.quickstart_credits_available === true,+ quickstart_credits_remaining: body.quickstart_credits_remaining ?? -1,+ };+ }, { timeout: 30_000 })+ .toEqual({+ enabled: true,+ model: 'quickstart:pulse-hosted',+ quickstart_credits_available: true,+ quickstart_credits_remaining: 25,+ });++ await expect(+ page.getByText(/Patrol quickstart ready • 25\/25 runs left • no API key needed yet/i),+ ).toBeVisible();++ await page.goto('/ai');+ await expect(page.getByRole('heading', { name: 'Patrol' }).first()).toBeVisible();+ await expect(page.getByText('Patrol quickstart: 25/25 runs left')).toBeVisible();+ await expect(page.getByRole('button', { name: 'Run Patrol' })).toBeEnabled();++ const patrolStatusRes = await apiRequest(page, '/api/ai/patrol/status');+ expect(+ patrolStatusRes.ok(),+ `Patrol status request failed: ${patrolStatusRes.status()}`,+ ).toBeTruthy();+ const patrolStatus = (await patrolStatusRes.json()) as PatrolStatusPayload;+ expect(patrolStatus.using_quickstart).toBe(true);+ expect(patrolStatus.quickstart_credits_total).toBe(25);+ expect(patrolStatus.quickstart_credits_remaining).toBe(25);+ expect(patrolStatus.runtime_state).toBe('active');+ });++ test('clears license via UI and verifies free tier', async ({ page }, testInfo) => {+ test.skip(!ADMIN_TOKEN, 'PULSE_LICENSE_ADMIN_TOKEN not set');+ test.skip(testInfo.project.name.startsWith('mobile-'), 'Desktop-only');+ test.skip(!activationKey, 'No activation key from previous step');++ await ensureAuthenticated(page);+ await page.goto('/settings/system/billing');+ await expect(page.getByRole('heading', { name: 'Pulse Pro' }).first()).toBeVisible();+ await expect(page.getByRole('heading', { name: 'Activation' })).toBeVisible();// Set up one-shot dialog handler for the native confirm() prompt.page.once('dialog', (dialog) => dialog.accept());@@ -251,7 +315,6 @@ test.describe.serial('V6 license activation flow', () => {// Verify UI shows "No Pro license is active" or free-tier state.await page.reload();- await page.getByRole('button', { name: /pulse pro/i }).first().click();await expect(page.locator('text=/No Pro license is active/i').first(),).toBeVisible({ timeout: 10_000 });