@cleocode/core 2026.5.131 → 2026.5.133

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.
Files changed (110) hide show
  1. package/dist/db/index.d.ts +36 -0
  2. package/dist/db/index.d.ts.map +1 -0
  3. package/dist/db/index.js +36 -0
  4. package/dist/db/index.js.map +1 -0
  5. package/dist/gc/daemon.d.ts +17 -8
  6. package/dist/gc/daemon.d.ts.map +1 -1
  7. package/dist/gc/daemon.js +24 -67
  8. package/dist/gc/daemon.js.map +1 -1
  9. package/dist/gc/gc-subsystem.d.ts +96 -0
  10. package/dist/gc/gc-subsystem.d.ts.map +1 -0
  11. package/dist/gc/gc-subsystem.js +186 -0
  12. package/dist/gc/gc-subsystem.js.map +1 -0
  13. package/dist/gc/index.d.ts +1 -0
  14. package/dist/gc/index.d.ts.map +1 -1
  15. package/dist/gc/index.js +1 -0
  16. package/dist/gc/index.js.map +1 -1
  17. package/dist/go/driver.d.ts +132 -0
  18. package/dist/go/driver.d.ts.map +1 -0
  19. package/dist/go/driver.js +191 -0
  20. package/dist/go/driver.js.map +1 -0
  21. package/dist/go/index.d.ts +13 -0
  22. package/dist/go/index.d.ts.map +1 -0
  23. package/dist/go/index.js +13 -0
  24. package/dist/go/index.js.map +1 -0
  25. package/dist/goal/advance-with-persist.d.ts +80 -0
  26. package/dist/goal/advance-with-persist.d.ts.map +1 -0
  27. package/dist/goal/advance-with-persist.js +105 -0
  28. package/dist/goal/advance-with-persist.js.map +1 -0
  29. package/dist/goal/arm.d.ts +61 -0
  30. package/dist/goal/arm.d.ts.map +1 -0
  31. package/dist/goal/arm.js +65 -0
  32. package/dist/goal/arm.js.map +1 -0
  33. package/dist/goal/index.d.ts +2 -0
  34. package/dist/goal/index.d.ts.map +1 -1
  35. package/dist/goal/index.js +2 -0
  36. package/dist/goal/index.js.map +1 -1
  37. package/dist/index.d.ts +3 -0
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +3 -0
  40. package/dist/index.js.map +1 -1
  41. package/dist/orchestrate/lifecycle-ops.js +1 -1
  42. package/dist/orchestrate/lifecycle-ops.js.map +1 -1
  43. package/dist/orchestration/classify-readiness.d.ts +172 -0
  44. package/dist/orchestration/classify-readiness.d.ts.map +1 -0
  45. package/dist/orchestration/classify-readiness.js +346 -0
  46. package/dist/orchestration/classify-readiness.js.map +1 -0
  47. package/dist/orchestration/index.d.ts +2 -0
  48. package/dist/orchestration/index.d.ts.map +1 -1
  49. package/dist/orchestration/index.js +1 -0
  50. package/dist/orchestration/index.js.map +1 -1
  51. package/dist/output.d.ts +2 -0
  52. package/dist/output.d.ts.map +1 -1
  53. package/dist/output.js +59 -1
  54. package/dist/output.js.map +1 -1
  55. package/dist/release/pr-evidence.d.ts +4 -3
  56. package/dist/release/pr-evidence.d.ts.map +1 -1
  57. package/dist/release/pr-evidence.js +4 -3
  58. package/dist/release/pr-evidence.js.map +1 -1
  59. package/dist/sagas/index.d.ts +1 -0
  60. package/dist/sagas/index.d.ts.map +1 -1
  61. package/dist/sagas/index.js +1 -0
  62. package/dist/sagas/index.js.map +1 -1
  63. package/dist/sagas/next.d.ts +77 -0
  64. package/dist/sagas/next.d.ts.map +1 -0
  65. package/dist/sagas/next.js +159 -0
  66. package/dist/sagas/next.js.map +1 -0
  67. package/dist/sentient/daemon-entry.d.ts +6 -0
  68. package/dist/sentient/daemon-entry.d.ts.map +1 -1
  69. package/dist/sentient/daemon-entry.js +10 -1
  70. package/dist/sentient/daemon-entry.js.map +1 -1
  71. package/dist/sentient/daemon.d.ts +30 -0
  72. package/dist/sentient/daemon.d.ts.map +1 -1
  73. package/dist/sentient/daemon.js +12 -2
  74. package/dist/sentient/daemon.js.map +1 -1
  75. package/dist/sentient/index.d.ts +2 -0
  76. package/dist/sentient/index.d.ts.map +1 -1
  77. package/dist/sentient/index.js +5 -0
  78. package/dist/sentient/index.js.map +1 -1
  79. package/dist/sentient/propose-tick.d.ts +101 -0
  80. package/dist/sentient/propose-tick.d.ts.map +1 -1
  81. package/dist/sentient/propose-tick.js +284 -0
  82. package/dist/sentient/propose-tick.js.map +1 -1
  83. package/dist/sentient/tick.d.ts +23 -0
  84. package/dist/sentient/tick.d.ts.map +1 -1
  85. package/dist/sentient/tick.js +91 -21
  86. package/dist/sentient/tick.js.map +1 -1
  87. package/dist/store/dual-scope-db.d.ts +183 -0
  88. package/dist/store/dual-scope-db.d.ts.map +1 -0
  89. package/dist/store/dual-scope-db.js +315 -0
  90. package/dist/store/dual-scope-db.js.map +1 -0
  91. package/dist/store/open-cleo-db.d.ts +51 -4
  92. package/dist/store/open-cleo-db.d.ts.map +1 -1
  93. package/dist/store/open-cleo-db.js +56 -2
  94. package/dist/store/open-cleo-db.js.map +1 -1
  95. package/dist/store/schema/cleo-global/nexus.d.ts +1 -1
  96. package/dist/store/schema/cleo-global/signaldock.d.ts +1 -1
  97. package/dist/store/schema/cleo-shared/brain.d.ts +1 -1
  98. package/dist/tasks/add.d.ts.map +1 -1
  99. package/dist/tasks/add.js +16 -2
  100. package/dist/tasks/add.js.map +1 -1
  101. package/dist/tasks/evidence.d.ts +3 -2
  102. package/dist/tasks/evidence.d.ts.map +1 -1
  103. package/dist/tasks/evidence.js.map +1 -1
  104. package/dist/verification/verify-tools.d.ts +164 -0
  105. package/dist/verification/verify-tools.d.ts.map +1 -0
  106. package/dist/verification/verify-tools.js +236 -0
  107. package/dist/verification/verify-tools.js.map +1 -0
  108. package/package.json +16 -11
  109. package/templates/CLEO-INJECTION.md +3 -2
  110. package/templates/workflows/release-prepare.yml.tmpl +86 -7
