@checkstack/slo-backend 0.3.3 → 0.3.5

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,143 @@
1
1
  # @checkstack/slo-backend
2
2
 
3
+ ## 0.3.5
4
+
5
+ ### Patch Changes
6
+
7
+ - 50e5f5f: Runtime plugin system: install + uninstall plugins from npm, GitHub releases
8
+ (including private GitHub Enterprise instances), or tarball uploads at
9
+ runtime, with multi-package bundles, dependency-derived compatibility checks,
10
+ multi-instance coordination via a Postgres artifact store, and
11
+ single-coordinator destructive cleanup.
12
+
13
+ Highlights:
14
+
15
+ - New `PluginSource` discriminated union and `PluginInstaller` /
16
+ `PluginInstallerRegistry` interfaces in `@checkstack/backend-api`. The
17
+ GitHub variant accepts an optional `apiBaseUrl` so deployments backed by
18
+ GitHub Enterprise can install from `https://ghe.example.com/api/v3`
19
+ instead of `api.github.com`.
20
+ - New `installPackageMetadataSchema` (Zod) in `@checkstack/common` validates
21
+ every plugin's `package.json` at install time. Required fields: `name`,
22
+ `version`, `description`, `author`, `license`, `checkstack.type`,
23
+ `checkstack.pluginId`. Optional: `checkstack.bundle`,
24
+ `checkstack.usageInstructions`, `checkstack.allowInstallScripts`.
25
+ - New `pluginManagerContract` in `@checkstack/pluginmanager-common` with
26
+ `list`, `previewInstall`, `install`, `previewUninstall`, `uninstall`, and
27
+ `events` procedures.
28
+ - New `@checkstack/pluginmanager-frontend` admin UI: installed-plugins list
29
+ with per-row uninstall (typed-confirmation modal, schema/configs/cascade
30
+ toggles), install page with NPM / Tarball Upload / GitHub Release tabs
31
+ (Catalog tab disabled — coming soon), and an events page surfacing the
32
+ install/uninstall audit log.
33
+ - New `bunx @checkstack/scripts plugin-pack` CLI for plugin authors —
34
+ per-package mode produces an npm-shaped tarball; `--bundle` mode produces
35
+ an outer tarball containing every sibling declared in
36
+ `package.json#checkstack.bundle`. Published to npm so external authors
37
+ can `bunx` it directly without a workspace checkout.
38
+ - Compatibility derived from `package.json#dependencies` ranges
39
+ (`semver.satisfies` against the platform's loaded `@checkstack/*`
40
+ versions) — no separate `compatibility` field.
41
+ - Multi-instance: originator persists artifacts + `plugins` rows + broadcasts
42
+ install/uninstall; receiving instances do in-process register/unregister
43
+ only. Destructive ops (drop schema, delete plugin_configs, delete
44
+ artifacts, delete `plugins` rows) run exactly once on the originator.
45
+ - Fresh-instance bootstrap: `loadPlugins()` hydrates any
46
+ `is_uninstallable=true` plugin missing from `node_modules` from the
47
+ artifact store before normal Phase 1 register.
48
+ - New schema: `plugin_artifacts` (tarball storage), `plugin_install_events`
49
+ (audit/error log). `plugins` extended with `version`, `metadata`,
50
+ `source`, `bundle_id`, `is_primary`. Local plugin sync now writes
51
+ `version` from each plugin's `package.json` so the admin UI shows real
52
+ versions instead of `—`.
53
+ - Tarball-upload endpoint (`POST /api/pluginmanager/upload-tarball`) for
54
+ the install UI; access-gated by `pluginmanager.plugin.manage`.
55
+ - Plugin Manager menu link added to the user menu (main grid, alongside
56
+ Profile / Notification Settings / etc.).
57
+
58
+ Cross-cutting changes:
59
+
60
+ - Backend request/response logging now flows through `rootLogger` (winston)
61
+ instead of `hono/logger`. 5xx responses include the response body inline
62
+ so swallowed early-return errors are visible in the log.
63
+ - The `/api/:pluginId/*` dispatcher now logs which core service is missing
64
+ or which `pluginId` had no metadata when it 500s.
65
+ - New `registerCorePluginMetadata` on `PluginManager` for core routers
66
+ (like the plugin manager itself) that need their metadata visible to the
67
+ RPC dispatcher without going through the full plugin lifecycle.
68
+ - ESLint: `unicorn/no-null` is now disabled globally. Drizzle distinguishes
69
+ between `null` (writes a real SQL NULL) and `undefined` (skip the column
70
+ on insert), so treating them as interchangeable produced latent bugs at
71
+ the persistence boundary. The bulk of the patch-bumped packages above
72
+ reflect lint-fix touches that landed when this rule was relaxed.
73
+ - Workspace-wide license normalization to `Elastic-2.0` (matches
74
+ `LICENSE.md`). Every `package.json` in the workspace now declares the
75
+ same SPDX identifier; the patch bumps capture this.
76
+
77
+ Plugin packages (every `plugins/*`): added a `pack` npm script
78
+ (`bunx @checkstack/scripts plugin-pack`), mirrored each plugin's
79
+ `pluginId` from `plugin-metadata.ts` into `package.json#checkstack.pluginId`
80
+ so install-time validation passes, stubbed any missing required metadata
81
+ fields (`description`, `author`, `license`), and added
82
+ `checkstack.bundle` to multi-package plugin primaries (telegram, rcon, ssh,
83
+ jira, queue-bullmq, queue-memory, cache-memory).
84
+
85
+ Breaking changes:
86
+
87
+ - The legacy single-method `PluginInstaller` interface (`install(packageName)`)
88
+ is removed. Callers must use `coreServices.pluginInstallerRegistry`.
89
+ - The old `pluginAdminContract` and `createPluginAdminRouter` are removed.
90
+ Replaced by `pluginManagerContract` in `@checkstack/pluginmanager-common`
91
+ and `createPluginManagerRouter` in `core/backend`.
92
+ - `@checkstack/test-utils-backend` no longer exports
93
+ `createMockPluginInstaller` / `MockPluginInstaller` (the legacy interface
94
+ it shimmed is gone).
95
+
96
+ Note: bumps are limited to `minor` (for packages with new public API
97
+ surface) and `patch` (for downstream consumers, license normalization,
98
+ and lint fixes). No `major` bumps despite the `PluginInstaller` removal —
99
+ the legacy interface had no third-party consumers in the wild before this
100
+ runtime plugin system landed, and the contract surface is the same shape
101
+ modulo the rename.
102
+
103
+ - Updated dependencies [50e5f5f]
104
+ - @checkstack/backend-api@0.15.0
105
+ - @checkstack/catalog-backend@1.0.2
106
+ - @checkstack/catalog-common@2.0.1
107
+ - @checkstack/common@0.8.0
108
+ - @checkstack/dependency-common@1.0.1
109
+ - @checkstack/healthcheck-backend@1.0.3
110
+ - @checkstack/integration-common@0.3.1
111
+ - @checkstack/queue-api@0.2.18
112
+ - @checkstack/slo-common@0.3.2
113
+ - @checkstack/cache-api@0.2.4
114
+ - @checkstack/cache-utils@0.2.4
115
+ - @checkstack/command-backend@0.1.24
116
+ - @checkstack/healthcheck-common@1.0.1
117
+ - @checkstack/integration-backend@0.1.24
118
+ - @checkstack/signal-common@0.2.1
119
+
120
+ ## 0.3.4
121
+
122
+ ### Patch Changes
123
+
124
+ - Updated dependencies [302cd3f]
125
+ - @checkstack/backend-api@0.14.1
126
+ - @checkstack/cache-api@0.2.3
127
+ - @checkstack/catalog-backend@1.0.1
128
+ - @checkstack/command-backend@0.1.23
129
+ - @checkstack/healthcheck-backend@1.0.2
130
+ - @checkstack/integration-backend@0.1.23
131
+ - @checkstack/queue-api@0.2.17
132
+ - @checkstack/cache-utils@0.2.3
133
+ - @checkstack/catalog-common@2.0.0
134
+ - @checkstack/common@0.7.0
135
+ - @checkstack/dependency-common@1.0.0
136
+ - @checkstack/healthcheck-common@1.0.0
137
+ - @checkstack/integration-common@0.3.0
138
+ - @checkstack/signal-common@0.2.0
139
+ - @checkstack/slo-common@0.3.1
140
+
3
141
  ## 0.3.3
