Repository navigation
553 lines (545 loc) · 24.8 KB
/
Copy pathpr.yml
File metadata and controls
553 lines (545 loc) · 24.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
name: PR
on:
pull_request:
push:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
# Only a newer push to the same pull request cancels a run. Every commit on
# main keeps its run, so every commit gets a preview.
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
jobs:
# The test suites run as parallel jobs. The workflow's wall time is then
# its slowest job, about 6 to 7 minutes, not the sum of every suite, about
# 21 minutes when they ran as one job. Each job should stay well under the
# 10-minute limit; pr-shards.mjs records how each suite is split.
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Tools
uses: tanstack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3
- run: pnpm run build
- run: pnpm run lint:check
- run: pnpm run format:check
- run: pnpm run typecheck
- run: pnpm --filter @tanstack/oracles run test
# Checks the partition of the end-to-end gap oracle into CI shards
# (packages/oracles/scripts/e2e-shards.mjs) ahead of the shard jobs,
# which CI does not run yet: every test is in exactly one shard.
- run: pnpm --filter @tanstack/oracles run test:oracle-gaps:shards
# The framework self-oracle, the gap report's static oracle, and the
# end-to-end oracle's fixed seed each run as several jobs. Together
# they run exactly the tests one job ran
# (packages/oracles/scripts/pr-shards.mjs).
- run: pnpm --filter @tanstack/oracles run test:pr-shards
- run: pnpm run test:publint
- run: pnpm run test:sherif
test-eslint-plugin:
name: Test eslint-plugin-oracles
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Tools
uses: tanstack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3
# The plugin's tests import @tanstack/oracles, which resolves to its
# build output.
- run: pnpm run build
- run: pnpm --filter @tanstack/eslint-plugin-oracles run test
test-oracle-framework:
name: Framework self-oracle (${{ matrix.shard }}/9)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4, 5, 6, 7, 8, 9]
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Tools
uses: tanstack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3
# The oracleProperty self-oracle spawns real Vitest runs, so the
# default test run leaves it out; it runs here on its own, in nine
# shards, packed to about 9 minutes each.
- run: pnpm exec vitest --run --config vitest.oracle-framework.config.mjs -t "$(node scripts/pr-shards.mjs pattern oracle-framework "$SHARD")"
working-directory: packages/oracles
env:
SHARD: ${{ matrix.shard }}
test-oracle-gaps-fast:
name: Gap report oracles (${{ matrix.shard }}/3)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3]
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Tools
uses: tanstack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3
# The gap report's own oracles also run real Vitest runs on fixture
# packages (test:oracle-gaps:fast): the static oracle in two shards,
# and the classify, probe-form, and mutant-validity oracles in a third.
# Packed with the first static shard, that job ran 8m10s and 9m08s on
# #122's CI, within a minute of the limit, so it runs apart.
- run: |
if [ "$SHARD" = 3 ]; then
exec pnpm exec vitest --run --config oracle-gaps/vitest.config.mjs gap-report-classify gap-report-probe-form gap-report-mutant-validity gap-report-path-spelling
fi
pnpm exec vitest --run --config oracle-gaps/vitest.config.mjs gap-report-static -t "$(node scripts/pr-shards.mjs pattern oracle-gaps-static "$SHARD")"
working-directory: packages/oracles
env:
SHARD: ${{ matrix.shard }}
test-oracle-gaps-end-to-end:
name: Gap report end-to-end oracle (fixed seed, ${{ matrix.shard }}/4)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Tools
uses: tanstack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3
# The end-to-end oracle's fixed-seed units, in four shards. Its random
# units and determinism units run in their own jobs, and its
# calibrations run locally.
- run: pnpm exec vitest --run --config oracle-gaps/vitest.config.mjs gap-report-oracle -t "$(node scripts/pr-shards.mjs pattern oracle-gaps-fixed-seed "$SHARD")"
working-directory: packages/oracles
env:
SHARD: ${{ matrix.shard }}
test-oracle-gaps-random:
name: Gap report end-to-end oracle (random seed, ${{ matrix.shard }}/4)
runs-on: ubuntu-latest
# A high backstop only (the maintainer's decision of 2026-11-12, M-6):
# each shard is packed to about 9 minutes and stays under 10 (P12).
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Tools
uses: tanstack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3
# The end-to-end oracle's random units, in four weighted shards. Each run
# draws a fresh campaign seed (the ORACLE_SEED line in the log). A failing
# unit prints its Replay line and its history, cut at 2,000 characters
# (#81), and does not shrink (GAP_E2E_SHRINKS=0; the maintainer's decision
# "Shrink briefly in CI", 2026-11-17), so the job stays under 10 minutes.
# The agent prints the full history from the seed and path, replays it
# on the base, and files it (P4, "Replay by history"); one the base also
# fails does not block the pull request (the phase-1 decision). That
# base replay is manual until #157. The verbose reporter prints each
# unit's duration, which sizes the shards.
- run: pnpm exec vitest --run --reporter=verbose --config oracle-gaps/vitest.config.mjs gap-report-oracle -t "$(node scripts/pr-shards.mjs pattern oracle-gaps-random "$SHARD")"
working-directory: packages/oracles
env:
SHARD: ${{ matrix.shard }}
GAP_E2E_SHRINKS: 0
test-oracle-gaps-determinism:
name: Gap report end-to-end oracle (determinism, ${{ matrix.shard }}/7)
runs-on: ubuntu-latest
# A high backstop only (M-6): each shard stays under 10 minutes (P12).
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4, 5, 6, 7]
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Tools
uses: tanstack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3
# The end-to-end oracle's determinism units, in seven shards, the witness
# module's two halves among them (the maintainer's decision "#90 job
# stays blocking", 2026-11-16). Each unit runs a history twice and
# compares the results and fixed lines; heartbeats are checked for shape.
- run: pnpm exec vitest --run --reporter=verbose --config oracle-gaps/vitest.config.mjs gap-report-oracle -t "$(node scripts/pr-shards.mjs pattern oracle-gaps-determinism "$SHARD")"
working-directory: packages/oracles
env:
SHARD: ${{ matrix.shard }}
test-vitest-5:
name: Test on Vitest 5 (${{ matrix.suite }})
# The package's vitest peer range includes 5; this job is the evidence.
# The unit tests and each self-oracle shard are their own jobs.
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
suite:
- test
- oracle-framework 1
- oracle-framework 2
- oracle-framework 3
- oracle-framework 4
- oracle-framework 5
- oracle-framework 6
- oracle-framework 7
- oracle-framework 8
- oracle-framework 9
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Tools
uses: tanstack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3
- run: pnpm --filter @tanstack/oracles add --save-dev vitest@^5.0.5
- run: pnpm --filter @tanstack/oracles exec vitest --version
- run: |
if [ "$SUITE" = test ]; then pnpm run test; exit; fi
pnpm exec vitest --run --config vitest.oracle-framework.config.mjs -t "$(node scripts/pr-shards.mjs pattern $SUITE)"
working-directory: packages/oracles
env:
SUITE: ${{ matrix.suite }}
preview:
name: Publish preview
# Only a commit that passes every check gets an installable preview.
needs:
- test
- test-eslint-plugin
- test-oracle-framework
- test-oracle-gaps-fast
- test-oracle-gaps-end-to-end
- test-oracle-gaps-random
- test-oracle-gaps-determinism
- test-vitest-5
# The blocking Windows jobs (the non-blocking end-to-end job is not a
# dependency until it is green).
- windows-unit
- windows-gap-classify
- windows-gap-oracles
- windows-gap-cli
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Tools
uses: tanstack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3
- run: pnpm run build
# Consumers install a commit as
# https://pkg.pr.new/TanStack/oracles/@tanstack/oracles@<sha>
# --compact needs the package on npm, so it is added after the first
# npm release. pkg.pr.new authenticates through its GitHub App, not an
# npm token, so npm trusted publishing does not apply.
- run: pnpm dlx pkg-pr-new@0.0.92 publish --pnpm './packages/*' # zizmor: ignore[use-trusted-publishing]
zizmor:
name: zizmor
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Run zizmor
uses: zizmorcore/zizmor-action@b1d7e1fb5de872772f31590499237e7cce841e8e # v0.5.3
with:
advanced-security: false
annotations: true
# Windows is a required part of CI: the framework, the eslint plugin, and
# the gap CLI run on windows-latest, split the way the Linux jobs split
# them. Each job stays under 10 minutes; each has a timeout backstop.
windows-unit:
name: Windows unit suites
runs-on: windows-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Tools
uses: tanstack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3
- run: pnpm --filter @tanstack/oracles run build
- run: pnpm --filter @tanstack/oracles run test
# Runs even when the framework tests fail, so each suite reports.
- if: always()
run: pnpm --filter @tanstack/eslint-plugin-oracles run test
windows-gap-oracles:
name: Windows gap report static oracle (${{ matrix.shard }}/2)
runs-on: windows-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
shard: [1, 2]
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Tools
uses: tanstack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3
- run: pnpm --filter @tanstack/oracles run build
# The same partition of the static oracle that Linux runs, by pattern.
- name: Gap report static oracle
shell: bash
working-directory: packages/oracles
env:
SHARD: ${{ matrix.shard }}
run: pnpm exec vitest --run --config oracle-gaps/vitest.config.mjs gap-report-static -t "$(node scripts/pr-shards.mjs pattern oracle-gaps-static-windows "$SHARD")"
windows-gap-classify:
name: Windows gap report classify, probe-form, and mutant-validity oracles
runs-on: windows-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Tools
uses: tanstack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3
- run: pnpm --filter @tanstack/oracles run build
- name: Gap report oracles
working-directory: packages/oracles
run: pnpm exec vitest --run --config oracle-gaps/vitest.config.mjs gap-report-classify gap-report-probe-form gap-report-mutant-validity gap-report-path-spelling
windows-gap-end-to-end:
name: Windows gap report end-to-end oracle (fixed seed, ${{ matrix.shard }}/10)
runs-on: windows-latest
# Not blocking yet: these suites fail on Windows, tracked by class in
# https://github.com/TanStack/oracles/issues/72. Remove this line when they
# are green.
continue-on-error: true
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Tools
uses: tanstack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3
- run: pnpm --filter @tanstack/oracles run build
- name: Gap report end-to-end oracle
shell: bash
working-directory: packages/oracles
env:
SHARD: ${{ matrix.shard }}
# The verbose reporter prints each test with its duration, which sizes the shards.
run: pnpm exec vitest --run --reporter=verbose --config oracle-gaps/vitest.config.mjs gap-report-oracle -t "$(node scripts/pr-shards.mjs pattern oracle-gaps-fixed-seed-windows "$SHARD")"
windows-gap-cli:
name: Windows gap CLI on a fixture
runs-on: windows-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Tools
uses: tanstack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3
- run: pnpm --filter @tanstack/oracles run build
- name: Write gap CLI fixture
shell: bash
run: |
set -euo pipefail
dir="$GITHUB_WORKSPACE/.ci-fixture"
mkdir -p "$dir/src" "$dir/tests"
cat > "$dir/package.json" <<'EOT'
{"name": "ci-fixture", "private": true, "type": "module"}
EOT
cat > "$dir/src/clamp.ts" <<'EOT'
export function clamp(x: number): number {
return x < 0 ? 0 : x > 10 ? 10 : x
}
EOT
cat > "$dir/tests/clamp.property.test.ts" <<'EOT'
import fc from 'fast-check'
import { differs, oracleProperty, pass } from '../../packages/oracles/dist/esm/index.js'
import { clamp } from '../src/clamp'
oracleProperty({
owns: ['src/clamp.ts#clamp'],
id: `fixture.clamp`,
law: {
statement: `clamp returns its argument within 0 and 10.`,
authority: `the CI fixture for the Windows gap-CLI run`,
limits: `integers from -20 to 20`,
},
histories: {
arbitrary: fc.integer({ min: -20, max: 20 }),
runs: 50,
fixedSeeds: [1],
states: [],
measured: [],
},
timeout: 5_000,
model: (x: number) => (x < 0 ? 0 : x > 10 ? 10 : x),
driver: (x: number, observe: (checkpoint: string, value: unknown) => void) => {
observe(`result`, clamp(x))
},
check: (_x: number, trace: ReadonlyArray<{ checkpoint: string; value: unknown }>, expected: number) => {
const seen = trace.find(({ checkpoint }) => checkpoint === `result`)?.value
return differs(`result`, `clamp`, seen, expected) ?? pass
},
})
EOT
cat > "$dir/vitest.config.mjs" <<'EOT'
export default {
test: { include: ['tests/**/*.test.ts'], environment: 'node', coverage: { enabled: false } },
}
EOT
# A failing property for the replay witness: every history fails, so a
# random unit prints its replay lines. Written in bash, as the fixture is.
- name: Write replay fixture
shell: bash
run: |
set -euo pipefail
dir="$GITHUB_WORKSPACE/.ci-replay"
mkdir -p "$dir/tests"
cat > "$dir/tests/fail.property.test.ts" <<'EOT'
import fc from 'fast-check'
import { differs, oracleProperty, pass } from '../../packages/oracles/dist/esm/index.js'
oracleProperty({
id: `fixture ’ & | < > ( ) ^ replay`,
law: {
statement: `a fixture that always fails, so its replay lines are printed.`,
authority: `the CI witness for the per-shell replay lines`,
limits: `integers from -20 to 20`,
},
histories: {
arbitrary: fc.integer({ min: -20, max: 20 }),
runs: 20,
fixedSeeds: [1],
states: [],
measured: [],
},
timeout: 5_000,
model: (x: number) => x,
driver: (x: number, observe: (checkpoint: string, value: unknown) => void) => {
observe(`result`, x + 1)
},
check: (_x: number, trace: ReadonlyArray<{ checkpoint: string; value: unknown }>, expected: number) =>
differs(`result`, `plus one`, trace.find(({ checkpoint }) => checkpoint === `result`)?.value, expected) ?? pass,
})
EOT
cat > "$dir/tests/hostile.property.test.ts" <<'EOT'
import fc from 'fast-check'
import { differs, oracleProperty, pass } from '../../packages/oracles/dist/esm/index.js'
oracleProperty({
id: `fixture Q"1 replay`,
law: {
statement: `a fixture that always fails, so its replay lines are printed.`,
authority: `the CI witness for the per-shell replay lines`,
limits: `integers from -20 to 20`,
},
histories: {
arbitrary: fc.integer({ min: -20, max: 20 }),
runs: 20,
fixedSeeds: [1],
states: [],
measured: [],
},
timeout: 5_000,
model: (x: number) => x,
driver: (x: number, observe: (checkpoint: string, value: unknown) => void) => {
observe(`result`, x + 1)
},
check: (_x: number, trace: ReadonlyArray<{ checkpoint: string; value: unknown }>, expected: number) =>
differs(`result`, `plus one`, trace.find(({ checkpoint }) => checkpoint === `result`)?.value, expected) ?? pass,
})
EOT
cat > "$dir/tests/percent.property.test.ts" <<'EOT'
import fc from 'fast-check'
import { differs, oracleProperty, pass } from '../../packages/oracles/dist/esm/index.js'
oracleProperty({
id: `fixture 100% done!`,
law: {
statement: `a fixture that always fails, so its replay lines are printed.`,
authority: `the CI witness for the per-shell replay lines`,
limits: `integers from -20 to 20`,
},
histories: {
arbitrary: fc.integer({ min: -20, max: 20 }),
runs: 20,
fixedSeeds: [1],
states: [],
measured: [],
},
timeout: 5_000,
model: (x: number) => x,
driver: (x: number, observe: (checkpoint: string, value: unknown) => void) => {
observe(`result`, x + 1)
},
check: (_x: number, trace: ReadonlyArray<{ checkpoint: string; value: unknown }>, expected: number) =>
differs(`result`, `plus one`, trace.find(({ checkpoint }) => checkpoint === `result`)?.value, expected) ?? pass,
})
EOT
printf '%s\n' "export default { test: { include: ['tests/**/*.test.ts'], environment: 'node', coverage: { enabled: false } } }" > "$dir/vitest.config.mjs"
# The user-facing path: PowerShell, the default shell, as a user runs it.
# Each run's stdout and stderr are kept apart, and the done line is
# checked on both streams against the exit code (P10).
- name: Gap CLI on the fixture
run: |
node packages/oracles/oracle-gaps/index.mjs --package .ci-fixture --source src/clamp.ts --config vitest.config.mjs > cli-out.txt 2> cli-err.txt
$code = $LASTEXITCODE
node packages/oracles/scripts/windows-witness.mjs done cli-out.txt cli-err.txt $code
if ($LASTEXITCODE -ne 0) { throw "the done line failed" }
- name: Gap CLI on the fixture, discovered config
run: |
node packages/oracles/oracle-gaps/index.mjs --package .ci-fixture --source src/clamp.ts > cli-out2.txt 2> cli-err2.txt
$code = $LASTEXITCODE
node packages/oracles/scripts/windows-witness.mjs done cli-out2.txt cli-err2.txt $code
if ($LASTEXITCODE -ne 0) { throw "the done line failed" }
# The daemon path: start it, check through it, then stop it.
- name: Gap CLI through the daemon
run: |
node packages/oracles/oracle-gaps/index.mjs --package .ci-fixture --source src/clamp.ts --config vitest.config.mjs --daemon > cli-out3.txt 2> cli-err3.txt
$code = $LASTEXITCODE
node packages/oracles/scripts/windows-witness.mjs done cli-out3.txt cli-err3.txt $code
if ($LASTEXITCODE -ne 0) { throw "the done line failed" }
- name: Stop the gap CLI daemon
if: always()
run: node packages/oracles/oracle-gaps/index.mjs --stop-daemon --package .ci-fixture
# A package with no package.json is refused, with exit 2 and a done line
# that says so.
- name: Gap CLI refuses a package with no package.json
run: |
New-Item -ItemType Directory -Force .ci-no-manifest | Out-Null
node packages/oracles/oracle-gaps/index.mjs --package .ci-no-manifest --source src/x.ts > nm-out.txt 2> nm-err.txt
$code = $LASTEXITCODE
if ($code -ne 2) { throw "want a refusal with exit 2, got $code" }
if (-not (Select-String -Path nm-out.txt, nm-err.txt -Pattern 'has no package.json' -Quiet)) { throw "the refusal does not name package.json" }
node packages/oracles/scripts/windows-witness.mjs done nm-out.txt nm-err.txt $code
if ($LASTEXITCODE -ne 0) { throw "the done line failed" }
# One early stop: SIGINT once the CLI has printed its first line. The
# run must end with the stop's done line on both streams, or with no
# output at all (the all-or-nothing law, #57).
- name: Early stop of the gap CLI
run: node packages/oracles/scripts/windows-witness.mjs stop .ci-fixture --package . --source src/clamp.ts --config vitest.config.mjs
# The per-shell replay lines: a failing property's PowerShell and cmd
# lines each reproduce its failure in their own shell (RED: the POSIX
# line does not, in PowerShell).
- name: Replay lines reproduce the failure in PowerShell and cmd
if: always()
run: |
node "$env:GITHUB_WORKSPACE\packages\oracles\node_modules\vitest\vitest.mjs" run --root .ci-replay > replay-out.txt 2>&1
Get-Content replay-out.txt
node packages/oracles/scripts/windows-witness.mjs replay replay-out.txt "$env:GITHUB_WORKSPACE\.ci-replay"
if ($LASTEXITCODE -ne 0) { throw "the replay witness failed" }