Repository navigation
671 lines (626 loc) · 30.8 KB
/
Copy pathci.yml
File metadata and controls
671 lines (626 loc) · 30.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
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
name: Falcon CI
on:
push:
branches: [New_era_Falcon, main, "feat/**", "test/**"]
pull_request:
branches: [New_era_Falcon, main]
# Manual re-run only. CI deliberately runs a fixed `--repeat=3` (see the
# `test` job's falcon.js invocation below) rather than exposing a
# dispatch input for it — on push/pull_request, `inputs.*` doesn't exist
# as a context at all, so a step referencing it would silently resolve to
# an empty string. An operator who wants a different repeat count runs
# `node falcon.js --repeat=N` locally instead.
workflow_dispatch:
permissions:
contents: read
# A newer push to the same branch/PR makes the older run's result moot, so
# cancel it to save runner minutes. Runs on main are never cancelled: each
# one is a record of that commit's result and also persists Falcon state.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
regression:
runs-on: ubuntu-latest
# The serial regression suite (real-Chromium E2E per assertion family)
# already ran close to 10 minutes; 15 keeps a hung step bounded.
timeout-minutes: 30
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: "24"
cache: npm
- run: npm ci
# Fails on known high/critical advisories in production dependencies.
- run: npm audit --omit=dev --audit-level=high
- run: timeout 300 npx playwright install --with-deps chromium || npx playwright install chromium
- run: node scripts/playwright/verify-pin.js
- run: npm run test:coverage
- run: npm run test:browser
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: always()
with:
name: regression-reports
path: reports/
retention-days: 14
test:
runs-on: ubuntu-latest
# Recent runs of this job finish in about 1.5-2 minutes; 10 minutes leaves
# generous headroom for a cold cache while stopping a hung browser or
# database step well before the 360-minute default.
timeout-minutes: 20
env:
HEADLESS: "true"
# falcon.js now reads CI=true itself to default the dashboard off (no
# browser to view it here) — the --no-dashboard flag below is now
# redundant but kept as an explicit belt-and-suspenders default.
CI: "true"
# Phase 6 — real Postgres for tests/db/*.js. This is a disposable CI-only
# instance (the `postgres:` service below), not the production database,
# so TLS is off and the credentials are throwaway values with no
# relation to any real secret.
DB_HOST: localhost
DB_PORT: 5432
DB_USER: falcon
DB_PASS: falcon_ci_password
DB_NAME: falcon_test
DB_SSL: "false"
services:
postgres:
# Pinned by digest. Tag postgres:16-alpine, digest resolved 2026-10-08.
image: postgres:16-alpine@sha256:721873c34ceb9f8d8fc265984940dc982404c105f19ad51be9fdc5970a6080ea
env:
POSTGRES_USER: falcon
POSTGRES_PASSWORD: falcon_ci_password
POSTGRES_DB: falcon_test
ports:
- 5432:5432
# Block subsequent steps until Postgres is actually accepting
# connections, not just until the container has started.
options: >-
--health-cmd "pg_isready -U falcon"
--health-interval 5s
--health-timeout 5s
--health-retries 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: "24"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Install Playwright browsers
run: timeout 300 npx playwright install --with-deps chromium || npx playwright install chromium
- name: Verify Playwright pin
run: node scripts/playwright/verify-pin.js
# ── Regression test for the Phase 6 exit-code fix ───────────────────────
# No browser, no DB — runs first and fast. Locks in that
# ReportManager.generateReport() actually sets process.exitCode, so a
# future refactor can't silently reintroduce "CI step is always green
# regardless of the actual test result."
- name: Run ReportManager exit-code regression test
run: node tests/unit/ReportManagerExitCode.check.js
# A misconfigured database (wrong password, unreachable host) must be a
# real failure, never mistaken for "no database configured." Doesn't
# need the seeded Postgres below — it only needs the DB test files
# themselves, run as child processes with deliberately broken configs.
- name: Run DB config skip-vs-fail regression test
run: node tests/unit/DBConfigBehavior.check.js
# Real Dashboard instance on an ephemeral port, real HTTP requests, real
# socket.io-client connections — proves both that auth is enforced when
# DASHBOARD_TOKEN is set (unauthenticated POST /emit, GET /events, and
# socket connections are all rejected) and that the default no-token
# local-dev experience is unchanged.
- name: Run Dashboard auth regression test
run: node tests/unit/DashboardAuth.check.js
# Business-outcome contract and approval store (issue #125): steal-mutex
# fail-closed (R1-B), FIFO/symlink/type-swap/size-cap file handling
# (FH), lock option bounds (LT), the gitignored default location (GS)
# and fingerprint hardening. Real child processes, FIFOs and
# filesystem identity checks, so this is the Linux evidence for the
# approval store. No browser, no DB, no network.
- name: Run Contract and ContractStore unit tests
run: |
node tests/unit/Contract.check.js
node tests/unit/ContractStore.check.js
node tests/unit/ContractStoreConcurrency.check.js
node tests/unit/ContractStoreHardening.check.js
node tests/unit/ContractStoreLockOptions.check.js
node tests/unit/ContractStoreDefaultLocation.check.js
node tests/unit/ContractStoreFingerprint.check.js
node tests/unit/ContractStoreSnapshot.check.js
node tests/unit/NavigationProposal.check.js
node tests/unit/NavigationEvaluator.check.js
node tests/unit/DataEvaluator.check.js
node tests/unit/BackendEvaluator.check.js
node tests/unit/ContractCli.check.js
node tests/unit/ExecutionBinding.check.js
node tests/unit/PlanContract.check.js
node tests/unit/TestRunnerVerify.check.js
node tests/unit/JourneyAggregation.check.js
node tests/unit/JourneyCoordinator.check.js
# ── Database fixture (Phase 6) ──────────────────────────────────────────
# Applies the same scripts/db/ci-seed.sql schema verified locally against
# a disposable Postgres container. Re-running this against a fresh
# service container on every job is intentional — the fixture is meant
# to be rebuilt from scratch each run, not reused across CI runs.
- name: Seed test database
run: psql "postgresql://$DB_USER:$DB_PASS@$DB_HOST:$DB_PORT/$DB_NAME" -f scripts/db/ci-seed.sql
# Persist visual-regression baselines across runs on the same branch —
# without this, reports/ (gitignored, never checked out) is empty on
# every fresh runner, so LoginTest/CheckoutTest always take the
# "capture baseline" branch and compare() (the code that actually
# detects a regression) never executes in CI.
- name: Restore visual regression baselines
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: reports/baselines
key: vr-baselines-${{ github.ref_name }}
restore-keys: |
vr-baselines-
# ── Scenario tests (custom runner) ──────────────────────────────────────
- name: Run Login test
run: node tests/ui/LoginTest.js
- name: Run Checkout test
run: node tests/ui/CheckoutTest.js
- name: Run User API test
run: node tests/api/UserApiTest.js
- name: Run Product API test
run: node tests/api/ProductApiTest.js
# ── Database tests (Phase 6) ────────────────────────────────────────────
# Deliberately no continue-on-error: these now run against a real,
# seeded Postgres instance (see the `postgres:` service above), so a
# failure here is a real signal, not a false positive to shrug off.
- name: Run User DB test
run: node tests/db/UserDBTest.js
- name: Run Order DB test
run: node tests/db/OrderDBTest.js
# ── Falcon flakiness/quarantine/healing state (Phase 12) ────────────────
# Restores the four gitignored data/*.json state files the tracker code
# reads/writes; NOT the whole data/ dir — data/locator_store.json is
# Phase 8's approved Tier-2 selector cache and must not be restored
# here, or Phase 8 healing behavior in CI would silently change.
#
# data/locator_memory.json (Phase 14's evidence-based locator store) is
# deliberately excluded here too, for a sharper reason than "scope
# creep": entries land in it as "trusted" via the ground-truth path
# with no approval gate at read time (only a Tier 2.5 PROPOSAL needs
# human approval; recordEvidence() does not), and the restore-keys
# above always fall back to the branch-prefix key
# (falcon-state-<branch>-) because the exact run_id key can never hit
# on a restore. If this file were added to that same restore/save
# pair, a PR branch could silently inherit another branch's already-
# approved locator memory — trusted ("trusted"), unproven
# ("unproven"), or previously revoked ("revoked") evidence all follow
# the restore key the same way, so a revocation recorded on one branch
# would not protect a PR branch that restores stale state from before
# it. This should be revisited only alongside a same-branch-provenance
# check inside LocatorMemory itself (e.g. binding entries to the
# branch/ref they were approved on), never as a CI-config-only change.
- name: Restore Falcon state (flakiness/quarantine/healing)
id: restore-falcon-state
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
data/scenario_history.json
data/quarantine_decisions.json
data/healing_pending.json
data/healing_decisions.json
key: falcon-state-${{ github.ref_name }}-${{ github.run_id }}
restore-keys: |
falcon-state-${{ github.ref_name }}-
# ── Run history ledger (Phase 15) ───────────────────────────────────────
# data/run_history.json is cached on its own key, deliberately apart from
# the state-file cache above: the ledger is append-only trend data with a
# different lifetime, and keeping it separate means nothing about the
# healing/quarantine state can change because of it (SEC-13). The path
# list is this one file and nothing else — never locator memory or the
# locator store. As with the state cache, the run_id key never hits on
# restore, so the prefix fallback brings back this branch's most recent
# ledger; a first run on a branch, a PR branch, or a branch idle for 7
# days (cache eviction) starts with an empty ledger.
- name: Restore run history ledger
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: data/run_history.json
key: falcon-history-${{ github.ref_name }}-${{ github.run_id }}
restore-keys: |
falcon-history-${{ github.ref_name }}-
# ── Autonomous exploration (no dashboard in CI) ─────────────────────────
- name: Run Falcon autonomous pipeline
run: node falcon.js --no-dashboard --repeat=3
# Runs even if the pipeline step above failed — the exact case where a
# new failure sample must be persisted for D2/quarantine to accumulate.
# An explicit, unconditional save is used instead of relying on
# actions/cache's automatic post-job save, whose behavior after a
# failing later step is unverified in this repo. continue-on-error is
# deliberately scoped to this step alone: actions/cache/save fails
# with a Path Validation Error when none of the listed paths exist, so
# with if: always() a cold run where falcon.js dies before writing any
# state would otherwise turn the job red for a pure infrastructure
# reason unrelated to the quality gate (which is the falcon.js step's
# own exit code, untouched by this).
- name: Save Falcon state (flakiness/quarantine/healing)
if: always()
continue-on-error: true
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
data/scenario_history.json
data/quarantine_decisions.json
data/healing_pending.json
data/healing_decisions.json
key: falcon-state-${{ github.ref_name }}-${{ github.run_id }}
# Same reasoning as the state save above: runs even when the pipeline
# failed, because a failing run is exactly the record the trend needs.
# continue-on-error is scoped to this step alone — the save fails with a
# Path Validation Error if falcon.js died before writing the ledger, which
# is an infrastructure artefact, not a quality-gate result.
- name: Save run history ledger
if: always()
continue-on-error: true
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: data/run_history.json
key: falcon-history-${{ github.ref_name }}-${{ github.run_id }}
# Exports the ledger as JSON and CSV into reports/history/, which the
# falcon-reports upload at the end of the job already covers (14 days),
# so a failed run still leaves a readable copy to download. --silent keeps
# npm's own banner out of the redirected files.
- name: Export run history
if: always()
run: |
# Advisory: each export goes to a temp file and is moved into place only
# on success, so a failed export leaves no partial file. A non-zero exit
# is reported as a warning and never fails the job; the exit code is
# handled explicitly rather than hidden behind a blanket "|| true".
mkdir -p reports/history
for fmt in json csv; do
tmp="$RUNNER_TEMP/run_history.$fmt"
rm -f "$tmp"
rc=0
npm run --silent history:export -- --format="$fmt" > "$tmp" || rc=$?
if [ "$rc" -eq 0 ]; then
mv "$tmp" "reports/history/run_history.$fmt"
else
echo "::warning::history export ($fmt) failed with exit code $rc; no file written"
rm -f "$tmp"
fi
done
# Advisory only: the trend check is written to the job summary so a
# reviewer sees flagged scenarios, but it must never decide the job's
# colour — hence no --strict, and a non-zero exit is reported inside the
# block instead of failing the step. Output is truncated to stay well
# under the summary size limit.
- name: Run history trend check (advisory)
if: always()
run: |
rc=0
node scripts/history.js check > "$RUNNER_TEMP/history_check.txt" 2>&1 || rc=$?
{
echo "## Run history trend check (advisory)"
echo '```'
head -c 4000 "$RUNNER_TEMP/history_check.txt"
[ "$rc" -eq 0 ] || echo "history check unavailable (exit $rc)"
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
# ── Review queue staleness (Phase 13) ────────────────────────────────────
# Reports pending Tier 3 healing fixes and flaky-scenario decisions nobody
# has acted on within threshold. Soft warning by default: findings are
# always printed, but the step exits 0 for staleness alone, so this job's
# red keeps meaning "a test failed" rather than "someone hasn't triaged the
# review queue". It still exits non-zero on invalid arguments or invalid
# configuration — that's a real defect, not a backlog signal.
#
# What this step can actually see: the exact cache key above embeds
# github.run_id, so it never hits on restore and every restore falls back
# to the falcon-state-<branch>- prefix. On a branch's very first run that
# prefix matches nothing and there is no queue to report; on later pushes
# to the same branch it does restore that branch's own earlier state. So a
# queue only accumulates across runs on a long-lived branch — in practice
# main — and a short-lived PR branch will usually have little or nothing
# here.
- name: Check review queue staleness
run: node scripts/review/status.js
# ── Playwright native suite (with Allure reporter) ──────────────────────
- name: Run Playwright native tests
run: npx playwright test
# ── Allure report generation ────────────────────────────────────────────
- name: Generate Allure report
if: always()
# `|| true` is kept on purpose: tests/regression/allure-results.check.cjs asserts the
# result files, not the HTML report, so a report-generation failure must not mask test results.
run: |
npx allure awesome allure-results -o allure-report || true
# ── Upload all artefacts ────────────────────────────────────────────────
- name: Upload test reports
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: always()
with:
name: falcon-reports
path: |
reports/
allure-report/
allure-results/
if-no-files-found: ignore
retention-days: 14
# Recovery copy of the ledger, main only: caches are evicted after 7 idle
# days, so this 90-day artifact is how a lost ledger on main is restored.
# PR and feature-branch runs do not publish one.
- name: Upload run history ledger
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: always() && github.ref == 'refs/heads/main'
with:
name: run-history
path: data/run_history.json
if-no-files-found: ignore
retention-days: 90
# G-02 (issue #114, CAP-11): proves DBClient's TLS/mTLS path against a
# real TLS-enabled Postgres, separate from the `test` job's plain-TCP
# service container above, which is left unchanged. Certs are generated
# at run time into a mktemp dir with openssl, never committed, and
# removed in the always() cleanup step. No private key, certificate, or
# password is logged or uploaded.
db-tls:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
env:
CI: "true"
TLS_DB_HOST: localhost
TLS_DB_PORT_TLS: "16432"
TLS_DB_PORT_MTLS: "16432"
# Throwaway, CI-only password for a disposable container removed at
# the end of this job — no relation to any real secret.
TLS_DB_PASSWORD: falcon_tls_ci_password
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: "24"
cache: npm
- run: npm ci
- name: Generate throwaway TLS certificates
run: |
CERT_DIR="$(mktemp -d)"
chmod 700 "$CERT_DIR"
bash scripts/db/tls/gen-certs.sh "$CERT_DIR"
echo "TLS_DB_CERT_DIR=$CERT_DIR" >> "$GITHUB_ENV"
- name: Start TLS Postgres (pinned digest, same image as the test job)
run: |
bash scripts/db/tls/start-tls-postgres.sh \
falcon-tls-ci \
"$TLS_DB_PORT_TLS" \
"$TLS_DB_CERT_DIR" \
postgres:16-alpine@sha256:721873c34ceb9f8d8fc265984940dc982404c105f19ad51be9fdc5970a6080ea
- name: Run TLS connection test
run: npm run test:db:tls
- name: Stop TLS Postgres and remove certificates
if: always()
run: |
docker rm -f falcon-tls-ci >/dev/null 2>&1 || true
if [ -n "${TLS_DB_CERT_DIR:-}" ]; then rm -rf "$TLS_DB_CERT_DIR"; fi
# Phase 16: three shards of one run, each on a fresh runner. No secrets are
# exposed to these jobs and no cache is saved from them (caches are only
# restored read-only elsewhere); the fixture app is local, no external site.
shards:
runs-on: ubuntu-latest
timeout-minutes: 25
permissions:
contents: read
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3]
env:
HEADLESS: "true"
CI: "true"
RUN_ID: gh-${{ github.run_id }}-${{ github.run_attempt }}
SHARD_INDEX: ${{ matrix.shard }}
FIXTURE_PORT: "4173"
# Non-secret and identical on every shard and in the aggregate job, so
# locator signatures recorded by shards use the salt the merge expects.
FALCON_LOCATOR_SALT: falcon-ci-shards
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: "24"
cache: npm
- run: npm ci
- run: timeout 300 npx playwright install --with-deps chromium || npx playwright install chromium
- run: node scripts/playwright/verify-pin.js
- name: Start local fixture app
run: |
nohup node scripts/fixture/server.js --port="$FIXTURE_PORT" > "$RUNNER_TEMP/fixture.log" 2>&1 &
for i in $(seq 1 30); do
if curl -fsS "http://127.0.0.1:$FIXTURE_PORT/health" > /dev/null; then exit 0; fi
sleep 1
done
echo "::error::fixture app did not become healthy"
cat "$RUNNER_TEMP/fixture.log"
exit 1
- name: Run shard
run: node falcon.js --no-dashboard --url="http://127.0.0.1:$FIXTURE_PORT" --shard="$SHARD_INDEX/3" --run-id="$RUN_ID"
- name: Stage shard bundle
if: always()
run: |
mkdir -p "$RUNNER_TEMP/stage"
if [ -d "reports/shards/$RUN_ID/shard-$SHARD_INDEX-of-3" ]; then
cp -a "reports/shards/$RUN_ID/shard-$SHARD_INDEX-of-3" "$RUNNER_TEMP/stage/"
else
echo "::warning::no bundle produced for shard $SHARD_INDEX"
fi
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: always()
with:
name: falcon-shard-${{ matrix.shard }}-of-3-${{ github.run_attempt }}
path: ${{ runner.temp }}/stage
if-no-files-found: warn
retention-days: 7
aggregate:
needs: shards
if: always()
runs-on: ubuntu-latest
timeout-minutes: 25
permissions:
contents: read
env:
CI: "true"
FALCON_LOCATOR_SALT: falcon-ci-shards
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: "24"
cache: npm
- run: npm ci
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
pattern: falcon-shard-*-of-3-${{ github.run_attempt }}
path: shards-in
merge-multiple: true
# Read-only restore; locator_memory.json is never part of any cache.
- name: Restore Falcon state
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
data/scenario_history.json
data/quarantine_decisions.json
data/healing_pending.json
data/healing_decisions.json
key: falcon-state-agg-${{ github.ref_name }}-${{ github.run_id }}
restore-keys: |
falcon-state-agg-${{ github.ref_name }}-
# The exit code of the merge is the job result. The run id and commit are
# passed through env (never interpolated into the script) and the merge
# rejects bundles from another run or commit with exit 2.
- name: Merge shards
id: merge
env:
EXPECT_RUN_ID: gh-${{ github.run_id }}-${{ github.run_attempt }}
EXPECT_COMMIT: ${{ github.sha }}
run: |
mkdir -p reports
set -o pipefail
node falcon.js merge --input=shards-in --expect-total=3 --expect-run-id="$EXPECT_RUN_ID" --expect-commit="$EXPECT_COMMIT" 2>&1 | tee reports/merge-output.txt
# Mirrors the sequential job: state is saved on if: always() for main
# (non-fork) so a failing run still records flaky history. The save fails
# with a Path Validation Error when no state file exists (for example the
# merge was rejected before writing any), so a check step reports whether
# any file exists and the save is skipped otherwise. continue-on-error is
# scoped to the cache save step alone, as in the sequential job; the merge
# step's exit code, which is the quality gate, is untouched.
- name: Check Falcon state files exist
id: state-files
if: always() && github.ref == 'refs/heads/main' && github.event.pull_request.head.repo.fork != true
run: |
mkdir -p data
found=false
for f in scenario_history quarantine_decisions healing_pending healing_decisions; do
if [ -f "data/$f.json" ]; then found=true; fi
done
echo "found=$found" >> "$GITHUB_OUTPUT"
if [ "$found" != "true" ]; then echo "::notice::no Falcon state files to save"; fi
- name: Save Falcon state
if: always() && steps.state-files.outputs.found == 'true' && github.ref == 'refs/heads/main' && github.event.pull_request.head.repo.fork != true
continue-on-error: true
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
data/scenario_history.json
data/quarantine_decisions.json
data/healing_pending.json
data/healing_decisions.json
key: falcon-state-agg-${{ github.ref_name }}-${{ github.run_id }}
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: always()
with:
name: falcon-merged-report-${{ github.run_id }}-${{ github.run_attempt }}
path: |
reports/
!reports/shards/
if-no-files-found: warn
retention-days: 14
# Proves a missing shard is rejected: merge over only 2 of 3 bundles while
# expecting 3 must exit 2 (rejected).
shard-negative:
needs: shards
if: needs.shards.result == 'success'
runs-on: ubuntu-latest
timeout-minutes: 25
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: "24"
cache: npm
- run: npm ci
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
pattern: falcon-shard-*-of-3-${{ github.run_attempt }}
path: shards-in
merge-multiple: true
- name: Merge with one shard missing must be rejected
env:
EXPECT_RUN_ID: gh-${{ github.run_id }}-${{ github.run_attempt }}
EXPECT_COMMIT: ${{ github.sha }}
run: |
mkdir -p "$RUNNER_TEMP/two"
cp -a shards-in/shard-1-of-3 shards-in/shard-2-of-3 "$RUNNER_TEMP/two/"
rc=0
node falcon.js merge --input="$RUNNER_TEMP/two" --expect-total=3 --expect-run-id="$EXPECT_RUN_ID" --expect-commit="$EXPECT_COMMIT" || rc=$?
if [ "$rc" -ne 2 ]; then
echo "::error::expected exit code 2 (rejected) for a missing shard, got $rc"
exit 1
fi
# Developer tooling only (tools/agent-telemetry). Isolated from Falcon's
# product jobs: it needs nothing else, nothing needs it, and it installs no
# packages because the tests use Node built-ins only. It runs the dashboard
# tests and the statusline checks on the supported Node 24 runtime.
agent-telemetry:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: "24"
- name: Dashboard tests
run: node --test tools/agent-telemetry/test/*.test.js
- name: Statusline checks
run: node tools/agent-telemetry/statusline/test-statusline.js
# Real Firefox and WebKit launched through BrowserManager (G-01 / CAP-02). Kept
# out of the required gate at first: it installs two extra browsers (Chromium is
# needed too, for the pin verification), and a
# failure here must not block unrelated work. Promote it to required once it
# has been stable for a run of consecutive pushes. The fixture app is local.
browser-engines:
runs-on: ubuntu-latest
timeout-minutes: 20
continue-on-error: true
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: "24"
cache: npm
- run: npm ci
- run: timeout 300 npx playwright install --with-deps chromium firefox webkit || npx playwright install chromium firefox webkit
- run: node scripts/playwright/verify-pin.js
- run: npm run test:engines