@checkstack/incident-frontend 0.5.6 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,85 @@
1
1
  # @checkstack/incident-frontend
2
2
 
3
+ ## 0.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 208ad71: Centralize realtime cache invalidation: signals now carry their owning `pluginId` end-to-end, and a single `SignalAutoInvalidator` mounted near the React Query client invalidates `[[pluginId]]` for every incoming signal automatically.
8
+
9
+ **Breaking change to `createSignal`** (`@checkstack/signal-common`): the factory now takes a single object argument with `pluginMetadata`, `event`, and `payloadSchema`. The signal id is constructed as `${pluginMetadata.pluginId}.${event}` and the resulting `Signal` carries a `pluginId` field. The `SignalMessage` wire envelope and `ServerToClientMessage` `signal` variant gained a `pluginId` field so the frontend can route invalidations without parsing the id.
10
+
11
+ ```ts
12
+ // Before
13
+ export const ANOMALY_STATE_CHANGED = createSignal(
14
+ "anomaly.state_changed",
15
+ z.object({ ... }),
16
+ );
17
+
18
+ // After
19
+ export const ANOMALY_STATE_CHANGED = createSignal({
20
+ pluginMetadata,
21
+ event: "state_changed",
22
+ payloadSchema: z.object({ ... }),
23
+ });
24
+ ```
25
+
26
+ **New plugin field**: `FrontendPlugin.foreignSignals?: Signal<unknown>[]` lets a plugin opt its `[[pluginId]]` cache into invalidation when another plugin's signal fires (e.g. `dependency-frontend` declares `[SYSTEM_STATUS_CHANGED]` because dependency payloads embed system status). Same-plugin signals must NOT be listed — they are always auto-invalidated.
27
+
28
+ **Removed boilerplate**: per-component `useSignal(X, () => refetch())` and `useSignal(X, () => queryClient.invalidateQueries(...))` calls have been removed across `incident-frontend`, `maintenance-frontend`, `healthcheck-frontend`, `slo-frontend`, `dependency-frontend`, `satellite-frontend`, `announcement-frontend`, `notification-frontend`, and `dashboard-frontend`. The `NotificationBell` unread count is now derived directly from the `getUnreadCount` query (auto-invalidated) instead of a local state mirror.
29
+
30
+ **User-visible bug fix**: the system detail page anomaly widget (`SystemAnomalyWidget`) now updates in real-time when anomalies change, with no per-widget signal subscription required. The dashboard status page also stays fresh on `ANOMALY_STATE_CHANGED`, `ANOMALY_BASELINE_UPDATED`, and `ANOMALY_TREND_DETECTED`.
31
+
32
+ UI-state consumers that legitimately need a `useSignal` (the dashboard activity terminal, the queue lag alert, and the rolling-preset date refresh in `useHealthCheckData`) keep their handlers; the auto-invalidator runs alongside them.
33
+
34
+ - Updated dependencies [208ad71]
35
+ - @checkstack/signal-frontend@0.1.0
36
+ - @checkstack/frontend-api@0.4.0
37
+ - @checkstack/incident-common@0.5.0
38
+ - @checkstack/dashboard-frontend@0.5.1
39
+ - @checkstack/auth-frontend@0.5.31
40
+ - @checkstack/catalog-common@1.5.3
41
+ - @checkstack/ui@1.6.1
42
+
43
+ ## 0.6.0
44
+
45
+ ### Minor Changes
46
+
47
+ - 8d1ef12: ## Anomaly Detection & UI Improvements
48
+
49
+ ### Anomaly Detection Enhancements (Phase 2)
50
+
51
+ - **`@checkstack/anomaly-backend`**: Implemented background baseline analyzer jobs and anomaly trend deviation detection mechanics.
52
+ - **`@checkstack/anomaly-common`**: Added new baseline statistical logic and inference rules.
53
+ - **`@checkstack/anomaly-frontend`**: Added new Anomaly Widget and refactored system detail rendering to be more human-readable.
54
+ - **`@checkstack/dashboard-frontend`**: Refined the global anomaly widget and fixed hardcoded access gating to render appropriately.
55
+ - **`@checkstack/healthcheck-backend`**: Connected executor telemetry to the anomaly pipeline.
56
+ - **`@checkstack/healthcheck-frontend`**: Reconciled baseline display consistency in Drawer and charts.
57
+
58
+ ### Notification Identifiers
59
+
60
+ - **`@checkstack/incident-backend`**: Resolved system IDs to human-readable System Names within Incident notifications to eliminate ID-only alert content.
61
+ - **`@checkstack/maintenance-backend`**: Adopted the same resolution strategy for Maintenance notifications to keep parity.
62
+
63
+ ### UI Experience
64
+
65
+ - **`@checkstack/incident-frontend`**: Fixed the "Back to X" BackLink to properly use `react-router` hook `useNavigate` instead of doing a full application reload.
66
+ - **`@checkstack/healthcheck-frontend`**: Implemented `useNavigate` for seamless SPA back-linking.
67
+ - **`@checkstack/integration-frontend`**: Updated connections and delivery logs links to navigate without hard reloads.
68
+
69
+ ### Patch Changes
70
+
71
+ - Updated dependencies [8d1ef12]
72
+ - Updated dependencies [8d1ef12]
73
+ - Updated dependencies [8d1ef12]
74
+ - @checkstack/dashboard-frontend@0.5.0
75
+ - @checkstack/common@0.7.0
76
+ - @checkstack/ui@1.6.0
77
+ - @checkstack/auth-frontend@0.5.30
78
+ - @checkstack/catalog-common@1.5.2
79
+ - @checkstack/frontend-api@0.3.11
80
+ - @checkstack/incident-common@0.4.9
81
+ - @checkstack/signal-frontend@0.0.16
82
+
3
83
  ## 0.5.6
