@checkstack/dependency-frontend 0.3.2 → 0.3.3
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,45 @@
|
|
|
1
1
|
# @checkstack/dependency-frontend
|
|
2
2
|
|
|
3
|
+
## 0.3.3
|
|
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/dependency-common@0.3.0
|
|
38
|
+
- @checkstack/healthcheck-common@0.13.0
|
|
39
|
+
- @checkstack/dashboard-frontend@0.5.1
|
|
40
|
+
- @checkstack/catalog-common@1.5.3
|
|
41
|
+
- @checkstack/ui@1.6.1
|
|
42
|
+
|
|
3
43
|
## 0.3.2
|
|
4
44
|
|
|
5
45
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@checkstack/dependency-frontend",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
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/catalog-common": "1.5.
|
|
16
|
-
"@checkstack/common": "0.
|
|
17
|
-
"@checkstack/dashboard-frontend": "0.
|
|
18
|
-
"@checkstack/dependency-common": "0.2.
|
|
19
|
-
"@checkstack/frontend-api": "0.3.
|
|
20
|
-
"@checkstack/healthcheck-common": "0.
|
|
21
|
-
"@checkstack/signal-frontend": "0.0.
|
|
22
|
-
"@checkstack/ui": "1.
|
|
15
|
+
"@checkstack/catalog-common": "1.5.2",
|
|
16
|
+
"@checkstack/common": "0.7.0",
|
|
17
|
+
"@checkstack/dashboard-frontend": "0.5.0",
|
|
18
|
+
"@checkstack/dependency-common": "0.2.3",
|
|
19
|
+
"@checkstack/frontend-api": "0.3.11",
|
|
20
|
+
"@checkstack/healthcheck-common": "0.12.0",
|
|
21
|
+
"@checkstack/signal-frontend": "0.0.16",
|
|
22
|
+
"@checkstack/ui": "1.6.0",
|
|
23
23
|
"@xyflow/react": "^12.10.2",
|
|
24
24
|
"lucide-react": "^0.344.0",
|
|
25
25
|
"react": "^18.2.0",
|
|
@@ -1,11 +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 { SystemDetailsTopSlot } from "@checkstack/catalog-common";
|
|
5
4
|
import {
|
|
6
5
|
DependencyApi,
|
|
7
|
-
DEPENDENCY_CHANGED,
|
|
8
|
-
DEPENDENCY_WARNINGS_CHANGED,
|
|
9
6
|
type DerivedState,
|
|
10
7
|
type AffectedUpstream,
|
|
11
8
|
} from "@checkstack/dependency-common";
|
|
@@ -79,23 +76,11 @@ function getImpactBadge(impactType: string): React.ReactNode {
|
|
|
79
76
|
export const DependencyAlert: React.FC<Props> = ({ system }) => {
|
|
80
77
|
const depClient = usePluginClient(DependencyApi);
|
|
81
78
|
|
|
82
|
-
const { data
|
|
79
|
+
const { data } = depClient.getWarningsForSystem.useQuery(
|
|
83
80
|
{ systemId: system?.id ?? "" },
|
|
84
81
|
{ enabled: !!system?.id },
|
|
85
82
|
);
|
|
86
83
|
|
|
87
|
-
// Listen for dependency graph changes
|
|
88
|
-
useSignal(DEPENDENCY_CHANGED, () => {
|
|
89
|
-
void refetch();
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
// Listen for warning re-evaluations
|
|
93
|
-
useSignal(DEPENDENCY_WARNINGS_CHANGED, ({ affectedSystemIds }) => {
|
|
94
|
-
if (system?.id && affectedSystemIds.includes(system.id)) {
|
|
95
|
-
void refetch();
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
|
|
99
84
|
if (!data || data.affectedUpstreams.length === 0) return;
|
|
100
85
|
|
|
101
86
|
const style = getAlertStyle(data.derivedState);
|
|
@@ -1,11 +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 {
|
|
6
5
|
DependencyApi,
|
|
7
|
-
DEPENDENCY_CHANGED,
|
|
8
|
-
DEPENDENCY_WARNINGS_CHANGED,
|
|
9
6
|
type DerivedState,
|
|
10
7
|
} from "@checkstack/dependency-common";
|
|
11
8
|
import { Badge } from "@checkstack/ui";
|
|
@@ -46,28 +43,18 @@ function getBadgeLabel(state: DerivedState): string {
|
|
|
46
43
|
* Displays a dependency warning badge for a system on the dashboard.
|
|
47
44
|
* Shows nothing if no upstream systems are affected.
|
|
48
45
|
*
|
|
49
|
-
*
|
|
46
|
+
* Realtime updates arrive via SignalAutoInvalidator on `[["dependency"]]`,
|
|
47
|
+
* including foreign-signal invalidation on SYSTEM_STATUS_CHANGED (declared in
|
|
48
|
+
* the dependency plugin's `foreignSignals`).
|
|
50
49
|
*/
|
|
51
50
|
export const DependencyBadge: React.FC<Props> = ({ system }) => {
|
|
52
51
|
const depClient = usePluginClient(DependencyApi);
|
|
53
52
|
|
|
54
|
-
const { data
|
|
53
|
+
const { data } = depClient.getWarningsForSystem.useQuery(
|
|
55
54
|
{ systemId: system?.id ?? "" },
|
|
56
55
|
{ enabled: !!system?.id },
|
|
57
56
|
);
|
|
58
57
|
|
|
59
|
-
// Listen for dependency changes
|
|
60
|
-
useSignal(DEPENDENCY_CHANGED, () => {
|
|
61
|
-
void refetch();
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
// Listen for warning re-evaluations
|
|
65
|
-
useSignal(DEPENDENCY_WARNINGS_CHANGED, ({ affectedSystemIds }) => {
|
|
66
|
-
if (system?.id && affectedSystemIds.includes(system.id)) {
|
|
67
|
-
void refetch();
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
|
|
71
58
|
if (!data) return;
|
|
72
59
|
|
|
73
60
|
return (
|
|
@@ -4,11 +4,9 @@ import {
|
|
|
4
4
|
usePluginClient,
|
|
5
5
|
type SlotContext,
|
|
6
6
|
} from "@checkstack/frontend-api";
|
|
7
|
-
import { useSignal } from "@checkstack/signal-frontend";
|
|
8
7
|
import { SystemEditorSlot } from "@checkstack/catalog-common";
|
|
9
8
|
import {
|
|
10
9
|
DependencyApi,
|
|
11
|
-
DEPENDENCY_CHANGED,
|
|
12
10
|
dependencyRoutes,
|
|
13
11
|
type Dependency,
|
|
14
12
|
type ImpactType,
|
|
@@ -91,11 +89,6 @@ export const DependencyEditor: React.FC<Props> = ({ systemId }) => {
|
|
|
91
89
|
return map;
|
|
92
90
|
}, [systemsData]);
|
|
93
91
|
|
|
94
|
-
// Listen for realtime changes
|
|
95
|
-
useSignal(DEPENDENCY_CHANGED, () => {
|
|
96
|
-
void refetchDeps();
|
|
97
|
-
});
|
|
98
|
-
|
|
99
92
|
const createMutation = depClient.createDependency.useMutation({
|
|
100
93
|
onSuccess: () => {
|
|
101
94
|
setIsAdding(false);
|
|
@@ -15,13 +15,10 @@ import {
|
|
|
15
15
|
import "@xyflow/react/dist/style.css";
|
|
16
16
|
|
|
17
17
|
import { usePluginClient, wrapInSuspense } from "@checkstack/frontend-api";
|
|
18
|
-
import { useSignal } from "@checkstack/signal-frontend";
|
|
19
18
|
import { CatalogApi } from "@checkstack/catalog-common";
|
|
20
|
-
import { HealthCheckApi
|
|
19
|
+
import { HealthCheckApi } from "@checkstack/healthcheck-common";
|
|
21
20
|
import {
|
|
22
21
|
DependencyApi,
|
|
23
|
-
DEPENDENCY_CHANGED,
|
|
24
|
-
DEPENDENCY_WARNINGS_CHANGED,
|
|
25
22
|
type Dependency,
|
|
26
23
|
type NodePosition,
|
|
27
24
|
} from "@checkstack/dependency-common";
|
|
@@ -137,12 +134,12 @@ function DependencyMapContent() {
|
|
|
137
134
|
{ enabled: systemIds.length > 0 },
|
|
138
135
|
);
|
|
139
136
|
|
|
140
|
-
// Fetch real health statuses for all systems
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
137
|
+
// Fetch real health statuses for all systems — kept fresh via SignalAutoInvalidator
|
|
138
|
+
// (foreignSignals declares SYSTEM_STATUS_CHANGED on the dependency plugin).
|
|
139
|
+
const { data: healthData } = healthCheckClient.getBulkSystemHealthStatus.useQuery(
|
|
140
|
+
{ systemIds },
|
|
141
|
+
{ enabled: systemIds.length > 0 },
|
|
142
|
+
);
|
|
146
143
|
|
|
147
144
|
// Save positions mutation
|
|
148
145
|
const saveMutation = depClient.saveNodePositions.useMutation({
|
|
@@ -381,20 +378,6 @@ function DependencyMapContent() {
|
|
|
381
378
|
savePositions({ positions });
|
|
382
379
|
}, [savePositions]);
|
|
383
380
|
|
|
384
|
-
// Listen for realtime dependency changes
|
|
385
|
-
useSignal(DEPENDENCY_CHANGED, () => {
|
|
386
|
-
void refetchDeps();
|
|
387
|
-
});
|
|
388
|
-
|
|
389
|
-
useSignal(DEPENDENCY_WARNINGS_CHANGED, () => {
|
|
390
|
-
void refetchWarnings();
|
|
391
|
-
});
|
|
392
|
-
|
|
393
|
-
useSignal(SYSTEM_STATUS_CHANGED, () => {
|
|
394
|
-
void refetchHealth();
|
|
395
|
-
void refetchWarnings();
|
|
396
|
-
});
|
|
397
|
-
|
|
398
381
|
// Cleanup timeout on unmount
|
|
399
382
|
useEffect(() => {
|
|
400
383
|
return () => {
|
package/src/index.tsx
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
dependencyRoutes,
|
|
9
9
|
dependencyAccess,
|
|
10
10
|
} from "@checkstack/dependency-common";
|
|
11
|
+
import { SYSTEM_STATUS_CHANGED } from "@checkstack/healthcheck-common";
|
|
11
12
|
import {
|
|
12
13
|
SystemDetailsTopSlot,
|
|
13
14
|
SystemStateBadgesSlot,
|
|
@@ -21,6 +22,10 @@ import { DependencyMenuItems } from "./components/DependencyMenuItems";
|
|
|
21
22
|
|
|
22
23
|
export default createFrontendPlugin({
|
|
23
24
|
metadata: pluginMetadata,
|
|
25
|
+
// Dependency queries embed system health, so a system status change must
|
|
26
|
+
// also invalidate this plugin's cache. Same-plugin signals (DEPENDENCY_*)
|
|
27
|
+
// are auto-invalidated and must NOT be listed here.
|
|
28
|
+
foreignSignals: [SYSTEM_STATUS_CHANGED],
|
|
24
29
|
routes: [
|
|
25
30
|
{
|
|
26
31
|
route: dependencyRoutes.routes.map,
|