@teamscala/service-boot 0.23.289 → 0.23.290

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/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  },
7
7
  "name": "@teamscala/service-boot",
8
8
  "type": "module",
9
- "version": "0.23.289",
9
+ "version": "0.23.290",
10
10
  "sideEffects": false,
11
11
  "files": [
12
12
  "src"
@@ -489,14 +489,6 @@
489
489
  "types": "./src/handlers/scala-tools-currency-watch.d.ts",
490
490
  "default": "./src/handlers/scala-tools-currency-watch.ts"
491
491
  },
492
- "./handlers/scheduled-browser-tests": {
493
- "types": "./src/handlers/scheduled-browser-tests.d.ts",
494
- "default": "./src/handlers/scheduled-browser-tests.ts"
495
- },
496
- "./handlers/scheduled-browser-tests.ts": {
497
- "types": "./src/handlers/scheduled-browser-tests.d.ts",
498
- "default": "./src/handlers/scheduled-browser-tests.ts"
499
- },
500
492
  "./handlers/sweep-event-log": {
501
493
  "types": "./src/handlers/sweep-event-log.d.ts",
502
494
  "default": "./src/handlers/sweep-event-log.ts"
@@ -17,7 +17,6 @@ import "./handlers/sweep-host-cache.ts";
17
17
  import "./handlers/bun-stable-watch.ts";
18
18
  import "./handlers/whatsapp-liveness.ts";
19
19
  import "./handlers/upstream-issue-sync.ts";
20
- import "./handlers/scheduled-browser-tests.ts";
21
20
  import "./handlers/scala-tools-currency-watch.ts";
22
21
  import "./handlers/registry-stale-inactive-sweep.ts";
23
22
  import "./handlers/pane-outbox-drain.ts";
@@ -30,7 +30,6 @@ import "./handlers/sweep-host-cache.ts";
30
30
  import "./handlers/bun-stable-watch.ts";
31
31
  import "./handlers/whatsapp-liveness.ts";
32
32
  import "./handlers/upstream-issue-sync.ts";
33
- import "./handlers/scheduled-browser-tests.ts";
34
33
  import "./handlers/scala-tools-currency-watch.ts";
35
34
  import "./handlers/registry-stale-inactive-sweep.ts";
36
35
  import "./handlers/pane-outbox-drain.ts";
@@ -1 +0,0 @@
1
- export {};
@@ -1,85 +0,0 @@
1
- /**
2
- * @system server-boot
3
- * @status handwritten
4
- * @edit edit directly
5
- *
6
- * The `scheduled-browser-tests` pg-boss handler — the single scheduled-test
7
- * home for the platform's regression suite (open migration
8
- * `test-execution-consolidation`). Spawns `scala-tools test run --existing`
9
- * on a cadence so every automated test execution flows through the one
10
- * registry-driven harness, emitting the queryable `test.run.*` event pair
11
- * (event-log-is-the-only-durable-event-log) that the deleted quartet of
12
- * interval `guard_rule` rows never did (2026-06-29: 4 interval guards each
13
- * autonomously drove headless Chrome against live UI services on 15/30-min
14
- * timers with no central schedule/run-log).
15
- *
16
- * `--existing` runs every ACTIVE `test_vector` row across all services (the
17
- * registry suite — both auto-generated and hand-authored vectors); `--no-boot`
18
- * leaves service supervision to PM2 so a DOWN service fails its own health
19
- * vector (the intended signal) instead of the scheduler booting a duplicate.
20
- * `--source scheduled:scheduled-browser-tests` stamps the run's invoker block
21
- * so a scheduled run is distinguishable from a manual agent run in the event
22
- * log (`SELECT … FROM event_log WHERE kind LIKE 'test.run.%'`).
23
- *
24
- * The per-service outcomes land in the `test.run.result` events sharing the
25
- * spawned run's `run_id`; this handler records only the schedule-level
26
- * `scheduled.test.run` "did the run fire + finish" event. Spawns via
27
- * `@teamscala/os` `spawn` (the single spawn surface); `scala-tools` resolves on
28
- * PATH — on the dev host that is the source-mode link (always current).
29
- *
30
- * Registered under slug `@teamscala/service-boot:scheduled-browser-tests`.
31
- * Mirrors `bun-stable-watch` / `upstream-issue-sync` (dev-host pg-boss
32
- * handlers on scala-loga).
33
- */
34
- import type { ScheduledJobConfig } from "@teamscala/db-validation/registry-schemas/scheduled-job";
35
- import { recordEvent } from "@teamscala/event-log/record-event";
36
- import { getAppLogger } from "@teamscala/logger/app-loggers";
37
- import { spawn } from "@teamscala/os/spawn";
38
- import { loadRegistryConfig } from "@teamscala/db/registry/load-config";
39
- import * as v from "valibot";
40
- import { pgBossHandlerRegistry } from "../pg-boss-handler-registry.ts";
41
-
42
- const SOURCE = "scheduled:scheduled-browser-tests";
43
-
44
- // A full --existing sweep across all UI services (Chrome-driven hydration +
45
- // responsive + node-diff vectors, paced 5s apart between browser vectors) runs
46
- // in the tens of minutes; bound the subprocess so a stuck vector's 90s wall can
47
- // never hang the pg-boss worker indefinitely. exitCode null (SIGKILL on
48
- // timeout) is treated as a failure + recorded.
49
- const DEFAULT_RUN_TIMEOUT_MS = 30 * 60 * 1000;
50
- let cachedRunTimeoutMs: number | undefined;
51
- async function getRunTimeoutMs(): Promise<number> {
52
- if (cachedRunTimeoutMs !== undefined) return cachedRunTimeoutMs;
53
- const row = await loadRegistryConfig("config", "scheduled-browser-tests", v.looseObject({}));
54
- cachedRunTimeoutMs = (row?.run_timeout_ms as number | undefined) ?? DEFAULT_RUN_TIMEOUT_MS;
55
- return cachedRunTimeoutMs;
56
- }
57
-
58
- async function scheduledBrowserTests(_ctx: { config: ScheduledJobConfig }): Promise<void> {
59
- const log = getAppLogger();
60
-
61
- const { stdout, stderr, exitCode } = await spawn({
62
- name: "scheduled-browser-tests",
63
- command: ["scala-tools", "test", "run", "--existing", "--no-boot", "--source", SOURCE],
64
- timeoutMs: await getRunTimeoutMs(),
65
- });
66
-
67
- const code = exitCode ?? -1;
68
- const ok = exitCode === 0;
69
- // Surface the run's own summary line (the CLI prints a final
70
- // "N/M vectors pass across K services" footer) so the schedule outcome is
71
- // visible in the loga tail without re-querying the event log.
72
- const tail = (stdout || stderr || "").trim().split("\n").slice(-2).join(" | ");
73
- log.info(
74
- `[scheduled-browser-tests] scala-tools test run --existing exited ${code} (${ok ? "pass" : "fail"}) — ${tail}`,
75
- );
76
- recordEvent({
77
- kind: "scheduled.test.run",
78
- payload: { source: SOURCE, exit_code: code, ok },
79
- });
80
- }
81
-
82
- pgBossHandlerRegistry.register(
83
- "@teamscala/service-boot:scheduled-browser-tests",
84
- scheduledBrowserTests,
85
- );