4
84
 
5
85
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/incident-frontend",
3
- "version": "0.5.6",
3
+ "version": "0.6.1",
4
4
  "type": "module",
5
5
  "main": "src/index.tsx",
6
6
  "checkstack": {
@@ -12,14 +12,14 @@
12
12
  "lint:code": "eslint . --max-warnings 0"
13
13
  },
14
14
  "dependencies": {
15
- "@checkstack/auth-frontend": "0.5.28",
16
- "@checkstack/catalog-common": "1.4.1",
17
- "@checkstack/common": "0.6.5",
18
- "@checkstack/dashboard-frontend": "0.4.4",
19
- "@checkstack/frontend-api": "0.3.9",
20
- "@checkstack/incident-common": "0.4.7",
21
- "@checkstack/signal-frontend": "0.0.15",
22
- "@checkstack/ui": "1.5.0",
15
+ "@checkstack/auth-frontend": "0.5.30",
16
+ "@checkstack/catalog-common": "1.5.2",
17
+ "@checkstack/common": "0.7.0",
18
+ "@checkstack/dashboard-frontend": "0.5.0",
19
+ "@checkstack/frontend-api": "0.3.11",
20
+ "@checkstack/incident-common": "0.4.9",
21
+ "@checkstack/signal-frontend": "0.0.16",
22
+ "@checkstack/ui": "1.6.0",
23
23
  "date-fns": "^4.1.0",
24
24
  "lucide-react": "^0.344.0",
25
25
  "react": "^18.2.0",
@@ -1,12 +1,8 @@
1
1
  import React from "react";
2
2
  import { usePluginClient, type SlotContext } from "@checkstack/frontend-api";
3
- import { useSignal } from "@checkstack/signal-frontend";
4
3
  import { SystemStateBadgesSlot } from "@checkstack/catalog-common";
5
4
  import { IncidentApi } from "../api";
6
- import {
7
- INCIDENT_UPDATED,
8
- type IncidentWithSystems,
9
- } from "@checkstack/incident-common";
5
+ import { type IncidentWithSystems } from "@checkstack/incident-common";
10
6
  import { Badge } from "@checkstack/ui";
11
7
  import { useSystemBadgeDataOptional } from "@checkstack/dashboard-frontend";
12
8
 
@@ -50,23 +46,15 @@ export const SystemIncidentBadge: React.FC<Props> = ({ system }) => {
50
46
  : undefined;
51
47
 
52
48
  // Query for incidents if not using provider
53
- const { data: incidents, refetch } =
54
- incidentClient.getIncidentsForSystem.useQuery(
55
- { systemId: system?.id ?? "" },
56
- { enabled: !badgeData && !!system?.id }
57
- );
49
+ const { data: incidents } = incidentClient.getIncidentsForSystem.useQuery(
50
+ { systemId: system?.id ?? "" },
51
+ { enabled: !badgeData && !!system?.id }
52
+ );
58
53
 
59
54
  const localIncident = incidents
60
55
  ? getMostSevereIncident(incidents)
61
56
  : undefined;
62
57
 
63
- // Listen for realtime incident updates (only in fallback mode)
64
- useSignal(INCIDENT_UPDATED, ({ systemIds }) => {
65
- if (!badgeData && system?.id && systemIds.includes(system.id)) {
66
- void refetch();
67
- }
68
- });
69
-
70
58
  // Use provider data if available, otherwise use local state
71
59
  const activeIncident = badgeData ? providerIncident : localIncident;
72
60
 
@@ -1,13 +1,11 @@
1
1
  import React from "react";
2
2
  import { Link } from "react-router-dom";
3
3
  import { usePluginClient, type SlotContext } from "@checkstack/frontend-api";
4
- import { useSignal } from "@checkstack/signal-frontend";
5
4
  import { resolveRoute } from "@checkstack/common";
6
5
  import { SystemDetailsTopSlot } from "@checkstack/catalog-common";
7
6
  import { IncidentApi } from "../api";
8
7
  import {
9
8
  incidentRoutes,
10
- INCIDENT_UPDATED,
11
9
  type IncidentWithSystems,
12
10
  } from "@checkstack/incident-common";
13
11
  import { Badge, LoadingSpinner, Button } from "@checkstack/ui";
@@ -43,21 +41,11 @@ export const SystemIncidentPanel: React.FC<Props> = ({ system }) => {
43
41
  const incidentClient = usePluginClient(IncidentApi);
44
42
 
45
43
  // Fetch incidents with useQuery
46
- const {
47
- data: incidents = [],
48
- isLoading: loading,
49
- refetch,
50
- } = incidentClient.getIncidentsForSystem.useQuery(
51
- { systemId: system?.id ?? "" },
52
- { enabled: !!system?.id }
53
- );
54
-
55
- // Listen for realtime incident updates
56
- useSignal(INCIDENT_UPDATED, ({ systemIds }) => {
57
- if (system?.id && systemIds.includes(system.id)) {
58
- void refetch();
59
- }
60
- });
44
+ const { data: incidents = [], isLoading: loading } =
45
+ incidentClient.getIncidentsForSystem.useQuery(
46
+ { systemId: system?.id ?? "" },
47
+ { enabled: !!system?.id }
48
+ );
61
49
 
62
50
  if (loading) {
63
51
  return (
@@ -6,14 +6,9 @@ import {
6
6
  useApi,
7
7
  wrapInSuspense,
8
8
  } from "@checkstack/frontend-api";
9
- import { useSignal } from "@checkstack/signal-frontend";
10
9
  import { resolveRoute, extractErrorMessage} from "@checkstack/common";
11
10
  import { IncidentApi } from "../api";
12
- import {
13
- incidentRoutes,
14
- INCIDENT_UPDATED,
15
- incidentAccess,
16
- } from "@checkstack/incident-common";
11
+ import { incidentRoutes, incidentAccess } from "@checkstack/incident-common";
17
12
  import { CatalogApi } from "@checkstack/catalog-common";
18
13
  import {
19
14
  Card,
@@ -77,13 +72,6 @@ const IncidentDetailPageContent: React.FC = () => {
77
72
  const systems = systemsData?.systems ?? [];
78
73
  const loading = incidentLoading || systemsLoading;
79
74
 
80
- // Listen for realtime updates
81
- useSignal(INCIDENT_UPDATED, ({ incidentId: updatedId }) => {
82
- if (incidentId === updatedId) {
83
- void refetchIncident();
84
- }
85
- });
86
-
87
75
  // Resolve mutation
88
76
  const resolveMutation = incidentClient.resolveIncident.useMutation({
89
77
  onSuccess: () => {
@@ -122,7 +110,7 @@ const IncidentDetailPageContent: React.FC = () => {
122
110
  <div className="p-12 text-center">
123
111
  <p className="text-muted-foreground">Incident not found</p>
124
112
  <BackLink
125
- to={resolveRoute(incidentRoutes.routes.config, {})}
113
+ onClick={() => navigate(resolveRoute(incidentRoutes.routes.config, {}))}
126
114
  className="mt-4"
127
115
  >
128
116
  Back to Incidents
@@ -1,12 +1,10 @@
1
1
  import React from "react";
2
- import { useParams, Link } from "react-router-dom";
2
+ import { useParams, Link, useNavigate } from "react-router-dom";
3
3
  import { usePluginClient, wrapInSuspense } from "@checkstack/frontend-api";
4
- import { useSignal } from "@checkstack/signal-frontend";
5
4
  import { resolveRoute } from "@checkstack/common";
6
5
  import { IncidentApi } from "../api";
7
6
  import {
8
7
  incidentRoutes,
9
- INCIDENT_UPDATED,
10
8
  type IncidentStatus,
11
9
  } from "@checkstack/incident-common";
12
10
  import { CatalogApi, catalogRoutes } from "@checkstack/catalog-common";
@@ -23,18 +21,16 @@ import { formatDistanceToNow } from "date-fns";
23
21
 
24
22
  const SystemIncidentHistoryPageContent: React.FC = () => {
25
23
  const { systemId } = useParams<{ systemId: string }>();
24
+ const navigate = useNavigate();
26
25
  const incidentClient = usePluginClient(IncidentApi);
27
26
  const catalogClient = usePluginClient(CatalogApi);
28
27
 
29
- // Fetch incidents with useQuery
30
- const {
31
- data: incidentsData,
32
- isLoading: incidentsLoading,
33
- refetch: refetchIncidents,
34
- } = incidentClient.listIncidents.useQuery(
35
- { systemId, includeResolved: true },
36
- { enabled: !!systemId },
37
- );
28
+ // Fetch incidents with useQuery — kept fresh via SignalAutoInvalidator.
29
+ const { data: incidentsData, isLoading: incidentsLoading } =
30
+ incidentClient.listIncidents.useQuery(
31
+ { systemId, includeResolved: true },
32
+ { enabled: !!systemId },
33
+ );
38
34
 
39
35
  // Fetch systems with useQuery
40
36
  const { data: systemsData, isLoading: systemsLoading } =
@@ -45,13 +41,6 @@ const SystemIncidentHistoryPageContent: React.FC = () => {
45
41
  const system = systems.find((s) => s.id === systemId);
46
42
  const loading = incidentsLoading || systemsLoading;
47
43
 
48
- // Listen for realtime updates
49
- useSignal(INCIDENT_UPDATED, ({ systemIds }) => {
50
- if (systemId && systemIds.includes(systemId)) {
51
- void refetchIncidents();
52
- }
53
- });
54
-
55
44
  const getStatusBadge = (status: IncidentStatus) => {
56
45
  switch (status) {
57
46
  case "investigating": {
@@ -92,9 +81,13 @@ const SystemIncidentHistoryPageContent: React.FC = () => {
92
81
  // Actions for the page header
93
82
  const headerActions = system && (
94
83
  <BackLink
95
- to={resolveRoute(catalogRoutes.routes.systemDetail, {
96
- systemId: system.id,
97
- })}
84
+ onClick={() =>
85
+ navigate(
86
+ resolveRoute(catalogRoutes.routes.systemDetail, {
87
+ systemId: system.id,
88
+ }),
89
+ )
90
+ }
98
91
  >
99
92
  Back to {system.name}
100
93
  </BackLink>