@checkstack/dependency-frontend 0.5.6 → 0.5.7

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,34 @@
1
1
  # @checkstack/dependency-frontend
2
2
 
3
+ ## 0.5.7
4
+
5
+ ### Patch Changes
6
+
7
+ - 0b6f01b: feat(dependency): contribute dependency warnings to the backend system.issues aggregator
8
+
9
+ The dependency plugin now registers a `system.issues` contributor (sourceId
10
+ `dependency`) from its backend `init`, so the AI assistant surfaces upstream
11
+ dependency problems alongside incidents, SLOs, health checks, and anomalies.
12
+
13
+ The contributor enforces its own `dependency.read` access gate (returning an
14
+ empty map - never throwing - when the principal lacks access; service users are
15
+ trusted), then evaluates dependency warnings for every system that participates
16
+ in a dependency edge by reading the shared, durable `dependencies` table. The
17
+ answer is therefore identical on every pod. Only systems with an actual warning
18
+ appear in the result.
19
+
20
+ The row->signal mapping (source/tone/label/detail/href/accessRule/iconName) is
21
+ extracted into a new pure `deriveDependencySignals` deriver in
22
+ `@checkstack/dependency-common`, shared by both the backend contributor and the
23
+ frontend `DependencySignalsFiller` so the two surfaces stay in lockstep. The
24
+ frontend filler now delegates to that deriver with unchanged behavior.
25
+
26
+ - Updated dependencies [0b6f01b]
27
+ - Updated dependencies [0b6f01b]
28
+ - @checkstack/dependency-common@1.3.0
29
+ - @checkstack/healthcheck-common@1.6.0
30
+ - @checkstack/dashboard-frontend@0.8.6
31
+
3
32
  ## 0.5.6
4
33
 
5
34
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/dependency-frontend",
3
- "version": "0.5.6",
3
+ "version": "0.5.7",
4
4
  "license": "Elastic-2.0",
5
5
  "type": "module",
6
6
  "main": "src/index.tsx",
@@ -15,12 +15,12 @@
15
15
  "dependencies": {
16
16
  "@checkstack/catalog-common": "2.3.4",
17
17
  "@checkstack/common": "0.15.0",
18
- "@checkstack/dashboard-frontend": "0.8.5",
19
- "@checkstack/dependency-common": "1.2.5",
18
+ "@checkstack/dashboard-frontend": "0.8.6",
19
+ "@checkstack/dependency-common": "1.3.0",
20
20
  "@checkstack/frontend-api": "0.9.0",
21
21
  "@checkstack/gitops-common": "0.6.3",
22
22
  "@checkstack/gitops-frontend": "0.5.5",
23
- "@checkstack/healthcheck-common": "1.5.4",
23
+ "@checkstack/healthcheck-common": "1.6.0",
24
24
  "@checkstack/signal-frontend": "0.2.4",
25
25
  "@checkstack/ui": "1.15.1",
26
26
  "@xyflow/react": "^12.11.0",
@@ -1,39 +1,24 @@
1
1
  import React, { useEffect, useMemo } from "react";
2
2
  import { usePluginClient, type SlotContext } from "@checkstack/frontend-api";
3
- import { resolveRoute } from "@checkstack/common";
4
3
  import {
5
4
  SystemSignalsSlot,
6
- type SystemSignal,
7
5
  type SystemSignalsMap,
8
6
  } from "@checkstack/catalog-common";
9
7
  import {
10
8
  DependencyApi,
11
- dependencyRoutes,
12
- dependencyAccess,
13
- type DerivedState,
9
+ deriveDependencySignals,
10
+ DEPENDENCY_SIGNAL_SOURCE_ID,
14
11
  } from "@checkstack/dependency-common";
15
12
 
16
13
  type Props = SlotContext<typeof SystemSignalsSlot>;
17
14
 
18
- const SOURCE_ID = "dependency";
19
-
20
- const stateToTone: Record<DerivedState, SystemSignal["tone"]> = {
21
- down: "error",
22
- degraded: "warn",
23
- info: "info",
24
- };
25
-
26
- const stateToLabel: Record<DerivedState, string> = {
27
- down: "Upstream down",
28
- degraded: "Upstream degraded",
29
- info: "Dependency info",
30
- };
31
-
32
15
  /**
33
16
  * Reports upstream dependency problems as dashboard signals. Bulk-fetches
34
17
  * derived warnings for all overview systems and emits one signal per affected
35
18
  * system, deep-linking to the dependency map. Headless filler for
36
- * {@link SystemSignalsSlot}.
19
+ * {@link SystemSignalsSlot}. The row->signal mapping is delegated to the shared
20
+ * {@link deriveDependencySignals} deriver so the frontend and the backend
21
+ * `system.issues` contributor stay in lockstep.
37
22
  */
38
23
  export const DependencySignalsFiller: React.FC<Props> = ({
39
24
  systemIds,
@@ -47,35 +32,21 @@ export const DependencySignalsFiller: React.FC<Props> = ({
47
32
  );
48
33
 
49
34
  const signals = useMemo<SystemSignalsMap>(() => {
50
- const result: SystemSignalsMap = {};
51
- if (!data) return result;
35
+ if (!data) return {};
52
36
 
37
+ // Scope the warnings to the systems this filler is responsible for before
38
+ // deriving, so the emitted map matches the slot's requested systemIds.
39
+ const scopedWarnings: typeof data.warnings = {};
53
40
  for (const systemId of systemIds) {
54
41
  const warning = data.warnings[systemId];
55
- if (!warning) continue;
56
-
57
- const upstreamCount = warning.affectedUpstreams.length;
58
- const signal: SystemSignal = {
59
- source: SOURCE_ID,
60
- tone: stateToTone[warning.derivedState],
61
- label: stateToLabel[warning.derivedState],
62
- detail:
63
- upstreamCount > 0
64
- ? `${upstreamCount} upstream ${upstreamCount === 1 ? "system" : "systems"} affected`
65
- : undefined,
66
- href: resolveRoute(dependencyRoutes.routes.map),
67
- // The dependency map is gated by its own rule; users who can see the
68
- // warning (dependency.read) but not the map get plain text, not a link.
69
- accessRule: dependencyAccess.map,
70
- iconName: "GitBranch",
71
- };
72
- result[systemId] = [signal];
42
+ if (warning) scopedWarnings[systemId] = warning;
73
43
  }
74
- return result;
44
+
45
+ return deriveDependencySignals({ warnings: scopedWarnings });
75
46
  }, [data, systemIds]);
76
47
 
77
48
  useEffect(() => {
78
- onSignals(SOURCE_ID, signals);
49
+ onSignals(DEPENDENCY_SIGNAL_SOURCE_ID, signals);
79
50
  }, [signals, onSignals]);
80
51
 
81
52
  return null;