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.

Fix alert detection and notification state boundary

rcourtmanc2df4ad27713
diff --git a/docs/release-control/v6/internal/OPERATIONAL_TRUST_IMPLEMENTATION_SPEC.md b/docs/release-control/v6/internal/OPERATIONAL_TRUST_IMPLEMENTATION_SPEC.md
new file mode 100644
index 0000000000..8b4a8f8d50
--- /dev/null
+++ b/docs/release-control/v6/internal/OPERATIONAL_TRUST_IMPLEMENTATION_SPEC.md
@@ -0,0 +1,915 @@
+# Pulse v6 Operational Trust Implementation Spec
+
+Last updated: 2026-07-18
+Status: ACTIVE
+Primary governance surface:
+- `status.json.candidate_lanes.protection-posture-attention-queue`
+
+Related governed surface:
+- `status.json.candidate_lanes.availability-as-resource-facet`
+
+## Intent
+
+This specification turns Pulse's product direction into one executable
+contract.
+
+Pulse must become the trusted operations layer for mixed private
+infrastructure. It must tell an operator:
+
+1. what needs attention
+2. which resource is affected
+3. why Pulse believes it
+4. what the likely impact is
+5. what protection or recovery evidence exists
+6. what safe next action is available
+7. whether that action worked
+
+The implementation loop is:
+
+`observe -> identify -> detect -> relate -> explain -> act -> verify`
+
+This is a monitor-first product. Platform pages and the dashboard remain the
+normal observation surfaces. Patrol is the cross-platform attention queue and
+explain-act-verify workbench. Assistant is contextual help for selected
+resources, evidence, findings, and actions. It is not the primary navigation
+model.
+
+The work is complete only when the runtime, APIs, product surfaces, migrations,
+tests, live-browser journeys, and governance evidence satisfy every applicable
+criterion in this document. A narrow detector, a polished card, or a passing
+unit test is not completion.
+
+## Canonical Root-Fix Decision
+
+The canonical fix is a shared operational-trust model, not UI composition over
+unrelated alert, notification, recovery, and Patrol payloads.
+
+The implementation must establish typed shared contracts for:
+
+1. resource identity and relationships
+2. evidence provenance, freshness, completeness, and confidence
+3. operational lifecycle state
+4. protection posture
+5. attention items
+6. governed actions and verification
+
+Platform adapters may emit provider-specific evidence, but they must not own
+parallel lifecycle, posture, or action semantics. Frontend code may present the
+shared contracts, but it must not infer canonical trust state from labels,
+message text, or loose metadata maps.
+
+## Product Jobs
+
+The least-expert plausible operator should be able to complete these jobs in
+their own vocabulary:
+
+1. "Show me what needs my attention."
+2. "Tell me what is affected and how serious it is."
+3. "Tell me whether the data is current and where it came from."
+4. "Tell me whether this workload has a usable recent backup."
+5. "Give me the safest next step."
+6. "Let me approve or run a supported action."
+7. "Show me whether the problem is actually fixed."
+8. "When everything is healthy, say so plainly and get out of the way."
+
+The default experience must not require the operator to understand internal
+terms such as detector, evidence envelope, rollup, canonical identity,
+projection, or verification intent.
+
+## Governing Product Rules
+
+### 1. Evidence before assertion
+
+Every user-visible operational assertion must link to typed evidence. Evidence
+must include source, observation time, ingestion time, subject identity, and
+completeness. When freshness or completeness is insufficient, the product says
+`unknown` or `stale`; it does not silently downgrade those states to `healthy`.
+
+### 2. One lifecycle truth
+
+The active count, navigation badge, alert list, Patrol queue, notification
+history, and resource detail must derive from the same canonical lifecycle
+truth. They may show different filtered views, but they must not disagree about
+whether the same operational item is open, acknowledged, suppressed, stale, or
+resolved.
+
+### 3. Identity before correlation
+
+Pulse must resolve observations to canonical resources before it correlates
+impact, recovery evidence, availability, or actions. Explicit links win.
+Provider-scoped stable identities are next. Unambiguous secondary identity is
+allowed only with auditable match evidence. Ambiguous matches remain separate
+and visible as unresolved.
+
+### 4. Protection evidence, not a backup engine
+
+Pulse reports protection and recovery evidence from connected providers. It
+does not claim to execute, own, or guarantee backup and restore workflows that
+belong to PBS, Proxmox, TrueNAS, Kubernetes tooling, or another native control
+plane.
+
+### 5. Monitor first, attention second
+
+Platform surfaces answer "what is happening here?" Patrol answers "what needs
+me across everything?" The same attention item may be entered from either
+surface without becoming two separate records.
+
+### 6. Actions are declared capabilities
+
+An action exists only when the target resource declares the capability and the
+policy engine can determine its eligibility. Unknown, stale, incomplete, or
+ambiguous evidence must fail closed for mutating actions.
+
+### 7. Verification is part of the action
+
+An execution result is not enough. Every mutating action must define a
+postcondition and a bounded verification policy. The UI distinguishes
+`executed` from `verified`.
+
+### 8. Calm is a valid state
+
+When nothing needs attention, Patrol shows a short calm-day state with the last
+successful evaluation time and any stale or disconnected coverage caveat.
+It must not invent proof strips, scores, or decorative activity to make an
+empty queue look busy.
+
+## Explicit Non-Goals
+
+This specification does not authorize:
+
+1. a general backup scheduler, retention manager, or restore engine
+2. broad autonomous remediation
+3. arbitrary shell or vendor API execution
+4. a chat-first home screen
+5. replacement of native vendor control planes
+6. a universal recoverability score that hides missing evidence
+7. automatic merging of ambiguous resources
+8. a second alert engine inside Patrol
+9. availability checks as duplicate resources when a canonical target is known
+10. platform-specific lifecycle states in primary APIs
+11. hiding stale, partial-permission, or collection-error states
+12. MSP multi-tenancy, fleet-wide delegation, or policy inheritance beyond
+ existing governed enterprise boundaries
+
+## Canonical Domain Model
+
+The implementation may refine names to match existing packages, but it must
+preserve the semantics and typed boundaries below.
+
+### 1. Evidence envelope
+
+Every detector input and every trust-bearing output must be traceable to an
+evidence envelope.
+
+```text
+EvidenceEnvelope
+ id stable within its source and observation
+ source provider and collector identity
+ subject canonical resource id or unresolved provider ref
+ observedAt time represented by the source
+ ingestedAt time Pulse accepted the observation
+ validUntil optional source-specific freshness boundary
+ completeness complete | partial | unavailable
+ confidence confirmed | inferred | unknown
+ reason typed reason for partial, unavailable, or inferred
+ permissions sufficient | partial | denied | unknown
+ payloadRef bounded reference to provider detail
+ correlation optional auditable identity match record
+```
+
+Required behavior:
+
+1. freshness is evaluated from `observedAt` and source policy, never only from
+ frontend wall-clock assumptions
+2. partial permission is different from no data
+3. provider failure is different from an observed healthy value
+4. inferred identity records the matched fields and rule
+5. raw provider payloads stay bounded and policy-shaped
+6. evidence needed for an open lifecycle item remains available for the
+ lifecycle retention window
+
+### 2. Resource identity and relationships
+
+The unified resource registry remains the owner of canonical resource identity.
+It must support auditable relationships required by operational reasoning:
+
+```text
+ResourceRelationship
+ id
+ fromResourceId
+ toResourceId
+ kind runs-on | hosted-by | depends-on | stores-on |
+ protected-by | checks | member-of | exposes
+ source
+ observedAt
+ confidence
+ evidenceId
+```
+
+Identity resolution order:
+
+1. explicit canonical resource id
+2. existing canonical provider link
+3. stable provider-scoped identity
+4. unambiguous normalized secondary identity
+5. unresolved provider reference
+
+Secondary identity correlation must:
+
+1. normalize case, address form, and hostname form consistently
+2. reject zero-match and multi-match results
+3. record the rule and matching values
+4. avoid per-row network or database fetches
+5. preserve provider scope so bare vendor ids are never workspace-global
+
+### 3. Operational lifecycle
+
+The existing canonical alert lifecycle is the starting point. The completed
+contract must represent:
+
+```text
+OperationalState
+ observing
+ open
+ acknowledged
+ suppressed
+ resolving
+ resolved
+ stale
+ unknown
+```
+
+These are operational states, not severity levels.
+
+Every lifecycle record must have:
+
+```text
+OperationalRecord
+ id
+ canonicalSpecId
+ subjectResourceId
+ state
+ severity
+ firstObservedAt
+ lastObservedAt
+ stateChangedAt
+ resolvedAt
+ acknowledgement
+ suppression
+ evidenceIds
+ causeKey
+ relatedResourceIds
+ impactSummary
+ recommendedNextStep
+```
+
+Required transition rules:
+
+1. `observing -> open` only through a canonical detector decision
+2. acknowledgement never means resolution
+3. suppression never rewrites the underlying detector state
+4. an absent observation cannot resolve an item when collection is stale,
+ partial, failed, or permission-denied
+5. resolution records the decisive recovery evidence
+6. recurrence after resolution either reopens the same stable cause or creates
+ a linked recurrence according to the detector's canonical identity policy
+7. transitions are idempotent
+8. concurrent reads and writes are race-safe
+9. retention preserves a usable timeline after resolution
+
+### 4. Notification linkage
+
+Notification delivery is a consequence of lifecycle transitions, not a second
+source of operational truth.
+
+Each queued delivery and audit record must carry:
+
+```text
+NotificationLink
+ notificationId
+ operationalRecordId
+ transitionId
+ lifecycleState
+ causeKey
+ destinationId
+ deliveryState
+ attemptedAt
+ completedAt
+```
+
+Required behavior:
+
+1. retries preserve one stable event id
+2. grouped notifications preserve every included operational and transition id
+3. resolve notifications link to the resolving transition
+4. cancelled, failed, and dead-letter delivery remain inspectable
+5. navigation counts never derive from queue status
+6. disabling notification delivery does not disable detection or erase open
+ operational records
+7. configuration surfaces clearly distinguish detection, in-product alerts,
+ and external notification delivery
+
+### 5. Protection posture
+
+Protection posture is a typed, per-subject read model derived from recovery
+points and provider job evidence.
+
+```text
+ProtectionPosture
+ subjectResourceId
+ state protected | attention | unprotected | unknown
+ lastAttemptAt
+ lastSuccessfulPointAt
+ lastVerifiedAt
+ freshness current | stale | unknown
+ verification verified | unverified | stale | unknown
+ coverage complete | partial | none | unknown
+ providerStates[]
+ repositoryResourceIds[]
+ evidenceIds[]
+ explanation
+ evaluatedAt
+```
+
+`providerStates[]` must preserve provider-specific uncertainty:
+
+```text
+ProtectionProviderState
+ provider
+ source
+ scope
+ jobState
+ historyCompleteness
+ permissions
+ lastAttemptAt
+ lastSuccessAt
+ lastVerifiedAt
+ evidenceIds[]
+```
+
+Derivation rules:
+
+1. `protected` requires a successful recovery point inside the configured
+ freshness window and no known provider failure that invalidates the claim
+2. `attention` means evidence exists but is stale, failing, unverified where
+ verification is expected, or incomplete in a way the operator can address
+3. `unprotected` requires sufficient evidence to affirm that no qualifying
+ protection exists
+4. `unknown` is mandatory when identity, permission, history, or collection
+ completeness cannot support a stronger claim
+5. snapshots and backups preserve their canonical distinction
+6. snapshot presence alone never implies independent recovery
+7. provider job success without a subject-linked recovery point may be useful
+ evidence, but it must not silently become subject-level protection
+8. the posture explanation names the strongest evidence and the limiting
+ uncertainty in plain language
+
+The existing recovery-point and protection-rollup models must be migrated or
+adapted into this contract without breaking supported clients.
+
+### 6. Attention item
+
+Patrol consumes a shared attention read model. It does not inspect arbitrary
+metadata to invent a queue.
+
+```text
+AttentionItem
+ id
+ operationalRecordId
+ subjectResourceId
+ title
+ plainLanguageSummary
+ severity
+ state
+ firstObservedAt
+ lastObservedAt
+ evidenceFreshness
+ evidenceCompleteness
+ impact
+ protectionPosture
+ relatedResources[]
+ recommendedNextStep
+ availableActions[]
+ verificationState
+```
+
+Queue rules:
+
+1. default ordering is actionable severity, blast radius, protection concern,
+ evidence freshness, then age
+2. stale or unknown evidence is visible but never presented as a confirmed
+ failure
+3. duplicate symptoms sharing a stable cause may group under one item, while
+ every member remains inspectable
+4. acknowledged and suppressed items are filterable and retain their true
+ lifecycle state
+5. resolved items leave the active queue and remain in recent history
+6. the same item id deep-links from navigation, platform rows, resource
+ detail, notifications, and Patrol
+
+### 7. Availability facet
+
+Availability is evidence about a resource, not a parallel inventory taxonomy.
+
+Required ingest behavior:
+
+1. attach by explicit canonical resource link first
+2. otherwise attach by one unambiguous normalized address or hostname match
+3. retain a standalone `network-endpoint` only for genuinely unowned targets
+4. preserve ambiguous targets as unresolved rather than guessing
+5. emit a `checks` relationship and evidence envelope
+6. use the unified-resource hot path with no per-row fetch
+
+Required presentation:
+
+1. show a compact Availability facet on the owning platform resource row and
+ resource detail
+2. show protocol identity, target, latest result, latency when relevant,
+ freshness, and last observation
+3. route failures into the canonical lifecycle and attention model
+4. avoid duplicating the target on a generic Machines page once attached
+
+This portion remains linked to the separately governed
+`availability-as-resource-facet` candidate and must be claimed in sequence
+before its runtime mutation begins.
+
+### 8. Governed action and verification
+
+Available actions are declared by resource capability and evaluated against
+policy, evidence, and current lifecycle state.
+
+```text
+ActionOffer
+ actionId
+ targetResourceId
+ kind
+ mode plan | dry-run | execute
+ risk read-only | low | elevated
+ approval not-required | required | granted | denied
+ eligibility eligible | ineligible | unknown
+ reasons[]
+ evidenceIds[]
+ expectedPostcondition
+ verificationPolicy
+```
+
+```text
+ActionRun
+ runId
+ actionId
+ operationalRecordId
+ actor
+ requestedAt
+ approvedAt
+ startedAt
+ completedAt
+ executionState
+ result
+ auditRef
+ verificationState pending | verified | failed | inconclusive | timed-out
+ verificationEvidenceIds[]
+```
+
+Required behavior:
+
+1. planning and dry-run are preferred where the provider supports them
+2. elevated actions require explicit approval
+3. mutating actions fail closed on stale, incomplete, unknown, or ambiguous
+ target evidence unless a narrower canonical policy explicitly allows them
+4. action parameters are typed and bounded
+5. idempotency keys prevent duplicate execution
+6. execution records actor, target, parameters, policy result, provider result,
+ and timestamps
+7. verification uses fresh post-action evidence and a declared postcondition
+8. verification failure or timeout keeps the attention item open
+9. the first shipped mutating actions must be narrow, reversible where
+ possible, and already supported by the canonical action framework
+
+## Runtime Ownership
+
+The intended ownership boundaries are:
+
+1. `internal/unifiedresources`: canonical identity and relationships
+2. `internal/alerts`: detector decisions and operational lifecycle
+3. `internal/notifications`: transition-linked delivery and audit
+4. `internal/recovery`: recovery points, provider evidence, and protection
+ posture derivation
+5. `internal/monitoring`: observation collection and availability evidence
+6. `internal/ai` or the existing Patrol application owner: attention
+ projection, explanation, and supported action proposals
+7. `internal/api`: versioned transport and authorization only
+8. `frontend-modern`: typed presentation and interaction only
+
+If existing ownership differs, the implementation must update subsystem
+contracts before moving logic. It must not create circular dependencies or
+place canonical derivation in API handlers.
+
+## API Contract
+
+Exact route names may follow existing conventions, but the completed API must
+provide these capabilities through versioned typed payloads.
+
+### Operational records
+
+1. list active records with filters and stable pagination
+2. get one record with transition timeline and evidence references
+3. acknowledge and unacknowledge
+4. suppress with bounded scope and expiry
+5. list recent resolved records
+6. expose one canonical active-count summary used by all badges
+
+### Evidence
+
+1. get bounded evidence detail authorized for the current operator
+2. show source, freshness, completeness, confidence, and reason
+3. redact sensitive provider detail by policy
+4. return typed unavailable responses when retained detail has expired
+
+### Protection
+
+1. get posture for one canonical resource
+2. batch posture for bounded resource tables
+3. list attention postures
+4. drill into contributing recovery points and provider evidence
+5. expose evaluation policy and timestamps
+
+### Patrol
+
+1. list active attention items
+2. get item detail
+3. list recent resolved history
+4. expose calm-day evaluation and coverage state
+5. deep-link to the owning resource and source platform
+
+### Actions
+
+1. list offers for an attention item or resource
+2. plan or dry-run
+3. request and record approval
+4. execute with idempotency
+5. retrieve execution and verification status
+6. cancel only where the provider contract supports safe cancellation
+
+### Compatibility rules
+
+1. existing supported alert and recovery routes remain compatible during
+ migration
+2. compatibility adapters are read-side boundaries, not parallel truth
+3. new typed fields are additive before deprecated fields are removed
+4. deprecations include usage evidence, migration tests, and a governed removal
+ decision
+5. table APIs support bounded batch reads; the frontend must not issue a
+ request per row
+
+## Product Surface Contract
+
+### 1. Navigation and dashboard
+
+1. one active attention count comes from the canonical read model
+2. label and tooltip distinguish attention items from notification delivery
+3. the count never remains non-zero beside an empty active queue
+4. the dashboard shows concise actionable summaries and links into Patrol or
+ the affected resource
+5. monitor pages remain the normal authenticated launch path
+
+### 2. Platform resource rows
+
+1. health, active attention, protection posture, and availability appear only
+ when relevant to that resource
+2. compact indicators show state and freshness without widening tables into
+ consoles
+3. row expansion or a drawer holds provider evidence and forensic detail
+4. every indicator has a clear operator action or is demoted from the default
+ row
+5. canonical table alignment helpers remain the sole alignment owner
+
+### 3. Resource detail
+
+The default detail answers, in order:
+
+1. what resource is this
+2. what is its current state
+3. what needs attention
+4. what recently changed
+5. what it depends on and what depends on it
+6. what protection evidence exists
+7. what safe actions are available
+
+Metrics and provider detail remain available without displacing those answers.
+
+### 4. Patrol active queue
+
+The initial view contains:
+
+1. a plain heading and accurate active count
+2. concise filters for open, acknowledged, suppressed, stale/unknown, and
+ recent resolved
+3. an ordered list of attention items
+4. resource identity, impact, evidence state, protection context, and next step
+5. a clear calm-day state when the list is empty
+
+It must not contain:
+
+1. a generic object browser
+2. vanity trust scores
+3. a large Assistant prompt before the queue
+4. stale findings presented as live
+5. read-only replicas of native vendor consoles
+
+### 5. Attention detail
+
+The detail or drawer contains:
+
+1. plain-language finding
+2. affected and related resources
+3. timeline from first observation through current state
+4. evidence source, age, completeness, confidence, and limiting caveats
+5. protection posture with provider drill-down
+6. recommended next step
+7. eligible actions, approval state, and risk
+8. execution and verification results
+9. links to the owning platform or native tool when Pulse cannot act
+
+### 6. Assistant
+
+Assistant receives selected typed context. It may:
+
+1. explain evidence
+2. summarize impact and relationships
+3. describe a proposed action or verification result
+4. help the operator navigate to supporting detail
+
+Assistant may not:
+
+1. become the source of lifecycle or protection truth
+2. infer an action capability absent from the canonical resource
+3. bypass approval or evidence eligibility
+4. hide uncertainty
+
+## Security, Privacy, and Trust
+
+1. evidence access follows existing tenant, role, and sensitivity boundaries
+2. secret values and full credential-bearing payloads are never stored as
+ evidence
+3. action authorization is checked at offer time and again at execution time
+4. approvals bind actor, exact target, action kind, parameters, and expiry
+5. evidence and action audit records use stable ids without leaking sensitive
+ provider identifiers into public logs
+6. API errors do not reveal unavailable resources across authorization
+ boundaries
+7. notification destination configuration remains protected
+8. Assistant receives policy-shaped summaries and references, not unrestricted
+ raw provider payloads
+
+## Performance and Retention
+
+1. active-count and Patrol list reads must not scan unbounded history
+2. platform tables use bounded batch posture and availability data
+3. no per-row fetches
+4. lifecycle writes and notification enqueue remain idempotent under retry
+5. relationship and evidence indexes support subject, time, source, and active
+ state reads
+6. retained evidence is sufficient to explain open records and recent
+ resolution
+7. high-cardinality recovery points remain outside unified-resource inventory
+8. retention expiry preserves a typed summary and explicitly reports expired
+ detail
+9. load proofs cover realistic resource, alert, recovery-point, and queue
+ cardinalities
+
+## Telemetry and Product Health
+
+The implementation must expose operational measurements for:
+
+1. observation-to-open latency
+2. open-to-notification-enqueue latency
+3. notification delivery success, retries, and dead letters
+4. stale or incomplete evidence counts by source
+5. unresolved or ambiguous identity correlations
+6. protection posture distribution and evaluation failures
+7. attention queue age and acknowledgement time
+8. action offer, approval, execution, and verification outcomes
+9. active-count/read-model mismatch detection
+10. calm-day evaluation age
+
+Telemetry must not use high-cardinality raw resource ids as metric labels.
+
+## Migration and Rollout
+
+### Phase 0: contract and contradiction containment
+
+1. finalize typed contracts and subsystem ownership
+2. inventory every active-count and alert-enabled interpretation
+3. make detection, in-product visibility, and external delivery separate
+4. add read-model consistency assertions
+5. preserve supported payload compatibility
+
+### Phase 1: lifecycle and evidence foundation
+
+1. land evidence envelopes
+2. make lifecycle transition ids durable and idempotent
+3. link notification audit to transitions
+4. surface freshness, completeness, and source
+5. migrate loose trust-bearing metadata into typed fields
+
+### Phase 2: protection posture
+
+1. build canonical posture derivation over recovery points and provider job
+ evidence
+2. add bounded subject and table APIs
+3. distinguish protected, attention, unprotected, and unknown
+4. prove PBS first without baking PBS semantics into the shared model
+5. add provider adapters only with explicit evidence-quality mappings
+
+### Phase 3: Patrol attention workbench
+
+1. project lifecycle records into typed attention items
+2. unify active counts and deep links
+3. deliver active, acknowledged, suppressed, stale/unknown, resolved, and calm
+ states
+4. show evidence, impact, relationships, and protection in detail
+5. demote Assistant to selected context
+
+### Phase 4: availability attachment
+
+1. claim the `availability-as-resource-facet` governed surface
+2. implement explicit and unambiguous correlation
+3. attach the facet and relationship
+4. remove duplicate primary presentation for attached checks
+5. route failures through canonical lifecycle and Patrol
+
+### Phase 5: governed actions and verification
+
+1. select the smallest useful existing declared capabilities
+2. implement offer eligibility and evidence gating
+3. prove approval, idempotent execution, audit, and postcondition verification
+4. ship no action whose failed verification cannot be represented honestly
+
+### Phase 6: hardening and rollout completion
+
+1. compatibility and migration proofs
+2. concurrency, failure, retention, and load proofs
+3. accessibility and responsive proofs
+4. production-observed telemetry where required by governance
+5. documentation and upgrade notes
+6. remove superseded compatibility paths only after governed evidence
+
+Each phase must leave one coherent runtime path. Feature flags may control
+exposure, but they must not create two writable sources of truth.
+
+## Required Proof Matrix
+
+### Unit and contract proof
+
+1. every lifecycle transition, including recurrence and stale collection
+2. evidence freshness, partial permission, provider failure, and expiry
+3. identity resolution, ambiguous rejection, and provider scoping
+4. protection posture truth table
+5. notification grouping, retry, resolve linkage, cancellation, and dead letter
+6. attention projection and stable ordering
+7. action eligibility, approval binding, idempotency, and verification
+8. JSON compatibility for supported clients
+
+### Integration proof
+
+1. observation opens one operational record and one attention item
+2. repeated observation does not duplicate either
+3. acknowledgement is reflected everywhere without resolving
+4. suppressed items leave the default queue but remain inspectable
+5. source outage produces stale or unknown, not false resolution
+6. recovery evidence changes protection posture and the related attention item
+7. notification audit links to the exact transition
+8. an action executes once and only closes after verified recovery evidence
+9. an attached availability check does not create a duplicate resource
+10. authorization and tenant boundaries hold across evidence and actions
+
+### Browser proof
+
+Playwright inspection is mandatory for:
+
+1. monitor-first launch
+2. platform row with healthy, attention, stale, unknown, protected,
+ unprotected, and unavailable-evidence states as applicable
+3. Patrol with active work
+4. Patrol calm day
+5. acknowledged and suppressed filters
+6. stale collection without false reassurance
+7. evidence and protection drill-down
+8. action approval, execution, verification success, and verification failure
+9. navigation count consistency
+10. keyboard navigation, focus restoration, screen-reader names, narrow
+ viewport, and reduced-motion behavior
+
+Proof must exercise expansions, drawers, empty states, and deepest supported
+detail. Source inspection and top-level screenshots are insufficient.
+
+### Failure proof
+
+1. collector disconnected
+2. provider partial permission
+3. provider rate limit or timeout
+4. notification destination failure and dead letter
+5. ambiguous identity
+6. missing recovery history
+7. stale successful backup
+8. action provider timeout
+9. successful provider response with failed postcondition
+10. restart during lifecycle transition or queued delivery
+
+### Performance proof
+
+1. bounded active-count latency
+2. bounded Patrol pagination
+3. bounded table batch enrichment
+4. no per-row network pattern
+5. stable memory and database behavior under retained evidence and recovery
+ history
+
+## User-Lens Acceptance
+
+Before each customer-facing phase is accepted:
+
+1. state the operator's job in their words
+2. exercise the live surface to deepest state
+3. count navigation depth and visible elements before the answer
+4. identify the action supported by each default-visible element
+5. replace or explain unfamiliar vocabulary
+6. compare the design with relevant GitHub issue evidence
+7. classify each element as keep, demote to expansion, or cut
+8. record whether the surface is `prototype` or `product`
+
+No phase closes while its main surface remains prototype-grade.
+
+## Completion Criteria
+
+This specification is fully implemented only when all of the following are
+true:
+
+1. every required canonical domain contract exists in code and subsystem
+ governance
+2. alert, navigation, Patrol, resource, and notification views share one
+ lifecycle truth
+3. stale, partial, denied, failed, ambiguous, and unknown evidence cannot
+ masquerade as healthy or resolved
+4. protection posture is provider-aware, subject-linked, explainable, and
+ available without per-row fetches
+5. Patrol is a functional attention queue with active-work and calm-day product
+ states
+6. availability attaches to known resources and participates in the same
+ evidence and lifecycle model
+7. at least one useful narrow mutating action completes the
+ plan/approve/execute/verify loop through the canonical action framework
+8. every required proof in this document passes or is explicitly marked not
+ applicable with a canonical justification
+9. live Playwright inspection passes the product quality and user-lens gates
+10. supported API and persisted-data migrations are proven
+11. subsystem contracts, status evidence, readiness assertions, release gates,
+ upgrade documentation, and operator documentation reflect runtime truth
+12. no temporary compatibility path remains in the primary runtime
+13. all implementation slices are committed with scoped proof and no unrelated
+ workspace changes
+14. the governing candidate lanes and coverage gaps are resolved or normalized
+ to an explicit remaining decision owned outside this specification
+
+Passing one phase does not satisfy the overall goal. The goal closes only after
+the full completion criteria pass.
+
+## Governance Mapping
+
+Primary lane and subsystem ownership:
+
+1. L6: alerts, lifecycle, notifications, API coherence, Patrol projection
+2. L8: platform and resource-facing product surfaces
+3. L13: monitoring, recovery evidence, unified resources, availability
+4. L20: action capability, approval, audit, and verification
+5. L22: product trust, Assistant boundaries, policy-shaped context
+6. L23: proactive operations and Patrol workbench
+
+Primary candidate:
+
+- `protection-posture-attention-queue`
+
+Sequential related candidate:
+
+- `availability-as-resource-facet`
+
+The primary candidate's subsystem mapping must include the canonical owners
+that this implementation touches, including alerts, notifications, storage and
+recovery, Patrol intelligence, monitoring, unified resources, API contracts,
+frontend primitives, action governance, and policy-shaped Assistant context.
+
+## Direction Captured
+
+This specification records a `release_gate`:
+
+> Pulse v6 is not operationally trustworthy until every customer-facing active
+> state, evidence explanation, protection assertion, notification consequence,
+> and governed action resolves through one contradiction-free canonical
+> lifecycle and evidence model.
+
+It also records a `readiness_assertion`:
+
+> A resource may be called protected, healthy, resolved, or action-eligible
+> only when current, sufficiently complete, subject-linked evidence supports
+> that assertion; otherwise Pulse must display the limiting stale, partial,
+> ambiguous, failed, or unknown state.
diff --git a/docs/release-control/v6/internal/records/operational-trust-alert-state-boundary-2026-07-18.md b/docs/release-control/v6/internal/records/operational-trust-alert-state-boundary-2026-07-18.md
new file mode 100644
index 0000000000..d161582a1e
--- /dev/null
+++ b/docs/release-control/v6/internal/records/operational-trust-alert-state-boundary-2026-07-18.md
@@ -0,0 +1,94 @@
+# Operational Trust Alert-State Boundary
+
+Date: 2026-07-18
+Lane: L6 alerts and notification coherence
+Candidate: `protection-posture-attention-queue`
+Specification:
+`docs/release-control/v6/internal/OPERATIONAL_TRUST_IMPLEMENTATION_SPEC.md`
+
+## Outcome
+
+Pulse now preserves the canonical boundary between alert detection, in-product
+alert visibility, and external notification delivery.
+
+- `AlertConfig.enabled` owns detector evaluation and the in-product active-alert
+ read model.
+- `AlertConfig.activationState` remains the compatibility field controlling
+ external notification delivery until the specification's typed API migration
+ replaces it.
+- Pausing external notifications no longer clears websocket alert state, hides
+ row alert indicators, blocks alert configuration, or claims that threshold
+ evaluation has stopped.
+- The Alerts surface names the control **Notifications enabled** or
+ **Notifications paused** and explicitly states that Pulse continues detecting
+ and showing active alerts while delivery is paused.
+
+This removes the observed contradiction where navigation reported active alerts
+while the Alerts page presented monitoring as paused and empty.
+
+## Canonical Ownership
+
+The alerts subsystem contract now owns the frontend state boundary, including
+the websocket projection and shared presentation helpers. The matching
+`alert-state-ownership-boundary` path policy requires focused store, page,
+websocket-resilience, and compatibility-helper tests whenever those files
+change.
+
+## Automated Proof
+
+- `npm run type-check` from `frontend-modern`
+- `npm --prefix frontend-modern run lint:eslint -- --quiet`
+- `npm test -- src/stores/__tests__/alertsActivation.test.ts src/utils/__tests__/alertsActivation.test.ts src/utils/__tests__/alertsActivation.branchcov0712c.test.ts src/pages/__tests__/Alerts.readOnly.test.tsx src/stores/__tests__/websocket-resilience.test.ts`
+ - 5 files passed
+ - 28 tests passed
+- Focused table and surface suite:
+ - 14 files passed
+ - 128 tests passed
+- `npm test -- src/i18n/__tests__/i18n.test.ts`
+ - 19 tests passed
+- `npm test -- src/utils/__tests__/metricThresholds.test.ts`
+ - 34 tests passed
+- `go test ./internal/alerts -run 'TestNotificationActivationDoesNotSuppressDetectionOrActiveReadModel' -count=1`
+ - proves both `pending_review` and `snoozed` continue detection and active
+ read-model visibility while suppressing external delivery
+- `go test ./internal/alerts -run 'TestCheckMetricInvokesAICallbackWhenNotificationsSuppressed|TestSmokeUnifiedEvaluatorActiveEndToEnd|TestSmokeAlertDisableGatesUnifiedEvaluation|TestSmokeReenableProducesCorrectAlerts' -count=1`
+- `go test ./internal/api -run 'TestActivateAlerts_EnablesNotificationManager' -count=1`
+- `python3 scripts/release_control/status_audit.py --pretty`
+ - repository governance ready
+ - no missing evidence
+ - no claim conflicts
+- `python3 scripts/release_control/contract_audit.py --check`
+ - 16 subsystem contracts
+ - no errors
+ - no warnings
+- `python3 -m unittest subsystem_contracts_test contract_audit_test` from
+ `scripts/release_control`
+ - 18 tests passed
+
+## Live Browser Proof
+
+The local v6 Alerts surface was exercised in the in-app browser at desktop and
+390 by 844 mobile dimensions.
+
+1. With notifications enabled, the navigation badge and Alerts overview both
+ showed the same four active alerts.
+2. Pausing notifications changed the header to **Notifications paused** while
+ the active alerts remained visible.
+3. The confirmation message stated that Pulse would keep detecting and showing
+ active alerts.
+4. Thresholds, Notifications, and Schedule remained available. Opening
+ Thresholds showed the complete configuration surface while delivery was
+ paused.
+5. Notifications were restored before ending the proof.
+6. The narrow viewport retained the header control, active-alert content, and
+ mobile navigation. A transient hydration frame settled to the same four
+ active alerts without a persistent contradictory empty state.
+7. No browser console errors or warnings were present.
+
+## Remaining Specification Work
+
+This evidence closes only the contradiction-containment implementation slice.
+It does not close the Operational Trust specification. The typed API migration,
+read-model consistency assertions, durable lifecycle and evidence model,
+protection posture, Patrol attention workbench, availability attachment,
+governed action loop, and hardening phases remain governed by the specification.
diff --git a/docs/release-control/v6/internal/status.json b/docs/release-control/v6/internal/status.json
index 4b07bedc74..f6a49c69c2 100644
--- a/docs/release-control/v6/internal/status.json
+++ b/docs/release-control/v6/internal/status.json
@@ -8691,16 +8691,22 @@
"L6",
"L8",
"L13",
+ "L14",
+ "L15",
"L20",
"L22",
"L23"
],
"subsystem_ids": [
"ai-runtime",
+ "alerts",
"api-contracts",
"frontend-primitives",
"monitoring",
+ "notifications",
"patrol-intelligence",
+ "security-privacy",
+ "storage-recovery",
"unified-resources"
],
"proposed_resolution": "lane-expansion",
@@ -8711,6 +8717,16 @@
"path": "docs/AI.md",
"kind": "file"
},
+ {
+ "repo": "pulse",
+ "path": "docs/release-control/v6/internal/OPERATIONAL_TRUST_IMPLEMENTATION_SPEC.md",
+ "kind": "file"
+ },
+ {
+ "repo": "pulse",
+ "path": "docs/release-control/v6/internal/records/operational-trust-alert-state-boundary-2026-07-18.md",
+ "kind": "file"
+ },
{
"repo": "pulse",
"path": "docs/release-control/v6/internal/records/protection-posture-attention-queue-strong-version-2026-06-25.md",
@@ -8833,6 +8849,8 @@
"L6",
"L8",
"L13",
+ "L14",
+ "L15",
"L20",
"L22",
"L23"
@@ -8842,10 +8860,14 @@
],
"subsystem_ids": [
"ai-runtime",
+ "alerts",
"api-contracts",
"frontend-primitives",
"monitoring",
+ "notifications",
"patrol-intelligence",
+ "security-privacy",
+ "storage-recovery",
"unified-resources"
]
},
@@ -8870,7 +8892,21 @@
]
}
],
- "work_claims": [],
+ "work_claims": [
+ {
+ "id": "codex-operational-trust-candidate-lane-protection-posture-attention-queue",
+ "agent_id": "codex-operational-trust",
+ "summary": "Canonical operational trust and protection evidence implementation specification",
+ "target_id": "v6-product-lane-expansion",
+ "claimed_at": "2026-07-18T21:46:08Z",
+ "heartbeat_at": "2026-07-18T21:46:08Z",
+ "expires_at": "2026-07-19T05:46:08Z",
+ "work_item": {
+ "kind": "candidate-lane",
+ "id": "protection-posture-attention-queue"
+ }
+ }
+ ],
"open_decisions": [],
"source_of_truth_file": "docs/release-control/v6/internal/SOURCE_OF_TRUTH.md",
"resolved_decisions": [
diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.md
index 10a7260f63..8dd1cd9a36 100644
--- a/docs/release-control/v6/internal/subsystems/alerts.md
+++ b/docs/release-control/v6/internal/subsystems/alerts.md
@@ -100,6 +100,9 @@ is no longer true.
68. `frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsPlatformData.ts`
69. `frontend-modern/src/utils/alertTargetTypes.ts`
70. `frontend-modern/src/types/alerts.ts`
+71. `frontend-modern/src/stores/websocket.ts`
+72. `frontend-modern/src/utils/alerts.ts`
+73. `frontend-modern/src/utils/alertsActivation.ts`
## Shared Boundaries
@@ -114,6 +117,14 @@ frontend-primitives: row, mobile-card, global-default, and bulk-selection
icon-only actions must compose `ActionIconButton` for shared size, tone, focus,
title, and accessible-name behavior instead of rendering local `<button>` plus
inline SVG shells in alert-owned runtime components.
+Alert runtime state has one explicit ownership boundary: `AlertConfig.enabled`
+controls detector evaluation and in-product alert visibility, while
+`AlertConfig.activationState` controls external notification delivery only.
+The websocket store, resource-row presentation, navigation counts, and Alerts
+overview must preserve active alert truth while notification delivery is
+pending review or snoozed. Notification activation must not clear the browser
+active-alert store, suppress resource indicators, lock threshold/history
+configuration, or claim that monitoring has stopped.
## Extension Points
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index a246de7d25..2ae634d461 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -2969,6 +2969,13 @@ thresholds from the table state, but threshold selection itself remains
alerts-owned through `frontend-modern/src/stores/alertsActivation.ts` and
`frontend-modern/src/utils/metricThresholds.ts`; shared primitive cells and rows
must only pass resolved warning/critical values into metric presentation.
+That alerts-owned boundary distinguishes detector state from external
+notification delivery. Shared tables, cells, navigation, and localized copy
+may use `detectionEnabled` to decide whether in-product alert evidence is
+applicable, but they must not derive visibility or threshold presentation from
+`activationState`. The activation control is presented as notification
+delivery only, and its localized paused copy must state that detection and
+in-product active-alert visibility continue.
The shared infrastructure selector now follows that same owner split.
`frontend-modern/src/components/shared/InfrastructureSelector.tsx` stays the
render shell, `frontend-modern/src/components/shared/useInfrastructureSelectorState.ts`
diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
index 03ea017684..3ca6d15563 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -203,6 +203,11 @@ change may globally weaken the Task 03 lifecycle-state idempotency invariant.
`frontend-modern/src/hooks/useWorkloads.ts` must consume canonical
`platformScopes`; page surfaces must not rebuild platform membership with
ad hoc source or runtime scans.
+ Workload active-alert decoration must consume the alerts store's existing
+ `detectionEnabled` accessor and websocket read model. External notification
+ activation may not trigger a second resource scan, clear cached active
+ alerts, or become a workload-table filter because delivery state is not
+ detector state.
Page-owned workload-type exclusions are part of that same hot path:
`useWorkloadsState` must apply them before dedupe, filter-option
derivation, summary statistics, and row rendering so a platform overview
diff --git a/docs/release-control/v6/internal/subsystems/registry.json b/docs/release-control/v6/internal/subsystems/registry.json
index 0ea4399413..7250aa0b07 100644
--- a/docs/release-control/v6/internal/subsystems/registry.json
+++ b/docs/release-control/v6/internal/subsystems/registry.json
@@ -1904,6 +1904,7 @@
"owned_files": [
"frontend-modern/src/pages/Alerts.tsx",
"frontend-modern/src/stores/alertsActivation.ts",
+ "frontend-modern/src/stores/websocket.ts",
"frontend-modern/src/types/alerts.ts",
"frontend-modern/src/utils/alertActivationPresentation.ts",
"frontend-modern/src/utils/alertAdministrationPresentation.ts",
@@ -1917,6 +1918,8 @@
"frontend-modern/src/utils/alertIncidentPresentation.ts",
"frontend-modern/src/utils/alertOverviewPresentation.ts",
"frontend-modern/src/utils/alertResourceTablePresentation.ts",
+ "frontend-modern/src/utils/alerts.ts",
+ "frontend-modern/src/utils/alertsActivation.ts",
"frontend-modern/src/utils/alertSchedulePresentation.ts",
"frontend-modern/src/utils/alertSeverityPresentation.ts",
"frontend-modern/src/utils/alertTabsPresentation.ts",
@@ -1938,6 +1941,23 @@
],
"require_explicit_path_policy_coverage": true,
"path_policies": [
+ {
+ "id": "alert-state-ownership-boundary",
+ "label": "alert detection and notification state proof",
+ "match_prefixes": [],
+ "match_files": [
+ "frontend-modern/src/stores/websocket.ts",
+ "frontend-modern/src/utils/alerts.ts",
+ "frontend-modern/src/utils/alertsActivation.ts"
+ ],
+ "allow_same_subsystem_tests": false,
+ "test_prefixes": [],
+ "exact_files": [
+ "frontend-modern/src/stores/__tests__/websocket-resilience.test.ts",
+ "frontend-modern/src/utils/__tests__/alertsActivation.branchcov0712c.test.ts",
+ "frontend-modern/src/utils/__tests__/alertsActivation.test.ts"
+ ]
+ },
{
"id": "alert-specs",
"label": "alert spec proof",
diff --git a/docs/release-control/v6/internal/subsystems/security-privacy.md b/docs/release-control/v6/internal/subsystems/security-privacy.md
index 16169ff303..b45fdae6e7 100644
--- a/docs/release-control/v6/internal/subsystems/security-privacy.md
+++ b/docs/release-control/v6/internal/subsystems/security-privacy.md
@@ -313,6 +313,11 @@ the `white_label` branding entitlement.
only for redirect/manual-link copy and must preserve `Pulse Account`,
security/privacy disclosures, token names, API field names, route/query keys,
and purchase-return state exactly.
+ Alerts-owned localization may distinguish detector state, in-product alert
+ visibility, and external notification delivery, but it must preserve all
+ security/privacy terminology and destination confidentiality. Pausing
+ delivery changes no authorization, tenant boundary, destination secret, or
+ active-alert evidence access rule.
6. Change operator-facing telemetry/adoption reporting through `scripts/telemetry_adoption_report.py` together with the privacy disclosure whenever release-identity interpretation changes.
The adoption report excludes mock-fixture-fleet-signature rows (120×N
Kubernetes pods with 7×N VMware hosts, the `internal/mock` template) from
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 3cd40759e2..530daa342b 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -94,6 +94,12 @@ a recovery-provider read helper or compatibility alias.
3. `internal/api/setup_script_render.go` shared with `agent-lifecycle`, `api-contracts`: the generated Proxmox setup-script is a shared boundary across agent lifecycle (forced-command keys, install/uninstall edits), API contracts (rendered token shape and encoded rerun URL), and storage/recovery (backup visibility grants, Pulse-managed temperature SSH keys, and SMART disk-temperature collection).
4. `internal/proxmoxidentity/backup_identity.go` shared with `alerts`, `monitoring`: Proxmox PBS backup subject identity is a shared runtime boundary for monitoring backup freshness, backup-age alert attribution, and recovery-point guest mapping.
+Storage resource projections may show alert indicators from the canonical
+active-alert read model only while detector evaluation is enabled. They must
+not hide storage or recovery alerts when external notification delivery is
+pending, paused, snoozed, unavailable, or destination-disabled; those delivery
+states do not change the underlying storage evidence or active lifecycle.
+
## Extension Points
Commercial v5-to-v6 migration posture may be carried by `internal/api/`
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 89ecd42c96..fb24a9a498 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -251,6 +251,10 @@ filter semantics, drawer handoffs, and resource projections, while
Future platform tables must keep that split: row data and platform semantics
stay in the unified-resource consumer, and the repeated table shell stays in the
shared frontend primitive.
+Alert decoration on those platform rows consumes the canonical active-alert
+read model and the detector-enabled accessor. External notification activation
+is not a resource-health field and must never suppress row alerts, change
+resource filtering, or create a parallel platform-local alert truth.
The standalone Pulse Agent and Availability monitor may add one compact status
summary immediately above its canonical table. That summary must be derived
from the same already-loaded unified-resource slice, use canonical resource
diff --git a/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx b/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx
index 0bf37826ab..22b86beac4 100644
--- a/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx
+++ b/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx
@@ -73,7 +73,7 @@ const reconnectSpy = vi.fn();
let hookResources: Resource[] = [];
let hookLoading = false;
let hookError: unknown = undefined;
-let alertsActivationState: 'active' | 'pending_review' | 'snoozed' | null = 'active';
+let alertsDetectionEnabled = true;
const setStorageFilter = (filterLabel: string, optionLabel: string) => {
const existingChip = queryStorageChip(filterLabel);
@@ -312,7 +312,7 @@ vi.mock('@/contexts/appRuntime', () => ({
vi.mock('@/stores/alertsActivation', () => ({
useAlertsActivation: () => ({
- activationState: () => alertsActivationState,
+ detectionEnabled: () => alertsDetectionEnabled,
getMetricThresholds: () => ({ warning: 80, critical: 85 }),
}),
}));
@@ -391,7 +391,7 @@ describe('Storage', () => {
wsInitialDataReceived = true;
wsReconnecting = false;
wsActiveAlerts = {};
- alertsActivationState = 'active';
+ alertsDetectionEnabled = true;
reconnectSpy.mockReset();
wsState = {
resources: [],
@@ -817,7 +817,10 @@ describe('Storage', () => {
fireEvent.click(clearButton);
await waitFor(() => {
- expect(navigateSpy).toHaveBeenCalledWith('/proxmox/storage?group=node', ROUTE_STATE_REPLACE_OPTIONS);
+ expect(navigateSpy).toHaveBeenCalledWith(
+ '/proxmox/storage?group=node',
+ ROUTE_STATE_REPLACE_OPTIONS,
+ );
});
});
diff --git a/frontend-modern/src/components/Storage/useStoragePageResources.ts b/frontend-modern/src/components/Storage/useStoragePageResources.ts
index 53ed5af570..9654743a9e 100644
--- a/frontend-modern/src/components/Storage/useStoragePageResources.ts
+++ b/frontend-modern/src/components/Storage/useStoragePageResources.ts
@@ -14,7 +14,7 @@ export const useStoragePageResources = () => {
const nodes = createMemo(() => byType('agent'));
const physicalDisks = createMemo(() => byType('physical_disk'));
const cephResources = createMemo(() => byType('ceph'));
- const alertsEnabled = createMemo(() => alertsActivation.activationState() === 'active');
+ const alertsEnabled = alertsActivation.detectionEnabled;
return {
state,
diff --git a/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.k8s.test.tsx b/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.k8s.test.tsx
index 45cd287cb4..fcde82e04b 100644
--- a/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.k8s.test.tsx
+++ b/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.k8s.test.tsx
@@ -106,7 +106,7 @@ vi.mock('@/api/guestMetadata', () => ({
vi.mock('@/stores/alertsActivation', () => ({
useAlertsActivation: () => ({
- activationState: () => 'active',
+ detectionEnabled: () => true,
getMetricThresholds: () => ({ warning: 70, critical: 85 }),
getBackupThresholds: () => ({ freshHours: 24, staleHours: 72 }),
}),
diff --git a/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.performance.contract.test.tsx b/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.performance.contract.test.tsx
index 5fca122817..0a12e7721f 100644
--- a/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.performance.contract.test.tsx
+++ b/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.performance.contract.test.tsx
@@ -195,7 +195,7 @@ vi.mock('@/api/guestMetadata', () => ({
vi.mock('@/stores/alertsActivation', () => ({
useAlertsActivation: () => ({
- activationState: () => 'active',
+ detectionEnabled: () => true,
getMetricThresholds: () => ({ warning: 70, critical: 85 }),
getBackupThresholds: () => ({ freshHours: 24, staleHours: 72 }),
}),
diff --git a/frontend-modern/src/components/Workloads/useWorkloadsState.ts b/frontend-modern/src/components/Workloads/useWorkloadsState.ts
index 99d579f56b..529837b2e9 100644
--- a/frontend-modern/src/components/Workloads/useWorkloadsState.ts
+++ b/frontend-modern/src/components/Workloads/useWorkloadsState.ts
@@ -126,7 +126,7 @@ export function useWorkloadsState(props: WorkloadsSurfaceProps) {
const ws = useWebSocket();
const { connected, activeAlerts, initialDataReceived, reconnecting, reconnect } = ws;
const alertsActivation = useAlertsActivation();
- const alertsEnabled = createMemo(() => alertsActivation.activationState() === 'active');
+ const alertsEnabled = alertsActivation.detectionEnabled;
const kioskMode = useKioskMode();
diff --git a/frontend-modern/src/features/alerts/__tests__/alertsLocalization.guardrails.test.ts b/frontend-modern/src/features/alerts/__tests__/alertsLocalization.guardrails.test.ts
index 8ca70d0fb9..d48044cf8d 100644
--- a/frontend-modern/src/features/alerts/__tests__/alertsLocalization.guardrails.test.ts
+++ b/frontend-modern/src/features/alerts/__tests__/alertsLocalization.guardrails.test.ts
@@ -22,10 +22,10 @@ const migratedAlertsSurfaceSources = [
] as const;
const migratedAlertsOverviewCopy = [
- 'Alerts enabled',
- 'Alerts disabled',
+ 'Notifications enabled',
+ 'Notifications paused',
'Alerts navigation',
- 'Toggle alerts',
+ 'Toggle external notifications',
'Active Alerts',
'Alerting is paused',
'Toggle alerts on to resume monitoring and unlock configuration tabs',
diff --git a/frontend-modern/src/features/alerts/thresholds/hooks/__tests__/useThresholdsTableState.test.tsx b/frontend-modern/src/features/alerts/thresholds/hooks/__tests__/useThresholdsTableState.test.tsx
index 8968dea0c0..8a1c413573 100644
--- a/frontend-modern/src/features/alerts/thresholds/hooks/__tests__/useThresholdsTableState.test.tsx
+++ b/frontend-modern/src/features/alerts/thresholds/hooks/__tests__/useThresholdsTableState.test.tsx
@@ -13,7 +13,7 @@ vi.mock('@solidjs/router', () => ({
}));
vi.mock('@/stores/alertsActivation', () => ({
- useAlertsActivation: () => ({ activationState: () => 'active' }),
+ useAlertsActivation: () => ({ detectionEnabled: () => true }),
}));
vi.mock('@/components/Alerts/Thresholds/hooks/useCollapsedSections', () => ({
diff --git a/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsTableState.ts b/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsTableState.ts
index 4637f97e53..3037b7a6ed 100644
--- a/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsTableState.ts
+++ b/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsTableState.ts
@@ -84,7 +84,7 @@ export function useThresholdsTableState(props: ThresholdsTableProps) {
const navigate = useNavigate();
const location = useLocation();
const alertsActivation = useAlertsActivation();
- const alertsEnabled = createMemo(() => alertsActivation.activationState() === 'active');
+ const alertsEnabled = alertsActivation.detectionEnabled;
const sectionTitles = getAlertThresholdsSectionTitles();
const guestFilterPresentation = getAlertThresholdsGuestFilterPresentation();
const backupOrphanedPresentation = getAlertThresholdsBackupOrphanedPresentation();
diff --git a/frontend-modern/src/features/docker/DockerHostsTable.tsx b/frontend-modern/src/features/docker/DockerHostsTable.tsx
index 5686e94c0b..5d3f3bed73 100644
--- a/frontend-modern/src/features/docker/DockerHostsTable.tsx
+++ b/frontend-modern/src/features/docker/DockerHostsTable.tsx
@@ -111,10 +111,7 @@ const DOCKER_HOST_SORT_KEYS = [
type DockerHostSortKey = (typeof DOCKER_HOST_SORT_KEYS)[number];
-const getDockerHostSortValue = (
- host: Resource,
- key: DockerHostSortKey,
-): PlatformTableSortValue => {
+const getDockerHostSortValue = (host: Resource, key: DockerHostSortKey): PlatformTableSortValue => {
switch (key) {
case 'host':
return asTrimmedString(host.name) || host.id;
@@ -160,7 +157,7 @@ export const DockerHostsTable: Component<{
}> = (props) => {
const { activeAlerts } = useWebSocket();
const alertsActivation = useAlertsActivation();
- const alertsEnabled = createMemo(() => alertsActivation.activationState() === 'active');
+ const alertsEnabled = alertsActivation.detectionEnabled;
const tableState = createPlatformTableFilterState({
resources: () => props.resources,
initialStatus: 'all' as DockerResourceStatusFilter,
@@ -174,7 +171,9 @@ export const DockerHostsTable: Component<{
sortKeys: DOCKER_HOST_SORT_KEYS,
descendingFirst: ['containers', 'cpu', 'memory', 'disk', 'uptime', 'temp'],
});
- const sortedHosts = createMemo(() => sort.sortRows(tableState.filtered(), getDockerHostSortValue));
+ const sortedHosts = createMemo(() =>
+ sort.sortRows(tableState.filtered(), getDockerHostSortValue),
+ );
const hasFilteredSourceRows = () => (props.sourceCount ?? props.resources.length) > 0;
@@ -474,9 +473,7 @@ export const DockerHostsTable: Component<{
<TableCell
class={`${getPlatformTableCellClassForKind('numeric-value')} hidden text-base-content md:table-cell`}
>
- {formatPlatformTableUptimeValue(
- host.uptime ?? docker()?.uptimeSeconds,
- )}
+ {formatPlatformTableUptimeValue(host.uptime ?? docker()?.uptimeSeconds)}
</TableCell>
<TableCell
class={`${getPlatformTableCellClassForKind('numeric-value')} hidden text-base-content md:table-cell`}
diff --git a/frontend-modern/src/features/docker/__tests__/DockerHostsTable.test.tsx b/frontend-modern/src/features/docker/__tests__/DockerHostsTable.test.tsx
index 2d5fa26241..eb4e46fad1 100644
--- a/frontend-modern/src/features/docker/__tests__/DockerHostsTable.test.tsx
+++ b/frontend-modern/src/features/docker/__tests__/DockerHostsTable.test.tsx
@@ -20,7 +20,7 @@ vi.mock('@/contexts/appRuntime', () => ({
}));
vi.mock('@/stores/alertsActivation', () => ({
useAlertsActivation: () => ({
- activationState: () => 'active',
+ detectionEnabled: () => true,
getMetricThresholds: () => ({ warning: 80, critical: 85 }),
}),
}));
diff --git a/frontend-modern/src/features/kubernetes/KubernetesNodesTable.tsx b/frontend-modern/src/features/kubernetes/KubernetesNodesTable.tsx
index ab4fd8d5f9..c996fd8136 100644
--- a/frontend-modern/src/features/kubernetes/KubernetesNodesTable.tsx
+++ b/frontend-modern/src/features/kubernetes/KubernetesNodesTable.tsx
@@ -122,7 +122,7 @@ export const KubernetesNodesTable: Component<{
}> = (props) => {
const { activeAlerts } = useWebSocket();
const alertsActivation = useAlertsActivation();
- const alertsEnabled = createMemo(() => alertsActivation.activationState() === 'active');
+ const alertsEnabled = alertsActivation.detectionEnabled;
const tableState = createPlatformTableFilterState({
resources: () => props.resources,
initialStatus: 'all' as KubernetesResourceStatusFilter,
@@ -196,7 +196,12 @@ export const KubernetesNodesTable: Component<{
desktop gets extra room without forcing normal desktop
viewports to hide Capacity behind horizontal scroll.
*/}
- <PlatformSortableTableHead kind="name" sort={sort} sortKey="node" class="md:w-[15%]">
+ <PlatformSortableTableHead
+ kind="name"
+ sort={sort}
+ sortKey="node"
+ class="md:w-[15%]"
+ >
Node
</PlatformSortableTableHead>
<PlatformSortableTableHead
diff --git a/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx
index 9c77c09b7e..273cce142d 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx
@@ -196,7 +196,7 @@ export const ProxmoxNodesTable: Component<{
const breakpoint = useBreakpoint();
const { activeAlerts } = useWebSocket();
const alertsActivation = useAlertsActivation();
- const alertsEnabled = createMemo(() => alertsActivation.activationState() === 'active');
+ const alertsEnabled = alertsActivation.detectionEnabled;
const [selectedNodeId, setSelectedNodeId] = createSignal<string | null>(null);
const layoutMode = createMemo(() => getWorkloadTableLayoutMode(breakpoint.width()));
const visibleColumns = createMemo(() => getProxmoxHostVisibleColumnsForLayout(layoutMode()));
diff --git a/frontend-modern/src/features/proxmox/__tests__/ProxmoxNodesTable.test.tsx b/frontend-modern/src/features/proxmox/__tests__/ProxmoxNodesTable.test.tsx
index d330b11de0..740bc95658 100644
--- a/frontend-modern/src/features/proxmox/__tests__/ProxmoxNodesTable.test.tsx
+++ b/frontend-modern/src/features/proxmox/__tests__/ProxmoxNodesTable.test.tsx
@@ -21,7 +21,7 @@ vi.mock('@/contexts/appRuntime', () => ({
vi.mock('@/stores/alertsActivation', () => ({
useAlertsActivation: () => ({
- activationState: () => 'active',
+ detectionEnabled: () => true,
getMetricThresholds: getMetricThresholdsMock,
}),
}));
diff --git a/frontend-modern/src/features/truenas/TrueNASSystemsTable.tsx b/frontend-modern/src/features/truenas/TrueNASSystemsTable.tsx
index 0f860aab4d..c2c3059678 100644
--- a/frontend-modern/src/features/truenas/TrueNASSystemsTable.tsx
+++ b/frontend-modern/src/features/truenas/TrueNASSystemsTable.tsx
@@ -144,7 +144,7 @@ export const TrueNASSystemsTable: Component<{
}> = (props) => {
const { activeAlerts } = useWebSocket();
const alertsActivation = useAlertsActivation();
- const alertsEnabled = createMemo(() => alertsActivation.activationState() === 'active');
+ const alertsEnabled = alertsActivation.detectionEnabled;
const tableState = createPlatformTableFilterState({
resources: () => props.systems,
initialStatus: 'all' as PlatformResourceStatusFilter,
@@ -248,7 +248,11 @@ export const TrueNASSystemsTable: Component<{
>
Temp
</PlatformSortableTableHead>
- <PlatformSortableTableHead kind="text" sort={sort} class="hidden lg:table-cell lg:w-[15%]">
+ <PlatformSortableTableHead
+ kind="text"
+ sort={sort}
+ class="hidden lg:table-cell lg:w-[15%]"
+ >
Inventory
</PlatformSortableTableHead>
<PlatformSortableTableHead
@@ -259,7 +263,11 @@ export const TrueNASSystemsTable: Component<{
>
Shares
</PlatformSortableTableHead>
- <PlatformSortableTableHead kind="text" sort={sort} class="hidden lg:table-cell lg:w-[10%]">
+ <PlatformSortableTableHead
+ kind="text"
+ sort={sort}
+ class="hidden lg:table-cell lg:w-[10%]"
+ >
VMs / Apps
</PlatformSortableTableHead>
<PlatformSortableTableHead
diff --git a/frontend-modern/src/features/truenas/__tests__/TrueNASSystemsTable.test.tsx b/frontend-modern/src/features/truenas/__tests__/TrueNASSystemsTable.test.tsx
index 9db7b1bf1a..3498c1f76d 100644
--- a/frontend-modern/src/features/truenas/__tests__/TrueNASSystemsTable.test.tsx
+++ b/frontend-modern/src/features/truenas/__tests__/TrueNASSystemsTable.test.tsx
@@ -13,7 +13,7 @@ vi.mock('@/contexts/appRuntime', () => ({
useWebSocket: () => ({ activeAlerts: {} as Record<string, never> }),
}));
vi.mock('@/stores/alertsActivation', () => ({
- useAlertsActivation: () => ({ activationState: () => 'active' }),
+ useAlertsActivation: () => ({ detectionEnabled: () => true }),
}));
import { TrueNASSystemsTable } from '@/features/truenas/TrueNASSystemsTable';
diff --git a/frontend-modern/src/features/vmware/VsphereHostsTable.tsx b/frontend-modern/src/features/vmware/VsphereHostsTable.tsx
index 9885f27f79..f6b13259fe 100644
--- a/frontend-modern/src/features/vmware/VsphereHostsTable.tsx
+++ b/frontend-modern/src/features/vmware/VsphereHostsTable.tsx
@@ -124,7 +124,7 @@ export const VsphereHostsTable: Component<{
}> = (props) => {
const { activeAlerts } = useWebSocket();
const alertsActivation = useAlertsActivation();
- const alertsEnabled = createMemo(() => alertsActivation.activationState() === 'active');
+ const alertsEnabled = alertsActivation.detectionEnabled;
const tableState = createPlatformTableFilterState({
resources: () => props.hosts,
initialStatus: 'all' as PlatformResourceStatusFilter,
diff --git a/frontend-modern/src/features/vmware/__tests__/VsphereHostsTable.test.tsx b/frontend-modern/src/features/vmware/__tests__/VsphereHostsTable.test.tsx
index 9eee780044..42a9dab4ae 100644
--- a/frontend-modern/src/features/vmware/__tests__/VsphereHostsTable.test.tsx
+++ b/frontend-modern/src/features/vmware/__tests__/VsphereHostsTable.test.tsx
@@ -13,7 +13,7 @@ vi.mock('@/contexts/appRuntime', () => ({
useWebSocket: () => ({ activeAlerts: {} as Record<string, never> }),
}));
vi.mock('@/stores/alertsActivation', () => ({
- useAlertsActivation: () => ({ activationState: () => 'active' }),
+ useAlertsActivation: () => ({ detectionEnabled: () => true }),
}));
import { VsphereHostsTable } from '@/features/vmware/VsphereHostsTable';
diff --git a/frontend-modern/src/i18n/__tests__/i18n.test.ts b/frontend-modern/src/i18n/__tests__/i18n.test.ts
index a5b6385d33..18e51e45d1 100644
--- a/frontend-modern/src/i18n/__tests__/i18n.test.ts
+++ b/frontend-modern/src/i18n/__tests__/i18n.test.ts
@@ -284,6 +284,26 @@ describe('i18n foundation', () => {
}
});
+ it('keeps external notification delivery distinct from alert detection', () => {
+ expect(I18N_MESSAGES.en['alerts.activation.label.enabled']).toBe('Notifications enabled');
+ expect(I18N_MESSAGES.en['alerts.activation.label.disabled']).toBe('Notifications paused');
+ expect(I18N_MESSAGES.en['alerts.activation.toast.deactivated']).toContain(
+ 'keep detecting and showing active alerts',
+ );
+
+ expect(I18N_MESSAGES.de['alerts.activation.label.enabled']).toBe(
+ 'Benachrichtigungen aktiviert',
+ );
+ expect(I18N_MESSAGES.de['alerts.activation.label.disabled']).toBe(
+ 'Benachrichtigungen pausiert',
+ );
+ expect(I18N_MESSAGES.de['alerts.activation.toast.deactivated']).toContain('weiterhin');
+
+ expect(I18N_MESSAGES.es['alerts.activation.label.enabled']).toBe('Notificaciones activadas');
+ expect(I18N_MESSAGES.es['alerts.activation.label.disabled']).toBe('Notificaciones pausadas');
+ expect(I18N_MESSAGES.es['alerts.activation.toast.deactivated']).toContain('seguira');
+ });
+
it('keeps machine-facing identifiers unchanged in alerts overview catalog copy', () => {
for (const locale of FIRST_LOCALIZATION_LOCALES) {
expect(I18N_MESSAGES[locale]['alerts.assistant.button.full']).toContain('Pulse Assistant');
diff --git a/frontend-modern/src/i18n/messages.de.ts b/frontend-modern/src/i18n/messages.de.ts
index f36d345b3d..5452519618 100644
--- a/frontend-modern/src/i18n/messages.de.ts
+++ b/frontend-modern/src/i18n/messages.de.ts
@@ -7,16 +7,16 @@ export const DE_MESSAGE_OVERRIDES = {
'pricing.handoff.link.pulseAccount': 'weiter zu Pulse Account',
'pricing.handoff.title.publicPricing': 'Weiterleitung zu den Preisen',
'pricing.handoff.title.pulseAccount': 'Weiterleitung zu Pulse Account',
- 'alerts.activation.label.enabled': 'Warnmeldungen aktiviert',
- 'alerts.activation.label.disabled': 'Warnmeldungen deaktiviert',
+ 'alerts.activation.label.enabled': 'Benachrichtigungen aktiviert',
+ 'alerts.activation.label.disabled': 'Benachrichtigungen pausiert',
'alerts.activation.toast.activated':
- 'Warnmeldungen aktiviert. Sie erhalten jetzt Warnungen, wenn Probleme erkannt werden.',
+ 'Benachrichtigungen aktiviert. Sie erhalten jetzt Hinweise, wenn Probleme erkannt werden.',
'alerts.activation.toast.activateFailed':
- 'Warnmeldungen konnten nicht aktiviert werden. Bitte versuchen Sie es erneut.',
+ 'Benachrichtigungen konnten nicht aktiviert werden. Bitte versuchen Sie es erneut.',
'alerts.activation.toast.deactivated':
- 'Warnmeldungen deaktiviert. Es wird nichts gesendet, bis Sie sie wieder aktivieren.',
+ 'Benachrichtigungen pausiert. Pulse erkennt und zeigt aktive Warnmeldungen weiterhin an.',
'alerts.activation.toast.deactivateFailed':
- 'Warnmeldungen konnten nicht deaktiviert werden. Bitte versuchen Sie es erneut.',
+ 'Benachrichtigungen konnten nicht pausiert werden. Bitte versuchen Sie es erneut.',
'alerts.assistant.action.investigate': 'Warnmeldung {alertIdentifier} untersuchen',
'alerts.assistant.button.full': 'Pulse Assistant zu dieser Warnmeldung fragen',
'alerts.assistant.button.text': 'Pulse Assistant fragen',
@@ -56,7 +56,7 @@ export const DE_MESSAGE_OVERRIDES = {
'alerts.nav.collapseSidebar': 'Seitenleiste einklappen',
'alerts.nav.expandSidebar': 'Seitenleiste ausklappen',
'alerts.nav.title': 'Warnmeldungen',
- 'alerts.nav.toggleAlerts': 'Warnmeldungen umschalten',
+ 'alerts.nav.toggleAlerts': 'Externe Benachrichtigungen umschalten',
'alerts.overview.action.acknowledge': 'Bestaetigen',
'alerts.overview.action.acknowledgeAll': 'Alle bestaetigen ({count})',
'alerts.overview.action.acknowledging': 'Wird bestaetigt...',
@@ -103,7 +103,7 @@ export const DE_MESSAGE_OVERRIDES = {
'Suchen Sie fruehere Warnmeldungen, pruefen Sie Vorfall-Zeitleisten und beobachten Sie Warnungshaeufigkeit ueber Zeit.',
'alerts.page.history.title': 'Warnungsverlauf',
'alerts.page.overview.description':
- 'Pruefen Sie aktive Vorfaelle, Warnungsabdeckung und ob Warnmeldungen diese Installation aktiv ueberwachen.',
+ 'Pruefen Sie aktive Vorfaelle und die aktuelle Warnungsabdeckung der ueberwachten Ressourcen.',
'alerts.page.overview.title': 'Warnmeldungsuebersicht',
'alerts.page.schedule.description':
'Definieren Sie Ruhezeiten, Gruppierung, Abklingzeiten, Wiederherstellung und Eskalation fuer Warnmeldungen.',
diff --git a/frontend-modern/src/i18n/messages.es.ts b/frontend-modern/src/i18n/messages.es.ts
index 7ad736dc50..5329e13acf 100644
--- a/frontend-modern/src/i18n/messages.es.ts
+++ b/frontend-modern/src/i18n/messages.es.ts
@@ -7,16 +7,16 @@ export const ES_MESSAGE_OVERRIDES = {
'pricing.handoff.link.pulseAccount': 'continua a Pulse Account',
'pricing.handoff.title.publicPricing': 'Redirigiendo a precios',
'pricing.handoff.title.pulseAccount': 'Redirigiendo a Pulse Account',
- 'alerts.activation.label.enabled': 'Alertas activadas',
- 'alerts.activation.label.disabled': 'Alertas desactivadas',
+ 'alerts.activation.label.enabled': 'Notificaciones activadas',
+ 'alerts.activation.label.disabled': 'Notificaciones pausadas',
'alerts.activation.toast.activated':
- 'Alertas activadas. Ahora recibiras avisos cuando se detecten problemas.',
+ 'Notificaciones activadas. Ahora recibiras avisos cuando se detecten problemas.',
'alerts.activation.toast.activateFailed':
- 'No se pudieron activar las alertas. Intentalo de nuevo.',
+ 'No se pudieron activar las notificaciones. Intentalo de nuevo.',
'alerts.activation.toast.deactivated':
- 'Alertas desactivadas. No se enviara nada hasta que las vuelvas a activar.',
+ 'Notificaciones pausadas. Pulse seguira detectando y mostrando alertas activas.',
'alerts.activation.toast.deactivateFailed':
- 'No se pudieron desactivar las alertas. Intentalo de nuevo.',
+ 'No se pudieron pausar las notificaciones. Intentalo de nuevo.',
'alerts.assistant.action.investigate': 'Investigar alerta {alertIdentifier}',
'alerts.assistant.button.full': 'Preguntar a Pulse Assistant sobre esta alerta',
'alerts.assistant.button.text': 'Preguntar a Pulse Assistant',
@@ -55,7 +55,7 @@ export const ES_MESSAGE_OVERRIDES = {
'alerts.nav.collapseSidebar': 'Contraer barra lateral',
'alerts.nav.expandSidebar': 'Expandir barra lateral',
'alerts.nav.title': 'Alertas',
- 'alerts.nav.toggleAlerts': 'Alternar alertas',
+ 'alerts.nav.toggleAlerts': 'Alternar notificaciones externas',
'alerts.overview.action.acknowledge': 'Reconocer',
'alerts.overview.action.acknowledgeAll': 'Reconocer todas ({count})',
'alerts.overview.action.acknowledging': 'Reconociendo...',
@@ -98,7 +98,7 @@ export const ES_MESSAGE_OVERRIDES = {
'Busca alertas anteriores, revisa lineas de tiempo de incidentes e inspecciona la frecuencia de alertas.',
'alerts.page.history.title': 'Historial de alertas',
'alerts.page.overview.description':
- 'Revisa incidentes activos, confirma la cobertura de alertas y controla si las alertas monitorizan activamente esta instalacion.',
+ 'Revisa incidentes activos y confirma la cobertura actual de alertas en los recursos monitorizados.',
'alerts.page.overview.title': 'Resumen de alertas',
'alerts.page.schedule.description':
'Define horas de silencio, agrupacion, enfriamiento, recuperacion y escalado para la entrega de alertas.',
diff --git a/frontend-modern/src/i18n/messages.ts b/frontend-modern/src/i18n/messages.ts
index aefea5cfe3..9d9e7ef50c 100644
--- a/frontend-modern/src/i18n/messages.ts
+++ b/frontend-modern/src/i18n/messages.ts
@@ -100,14 +100,14 @@ export const EN_MESSAGES = {
'setup.step.security': 'Security',
'setup.step.unlockServer': 'Unlock server',
'setup.wizard.ariaLabel': 'Pulse Setup Wizard',
- 'alerts.activation.label.enabled': 'Alerts enabled',
- 'alerts.activation.label.disabled': 'Alerts disabled',
+ 'alerts.activation.label.enabled': 'Notifications enabled',
+ 'alerts.activation.label.disabled': 'Notifications paused',
'alerts.activation.toast.activated':
- "Alerts activated! You'll now receive alerts when issues are detected.",
- 'alerts.activation.toast.activateFailed': 'Unable to activate alerts. Please try again.',
+ "Notifications enabled. You'll now receive notifications when issues are detected.",
+ 'alerts.activation.toast.activateFailed': 'Unable to enable notifications. Please try again.',
'alerts.activation.toast.deactivated':
- 'Alerts deactivated. Nothing will be sent until you activate them again.',
- 'alerts.activation.toast.deactivateFailed': 'Unable to deactivate alerts. Please try again.',
+ 'Notifications paused. Pulse will keep detecting and showing active alerts.',
+ 'alerts.activation.toast.deactivateFailed': 'Unable to pause notifications. Please try again.',
'alerts.assistant.action.investigate': 'Investigate alert {alertIdentifier}',
'alerts.assistant.button.full': 'Ask Pulse Assistant about this alert',
'alerts.assistant.button.text': 'Ask Pulse Assistant',
@@ -144,7 +144,7 @@ export const EN_MESSAGES = {
'alerts.nav.collapseSidebar': 'Collapse sidebar',
'alerts.nav.expandSidebar': 'Expand sidebar',
'alerts.nav.title': 'Alerts',
- 'alerts.nav.toggleAlerts': 'Toggle alerts',
+ 'alerts.nav.toggleAlerts': 'Toggle external notifications',
'alerts.overview.action.acknowledge': 'Acknowledge',
'alerts.overview.action.acknowledgeAll': 'Acknowledge all ({count})',
'alerts.overview.action.acknowledging': 'Acknowledging...',
@@ -187,7 +187,7 @@ export const EN_MESSAGES = {
'Search prior alerts, review incident timelines, and inspect alert frequency over time.',
'alerts.page.history.title': 'Alert History',
'alerts.page.overview.description':
- 'Review active incidents, confirm alert coverage, and control whether alerts are actively monitoring this install.',
+ 'Review active incidents and confirm current alert coverage across monitored resources.',
'alerts.page.overview.title': 'Alerts Overview',
'alerts.page.schedule.description':
'Define quiet hours, grouping, cooldowns, recovery, and escalation behavior for alert delivery.',
diff --git a/frontend-modern/src/pages/Alerts.tsx b/frontend-modern/src/pages/Alerts.tsx
index 481c2409cd..87856eb329 100644
--- a/frontend-modern/src/pages/Alerts.tsx
+++ b/frontend-modern/src/pages/Alerts.tsx
@@ -6,7 +6,6 @@ import { useLocation, useNavigate } from '@solidjs/router';
import { logger } from '@/utils/logger';
import { t } from '@/i18n';
import { Card } from '@/components/shared/Card';
-import { Button } from '@/components/shared/Button';
import { PageHeader } from '@/components/shared/PageHeader';
import { notificationStore } from '@/stores/notifications';
@@ -35,7 +34,6 @@ import LayoutDashboard from 'lucide-solid/icons/layout-dashboard';
import History from 'lucide-solid/icons/history';
import Gauge from 'lucide-solid/icons/gauge';
import Send from 'lucide-solid/icons/send';
-import BellOff from 'lucide-solid/icons/bell-off';
import { presentationPolicyIsReadOnly } from '@/stores/sessionPresentationPolicy';
import { AlertsConfigurationSurface } from '@/features/alerts/AlertsConfigurationSurface';
import { OverviewTab } from '@/features/alerts/OverviewTab';
@@ -50,12 +48,10 @@ export function Alerts() {
const alertsActivation = useAlertsActivation();
const [isSwitchingActivation, setIsSwitchingActivation] = createSignal(false);
const readOnlySession = createMemo(() => presentationPolicyIsReadOnly());
- const isAlertsActive = createMemo(() => alertsActivation.activationState() === 'active');
- const areAlertsDisabled = createMemo(() => !isAlertsActive());
- const alertsConfigurationLocked = createMemo(() => !readOnlySession() && areAlertsDisabled());
+ const isNotificationDeliveryActive = alertsActivation.notificationDeliveryEnabled;
const alertActivationPresentation = createMemo(() =>
getAlertActivationPresentation({
- isActive: isAlertsActive(),
+ isActive: isNotificationDeliveryActive(),
isBusy: alertsActivation.isLoading() || isSwitchingActivation(),
}),
);
@@ -134,16 +130,6 @@ export function Alerts() {
}
});
- createEffect(() => {
- const activation = alertsActivation.activationState();
- if (activation === null || readOnlySession()) {
- return;
- }
- if (activation !== 'active' && activeTab() !== 'overview') {
- handleTabChange('overview');
- }
- });
-
const handleTabChange = (tab: AlertTab) => {
const targetPath = pathForTab(tab);
if (location.pathname !== targetPath) {
@@ -235,7 +221,7 @@ export function Alerts() {
<input
type="checkbox"
class="sr-only peer"
- checked={isAlertsActive()}
+ checked={isNotificationDeliveryActive()}
disabled={alertsActivation.isLoading() || isSwitchingActivation()}
onChange={(event) => {
if (event.currentTarget.checked) {
@@ -254,205 +240,158 @@ export function Alerts() {
}
/>
- <Show
- when={!alertsConfigurationLocked()}
- fallback={
- <Card padding="none" class="overflow-hidden">
- <div class="grid gap-5 p-5 sm:p-6 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-center">
- <div class="flex min-w-0 gap-4">
- <div class="flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-amber-100 text-amber-700 dark:bg-amber-950 dark:text-amber-300">
- <BellOff class="h-5 w-5" aria-hidden="true" />
- </div>
- <div class="min-w-0">
- <h2 class="text-base font-semibold text-base-content">Alerts are paused</h2>
- <p class="mt-1 text-sm leading-6 text-muted">
- Pulse is not evaluating thresholds or sending new alert notifications. Existing
- alert history and configuration are preserved.
- </p>
- <p class="mt-2 text-xs text-muted">
- Enable alerts to resume monitoring and unlock thresholds, notifications, and
- maintenance schedules.
- </p>
- </div>
- </div>
- <Button
- type="button"
- variant="primary"
- size="md"
- class="w-full justify-center sm:w-auto"
- disabled={alertsActivation.isLoading() || isSwitchingActivation()}
- onClick={() => void handleActivateAlerts()}
- >
- {alertsActivation.isLoading() || isSwitchingActivation()
- ? 'Enabling alerts…'
- : 'Enable alerts'}
- </Button>
- </div>
- </Card>
- }
- >
- <Card padding="none" class="relative lg:flex overflow-hidden">
+ <Card padding="none" class="relative lg:flex overflow-hidden">
+ <div
+ class={`hidden lg:flex lg:flex-col ${sidebarCollapsed() ? 'w-16' : 'w-72'} ${sidebarCollapsed() ? 'lg:min-w-[4rem] lg:max-w-[4rem] lg:basis-[4rem]' : 'lg:min-w-[18rem] lg:max-w-[18rem] lg:basis-[18rem]'} relative border-b border-border lg:border-b-0 lg:border-r lg:align-top flex-shrink-0 transition-all duration-200`}
+ aria-label={t('alerts.nav.ariaLabel')}
+ aria-expanded={!sidebarCollapsed()}
+ >
<div
- class={`hidden lg:flex lg:flex-col ${sidebarCollapsed() ? 'w-16' : 'w-72'} ${sidebarCollapsed() ? 'lg:min-w-[4rem] lg:max-w-[4rem] lg:basis-[4rem]' : 'lg:min-w-[18rem] lg:max-w-[18rem] lg:basis-[18rem]'} relative border-b border-border lg:border-b-0 lg:border-r lg:align-top flex-shrink-0 transition-all duration-200`}
- aria-label={t('alerts.nav.ariaLabel')}
- aria-expanded={!sidebarCollapsed()}
+ class={`sticky top-0 ${sidebarCollapsed() ? 'px-2' : 'px-4'} py-5 space-y-5 transition-all duration-200`}
>
- <div
- class={`sticky top-0 ${sidebarCollapsed() ? 'px-2' : 'px-4'} py-5 space-y-5 transition-all duration-200`}
- >
- <Show when={!sidebarCollapsed()}>
- <div class="flex items-center justify-between pb-2 border-b border-border">
- <h2 class="text-sm font-semibold text-base-content">{t('alerts.nav.title')}</h2>
- <button
- type="button"
- onClick={() => setSidebarCollapsed(true)}
- class="p-1 rounded-md hover:bg-surface-hover transition-colors"
- aria-label={t('alerts.nav.collapseSidebar')}
- >
- <svg class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M11 19l-7-7 7-7m8 14l-7-7 7-7"
- />
- </svg>
- </button>
- </div>
- </Show>
- <Show when={sidebarCollapsed()}>
+ <Show when={!sidebarCollapsed()}>
+ <div class="flex items-center justify-between pb-2 border-b border-border">
+ <h2 class="text-sm font-semibold text-base-content">{t('alerts.nav.title')}</h2>
<button
type="button"
- onClick={() => setSidebarCollapsed(false)}
- class="w-full p-2 rounded-md hover:bg-surface-hover transition-colors"
- aria-label={t('alerts.nav.expandSidebar')}
+ onClick={() => setSidebarCollapsed(true)}
+ class="p-1 rounded-md hover:bg-surface-hover transition-colors"
+ aria-label={t('alerts.nav.collapseSidebar')}
>
- <svg
- class="w-5 h-5 mx-auto"
- fill="none"
- viewBox="0 0 24 24"
- stroke="currentColor"
- >
+ <svg class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
- d="M13 5l7 7-7 7M5 5l7 7-7 7"
+ d="M11 19l-7-7 7-7m8 14l-7-7 7-7"
/>
</svg>
</button>
- </Show>
- <div id="alerts-sidebar-menu" class="space-y-5">
- <For each={tabGroups()}>
- {(group) => (
- <div class="space-y-2">
- <Show when={!sidebarCollapsed()}>
- <p class="text-xs font-semibold uppercase tracking-wide text-muted">
- {group.label}
- </p>
- </Show>
- <div class="space-y-1.5">
- <For each={group.items}>
- {(item) => (
- <button
- type="button"
- aria-current={activeTab() === item.id ? 'page' : undefined}
- aria-disabled={alertsConfigurationLocked()}
- disabled={alertsConfigurationLocked()}
- class={getAlertsSidebarTabClass({
- isActive: activeTab() === item.id,
- isDisabled: alertsConfigurationLocked(),
- collapsed: sidebarCollapsed(),
- })}
- onClick={() => handleTabChange(item.id)}
- title={getAlertsTabTitle({
- isDisabled: alertsConfigurationLocked(),
- collapsed: sidebarCollapsed(),
- label: item.label,
- })}
- >
- {item.icon}
- <Show when={!sidebarCollapsed()}>
- <span class="truncate">{item.label}</span>
- </Show>
- </button>
- )}
- </For>
- </div>
- </div>
- )}
- </For>
</div>
+ </Show>
+ <Show when={sidebarCollapsed()}>
+ <button
+ type="button"
+ onClick={() => setSidebarCollapsed(false)}
+ class="w-full p-2 rounded-md hover:bg-surface-hover transition-colors"
+ aria-label={t('alerts.nav.expandSidebar')}
+ >
+ <svg class="w-5 h-5 mx-auto" fill="none" viewBox="0 0 24 24" stroke="currentColor">
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-width="2"
+ d="M13 5l7 7-7 7M5 5l7 7-7 7"
+ />
+ </svg>
+ </button>
+ </Show>
+ <div id="alerts-sidebar-menu" class="space-y-5">
+ <For each={tabGroups()}>
+ {(group) => (
+ <div class="space-y-2">
+ <Show when={!sidebarCollapsed()}>
+ <p class="text-xs font-semibold uppercase tracking-wide text-muted">
+ {group.label}
+ </p>
+ </Show>
+ <div class="space-y-1.5">
+ <For each={group.items}>
+ {(item) => (
+ <button
+ type="button"
+ aria-current={activeTab() === item.id ? 'page' : undefined}
+ class={getAlertsSidebarTabClass({
+ isActive: activeTab() === item.id,
+ isDisabled: false,
+ collapsed: sidebarCollapsed(),
+ })}
+ onClick={() => handleTabChange(item.id)}
+ title={getAlertsTabTitle({
+ isDisabled: false,
+ collapsed: sidebarCollapsed(),
+ label: item.label,
+ })}
+ >
+ {item.icon}
+ <Show when={!sidebarCollapsed()}>
+ <span class="truncate">{item.label}</span>
+ </Show>
+ </button>
+ )}
+ </For>
+ </div>
+ </div>
+ )}
+ </For>
</div>
</div>
+ </div>
- <div class="flex-1 overflow-hidden">
- <Show when={flatTabs().length > 0}>
- <div class="lg:hidden border-b border-border">
- <div class="p-1">
- <div class="flex w-full overflow-x-auto rounded-md bg-surface-hover p-0.5 touch-scroll scrollbar-hide">
- <For each={flatTabs()}>
- {(tab) => (
- <button
- type="button"
- aria-disabled={alertsConfigurationLocked()}
- disabled={alertsConfigurationLocked()}
- class={getAlertsMobileTabClass({
- isActive: activeTab() === tab.id,
- isDisabled: alertsConfigurationLocked(),
- })}
- onClick={() => handleTabChange(tab.id)}
- title={getAlertsTabTitle({
- isDisabled: alertsConfigurationLocked(),
- label: tab.label,
- })}
- >
- <span class="w-full text-center truncate block">{tab.label}</span>
- </button>
- )}
- </For>
- </div>
+ <div class="flex-1 overflow-hidden">
+ <Show when={flatTabs().length > 0}>
+ <div class="lg:hidden border-b border-border">
+ <div class="p-1">
+ <div class="flex w-full overflow-x-auto rounded-md bg-surface-hover p-0.5 touch-scroll scrollbar-hide">
+ <For each={flatTabs()}>
+ {(tab) => (
+ <button
+ type="button"
+ class={getAlertsMobileTabClass({
+ isActive: activeTab() === tab.id,
+ isDisabled: false,
+ })}
+ onClick={() => handleTabChange(tab.id)}
+ title={getAlertsTabTitle({
+ isDisabled: false,
+ label: tab.label,
+ })}
+ >
+ <span class="w-full text-center truncate block">{tab.label}</span>
+ </button>
+ )}
+ </For>
</div>
</div>
- </Show>
+ </div>
+ </Show>
- <div class="p-2 sm:p-6">
- <Show when={activeTab() === 'overview'}>
- <OverviewTab
- overrides={overviewOverrides()}
- activeAlerts={activeAlerts}
- updateAlert={updateAlert}
- showQuickTip={showQuickTip}
- dismissQuickTip={dismissQuickTip}
- showAcknowledged={showAcknowledged}
- setShowAcknowledged={setShowAcknowledged}
- alertsDisabled={alertsConfigurationLocked}
- />
- </Show>
+ <div class="p-2 sm:p-6">
+ <Show when={activeTab() === 'overview'}>
+ <OverviewTab
+ overrides={overviewOverrides()}
+ activeAlerts={activeAlerts}
+ updateAlert={updateAlert}
+ showQuickTip={showQuickTip}
+ dismissQuickTip={dismissQuickTip}
+ showAcknowledged={showAcknowledged}
+ setShowAcknowledged={setShowAcknowledged}
+ alertsDisabled={() => !alertsActivation.detectionEnabled()}
+ />
+ </Show>
- <Show when={!readOnlySession()}>
- <AlertsConfigurationSurface
- activeTab={activeTab}
- allResources={allResources}
- byType={byType}
- children={children}
- activeAlerts={activeAlerts}
- removeAlerts={removeAlerts}
- setOverviewOverrides={setOverviewOverrides}
- hasUnsavedChanges={hasUnsavedChanges}
- setHasUnsavedChanges={setHasUnsavedChanges}
- alertsActivationState={alertsActivation.activationState}
- alertsActivationConfig={alertsActivation.config}
- />
- </Show>
+ <Show when={!readOnlySession()}>
+ <AlertsConfigurationSurface
+ activeTab={activeTab}
+ allResources={allResources}
+ byType={byType}
+ children={children}
+ activeAlerts={activeAlerts}
+ removeAlerts={removeAlerts}
+ setOverviewOverrides={setOverviewOverrides}
+ hasUnsavedChanges={hasUnsavedChanges}
+ setHasUnsavedChanges={setHasUnsavedChanges}
+ alertsActivationState={alertsActivation.activationState}
+ alertsActivationConfig={alertsActivation.config}
+ />
+ </Show>
- <Show when={activeTab() === 'history'}>
- <HistoryTab getResource={getResource} allResources={allResources} />
- </Show>
- </div>
+ <Show when={activeTab() === 'history'}>
+ <HistoryTab getResource={getResource} allResources={allResources} />
+ </Show>
</div>
- </Card>
- </Show>
+ </div>
+ </Card>
</div>
);
}
diff --git a/frontend-modern/src/pages/__tests__/Alerts.readOnly.test.tsx b/frontend-modern/src/pages/__tests__/Alerts.readOnly.test.tsx
index caa5b5e716..620b8c607c 100644
--- a/frontend-modern/src/pages/__tests__/Alerts.readOnly.test.tsx
+++ b/frontend-modern/src/pages/__tests__/Alerts.readOnly.test.tsx
@@ -68,6 +68,8 @@ vi.mock('@/stores/aiChat', () => ({
vi.mock('@/stores/alertsActivation', () => ({
useAlertsActivation: () => ({
activationState: () => activationStateMock(),
+ detectionEnabled: () => true,
+ notificationDeliveryEnabled: () => activationStateMock() === 'active',
isLoading: () => false,
activate: vi.fn(async () => true),
deactivate: vi.fn(async () => true),
@@ -131,7 +133,7 @@ describe('Alerts read-only presentation', () => {
expect(screen.getByTestId('overview-tab')).toBeInTheDocument();
});
- expect(screen.queryByLabelText('Toggle alerts')).not.toBeInTheDocument();
+ expect(screen.queryByLabelText('Toggle external notifications')).not.toBeInTheDocument();
expect(screen.getAllByText('Overview').length).toBeGreaterThan(0);
expect(screen.getAllByText('History').length).toBeGreaterThan(0);
expect(screen.queryByText('Thresholds')).not.toBeInTheDocument();
@@ -165,24 +167,23 @@ describe('Alerts read-only presentation', () => {
await waitFor(() => {
expect(screen.getByTestId('alerts-config-surface')).toBeInTheDocument();
});
- expect(screen.queryByLabelText('Toggle alerts')).not.toBeInTheDocument();
+ expect(screen.queryByLabelText('Toggle external notifications')).not.toBeInTheDocument();
expect(screen.getAllByText('Thresholds').length).toBeGreaterThan(0);
expect(navigateSpy).not.toHaveBeenCalledWith('/alerts/overview', { replace: true });
});
- it('replaces the disabled navigation shell with one clear activation task', async () => {
+ it('keeps alert truth and configuration visible while external notifications are paused', async () => {
presentationPolicyIsReadOnlyMock.mockReturnValue(false);
activationStateMock.mockReturnValue('pending_review');
render(() => <Alerts />);
- expect(await screen.findByRole('heading', { name: 'Alerts are paused' })).toBeInTheDocument();
- expect(screen.getByRole('button', { name: 'Enable alerts' })).toBeInTheDocument();
- expect(
- screen.getByText(/not evaluating thresholds or sending new alert notifications/i),
- ).toBeInTheDocument();
- expect(screen.queryByTestId('overview-tab')).not.toBeInTheDocument();
- expect(screen.queryByTestId('alerts-config-surface')).not.toBeInTheDocument();
- expect(screen.queryByText('Thresholds')).not.toBeInTheDocument();
+ expect(await screen.findByTestId('overview-tab')).toBeInTheDocument();
+ expect(screen.getByTestId('alerts-config-surface')).toBeInTheDocument();
+ expect(screen.getByLabelText('Toggle external notifications')).not.toBeChecked();
+ expect(screen.getByText('Notifications paused')).toBeInTheDocument();
+ expect(screen.getAllByText('Thresholds').length).toBeGreaterThan(0);
+ expect(screen.queryByText('Alerts are paused')).not.toBeInTheDocument();
+ expect(overviewTabSpy.mock.calls.at(-1)?.[0].alertsDisabled()).toBe(false);
});
});
diff --git a/frontend-modern/src/stores/__tests__/alertsActivation.test.ts b/frontend-modern/src/stores/__tests__/alertsActivation.test.ts
new file mode 100644
index 0000000000..cca247590b
--- /dev/null
+++ b/frontend-modern/src/stores/__tests__/alertsActivation.test.ts
@@ -0,0 +1,68 @@
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { AlertsAPI } from '@/api/alerts';
+import { eventBus } from '@/stores/events';
+import { useAlertsActivation } from '@/stores/alertsActivation';
+import type { AlertConfig } from '@/types/alerts';
+import { ALERTS_DETECTION_EVENT } from '@/utils/alertsActivation';
+
+const alertConfig = (
+ activationState: AlertConfig['activationState'],
+ enabled = true,
+): AlertConfig =>
+ ({
+ enabled,
+ activationState,
+ }) as AlertConfig;
+
+describe('alerts activation ownership boundary', () => {
+ beforeEach(() => {
+ vi.restoreAllMocks();
+ window.__pulseAlertsDetectionEnabled = null;
+ eventBus.emit('org_switched', 'test-org');
+ });
+
+ it('keeps detection enabled when external notifications are pending review', async () => {
+ vi.spyOn(AlertsAPI, 'getConfig').mockResolvedValue(alertConfig('pending_review'));
+
+ const store = useAlertsActivation();
+ await store.refreshConfig();
+
+ expect(store.activationState()).toBe('pending_review');
+ expect(store.detectionEnabled()).toBe(true);
+ expect(store.notificationDeliveryEnabled()).toBe(false);
+ expect(window.__pulseAlertsDetectionEnabled).toBe(true);
+ });
+
+ it('pauses notification delivery without dispatching a detection-state change', async () => {
+ vi.spyOn(AlertsAPI, 'getConfig').mockResolvedValue(alertConfig('active'));
+ vi.spyOn(AlertsAPI, 'updateConfig').mockResolvedValue({ success: true });
+ const detectionEvent = vi.fn();
+ window.addEventListener(ALERTS_DETECTION_EVENT, detectionEvent);
+
+ try {
+ const store = useAlertsActivation();
+ await store.refreshConfig();
+ detectionEvent.mockClear();
+
+ expect(await store.deactivate()).toBe(true);
+ expect(store.activationState()).toBe('pending_review');
+ expect(store.detectionEnabled()).toBe(true);
+ expect(store.notificationDeliveryEnabled()).toBe(false);
+ expect(detectionEvent).not.toHaveBeenCalled();
+ } finally {
+ window.removeEventListener(ALERTS_DETECTION_EVENT, detectionEvent);
+ }
+ });
+
+ it('propagates the actual global detection switch independently of notification state', async () => {
+ vi.spyOn(AlertsAPI, 'getConfig').mockResolvedValue(alertConfig('active', false));
+
+ const store = useAlertsActivation();
+ await store.refreshConfig();
+
+ expect(store.detectionEnabled()).toBe(false);
+ expect(store.notificationDeliveryEnabled()).toBe(false);
+ expect(window.__pulseAlertsDetectionEnabled).toBe(false);
+ });
+});
diff --git a/frontend-modern/src/stores/alertsActivation.ts b/frontend-modern/src/stores/alertsActivation.ts
index dcf22fb720..8ccdf15dfe 100644
--- a/frontend-modern/src/stores/alertsActivation.ts
+++ b/frontend-modern/src/stores/alertsActivation.ts
@@ -2,7 +2,7 @@ import { createSignal } from 'solid-js';
import { AlertsAPI } from '@/api/alerts';
import type { AlertConfig, ActivationState as ActivationStateType } from '@/types/alerts';
import type { Alert } from '@/types/api';
-import { setGlobalActivationState } from '@/utils/alertsActivation';
+import { setGlobalAlertsDetectionEnabled } from '@/utils/alertsActivation';
import { FACTORY_NODE_DEFAULTS } from '@/utils/alertThresholdDefaults';
import { logger } from '@/utils/logger';
import {
@@ -19,10 +19,11 @@ const [activationState, setActivationStateSignal] = createSignal<ActivationState
const [isLoading, setIsLoading] = createSignal(false);
const [activeAlerts, setActiveAlerts] = createSignal<Alert[]>([]);
const [lastError, setLastError] = createSignal<string | null>(null);
+const detectionEnabled = () => config()?.enabled ?? true;
+const notificationDeliveryEnabled = () => detectionEnabled() && activationState() === 'active';
const applyActivationState = (state: ActivationStateType | null) => {
setActivationStateSignal(state);
- setGlobalActivationState(state);
};
const ensureConfigLoaded = async (): Promise<AlertConfig | null> => {
@@ -41,6 +42,7 @@ const refreshConfig = async (): Promise<void> => {
setLastError(null);
const alertConfig = await AlertsAPI.getConfig();
setConfig(alertConfig);
+ setGlobalAlertsDetectionEnabled(alertConfig.enabled);
applyActivationState(alertConfig.activationState || 'active');
} catch (error) {
logger.error('Failed to fetch alert config:', error);
@@ -158,6 +160,7 @@ const getDiskTemperatureThresholds = (
eventBus.on('org_switched', () => {
setConfig(null);
+ setGlobalAlertsDetectionEnabled(null);
applyActivationState(null);
setActiveAlerts([]);
setLastError(null);
@@ -169,6 +172,8 @@ export const useAlertsActivation = () => ({
// Signals
config,
activationState,
+ detectionEnabled,
+ notificationDeliveryEnabled,
isLoading,
activeAlerts,
lastError,
diff --git a/frontend-modern/src/stores/websocket.ts b/frontend-modern/src/stores/websocket.ts
index f0d227f928..4badb7085e 100644
--- a/frontend-modern/src/stores/websocket.ts
+++ b/frontend-modern/src/stores/websocket.ts
@@ -7,12 +7,11 @@ import type {
ResolvedAlert,
ConnectedInfrastructureItem,
} from '@/types/api';
-import type { ActivationState as ActivationStateType } from '@/types/alerts';
import { logger } from '@/utils/logger';
import { POLLING_INTERVALS, WEBSOCKET } from '@/constants';
import { notificationStore } from './notifications';
import { eventBus } from './events';
-import { ALERTS_ACTIVATION_EVENT, isAlertsActivationEnabled } from '@/utils/alertsActivation';
+import { ALERTS_DETECTION_EVENT, isAlertsDetectionEnabled } from '@/utils/alertsActivation';
import { syncWithAgentCommand } from './containerUpdates';
import {
getAgentDiscoveryResourceId,
@@ -162,7 +161,7 @@ export function createWebSocketStore(url: string) {
const pendingAckChanges = new Map<string, { ack: boolean; previousAckTime?: string }>();
const pendingAckTimeouts = new Map<string, number>();
- let alertsEnabled = isAlertsActivationEnabled();
+ let alertsEnabled = isAlertsDetectionEnabled();
let lastActiveAlertsPayload: Record<string, Alert> = {};
const clearPendingAckTimeout = (alertIdentifier: string) => {
@@ -223,14 +222,14 @@ export function createWebSocketStore(url: string) {
setState('activeAlerts', Object.values(alertsMap));
};
- const handleAlertsActivationEvent = (event: Event) => {
- const detail = (event as CustomEvent<ActivationStateType | null>).detail;
- alertsEnabled = detail === 'active';
+ const handleAlertsDetectionEvent = (event: Event) => {
+ const detail = (event as CustomEvent<boolean | null>).detail;
+ alertsEnabled = detail ?? true;
applyActiveAlerts(alertsEnabled ? lastActiveAlertsPayload : {});
};
if (typeof window !== 'undefined') {
- window.addEventListener(ALERTS_ACTIVATION_EVENT, handleAlertsActivationEvent, {
+ window.addEventListener(ALERTS_DETECTION_EVENT, handleAlertsDetectionEvent, {
passive: true,
});
}
@@ -302,7 +301,7 @@ export function createWebSocketStore(url: string) {
pendingAckChanges.clear();
if (typeof window !== 'undefined') {
- window.removeEventListener(ALERTS_ACTIVATION_EVENT, handleAlertsActivationEvent);
+ window.removeEventListener(ALERTS_DETECTION_EVENT, handleAlertsDetectionEvent);
}
if (ws) {
@@ -705,7 +704,7 @@ export function createWebSocketStore(url: string) {
pendingAckTimeouts.forEach((t) => window.clearTimeout(t));
pendingAckTimeouts.clear();
if (typeof window !== 'undefined') {
- window.removeEventListener(ALERTS_ACTIVATION_EVENT, handleAlertsActivationEvent);
+ window.removeEventListener(ALERTS_DETECTION_EVENT, handleAlertsDetectionEvent);
}
if (ws) {
ws.close(1000, 'Component unmounting');
diff --git a/frontend-modern/src/utils/__tests__/alertActivationPresentation.test.ts b/frontend-modern/src/utils/__tests__/alertActivationPresentation.test.ts
index 98be3468ce..6b0fdc5cb4 100644
--- a/frontend-modern/src/utils/__tests__/alertActivationPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/alertActivationPresentation.test.ts
@@ -21,9 +21,9 @@ describe('getAlertActivationPresentation', () => {
setActiveLocale(DEFAULT_LOCALE);
});
- it('returns the active alerts presentation', () => {
+ it('returns the enabled notification presentation', () => {
expect(getAlertActivationPresentation({ isActive: true })).toEqual({
- label: 'Alerts enabled',
+ label: 'Notifications enabled',
labelClass: 'text-green-600 dark:text-green-400',
trackClass: 'relative h-6 w-11 rounded-full transition bg-blue-600',
thumbClass:
@@ -31,9 +31,9 @@ describe('getAlertActivationPresentation', () => {
});
});
- it('returns the inactive busy alerts presentation', () => {
+ it('returns the paused busy notification presentation', () => {
expect(getAlertActivationPresentation({ isActive: false, isBusy: true })).toEqual({
- label: 'Alerts disabled',
+ label: 'Notifications paused',
labelClass: 'text-muted',
trackClass: 'relative h-6 w-11 rounded-full transition bg-surface-hover opacity-50',
thumbClass:
@@ -43,13 +43,13 @@ describe('getAlertActivationPresentation', () => {
it('returns canonical activation feedback copy', () => {
expect(ALERT_ACTIVATION_SUCCESS).toBe(
- "Alerts activated! You'll now receive alerts when issues are detected.",
+ "Notifications enabled. You'll now receive notifications when issues are detected.",
);
- expect(ALERT_ACTIVATION_FAILURE).toBe('Unable to activate alerts. Please try again.');
+ expect(ALERT_ACTIVATION_FAILURE).toBe('Unable to enable notifications. Please try again.');
expect(ALERT_DEACTIVATION_SUCCESS).toBe(
- 'Alerts deactivated. Nothing will be sent until you activate them again.',
+ 'Notifications paused. Pulse will keep detecting and showing active alerts.',
);
- expect(ALERT_DEACTIVATION_FAILURE).toBe('Unable to deactivate alerts. Please try again.');
+ expect(ALERT_DEACTIVATION_FAILURE).toBe('Unable to pause notifications. Please try again.');
expect(getAlertActivationSuccess()).toBe(ALERT_ACTIVATION_SUCCESS);
expect(getAlertActivationFailure()).toBe(ALERT_ACTIVATION_FAILURE);
expect(getAlertDeactivationSuccess()).toBe(ALERT_DEACTIVATION_SUCCESS);
@@ -59,19 +59,23 @@ describe('getAlertActivationPresentation', () => {
it('localizes activation labels and feedback through the active locale', () => {
setActiveLocale('es');
- expect(getAlertActivationPresentation({ isActive: true }).label).toBe('Alertas activadas');
- expect(getAlertActivationPresentation({ isActive: false }).label).toBe('Alertas desactivadas');
+ expect(getAlertActivationPresentation({ isActive: true }).label).toBe(
+ 'Notificaciones activadas',
+ );
+ expect(getAlertActivationPresentation({ isActive: false }).label).toBe(
+ 'Notificaciones pausadas',
+ );
expect(getAlertActivationSuccess()).toBe(
- 'Alertas activadas. Ahora recibiras avisos cuando se detecten problemas.',
+ 'Notificaciones activadas. Ahora recibiras avisos cuando se detecten problemas.',
);
expect(getAlertActivationFailure()).toBe(
- 'No se pudieron activar las alertas. Intentalo de nuevo.',
+ 'No se pudieron activar las notificaciones. Intentalo de nuevo.',
);
expect(getAlertDeactivationSuccess()).toBe(
- 'Alertas desactivadas. No se enviara nada hasta que las vuelvas a activar.',
+ 'Notificaciones pausadas. Pulse seguira detectando y mostrando alertas activas.',
);
expect(getAlertDeactivationFailure()).toBe(
- 'No se pudieron desactivar las alertas. Intentalo de nuevo.',
+ 'No se pudieron pausar las notificaciones. Intentalo de nuevo.',
);
});
});
diff --git a/frontend-modern/src/utils/__tests__/alertsActivation.branchcov0712c.test.ts b/frontend-modern/src/utils/__tests__/alertsActivation.branchcov0712c.test.ts
index c9ef5cf528..adbfb01d06 100644
--- a/frontend-modern/src/utils/__tests__/alertsActivation.branchcov0712c.test.ts
+++ b/frontend-modern/src/utils/__tests__/alertsActivation.branchcov0712c.test.ts
@@ -1,46 +1,14 @@
-/**
- * Branch-coverage tests for alertsActivation.ts.
- *
- * Scope: ONLY `setGlobalActivationState` and `isAlertsActivationEnabled`.
- * The sibling alertsActivation.test.ts exercises the browser happy-path for
- * both functions; this file drives every remaining branch:
- *
- * - `setGlobalActivationState`:
- * - The `if (!isBrowser) return` early-return arm (SSR), verified by
- * reloading the module while `window` is undefined and asserting that
- * `window.__pulseAlertsActivationState` is left untouched and no event
- * is dispatched.
- * - The browser dispatch arm for every value of `ActivationState | null`,
- * asserting each dispatched event is a genuine `CustomEvent` instance,
- * its `type` equals `ALERTS_ACTIVATION_EVENT`, and its `detail` equals
- * the exact value passed (including `null`), and that each call
- * dispatches a fresh event with no dedup.
- *
- * - `isAlertsActivationEnabled`:
- * - The `if (!isBrowser) return true` SSR arm.
- * - The `state === 'pending_review'` case flowing through the
- * `return state === 'active'` false arm (sibling test only covers
- * 'snoozed' for that arm).
- * - The `state === undefined || state === null` early-true arm via both
- * inputs independently.
- *
- * The SSR arms are reached with `vi.resetModules()` + a dynamic `import()`
- * while `window` is stubbed to `undefined`, so the module-level `isBrowser`
- * const is re-evaluated to `false`. The stub is always cleared via
- * `vi.unstubAllGlobals()` in `afterEach` (and inside `finally` blocks).
- */
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
-import type { ActivationState } from '@/types/alerts';
import {
- ALERTS_ACTIVATION_EVENT,
- isAlertsActivationEnabled,
- setGlobalActivationState,
+ ALERTS_DETECTION_EVENT,
+ isAlertsDetectionEnabled,
+ setGlobalAlertsDetectionEnabled,
} from '@/utils/alertsActivation';
-describe('setGlobalActivationState (branch coverage)', () => {
+describe('setGlobalAlertsDetectionEnabled branch coverage', () => {
beforeEach(() => {
- window.__pulseAlertsActivationState = null;
+ window.__pulseAlertsDetectionEnabled = null;
});
afterEach(() => {
@@ -48,84 +16,57 @@ describe('setGlobalActivationState (branch coverage)', () => {
vi.unstubAllGlobals();
});
- it('writes the exact value to window.__pulseAlertsActivationState for every ActivationState and null', () => {
- const cases: Array<ActivationState | null> = [
- 'pending_review',
- 'active',
- 'snoozed',
- null,
- ];
- for (const c of cases) {
- setGlobalActivationState(c);
- expect(window.__pulseAlertsActivationState).toBe(c);
- }
- });
-
- it('dispatches a fresh genuine CustomEvent whose detail equals each value passed (all ActivationState and null)', () => {
+ it('dispatches a fresh CustomEvent for true, false, and null', () => {
const dispatchSpy = vi.spyOn(window, 'dispatchEvent');
- const seen: Array<{
- type: string;
- detail: ActivationState | null;
- isCustomEvent: boolean;
- }> = [];
+ const seen: Array<{ type: string; detail: boolean | null; isCustomEvent: boolean }> = [];
dispatchSpy.mockImplementation((event: Event) => {
seen.push({
type: event.type,
- detail: (event as CustomEvent<ActivationState | null>).detail,
+ detail: (event as CustomEvent<boolean | null>).detail,
isCustomEvent: event instanceof CustomEvent,
});
return true;
});
- const cases: Array<ActivationState | null> = [
- 'pending_review',
- 'active',
- 'snoozed',
- null,
- ];
- for (const c of cases) {
- setGlobalActivationState(c);
+ const cases: Array<boolean | null> = [true, false, null];
+ for (const value of cases) {
+ setGlobalAlertsDetectionEnabled(value);
+ expect(window.__pulseAlertsDetectionEnabled).toBe(value);
}
expect(seen).toStrictEqual(
- cases.map((c) => ({
- type: ALERTS_ACTIVATION_EVENT,
- detail: c,
+ cases.map((detail) => ({
+ type: ALERTS_DETECTION_EVENT,
+ detail,
isCustomEvent: true,
})),
);
- // No dedup: exactly one dispatch per call.
expect(dispatchSpy).toHaveBeenCalledTimes(cases.length);
});
- it('early-returns in an SSR context (window undefined at module load) without mutating state or dispatching', async () => {
- // Sentinel: the SSR call must NOT overwrite this.
- window.__pulseAlertsActivationState = 'active';
+ it('does not mutate browser state in an SSR module instance', async () => {
+ window.__pulseAlertsDetectionEnabled = false;
const dispatchSpy = vi.spyOn(window, 'dispatchEvent');
const callsBefore = dispatchSpy.mock.calls.length;
vi.resetModules();
vi.stubGlobal('window', undefined);
try {
- // Fresh module instance: module-level `isBrowser` is re-evaluated to
- // `false` because `typeof window === 'undefined'` at load time.
const mod = await import('@/utils/alertsActivation');
- mod.setGlobalActivationState(null);
- mod.setGlobalActivationState('snoozed');
+ mod.setGlobalAlertsDetectionEnabled(true);
+ mod.setGlobalAlertsDetectionEnabled(null);
} finally {
vi.unstubAllGlobals();
}
- // window is restored: sentinel must be unchanged, and no new dispatch
- // may have occurred during the SSR calls.
- expect(window.__pulseAlertsActivationState).toBe('active');
+ expect(window.__pulseAlertsDetectionEnabled).toBe(false);
expect(dispatchSpy.mock.calls.length).toBe(callsBefore);
});
});
-describe('isAlertsActivationEnabled (branch coverage)', () => {
+describe('isAlertsDetectionEnabled branch coverage', () => {
beforeEach(() => {
- window.__pulseAlertsActivationState = null;
+ window.__pulseAlertsDetectionEnabled = null;
});
afterEach(() => {
@@ -133,37 +74,28 @@ describe('isAlertsActivationEnabled (branch coverage)', () => {
vi.unstubAllGlobals();
});
- it('returns false for pending_review (false arm of `state === "active"`, not exercised by sibling test)', () => {
- setGlobalActivationState('pending_review');
- expect(isAlertsActivationEnabled()).toBe(false);
+ it('returns false only for an explicit disabled state', () => {
+ setGlobalAlertsDetectionEnabled(false);
+ expect(isAlertsDetectionEnabled()).toBe(false);
});
- it('returns false for snoozed (false arm of `state === "active"`)', () => {
- setGlobalActivationState('snoozed');
- expect(isAlertsActivationEnabled()).toBe(false);
- });
+ it('returns true for explicit enabled, undefined, and null states', () => {
+ setGlobalAlertsDetectionEnabled(true);
+ expect(isAlertsDetectionEnabled()).toBe(true);
- it('returns true for active (true arm of `state === "active"`)', () => {
- setGlobalActivationState('active');
- expect(isAlertsActivationEnabled()).toBe(true);
- });
-
- it('returns true when window.__pulseAlertsActivationState is explicitly undefined (left || operand true)', () => {
- window.__pulseAlertsActivationState = undefined;
- expect(isAlertsActivationEnabled()).toBe(true);
- });
+ window.__pulseAlertsDetectionEnabled = undefined;
+ expect(isAlertsDetectionEnabled()).toBe(true);
- it('returns true when window.__pulseAlertsActivationState is null (right || operand true)', () => {
- window.__pulseAlertsActivationState = null;
- expect(isAlertsActivationEnabled()).toBe(true);
+ window.__pulseAlertsDetectionEnabled = null;
+ expect(isAlertsDetectionEnabled()).toBe(true);
});
- it('returns true in an SSR context (window undefined at module load) via the !isBrowser early return', async () => {
+ it('returns true in an SSR module instance', async () => {
vi.resetModules();
vi.stubGlobal('window', undefined);
try {
const mod = await import('@/utils/alertsActivation');
- expect(mod.isAlertsActivationEnabled()).toBe(true);
+ expect(mod.isAlertsDetectionEnabled()).toBe(true);
} finally {
vi.unstubAllGlobals();
}
diff --git a/frontend-modern/src/utils/__tests__/alertsActivation.test.ts b/frontend-modern/src/utils/__tests__/alertsActivation.test.ts
index 62d7ef2cc7..5bc58e2577 100644
--- a/frontend-modern/src/utils/__tests__/alertsActivation.test.ts
+++ b/frontend-modern/src/utils/__tests__/alertsActivation.test.ts
@@ -1,63 +1,53 @@
-import { describe, expect, it, vi, beforeEach } from 'vitest';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
import {
- setGlobalActivationState,
- isAlertsActivationEnabled,
- ALERTS_ACTIVATION_EVENT,
+ ALERTS_DETECTION_EVENT,
+ isAlertsDetectionEnabled,
+ setGlobalAlertsDetectionEnabled,
} from '@/utils/alertsActivation';
-describe('alertsActivation', () => {
+describe('alerts detection state', () => {
beforeEach(() => {
- // Reset global state before each test
- if (typeof window !== 'undefined') {
- window.__pulseAlertsActivationState = null;
- }
+ window.__pulseAlertsDetectionEnabled = null;
});
- describe('isAlertsActivationEnabled', () => {
- it('returns true by default in browser when no state is set', () => {
- const result = isAlertsActivationEnabled();
- expect(result).toBe(true);
+ describe('isAlertsDetectionEnabled', () => {
+ it('defaults to enabled before configuration loads', () => {
+ expect(isAlertsDetectionEnabled()).toBe(true);
});
- it('returns true when state is active', () => {
- setGlobalActivationState('active');
- const result = isAlertsActivationEnabled();
- expect(result).toBe(true);
- });
+ it('returns the explicit detection state', () => {
+ setGlobalAlertsDetectionEnabled(false);
+ expect(isAlertsDetectionEnabled()).toBe(false);
- it('returns false when state is not active', () => {
- setGlobalActivationState('snoozed');
- const result = isAlertsActivationEnabled();
- expect(result).toBe(false);
+ setGlobalAlertsDetectionEnabled(true);
+ expect(isAlertsDetectionEnabled()).toBe(true);
});
- it('returns true when state is undefined (default)', () => {
- window.__pulseAlertsActivationState = undefined;
- const result = isAlertsActivationEnabled();
- expect(result).toBe(true);
+ it('defaults to enabled when state is undefined', () => {
+ window.__pulseAlertsDetectionEnabled = undefined;
+ expect(isAlertsDetectionEnabled()).toBe(true);
});
});
- describe('setGlobalActivationState', () => {
- it('sets the global activation state', () => {
- setGlobalActivationState('pending_review');
- expect(window.__pulseAlertsActivationState).toBe('pending_review');
+ describe('setGlobalAlertsDetectionEnabled', () => {
+ it('sets the global detection state', () => {
+ setGlobalAlertsDetectionEnabled(false);
+ expect(window.__pulseAlertsDetectionEnabled).toBe(false);
});
- it('dispatches custom event when state changes', () => {
+ it('dispatches the detection event with the exact state', () => {
const dispatchEventSpy = vi.spyOn(window, 'dispatchEvent');
- setGlobalActivationState('active');
+ setGlobalAlertsDetectionEnabled(true);
- expect(dispatchEventSpy).toHaveBeenCalled();
- const event = dispatchEventSpy.mock.calls[0][0] as CustomEvent;
- expect(event.type).toBe(ALERTS_ACTIVATION_EVENT);
- expect(event.detail).toBe('active');
+ const event = dispatchEventSpy.mock.calls[0][0] as CustomEvent<boolean>;
+ expect(event.type).toBe(ALERTS_DETECTION_EVENT);
+ expect(event.detail).toBe(true);
});
- it('can set state to null', () => {
- setGlobalActivationState('active');
- setGlobalActivationState(null);
- expect(window.__pulseAlertsActivationState).toBeNull();
+ it('can reset state to null', () => {
+ setGlobalAlertsDetectionEnabled(false);
+ setGlobalAlertsDetectionEnabled(null);
+ expect(window.__pulseAlertsDetectionEnabled).toBeNull();
});
});
});
diff --git a/frontend-modern/src/utils/__tests__/metricThresholds.test.ts b/frontend-modern/src/utils/__tests__/metricThresholds.test.ts
index 504a3e83a1..72d0a07929 100644
--- a/frontend-modern/src/utils/__tests__/metricThresholds.test.ts
+++ b/frontend-modern/src/utils/__tests__/metricThresholds.test.ts
@@ -224,6 +224,30 @@ describe('metricThresholds', () => {
});
});
+ it('does not treat external notification activation as detector state', () => {
+ const config = {
+ enabled: true,
+ activationState: 'pending_review',
+ guestDefaults: {
+ cpu: { trigger: 88, clear: 82 },
+ },
+ nodeDefaults: {},
+ storageDefault: { trigger: 85, clear: 80 },
+ overrides: {},
+ } as AlertConfig;
+
+ expect(resolveMetricDisplayThresholds(config, 'guest', 'cpu')).toEqual({
+ warning: 82,
+ critical: 88,
+ });
+
+ config.activationState = 'snoozed';
+ expect(resolveMetricDisplayThresholds(config, 'guest', 'cpu')).toEqual({
+ warning: 82,
+ critical: 88,
+ });
+ });
+
it('uses default display coloring when alert thresholds are disabled', () => {
const config = {
enabled: true,
diff --git a/frontend-modern/src/utils/alertActivationPresentation.ts b/frontend-modern/src/utils/alertActivationPresentation.ts
index 628877e0b4..c7ec854af1 100644
--- a/frontend-modern/src/utils/alertActivationPresentation.ts
+++ b/frontend-modern/src/utils/alertActivationPresentation.ts
@@ -13,11 +13,11 @@ export interface AlertActivationPresentation {
}
export const ALERT_ACTIVATION_SUCCESS =
- "Alerts activated! You'll now receive alerts when issues are detected.";
-export const ALERT_ACTIVATION_FAILURE = 'Unable to activate alerts. Please try again.';
+ "Notifications enabled. You'll now receive notifications when issues are detected.";
+export const ALERT_ACTIVATION_FAILURE = 'Unable to enable notifications. Please try again.';
export const ALERT_DEACTIVATION_SUCCESS =
- 'Alerts deactivated. Nothing will be sent until you activate them again.';
-export const ALERT_DEACTIVATION_FAILURE = 'Unable to deactivate alerts. Please try again.';
+ 'Notifications paused. Pulse will keep detecting and showing active alerts.';
+export const ALERT_DEACTIVATION_FAILURE = 'Unable to pause notifications. Please try again.';
export function getAlertActivationPresentation({
isActive,
diff --git a/frontend-modern/src/utils/alerts.ts b/frontend-modern/src/utils/alerts.ts
index 108f8f647c..720110e93c 100644
--- a/frontend-modern/src/utils/alerts.ts
+++ b/frontend-modern/src/utils/alerts.ts
@@ -1,5 +1,5 @@
import type { Alert } from '@/types/api';
-import { isAlertsActivationEnabled } from '@/utils/alertsActivation';
+import { isAlertsDetectionEnabled } from '@/utils/alertsActivation';
const noAlertStyles = {
rowClass: '',
@@ -23,7 +23,7 @@ const noAlertStyles = {
export const getAlertStyles = (
resourceId: string,
activeAlerts: Record<string, Alert>,
- alertsEnabled: boolean | undefined = isAlertsActivationEnabled(),
+ alertsEnabled: boolean | undefined = isAlertsDetectionEnabled(),
nodeMatch?: string,
) => {
if (!alertsEnabled) {
@@ -32,8 +32,7 @@ export const getAlertStyles = (
const alertsForResource = Object.values(activeAlerts).filter(
(alert) =>
- alert.resourceId === resourceId ||
- (nodeMatch !== undefined && alert.node === nodeMatch),
+ alert.resourceId === resourceId || (nodeMatch !== undefined && alert.node === nodeMatch),
);
const unacknowledgedAlerts = alertsForResource.filter((alert) => !alert.acknowledged);
diff --git a/frontend-modern/src/utils/alertsActivation.ts b/frontend-modern/src/utils/alertsActivation.ts
index a4bd090703..afe601d639 100644
--- a/frontend-modern/src/utils/alertsActivation.ts
+++ b/frontend-modern/src/utils/alertsActivation.ts
@@ -1,30 +1,28 @@
-import type { ActivationState } from '@/types/alerts';
-
-export const ALERTS_ACTIVATION_EVENT = 'pulse-alerts-activation-change';
+export const ALERTS_DETECTION_EVENT = 'pulse-alerts-detection-change';
declare global {
interface Window {
- __pulseAlertsActivationState?: ActivationState | null;
+ __pulseAlertsDetectionEnabled?: boolean | null;
}
}
const isBrowser = typeof window !== 'undefined';
-export const setGlobalActivationState = (state: ActivationState | null): void => {
+export const setGlobalAlertsDetectionEnabled = (enabled: boolean | null): void => {
if (!isBrowser) return;
- window.__pulseAlertsActivationState = state;
+ window.__pulseAlertsDetectionEnabled = enabled;
window.dispatchEvent(
- new CustomEvent<ActivationState | null>(ALERTS_ACTIVATION_EVENT, {
- detail: state,
+ new CustomEvent<boolean | null>(ALERTS_DETECTION_EVENT, {
+ detail: enabled,
}),
);
};
-export const isAlertsActivationEnabled = (): boolean => {
+export const isAlertsDetectionEnabled = (): boolean => {
if (!isBrowser) return true;
- const state = window.__pulseAlertsActivationState;
- if (state === undefined || state === null) {
+ const enabled = window.__pulseAlertsDetectionEnabled;
+ if (enabled === undefined || enabled === null) {
return true;
}
- return state === 'active';
+ return enabled;
};
diff --git a/internal/alerts/notification_activation_boundary_test.go b/internal/alerts/notification_activation_boundary_test.go
new file mode 100644
index 0000000000..65223ae7b3
--- /dev/null
+++ b/internal/alerts/notification_activation_boundary_test.go
@@ -0,0 +1,67 @@
+package alerts
+
+import (
+ "testing"
+ "time"
+)
+
+func TestNotificationActivationDoesNotSuppressDetectionOrActiveReadModel(t *testing.T) {
+ for _, activationState := range []ActivationState{
+ ActivationPending,
+ ActivationSnoozed,
+ } {
+ t.Run(string(activationState), func(t *testing.T) {
+ m := newTestManager(t)
+ delivered := make(chan *Alert, 1)
+ m.SetAlertCallback(func(alert *Alert) {
+ delivered <- alert
+ })
+
+ m.mu.Lock()
+ m.config.Enabled = true
+ m.config.ActivationState = activationState
+ m.config.TimeThresholds = map[string]int{}
+ m.config.SuppressionWindow = 0
+ m.config.MinimumDelta = 0
+ m.mu.Unlock()
+
+ m.checkMetric(
+ "boundary-resource",
+ "Boundary Resource",
+ "node-1",
+ "instance-1",
+ "guest",
+ "cpu",
+ 95,
+ &HysteresisThreshold{Trigger: 80, Clear: 75},
+ nil,
+ )
+
+ active := m.GetActiveAlerts()
+ if len(active) != 1 {
+ t.Fatalf(
+ "activation state %q produced %d active alerts, want 1",
+ activationState,
+ len(active),
+ )
+ }
+ if active[0].ResourceID != "boundary-resource" {
+ t.Fatalf(
+ "activation state %q exposed resource %q, want boundary-resource",
+ activationState,
+ active[0].ResourceID,
+ )
+ }
+
+ select {
+ case alert := <-delivered:
+ t.Fatalf(
+ "activation state %q delivered external notification for %q",
+ activationState,
+ alert.ID,
+ )
+ case <-time.After(50 * time.Millisecond):
+ }
+ })
+ }
+}