@checkstack/healthcheck-common 0.11.0 → 0.12.0

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,24 @@
1
1
  # @checkstack/healthcheck-common
2
2
 
3
+ ## 0.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 8d1ef12: ## Downstream consumer bumps for the anomaly detection + cache system rollout
8
+
9
+ Packages on this branch were updated as part of the anomaly detection feature (schema annotations on result fields, plugin metadata for the modular cache system) but were not listed in the upstream changesets.
10
+
11
+ - **`@checkstack/healthcheck-common`** (minor) — new RPC contract additions and schema changes supporting per-field anomaly metadata.
12
+ - **`@checkstack/cache-memory-common`** (minor) — new package providing access rules + plugin metadata for the in-memory cache backend.
13
+ - **healthcheck plugins** (patch) — adopt the new `x-anomaly-*` schema annotations on their result fields so anomaly detection works automatically against their checks. No public API changes.
14
+ - **integration / notification / auth / queue / collector plugins** (patch) — minor internal updates as consumers of upstream API changes (cache plugin registry, schema additions). No public API changes.
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies [8d1ef12]
19
+ - @checkstack/common@0.7.0
20
+ - @checkstack/signal-common@0.1.10
21
+
3
22
  ## 0.11.0
4
23
 
5
24
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/healthcheck-common",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -443,6 +443,31 @@ export const healthCheckContract = {
443
443
  }),
444
444
  )
445
445
  .output(z.void()),
446
+
447
+ getRunsForAnalysis: proc({
448
+ operationType: "query",
449
+ userType: "service",
450
+ access: [],
451
+ })
452
+ .input(
453
+ z.object({
454
+ startDate: z.date(),
455
+ limitPerAssignment: z.number().optional().default(200),
456
+ }),
457
+ )
458
+ .output(
459
+ z.array(
460
+ z.object({
461
+ systemId: z.string(),
462
+ configurationId: z.string(),
463
+ runs: z.array(
464
+ z.object({
465
+ result: z.record(z.string(), z.unknown()).nullable().optional(),
466
+ }),
467
+ ),
468
+ }),
469
+ ),
470
+ ),
446
471
  };
447
472
  // Export contract type
448
473
  export type HealthCheckContract = typeof healthCheckContract;
@@ -12,7 +12,7 @@ import {
12
12
  describe("stripEphemeralFields", () => {
13
13
  it("should strip fields marked with x-ephemeral", () => {
14
14
  const schema = healthResultSchema({
15
- statusCode: healthResultNumber({ "x-chart-type": "counter" }),
15
+ statusCode: healthResultNumber({ "x-chart-type": "counter", "x-anomaly-enabled": false }),
16
16
  body: healthResultJSONPath({ "x-ephemeral": true }), // Explicitly marked ephemeral
17
17
  });
18
18
 
@@ -29,8 +29,8 @@ describe("stripEphemeralFields", () => {
29
29
 
30
30
  it("should preserve non-ephemeral fields", () => {
31
31
  const schema = healthResultSchema({
32
- responseTimeMs: healthResultNumber({ "x-chart-type": "line" }),
33
- statusText: healthResultString({ "x-chart-type": "text" }),
32
+ responseTimeMs: healthResultNumber({ "x-chart-type": "line", "x-anomaly-enabled": false }),
33
+ statusText: healthResultString({ "x-chart-type": "text", "x-anomaly-enabled": false }),
34
34
  });
35
35
 
36
36
  const result = {
@@ -45,7 +45,7 @@ describe("stripEphemeralFields", () => {
45
45
 
46
46
  it("should preserve unknown fields like _collectorId", () => {
47
47
  const schema = healthResultSchema({
48
- value: healthResultNumber({ "x-chart-type": "counter" }),
48
+ value: healthResultNumber({ "x-chart-type": "counter", "x-anomaly-enabled": false }),
49
49
  body: healthResultJSONPath({ "x-ephemeral": true }),
50
50
  });
51
51
 
@@ -96,7 +96,8 @@ export function healthResultSchema<T extends HealthResultShape>(
96
96
  // ============================================================================
97
97
 
98
98
  /** Chart metadata (excludes x-jsonpath, use healthResultJSONPath for that) */
99
- type ChartMeta = Omit<HealthResultMeta, "x-jsonpath">;
99
+ type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
100
+ type ChartMeta = DistributiveOmit<HealthResultMeta, "x-jsonpath">;
100
101
 
101
102
  /**
102
103
  * Create a health result string field with typed chart metadata.
@@ -114,7 +115,8 @@ export function healthResultString(
114
115
  meta: ChartMeta,
115
116
  ): HealthResultField<z.ZodString> {
116
117
  const schema = z.string();
117
- schema.register(healthResultRegistry, meta);
118
+ const finalMeta = (meta["x-ephemeral"] ? { ...meta, "x-anomaly-enabled": false as const } : meta) as HealthResultMeta;
119
+ schema.register(healthResultRegistry, finalMeta);
118
120
  return schema as HealthResultField<z.ZodString>;
119
121
  }
120
122
 
@@ -125,7 +127,8 @@ export function healthResultNumber(
125
127
  meta: ChartMeta,
126
128
  ): HealthResultField<z.ZodNumber> {
127
129
  const schema = z.number();
128
- schema.register(healthResultRegistry, meta);
130
+ const finalMeta = (meta["x-ephemeral"] ? { ...meta, "x-anomaly-enabled": false as const } : meta) as HealthResultMeta;
131
+ schema.register(healthResultRegistry, finalMeta);
129
132
  return schema as HealthResultField<z.ZodNumber>;
130
133
  }
131
134
 
@@ -136,7 +139,8 @@ export function healthResultBoolean(
136
139
  meta: ChartMeta,
137
140
  ): HealthResultField<z.ZodBoolean> {
138
141
  const schema = z.boolean();
139
- schema.register(healthResultRegistry, meta);
142
+ const finalMeta = (meta["x-ephemeral"] ? { ...meta, "x-anomaly-enabled": false as const } : meta) as HealthResultMeta;
143
+ schema.register(healthResultRegistry, finalMeta);
140
144
  return schema as HealthResultField<z.ZodBoolean>;
141
145
  }
142
146
 
@@ -155,7 +159,8 @@ export function healthResultArray(
155
159
  meta: ChartMeta,
156
160
  ): HealthResultField<z.ZodArray<z.ZodString>> {
157
161
  const schema = z.array(z.string());
158
- schema.register(healthResultRegistry, meta);
162
+ const finalMeta = (meta["x-ephemeral"] ? { ...meta, "x-anomaly-enabled": false as const } : meta) as HealthResultMeta;
163
+ schema.register(healthResultRegistry, finalMeta);
159
164
  return schema as HealthResultField<z.ZodArray<z.ZodString>>;
160
165
  }
161
166
 
@@ -176,7 +181,11 @@ export function healthResultJSONPath(
176
181
  meta: ChartMeta,
177
182
  ): HealthResultField<z.ZodString> {
178
183
  const schema = z.string();
179
- schema.register(healthResultRegistry, { ...meta, "x-jsonpath": true });
184
+ schema.register(healthResultRegistry, {
185
+ ...meta,
186
+ "x-jsonpath": true,
187
+ "x-anomaly-enabled": false as const // Always disable anomaly detection for raw body payloads
188
+ } as HealthResultMeta);
180
189
  return schema as HealthResultField<z.ZodString>;
181
190
  }
182
191