@@ -0,0 +1,236 @@
1
+ /**
2
+ * Core verification helpers: verifyTypes + verifyRuntimeBoot.
3
+ *
4
+ * These two functions are the canonical agent-facing evidence-gathering tools
5
+ * for type-safety and runtime-boot validation in the CLEO monorepo.
6
+ *
7
+ * ## `verifyTypes`
8
+ *
9
+ * Runs `tsc -b` (the project-reference composite build — the real
10
+ * cross-package type oracle). Per-package `pnpm build` FALSE-passes
11
+ * cross-package type breaks because esbuild transpiles without checking;
12
+ * only `tsc -b` exercises the full type graph.
13
+ *
14
+ * ## `verifyRuntimeBoot`
15
+ *
16
+ * Performs a cold boot sequence:
17
+ * 1. `node build.mjs` — rebuilds the CLI bundle from source.
18
+ * 2. `node packages/cleo/dist/cli/index.js version` — smoke-boots the
19
+ * CLI and asserts it exits cleanly.
20
+ *
21
+ * This catches circular-import TDZ (temporal dead-zone) errors that are
22
+ * invisible to both `tsc` and Biome because they are runtime-only
23
+ * phenomena produced by ESM module evaluation order.
24
+ *
25
+ * ## Return contract
26
+ *
27
+ * Both functions return a {@link VerifyResult} with a discriminated
28
+ * `passed` boolean, `durationMs`, and captured `stdout` / `stderr` tails
29
+ * for actionable diagnostics. Callers MUST check `passed` before treating
30
+ * the output as valid.
31
+ *
32
+ * ## Regression tests captured
33
+ *
34
+ * - `verifyTypes`: dual-ORM-instance type break (two `drizzle-orm` versions
35
+ * resolve to different instances — tsc catches the shape mismatch; build passes).
36
+ * - `verifyRuntimeBoot`: leaf-hoist TDZ (circular dep between a leaf package
37
+ * and a re-exported barrel causes the CLI to throw at startup; invisible to tsc).
38
+ *
39
+ * @task T11488
40
+ * @see packages/core/src/tasks/tool-cache.ts — runToolCached (evidence caching layer)
41
+ */
42
+ import { spawn } from 'node:child_process';
43
+ import { resolveOrCwd } from '../paths.js';
44
+ // ---------------------------------------------------------------------------
45
+ // Internal helpers
46
+ // ---------------------------------------------------------------------------
47
+ /** Maximum bytes retained from a child stream. */
48
+ const DEFAULT_TAIL_BYTES = 4096;
49
+ /**
50
+ * Minimal ring-buffer that retains the last `cap` bytes of appended data.
51
+ *
52
+ * @internal
53
+ */
54
+ class TailBuffer {
55
+ cap;
56
+ chunks = [];
57
+ size = 0;
58
+ constructor(cap) {
59
+ this.cap = cap;
60
+ }
61
+ append(chunk) {
62
+ this.chunks.push(chunk);
63
+ this.size += chunk.length;
64
+ // Trim from the front when we overflow the cap.
65
+ while (this.size > this.cap && this.chunks.length > 0) {
66
+ const front = this.chunks[0];
67
+ if (this.size - front.length >= this.cap) {
68
+ this.size -= front.length;
69
+ this.chunks.shift();
70
+ }
71
+ else {
72
+ break;
73
+ }
74
+ }
75
+ }
76
+ toString() {
77
+ return Buffer.concat(this.chunks, this.size).toString('utf-8');
78
+ }
79
+ }
80
+ /**
81
+ * Spawn a command and collect stdout / stderr tails.
82
+ *
83
+ * @param cmd - Executable name.
84
+ * @param args - Argument list.
85
+ * @param cwd - Working directory.
86
+ * @param step - Human-readable label for the {@link VerifyResult}.
87
+ * @param opts - Tail and timeout options.
88
+ *
89
+ * @internal
90
+ */
91
+ async function runStep(cmd, args, cwd, step, opts) {
92
+ const startMs = Date.now();
93
+ const { tailBytes, timeoutMs } = opts;
94
+ return new Promise((resolve) => {
95
+ const stdoutBuf = new TailBuffer(tailBytes);
96
+ const stderrBuf = new TailBuffer(tailBytes);
97
+ const child = spawn(cmd, args, {
98
+ cwd,
99
+ stdio: ['ignore', 'pipe', 'pipe'],
100
+ env: process.env,
101
+ });
102
+ let timedOut = false;
103
+ const timer = setTimeout(() => {
104
+ timedOut = true;
105
+ child.kill('SIGTERM');
106
+ }, timeoutMs);
107
+ child.stdout?.on('data', (d) => {
108
+ stdoutBuf.append(d);
109
+ });
110
+ child.stderr?.on('data', (d) => {
111
+ stderrBuf.append(d);
112
+ });
113
+ child.on('error', () => {
114
+ clearTimeout(timer);
115
+ resolve({
116
+ passed: false,
117
+ exitCode: null,
118
+ stdout: stdoutBuf.toString(),
119
+ stderr: stderrBuf.toString(),
120
+ durationMs: Date.now() - startMs,
121
+ step,
122
+ });
123
+ });
124
+ child.on('close', (code) => {
125
+ clearTimeout(timer);
126
+ const exitCode = timedOut ? null : code;
127
+ resolve({
128
+ passed: exitCode === 0,
129
+ exitCode,
130
+ stdout: stdoutBuf.toString(),
131
+ stderr: stderrBuf.toString(),
132
+ durationMs: Date.now() - startMs,
133
+ step: timedOut ? `${step} [timed out after ${timeoutMs}ms]` : step,
134
+ });
135
+ });
136
+ });
137
+ }
138
+ // ---------------------------------------------------------------------------
139
+ // Public API
140
+ // ---------------------------------------------------------------------------
141
+ /**
142
+ * Run `tsc -b` — the cross-package TypeScript type oracle.
143
+ *
144
+ * Per-package `pnpm build` compiles via esbuild (transpile-only) and
145
+ * therefore passes silently when cross-package type breaks exist. Only
146
+ * `tsc -b` exercises the full composite project-reference graph.
147
+ *
148
+ * Returns a {@link VerifyResult} with `passed: true` iff `tsc` exits with
149
+ * code 0 (no type errors).
150
+ *
151
+ * @param opts - Optional cwd, tail size, and timeout overrides.
152
+ * @returns Structured pass/fail result with diagnostic output.
153
+ *
154
+ * @example
155
+ * ```ts
156
+ * const result = await verifyTypes({ cwd: '/path/to/monorepo' });
157
+ * if (!result.passed) {
158
+ * console.error('Type errors found:', result.stderr);
159
+ * }
160
+ * ```
161
+ *
162
+ * @task T11488
163
+ */
164
+ export async function verifyTypes(opts = {}) {
165
+ const cwd = resolveOrCwd(opts.cwd);
166
+ const tailBytes = opts.tailBytes ?? DEFAULT_TAIL_BYTES;
167
+ const timeoutMs = opts.timeoutMs ?? 300_000;
168
+ return runStep('node', ['node_modules/.bin/tsc', '-b'], cwd, 'tsc -b', {
169
+ tailBytes,
170
+ timeoutMs,
171
+ });
172
+ }
173
+ /**
174
+ * Run a cold monorepo build + CLI boot smoke.
175
+ *
176
+ * Performs two sequential steps:
177
+ *
178
+ * 1. **Build**: `node build.mjs` — rebuilds the CLI bundle from source
179
+ * (catches bundler/esbuild-level issues).
180
+ * 2. **CLI smoke**: `node packages/cleo/dist/cli/index.js version` — boots
181
+ * the CLI and asserts a clean exit (catches circular-import TDZ errors
182
+ * that are invisible to the type checker).
183
+ *
184
+ * The CLI smoke step is skipped when the build step fails (there is no
185
+ * artefact to boot).
186
+ *
187
+ * Returns a {@link RuntimeBootResult} with `passed: true` iff BOTH steps
188
+ * exit with code 0.
189
+ *
190
+ * @param opts - Optional cwd, tail size, and timeout overrides.
191
+ * @returns Structured result containing per-step diagnostics.
192
+ *
193
+ * @example
194
+ * ```ts
195
+ * const result = await verifyRuntimeBoot({ cwd: '/path/to/monorepo' });
196
+ * if (!result.passed) {
197
+ * if (!result.buildStep.passed) {
198
+ * console.error('Build failed:', result.buildStep.stderr);
199
+ * } else {
200
+ * console.error('CLI boot failed:', result.cliSmokeStep.stderr);
201
+ * }
202
+ * }
203
+ * ```
204
+ *
205
+ * @task T11488
206
+ */
207
+ export async function verifyRuntimeBoot(opts = {}) {
208
+ const cwd = resolveOrCwd(opts.cwd);
209
+ const tailBytes = opts.tailBytes ?? DEFAULT_TAIL_BYTES;
210
+ const timeoutMs = opts.timeoutMs ?? 120_000;
211
+ // Step 1: rebuild the CLI bundle.
212
+ const buildStep = await runStep('node', ['build.mjs'], cwd, 'node build.mjs', {
213
+ tailBytes,
214
+ timeoutMs,
215
+ });
216
+ if (!buildStep.passed) {
217
+ // Skip the smoke step when build fails — there is nothing to boot.
218
+ const cliSmokeStep = {
219
+ passed: false,
220
+ exitCode: null,
221
+ stdout: '',
222
+ stderr: 'Skipped: build step failed.',
223
+ durationMs: 0,
224
+ step: 'node packages/cleo/dist/cli/index.js version [skipped]',
225
+ };
226
+ return { passed: false, buildStep, cliSmokeStep };
227
+ }
228
+ // Step 2: cold-boot CLI and assert `version` exits cleanly.
229
+ const cliSmokeStep = await runStep('node', ['packages/cleo/dist/cli/index.js', 'version'], cwd, 'node packages/cleo/dist/cli/index.js version', { tailBytes, timeoutMs });
230
+ return {
231
+ passed: cliSmokeStep.passed,
232
+ buildStep,
233
+ cliSmokeStep,
234
+ };
235
+ }
236
+ //# sourceMappingURL=verify-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify-tools.js","sourceRoot":"","sources":["../../src/verification/verify-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,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CAAC,CAAC;IACnC,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,kBAAkB,CAAC;IACvD,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,OAAO,CAAC;IAE5C,kCAAkC;IAClC,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC,WAAW,CAAC,EAAE,GAAG,EAAE,gBAAgB,EAAE;QAC5E,SAAS;QACT,SAAS;KACV,CAAC,CAAC;IAEH,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;QACtB,mEAAmE;QACnE,MAAM,YAAY,GAAiB;YACjC,MAAM,EAAE,KAAK;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,EAAE;YACV,MAAM,EAAE,6BAA6B;YACrC,UAAU,EAAE,CAAC;YACb,IAAI,EAAE,wDAAwD;SAC/D,CAAC;QACF,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;IACpD,CAAC;IAED,4DAA4D;IAC5D,MAAM,YAAY,GAAG,MAAM,OAAO,CAChC,MAAM,EACN,CAAC,iCAAiC,EAAE,SAAS,CAAC,EAC9C,GAAG,EACH,8CAA8C,EAC9C,EAAE,SAAS,EAAE,SAAS,EAAE,CACzB,CAAC;IAEF,OAAO;QACL,MAAM,EAAE,YAAY,CAAC,MAAM;QAC3B,SAAS;QACT,YAAY;KACb,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cleocode/core",
3
- "version": "2026.5.131",
3
+ "version": "2026.5.133",
4
4
  "description": "CLEO core business logic kernel — tasks, sessions, memory, orchestration, lifecycle, with bundled SQLite store",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -121,6 +121,11 @@
