@checkstack/healthcheck-backend 0.16.0 → 0.16.2
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 +25 -0
- package/package.json +6 -6
- package/src/healthcheck-gitops-kinds.test.ts +14 -6
- package/src/healthcheck-gitops-kinds.ts +30 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @checkstack/healthcheck-backend
|
|
2
2
|
|
|
3
|
+
## 0.16.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 57d54de: Fix GitOps Healthcheck reconciliation engine and Kind Registry UI
|
|
8
|
+
|
|
9
|
+
- Mandated fully qualified IDs for all healthcheck strategies and collector definitions.
|
|
10
|
+
- Refactored the Kind Registry UI to display schema documentation in beautifully formatted, interactive YAML examples.
|
|
11
|
+
- Entity Envelope Fields and Base Spec Schema are now displayed in collapsed accordions.
|
|
12
|
+
- Fixed condition logic that broke the collector documentation display.
|
|
13
|
+
- Enhanced UX by dynamically injecting fully-qualified strategy variants directly into the YAML examples.
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [57d54de]
|
|
16
|
+
- @checkstack/gitops-backend@0.2.1
|
|
17
|
+
- @checkstack/catalog-backend@0.5.2
|
|
18
|
+
- @checkstack/satellite-backend@0.2.10
|
|
19
|
+
|
|
20
|
+
## 0.16.1
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- @checkstack/catalog-backend@0.5.1
|
|
25
|
+
- @checkstack/catalog-common@1.4.1
|
|
26
|
+
- @checkstack/satellite-backend@0.2.9
|
|
27
|
+
|
|
3
28
|
## 0.16.0
|
|
4
29
|
|
|
5
30
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@checkstack/healthcheck-backend",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"checkstack": {
|
|
@@ -14,18 +14,18 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@checkstack/backend-api": "0.12.0",
|
|
17
|
-
"@checkstack/catalog-backend": "0.
|
|
18
|
-
"@checkstack/catalog-common": "1.
|
|
17
|
+
"@checkstack/catalog-backend": "0.5.0",
|
|
18
|
+
"@checkstack/catalog-common": "1.4.0",
|
|
19
19
|
"@checkstack/command-backend": "0.1.19",
|
|
20
20
|
"@checkstack/common": "0.6.5",
|
|
21
|
-
"@checkstack/gitops-backend": "0.
|
|
22
|
-
"@checkstack/gitops-common": "0.
|
|
21
|
+
"@checkstack/gitops-backend": "0.2.0",
|
|
22
|
+
"@checkstack/gitops-common": "0.2.0",
|
|
23
23
|
"@checkstack/healthcheck-common": "0.11.0",
|
|
24
24
|
"@checkstack/incident-common": "0.4.7",
|
|
25
25
|
"@checkstack/integration-backend": "0.1.19",
|
|
26
26
|
"@checkstack/maintenance-common": "0.4.9",
|
|
27
27
|
"@checkstack/queue-api": "0.2.13",
|
|
28
|
-
"@checkstack/satellite-backend": "0.2.
|
|
28
|
+
"@checkstack/satellite-backend": "0.2.8",
|
|
29
29
|
"@checkstack/signal-common": "0.1.9",
|
|
30
30
|
"@hono/zod-validator": "^0.7.6",
|
|
31
31
|
"drizzle-orm": "^0.45.0",
|
|
@@ -135,23 +135,31 @@ const cpuCollectorConfigSchema = z.object({
|
|
|
135
135
|
function createMockHealthCheckRegistry() {
|
|
136
136
|
const strategies = new Map<
|
|
137
137
|
string,
|
|
138
|
-
{
|
|
138
|
+
{ strategy: any; ownerPluginId: string; qualifiedId: string }
|
|
139
139
|
>();
|
|
140
140
|
|
|
141
|
-
|
|
142
|
-
strategies.set("postgres", {
|
|
141
|
+
const strategy = {
|
|
143
142
|
id: "postgres",
|
|
143
|
+
displayName: "PostgreSQL",
|
|
144
|
+
description: "test",
|
|
144
145
|
config: new Versioned({
|
|
145
146
|
version: 1,
|
|
146
147
|
schema: postgresConfigSchema,
|
|
147
148
|
}),
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
// Register a test strategy
|
|
152
|
+
strategies.set("postgres", {
|
|
153
|
+
strategy,
|
|
154
|
+
ownerPluginId: "mock",
|
|
155
|
+
qualifiedId: "postgres",
|
|
148
156
|
});
|
|
149
157
|
|
|
150
158
|
return {
|
|
151
|
-
getStrategy: (id: string) => strategies.get(id) as ReturnType<import("@checkstack/backend-api").HealthCheckRegistry["getStrategy"]>,
|
|
159
|
+
getStrategy: (id: string) => strategies.get(id)?.strategy as ReturnType<import("@checkstack/backend-api").HealthCheckRegistry["getStrategy"]>,
|
|
152
160
|
getStrategies: () =>
|
|
153
|
-
[...strategies.values()] as ReturnType<import("@checkstack/backend-api").HealthCheckRegistry["getStrategies"]>,
|
|
154
|
-
getStrategiesWithMeta: () => [],
|
|
161
|
+
[...strategies.values()].map(s => s.strategy) as ReturnType<import("@checkstack/backend-api").HealthCheckRegistry["getStrategies"]>,
|
|
162
|
+
getStrategiesWithMeta: () => [...strategies.values()] as any,
|
|
155
163
|
register: () => {},
|
|
156
164
|
};
|
|
157
165
|
}
|
|
@@ -117,18 +117,21 @@ export function buildHealthcheckKind(
|
|
|
117
117
|
const service = deps.createService();
|
|
118
118
|
const spec = entity.spec;
|
|
119
119
|
|
|
120
|
-
// Look up strategy
|
|
120
|
+
// Look up strategy using strictly the fully qualified ID
|
|
121
121
|
const healthCheckRegistry = deps.getHealthCheckRegistry();
|
|
122
|
-
const
|
|
123
|
-
|
|
122
|
+
const allStrategies = healthCheckRegistry.getStrategiesWithMeta();
|
|
123
|
+
const matchStrategy = allStrategies.find((s) => s.qualifiedId === spec.strategy);
|
|
124
|
+
|
|
125
|
+
if (!matchStrategy) {
|
|
124
126
|
throw new Error(
|
|
125
127
|
`Unknown health check strategy "${spec.strategy}". ` +
|
|
126
|
-
`Available: ${
|
|
127
|
-
.
|
|
128
|
-
.map((s) => s.id)
|
|
128
|
+
`Available: ${allStrategies
|
|
129
|
+
.map((s) => s.qualifiedId)
|
|
129
130
|
.join(", ")}`,
|
|
130
131
|
);
|
|
131
132
|
}
|
|
133
|
+
|
|
134
|
+
const strategy = matchStrategy.strategy;
|
|
132
135
|
|
|
133
136
|
// Resolve secrets using the strategy's typed schema.
|
|
134
137
|
// Only fields marked with configString({ "x-secret": true }) get resolved.
|
|
@@ -151,17 +154,22 @@ export function buildHealthcheckKind(
|
|
|
151
154
|
const resolvedCollectors = spec.collectors
|
|
152
155
|
? await Promise.all(
|
|
153
156
|
spec.collectors.map(async (c) => {
|
|
157
|
+
// Look up collector using strictly the fully qualified ID
|
|
154
158
|
const collectorReg = deps.getCollectorRegistry();
|
|
155
|
-
const
|
|
156
|
-
|
|
159
|
+
const allCollectors = collectorReg.getCollectors();
|
|
160
|
+
const matchCollector = allCollectors.find(
|
|
161
|
+
(col) => col.qualifiedId === c.collectorId
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
if (!matchCollector) {
|
|
157
165
|
throw new Error(
|
|
158
166
|
`Unknown collector "${c.collectorId}". ` +
|
|
159
|
-
`Available: ${
|
|
160
|
-
.getCollectors()
|
|
167
|
+
`Available: ${allCollectors
|
|
161
168
|
.map((col) => col.qualifiedId)
|
|
162
169
|
.join(", ")}`,
|
|
163
170
|
);
|
|
164
171
|
}
|
|
172
|
+
const registered = matchCollector;
|
|
165
173
|
|
|
166
174
|
// Resolve secrets using the collector's typed schema
|
|
167
175
|
const { resolved: resolvedCollectorConfig } =
|
|
@@ -370,15 +378,24 @@ export function registerHealthcheckGitOpsDocumentation({
|
|
|
370
378
|
apiVersion: CHECKSTACK_API_VERSION,
|
|
371
379
|
kind: "Healthcheck",
|
|
372
380
|
fieldPath: "config",
|
|
373
|
-
variantId: registered.
|
|
381
|
+
variantId: registered.qualifiedId,
|
|
374
382
|
label: registered.strategy.displayName,
|
|
375
|
-
description: `ID: ${registered.
|
|
383
|
+
description: `ID: ${registered.qualifiedId}\n\n${registered.strategy.description}`,
|
|
376
384
|
schema: registered.strategy.config.schema,
|
|
377
385
|
});
|
|
378
386
|
}
|
|
379
387
|
|
|
380
388
|
// 2. Register documentation for collector configs (fieldPath: "collectors[].config")
|
|
381
389
|
for (const registered of collectorRegistry.getCollectors()) {
|
|
390
|
+
const supportedStrategyIds = healthCheckRegistry
|
|
391
|
+
.getStrategiesWithMeta()
|
|
392
|
+
.filter((s) =>
|
|
393
|
+
registered.collector.supportedPlugins.some(
|
|
394
|
+
(p) => p.pluginId === s.ownerPluginId,
|
|
395
|
+
),
|
|
396
|
+
)
|
|
397
|
+
.map((s) => s.qualifiedId);
|
|
398
|
+
|
|
382
399
|
kindRegistry.registerSpecSchemaDocumentation({
|
|
383
400
|
apiVersion: CHECKSTACK_API_VERSION,
|
|
384
401
|
kind: "Healthcheck",
|
|
@@ -390,9 +407,7 @@ export function registerHealthcheckGitOpsDocumentation({
|
|
|
390
407
|
conditions: [
|
|
391
408
|
{
|
|
392
409
|
fieldPath: "config",
|
|
393
|
-
variantIds:
|
|
394
|
-
(p) => p.pluginId,
|
|
395
|
-
),
|
|
410
|
+
variantIds: supportedStrategyIds,
|
|
396
411
|
},
|
|
397
412
|
],
|
|
398
413
|
});
|