@checkstack/healthcheck-http-backend 0.3.0 → 0.3.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,29 @@
1
1
  # @checkstack/healthcheck-http-backend
2
2
 
3
+ ## 0.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 869b4ab: ## Health Check Execution Improvements
8
+
9
+ ### Breaking Changes (backend-api)
10
+
11
+ - `HealthCheckStrategy.createClient()` now accepts `unknown` instead of `TConfig` due to TypeScript contravariance constraints. Implementations should use `this.config.validate(config)` to narrow the type.
12
+
13
+ ### Features
14
+
15
+ - **Platform-level hard timeout**: The executor now wraps the entire health check execution (connection + all collectors) in a single timeout, ensuring checks never hang indefinitely.
16
+ - **Parallel collector execution**: Collectors now run in parallel using `Promise.allSettled()`, improving performance while ensuring all collectors complete regardless of individual failures.
17
+ - **Base strategy config schema**: All strategy configs now extend `baseStrategyConfigSchema` which provides a standardized `timeout` field with sensible defaults (30s, min 100ms).
18
+
19
+ ### Fixes
20
+
21
+ - Fixed HTTP and Jenkins strategies clearing timeouts before reading the full response body.
22
+ - Simplified registry type signatures by using default type parameters.
23
+
24
+ - Updated dependencies [869b4ab]
25
+ - @checkstack/backend-api@0.8.0
26
+
3
27
  ## 0.3.0
4
28
 
5
29
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/healthcheck-http-backend",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "scripts": {
@@ -9,10 +9,10 @@
9
9
  "lint:code": "eslint . --max-warnings 0"
10
10
  },
11
11
  "dependencies": {
12
- "@checkstack/backend-api": "0.5.2",
13
- "@checkstack/healthcheck-common": "0.8.1",
12
+ "@checkstack/backend-api": "0.7.0",
13
+ "@checkstack/healthcheck-common": "0.8.2",
14
14
  "jsonpath-plus": "^10.3.0",
15
- "@checkstack/common": "0.6.1"
15
+ "@checkstack/common": "0.6.2"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@types/bun": "^1.0.0",
package/src/strategy.ts CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  z,
9
9
  type InferAggregatedResult,
10
10
  type ConnectedClient,
11
+ baseStrategyConfigSchema,
11
12
  } from "@checkstack/backend-api";
12
13
  import {
13
14
  healthResultString,
@@ -27,14 +28,7 @@ import type {
27
28
  * HTTP health check configuration schema.
28
29
  * Global defaults only - action params moved to RequestCollector.
29
30
  */
30
- export const httpHealthCheckConfigSchema = z.object({
31
- timeout: z
32
- .number()
33
- .int()
34
- .min(100)
35
- .default(30_000)
36
- .describe("Default request timeout in milliseconds"),
37
- });
31
+ export const httpHealthCheckConfigSchema = baseStrategyConfigSchema.extend({});
38
32
 
39
33
  export type HttpHealthCheckConfig = z.infer<typeof httpHealthCheckConfigSchema>;
40
34
 
@@ -154,9 +148,10 @@ export class HttpHealthCheckStrategy implements HealthCheckStrategy<
154
148
  signal: controller.signal,
155
149
  });
156
150
 
157
- clearTimeout(timeoutId);
158
-
151
+ // Read body BEFORE clearing timeout - body streaming can also hang
159
152
  const body = await response.text();
153
+
154
+ clearTimeout(timeoutId);
160
155
  const headers: Record<string, string> = {};
161
156
 
162
157
  // eslint-disable-next-line unicorn/no-array-for-each