121
121
  "import": "./dist/gc/index.js",
122
122
  "require": "./dist/gc/index.js"
123
123
  },
124
+ "./db": {
125
+ "types": "./dist/db/index.d.ts",
126
+ "import": "./dist/db/index.js",
127
+ "require": "./dist/db/index.js"
128
+ },
124
129
  "./doctor": {
125
130
  "types": "./dist/doctor/index.d.ts",
126
131
  "import": "./dist/doctor/index.js",
@@ -394,16 +399,16 @@
394
399
  "write-file-atomic": "^7.0.1",
395
400
  "yaml": "^2.8.3",
396
401
  "zod": "^4.3.6",
397
- "@cleocode/adapters": "2026.5.131",
398
- "@cleocode/agents": "2026.5.131",
399
- "@cleocode/contracts": "2026.5.131",
400
- "@cleocode/caamp": "2026.5.131",
401
- "@cleocode/lafs": "2026.5.131",
402
- "@cleocode/nexus": "2026.5.131",
403
- "@cleocode/paths": "2026.5.131",
404
- "@cleocode/skills": "2026.5.131",
402
+ "@cleocode/adapters": "2026.5.133",
403
+ "@cleocode/caamp": "2026.5.133",
404
+ "@cleocode/contracts": "2026.5.133",
405
+ "@cleocode/agents": "2026.5.133",
406
+ "@cleocode/lafs": "2026.5.133",
407
+ "@cleocode/nexus": "2026.5.133",
408
+ "@cleocode/paths": "2026.5.133",
409
+ "@cleocode/skills": "2026.5.133",
405
410
  "@cleocode/utils": "2026.5.122",
406
- "@cleocode/worktree": "2026.5.131"
411
+ "@cleocode/worktree": "2026.5.133"
407
412
  },