4
142
 
5
143
  ### Patch Changes
package/package.json CHANGED
@@ -1,33 +1,34 @@
1
1
  {
2
2
  "name": "@checkstack/slo-backend",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
+ "license": "Elastic-2.0",
4
5
  "type": "module",
5
6
  "main": "src/index.ts",
6
7
  "checkstack": {
7
8
  "type": "backend"
8
9
  },
9
10
  "scripts": {
10
- "typecheck": "tsc --noEmit",
11
+ "typecheck": "tsgo -b",
11
12
  "generate": "drizzle-kit generate",
12
13
  "lint": "bun run lint:code",
13
14
  "lint:code": "eslint . --max-warnings 0"
14
15
  },
15
16
  "dependencies": {
16
- "@checkstack/backend-api": "0.13.1",
17
- "@checkstack/cache-api": "0.2.1",
18
- "@checkstack/cache-utils": "0.2.1",
19
- "@checkstack/slo-common": "0.3.0",
20
- "@checkstack/healthcheck-common": "0.13.0",
21
- "@checkstack/healthcheck-backend": "0.18.1",
22
- "@checkstack/dependency-common": "0.3.0",
23
- "@checkstack/catalog-common": "1.5.3",
24
- "@checkstack/catalog-backend": "0.7.1",
25
- "@checkstack/command-backend": "0.1.21",
17
+ "@checkstack/backend-api": "0.14.1",
18
+ "@checkstack/cache-api": "0.2.3",
19
+ "@checkstack/cache-utils": "0.2.3",
20
+ "@checkstack/slo-common": "0.3.1",
21
+ "@checkstack/healthcheck-common": "1.0.0",
22
+ "@checkstack/healthcheck-backend": "1.0.2",
23
+ "@checkstack/dependency-common": "1.0.0",
24
+ "@checkstack/catalog-common": "2.0.0",
25
+ "@checkstack/catalog-backend": "1.0.1",
26
+ "@checkstack/command-backend": "0.1.23",
26
27
  "@checkstack/signal-common": "0.2.0",
27
- "@checkstack/integration-backend": "0.1.21",
28
+ "@checkstack/integration-backend": "0.1.23",
28
29
  "@checkstack/integration-common": "0.3.0",
29
30
  "@checkstack/common": "0.7.0",
30
- "@checkstack/queue-api": "0.2.15",
31
+ "@checkstack/queue-api": "0.2.17",
31
32
  "drizzle-orm": "^0.45.0",
32
33
  "zod": "^4.2.1",
33
34
  "@orpc/server": "^1.13.2"
@@ -35,8 +36,8 @@
35
36
  "devDependencies": {
36
37
  "@checkstack/drizzle-helper": "0.0.4",
37
38
  "@checkstack/scripts": "0.1.2",
38
- "@checkstack/test-utils-backend": "0.1.21",
39
- "@checkstack/tsconfig": "0.0.5",
39
+ "@checkstack/test-utils-backend": "0.1.23",
40
+ "@checkstack/tsconfig": "0.0.6",
40
41
  "@types/bun": "^1.0.0",
41
42
  "drizzle-kit": "^0.31.10",
42
43
  "typescript": "^5.0.0"
package/src/router.ts CHANGED
@@ -53,7 +53,7 @@ export function createRouter({
53
53
  cache.wrapObjective(input.id, async () => {
54
54
  const objective = await service.getObjective({ id: input.id });
55
55
  if (!objective) {
56
- // eslint-disable-next-line unicorn/no-null -- oRPC contract requires null for missing values
56
+
57
57
  return null;
58
58
  }
59
59
  const status = await engine.computeStatus({ objective });
package/src/service.ts CHANGED
@@ -72,7 +72,7 @@ export class SloService {
72
72
  await this.db.insert(sloObjectives).values({
73
73
  id,
74
74
  systemId: input.systemId,
75
- // eslint-disable-next-line unicorn/no-null -- Drizzle requires null for nullable columns
75
+
76
76
  healthCheckConfigurationId: input.healthCheckConfigurationId ?? null,
77
77
  target: input.target,
78
78
  windowDays: input.windowDays,
@@ -184,9 +184,9 @@ export class SloService {
184
184
  systemId,
185
185
  startTime: now,
186
186
  attributionType,
187
- // eslint-disable-next-line unicorn/no-null -- Drizzle requires null for nullable columns
187
+
188
188
  upstreamSystemId: upstreamSystemId ?? null,
189
- // eslint-disable-next-line unicorn/no-null -- Drizzle requires null for nullable columns
189
+
190
190
  upstreamSystemName: upstreamSystemName ?? null,
191
191
  });
192
192
 
@@ -480,7 +480,7 @@ export class SloService {
480
480
  currentStreak: newCurrent,
481
481
  bestStreak: newBest,
482
482
  streakStart: streak.streakStart ?? now,
483
- // eslint-disable-next-line unicorn/no-null -- Drizzle requires null for nullable columns
483
+
484
484
  bestStreakEnd: newCurrent > streak.bestStreak ? null : streak.bestStreakEnd,
485
485
  })
486
486
  .where(eq(sloStreaks.objectiveId, objectiveId));
@@ -499,7 +499,7 @@ export class SloService {
499
499
  const now = new Date();
500
500
  const updateData: Partial<typeof sloStreaks.$inferInsert> = {
501
501
  currentStreak: 0,
502
- // eslint-disable-next-line unicorn/no-null -- Drizzle requires null for nullable columns
502
+
503
503
  streakStart: null,
504
504
  };
505
505
 
package/src/slo-engine.ts CHANGED
@@ -325,13 +325,13 @@ export class SloEngine {
325
325
  const effectiveAvailability =
326
326
  totalWindowMinutes > 0
327
327
  ? ((totalWindowMinutes - consumedMinutes) / totalWindowMinutes) * 100
328
- // eslint-disable-next-line unicorn/no-null -- Zod schema uses .nullable()
328
+
329
329
  : null;
330
330
 
331
331
  const strictAvailability =
332
332
  totalWindowMinutes > 0
333
333
  ? ((totalWindowMinutes - downtime.totalMinutes) / totalWindowMinutes) * 100
334
- // eslint-disable-next-line unicorn/no-null -- Zod schema uses .nullable()
334
+
335
335
  : null;
336
336
 
337
337
  // Burn rate: how fast are we consuming budget relative to the window?
@@ -342,7 +342,7 @@ export class SloEngine {
342
342
  const expectedConsumption =
343
343
  (elapsedDays / objective.windowDays) * allowedDowntimeMinutes;
344
344
  const burnRate =
345
- // eslint-disable-next-line unicorn/no-null -- Zod schema uses .nullable()
345
+
346
346
  expectedConsumption > 0 ? consumedMinutes / expectedConsumption : null;
347
347
 
348
348
  // Check for open downtime events
@@ -364,7 +364,7 @@ export class SloEngine {
364
364
  target: objective.target,
365
365
  windowDays: objective.windowDays,
366
366
  healthCheckConfigurationId: objective.healthCheckConfigurationId,
367
- // eslint-disable-next-line unicorn/no-null -- Not yet resolving configuration names
367
+
368
368
  healthCheckConfigurationName: null,
369
369
  currentAvailability: effectiveAvailability,
370
370
  strictAvailability,
@@ -79,7 +79,7 @@ export async function runDailySnapshotJob(deps: {
79
79
  availabilityPercent: status.currentAvailability ?? 100,
80
80
  budgetConsumedMinutes: status.errorBudgetConsumedMinutes,
81
81
  budgetRemainingPercent: status.errorBudgetRemainingPercent,
82
- // eslint-disable-next-line unicorn/no-null -- Zod schema uses .nullable()
82
+
83
83
  burnRate: status.burnRate ?? null,
84
84
  streakDays: streak?.currentStreak ?? 0,
85
85
  },
package/tsconfig.json CHANGED
@@ -2,5 +2,58 @@
2
2
  "extends": "@checkstack/tsconfig/backend.json",
3
3
  "include": [
4
4
  "src"
5
+ ],
6
+ "references": [
7
+ {
8
+ "path": "../backend-api"
9
+ },
10
+ {
11
+ "path": "../cache-api"
12
+ },
13
+ {
14
+ "path": "../cache-utils"
15
+ },
16
+ {
17
+ "path": "../catalog-backend"
18
+ },
19
+ {
20
+ "path": "../catalog-common"
21
+ },
22
+ {
23
+ "path": "../command-backend"
24
+ },
25
+ {
26
+ "path": "../common"
27
+ },
28
+ {
29
+ "path": "../dependency-common"
30
+ },
31
+ {
32
+ "path": "../drizzle-helper"
33
+ },
34
+ {
35
+ "path": "../healthcheck-backend"
36
+ },
37
+ {
38
+ "path": "../healthcheck-common"
39
+ },
40
+ {
41
+ "path": "../integration-backend"
42
+ },
43
+ {
44
+ "path": "../integration-common"
45
+ },
46
+ {
47
+ "path": "../queue-api"
48
+ },
49
+ {
50
+ "path": "../signal-common"
51
+ },
52
+ {
53
+ "path": "../slo-common"
54
+ },
55
+ {
56
+ "path": "../test-utils-backend"
57
+ }
5
58
  ]
6
59
  }