408
413
  "engines": {
409
414
  "node": ">=24.16.0"
@@ -435,7 +440,7 @@
435
440
  },
436
441
  "optionalDependencies": {
437
442
  "llmtxt": "^2026.5.15",
438
- "@cleocode/studio": "^2026.5.131"
443
+ "@cleocode/studio": "^2026.5.133"
439
444
  },
440
445
  "scripts": {
441
446
  "build": "tsc",
@@ -285,7 +285,8 @@ cleo verify T### --gate testsPassed --evidence "tool:test"
285
285
  # qaPassed — lint + typecheck
286
286
  cleo verify T### --gate qaPassed --evidence "tool:lint;tool:typecheck"
287
287
 
288
- # retroactive PR atom (PR MERGED + CI green) satisfies testsPassed AND qaPassed
288
+ # retroactive PR atom (PR MERGED + CI green) satisfies implemented + testsPassed + qaPassed
289
+ cleo verify T### --gate implemented --evidence "pr:357"
289
290
  cleo verify T### --gate testsPassed --evidence "pr:357"
290
291
  cleo verify T### --gate qaPassed --evidence "pr:357"
291
292
 
@@ -325,7 +326,7 @@ All overrides append a line to `.cleo/audit/force-bypass.jsonl`. Use sparingly.
325
326
 
326
327
  ### `pr:<number>` retroactive atom (T9764)
327
328
 
328
- Accepts IFF PR `state=MERGED` AND required-workflow checks are `SUCCESS`/`SKIPPED`. Single atom satisfies BOTH `testsPassed` + `qaPassed`. Cache under `.cleo/cache/evidence/pr-<num>.json`.
329
+ Accepts IFF PR `state=MERGED` AND required-workflow checks are `SUCCESS`/`SKIPPED`. Single atom satisfies `implemented` + `testsPassed` + `qaPassed` simultaneously (T9838). Cache under `.cleo/cache/evidence/pr-<num>.json`.
329
330
 
330
331
  ### Anti-patterns to avoid
331
332
 
@@ -50,6 +50,11 @@ on:
50
50
  - beta
51
51
  - alpha
52
52
  - rc
53
+ skip-tests:
54
+ description: 'Skip the full test suite in Preflight (use when main CI is already green — avoids the 10min+ timeout). Lint and typecheck still run.'
55
+ type: boolean
56
+ required: false
57
+ default: false
53
58
 
54
59
  # R-202: contents:write (commit + branch), pull-requests:write (gh pr create),
55
60
  # id-token:write (signed tags only). MUST NOT request packages:write — npm
@@ -73,10 +78,17 @@ defaults:
73
78
  jobs:
74
79
  # R-204: lint + typecheck + test + build BEFORE any commit. Failure here
75
80
  # MUST fail the workflow and prevent `prepare` from running.
76
- preflight:
77
- name: Preflight (lint + typecheck + test + build)
81
+ #
82
+ # T11490 DHQ-042: the full unsharded test suite can exceed 10 min and
83
+ # time out the preflight. Two mitigations:
84
+ # (a) `skip-tests` input (default false) — when the caller knows main CI
85
+ # is already green, tests can be skipped to avoid the redundant run.
86
+ # (b) The test step is sharded across 2 parallel matrix workers, keeping
87
+ # each shard under 10 min even without skipping.
88
+ preflight-lint-typecheck:
89
+ name: Preflight (lint + typecheck)
78
90
  runs-on: ubuntu-latest
79
- timeout-minutes: 20
91
+ timeout-minutes: 15
80
92
  steps:
81
93
  # R-263: third-party Actions pinned to major+minor.
82
94
  - name: Checkout
@@ -107,10 +119,68 @@ jobs:
107
119
  run: {{TYPECHECK_CMD}}
108
120
  timeout-minutes: 5
109
121
 
110
- - name: Test
111
- run: {{TEST_CMD}}
122
+ # T11490 — DHQ-042: test shards run in parallel to stay under 10 min.
123
+ # Skipped when skip-tests=true (e.g. dispatched after a green main CI).
124
+ preflight-test:
125
+ name: Preflight (test shard ${{ matrix.shard }}/2)
126
+ if: ${{ inputs.skip-tests != true }}
127
+ runs-on: ubuntu-latest
128
+ timeout-minutes: 15
129
+ strategy:
130
+ fail-fast: true
131
+ matrix:
132
+ shard: [1, 2]
133
+ steps:
134
+ - name: Checkout
135
+ uses: actions/checkout@v4
136
+ with:
137
+ fetch-depth: 0
138
+ timeout-minutes: 5
139
+
140
+ - name: Set up pnpm
141
+ uses: pnpm/action-setup@v4
142
+ timeout-minutes: 2
143
+
144
+ - name: Set up Node.js
145
+ uses: actions/setup-node@v4
146
+ with:
147
+ node-version: '{{NODE_VERSION}}'
148
+ timeout-minutes: 3
149
+
150
+ - name: Install dependencies
151
+ run: {{INSTALL_CMD}}
152
+ timeout-minutes: 5
153
+
154
+ - name: Test (shard ${{ matrix.shard }}/2)
155
+ run: pnpm exec vitest run --shard=${{ matrix.shard }}/2
112
156
  timeout-minutes: 10
113
157
 
158
+ preflight-build:
159
+ name: Preflight (build)
160
+ runs-on: ubuntu-latest
161
+ needs: [preflight-lint-typecheck]
162
+ timeout-minutes: 15
163
+ steps:
164
+ - name: Checkout
165
+ uses: actions/checkout@v4
166
+ with:
167
+ fetch-depth: 0
168
+ timeout-minutes: 5
169
+
170
+ - name: Set up pnpm
171
+ uses: pnpm/action-setup@v4
172
+ timeout-minutes: 2
173
+
174
+ - name: Set up Node.js
175
+ uses: actions/setup-node@v4
176
+ with:
177
+ node-version: '{{NODE_VERSION}}'
178
+ timeout-minutes: 3
179
+
180
+ - name: Install dependencies
181
+ run: {{INSTALL_CMD}}
182
+ timeout-minutes: 5
183
+
114
184
  - name: Build
115
185
  run: {{BUILD_CMD}}
116
186
  timeout-minutes: 10
@@ -121,10 +191,17 @@ jobs:
121
191
 
122
192
  # R-203: prepare needs preflight.
123
193
  # R-205: plan resolution → version bump → CHANGELOG → commit → push → bump-PR.
194
+ # T11490: needs both lint/typecheck and build to pass; test shards are
195
+ # independent (always() used so prepare can run even when tests are skipped).
124
196
  prepare:
125
197
  name: Prepare bump-PR
126
198
  runs-on: ubuntu-latest
127
- needs: preflight
199
+ needs: [preflight-lint-typecheck, preflight-test, preflight-build]
200
+ if: |
201
+ always() &&
202
+ needs.preflight-lint-typecheck.result == 'success' &&
203
+ needs.preflight-build.result == 'success' &&
204
+ (needs.preflight-test.result == 'success' || needs.preflight-test.result == 'skipped')
128
205
  timeout-minutes: 20
129
206
  outputs:
130
207
  branch: ${{ steps.branch.outputs.name }}
@@ -263,7 +340,9 @@ jobs:
263
340
  name: Cleanup on failure
264
341
  runs-on: ubuntu-latest
265
342
  needs:
266
- - preflight
343
+ - preflight-lint-typecheck
344
+ - preflight-test
345
+ - preflight-build
267
346
  - prepare
268
347
  if: failure()
269
348
  timeout-minutes: 10