Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

ci: cheap tier on pull requests, full suite by full-ci dispatch on the head (P1, P3)

garrytan88920eeb7a90
diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml
index c32feff480..a56abd0950 100644
--- a/.github/workflows/e2e.yml
+++ b/.github/workflows/e2e.yml
@@ -3,8 +3,6 @@ name: E2E Tests
on:
push:
branches: [master]
- pull_request:
- branches: [master]
# Merge queue (inert until the queue is enabled on master): the PR profile.
# prepare-e2e classifies the queued change from the compare API (base_sha...
# head_sha). docs/RELEASING.md#merge-queue.
@@ -1167,3 +1165,45 @@ jobs:
- name: Verify complete nightly execution
if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.full_corpus)
run: bun scripts/verify-nightly-e2e.ts "$RUNNER_TEMP/e2e-execution" 4 "$GITHUB_SHA"
+
+ # Full CI on pull requests (docs/TESTING.md#full-ci-on-pull-requests): the E2E
+ # check merge-train reads. E2E does not run on pull_request events; it runs
+ # in the full-ci dispatch on a pull request's head, on every push to master,
+ # in the merge queue and on the nightly schedule. It succeeds only when
+ # e2e-status did on the same run. Its artifact records the tested tree for
+ # master-push reuse (scripts/ci-reuse.ts).
+ # Event parity (docs/TESTING.md#event-parity): the same job on every event;
+ # EVENT only labels the recorded tree.
+ e2e-full-suite:
+ needs: [e2e-status]
+ if: always()
+ runs-on: ubicloud-standard-2-ubuntu-2404
+ timeout-minutes: 5
+ steps:
+ - name: Require e2e-status
+ env:
+ E2E_STATUS: ${{ needs.e2e-status.result }}
+ run: |
+ if [ "$E2E_STATUS" != success ]; then
+ echo "::error::e2e-full-suite requires e2e-status to succeed on this run (got $E2E_STATUS)"
+ exit 1
+ fi
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
+ with:
+ persist-credentials: false
+ sparse-checkout: scripts/ci-full-suite-tree.sh
+ sparse-checkout-cone-mode: false
+ - name: Record the tested tree
+ env:
+ ARTIFACT_DIR: ${{ runner.temp }}/full-suite
+ RUN_ID: ${{ github.run_id }}
+ RUN_ATTEMPT: ${{ github.run_attempt }}
+ WORKFLOW: ${{ github.workflow }}
+ EVENT: ${{ github.event_name }}
+ run: bash scripts/ci-full-suite-tree.sh
+ - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
+ with:
+ name: e2e-full-suite-tree
+ path: ${{ runner.temp }}/full-suite/tree.json
+ retention-days: 30
+ overwrite: true
diff --git a/.github/workflows/full-ci.yml b/.github/workflows/full-ci.yml
new file mode 100644
index 0000000000..14da88a9ba
--- /dev/null
+++ b/.github/workflows/full-ci.yml
@@ -0,0 +1,48 @@
+name: Full CI dispatch
+
+# Full CI on pull requests (docs/ci-event-parity.md#full-ci-on-pull-requests). A
+# pull-request run of Test is the cheap tier, and E2E does not run on pull
+# requests. The full-ci label starts the full profile: this workflow dispatches
+# Test and E2E on the pull request's head branch, the same shape as a push to
+# master, and dispatches again on every later push while the label stays.
+# Applying a label needs triage access or higher, so contributors cannot start
+# it, and a fork's head branch is never dispatched. A thread can do the same by
+# hand before its slot:
+# gh workflow run test.yml --ref <branch> && gh workflow run e2e.yml --ref <branch>
+# merge-train requires the full-suite and e2e-full-suite checks on the exact head.
+on:
+ pull_request:
+ branches: [master]
+ types: [labeled, synchronize, reopened]
+
+permissions: {}
+
+concurrency:
+ group: full-ci-dispatch-${{ github.event.pull_request.number }}
+ cancel-in-progress: true
+
+jobs:
+ dispatch:
+ name: full-ci dispatch
+ if: ${{ github.event.pull_request.head.repo.full_name == github.repository && ((github.event.action == 'labeled' && github.event.label.name == 'full-ci') || (github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'full-ci'))) }}
+ runs-on: ubicloud-standard-2-ubuntu-2404
+ timeout-minutes: 5
+ permissions:
+ actions: write
+ contents: read
+ steps:
+ - name: Dispatch Test and E2E on the head
+ env:
+ GH_TOKEN: ${{ github.token }}
+ REPO: ${{ github.repository }}
+ BRANCH: ${{ github.event.pull_request.head.ref }}
+ HEAD_SHA: ${{ github.event.pull_request.head.sha }}
+ run: |
+ current=$(gh api "repos/$REPO/commits/heads/$BRANCH" --jq .sha)
+ if [ "$current" != "$HEAD_SHA" ]; then
+ echo "::notice::$BRANCH moved to $current after this event; the push that moved it dispatches its own full run."
+ exit 0
+ fi
+ gh workflow run test.yml -R "$REPO" --ref "$BRANCH"
+ gh workflow run e2e.yml -R "$REPO" --ref "$BRANCH"
+ echo "Dispatched Test and E2E (full profile) on $BRANCH at $HEAD_SHA." >> "$GITHUB_STEP_SUMMARY"
diff --git a/.github/workflows/persistence-validation.yml b/.github/workflows/persistence-validation.yml
index 9843d43ce6..61d81e3917 100644
--- a/.github/workflows/persistence-validation.yml
+++ b/.github/workflows/persistence-validation.yml
@@ -14,8 +14,12 @@ permissions:
contents: read
jobs:
+ # Event parity (docs/TESTING.md#full-ci-on-pull-requests): full profile only; a
+ # pull request (cheap tier) runs only the crash robot and convergence here. The
+ # full-ci dispatch on its head, every push and the nightly run this lane.
read-performance:
name: Read latency / ${{ matrix.engine }} / Bun ${{ matrix.bun }}
+ if: ${{ github.event_name != 'pull_request' }}
runs-on: ubicloud-standard-4-ubuntu-2404
timeout-minutes: 55
strategy:
@@ -57,8 +61,12 @@ jobs:
path: .context/persistence-read-latency.json
if-no-files-found: error
+ # Event parity (docs/TESTING.md#full-ci-on-pull-requests): full profile only; a
+ # pull request (cheap tier) runs only the crash robot and convergence here. The
+ # full-ci dispatch on its head, every push and the nightly run this lane.
deployment-matrix:
name: PgBouncer, RLS and pool capacity / Bun ${{ matrix.bun }}
+ if: ${{ github.event_name != 'pull_request' }}
runs-on: ubicloud-standard-8-ubuntu-2404
timeout-minutes: 15
strategy:
@@ -182,8 +190,12 @@ jobs:
# balanced by measured runtime (scripts/postgres-arm-weights.json, mined from
# this job's logs); each shard's measured sum, doubled for a slow runner, must
# end a minute inside the step's 20 minutes (ARM_SHARD_BUDGET_MS).
+ # Event parity (docs/TESTING.md#full-ci-on-pull-requests): full profile only; a
+ # pull request (cheap tier) runs only the crash robot and convergence here. The
+ # full-ci dispatch on its head, every push and the nightly run this lane.
unit-postgres-arms:
name: Unit-lane PostgreSQL arms ${{ matrix.shard }}/19 / Bun ${{ matrix.bun }}
+ if: ${{ github.event_name != 'pull_request' }}
runs-on: ubicloud-standard-4-ubuntu-2404
timeout-minutes: 30
strategy:
@@ -266,8 +278,12 @@ jobs:
if-no-files-found: warn
overwrite: true
+ # Event parity (docs/TESTING.md#full-ci-on-pull-requests): full profile only; a
+ # pull request (cheap tier) runs only the crash robot and convergence here. The
+ # full-ci dispatch on its head, every push and the nightly run this lane.
invariants:
name: ${{ matrix.engine }} / Bun ${{ matrix.bun }}
+ if: ${{ github.event_name != 'pull_request' }}
# The soak uses 1.3-1.8 busy cores: the 2,500-write PGLite soak took 523s on
# 4 vCPUs, 539s on 8 and 500s on 16.
runs-on: ubicloud-standard-4-ubuntu-2404
@@ -402,8 +418,12 @@ jobs:
# The reconciliation crash suites run beside the soak instead of after it, so
# neither holds the other's runner: each is about four minutes on PGLite.
+ # Event parity (docs/TESTING.md#full-ci-on-pull-requests): full profile only; a
+ # pull request (cheap tier) runs only the crash robot and convergence here. The
+ # full-ci dispatch on its head, every push and the nightly run this lane.
reconciliation:
name: Reconciliation crashes / ${{ matrix.engine }} / Bun ${{ matrix.bun }}
+ if: ${{ github.event_name != 'pull_request' }}
runs-on: ubicloud-standard-4-ubuntu-2404
timeout-minutes: 30
strategy:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 2c5402d6e2..04af0c6910 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -468,8 +468,12 @@ jobs:
path: node_modules/.cache/gbrain-typecheck.tsbuildinfo
key: tsbuildinfo-${{ runner.os }}-${{ hashFiles('bun.lock', 'tsconfig.json') }}-${{ github.sha }}
+ # Event parity (docs/TESTING.md#full-ci-on-pull-requests): full profile only. A
+ # pull request runs the cheap tier; this job runs in the full-ci dispatch on its
+ # head before merge (merge-train requires full-suite), on every push to master
+ # and on the nightly schedule.
serial-tests:
- if: ${{ github.event_name != 'workflow_dispatch' || (inputs.native_only != true && inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base) }}
+ if: ${{ github.event_name != 'pull_request' && (github.event_name != 'workflow_dispatch' || (inputs.native_only != true && inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base)) }}
# *.serial.test.ts — one bun process per file (module-registry isolation),
# POOLED across files by scripts/run-serial-tests.sh (was strictly
# sequential: an 8.5-minute job whose serialization the quarantine
@@ -560,8 +564,12 @@ jobs:
retention-days: 14
overwrite: true
+ # Event parity (docs/TESTING.md#full-ci-on-pull-requests): full profile only. A
+ # pull request runs the cheap tier; this job runs in the full-ci dispatch on its
+ # head before merge (merge-train requires full-suite), on every push to master
+ # and on the nightly schedule.
slow-brainbench-e2e:
- if: ${{ github.event_name != 'workflow_dispatch' || (inputs.native_only != true && inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base) }}
+ if: ${{ github.event_name != 'pull_request' && (github.event_name != 'workflow_dispatch' || (inputs.native_only != true && inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base)) }}
# Dedicated runner for the BrainBench CLI e2e file. At 98s mined it was
# the matrix's single heaviest atom (10% of the whole corpus weight) and
# the hard floor on shard-count scaling; a Phase-2 rewrite (spawn batching
@@ -637,8 +645,12 @@ jobs:
if-no-files-found: ignore
overwrite: true
+ # Event parity (docs/TESTING.md#full-ci-on-pull-requests): full profile only. A
+ # pull request runs the cheap tier; this job runs in the full-ci dispatch on its
+ # head before merge (merge-train requires full-suite), on every push to master
+ # and on the nightly schedule.
brainbench:
- if: ${{ github.event_name != 'workflow_dispatch' || (inputs.native_only != true && inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base) }}
+ if: ${{ github.event_name != 'pull_request' && (github.event_name != 'workflow_dispatch' || (inputs.native_only != true && inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base)) }}
# BrainBench memory-conformance gate (Cathedral 2). Hermetic: in-memory
# PGLite, zero API keys, ~15s for the full 141-fixture × 3-harness run.
# Governance (decision 4): compares HEAD's run against MAIN's committed
@@ -681,8 +693,12 @@ jobs:
bun scripts/render-brainbench-delta.ts "${{ runner.temp }}/brainbench-result.json" >> "$GITHUB_STEP_SUMMARY"
fi
+ # Event parity (docs/TESTING.md#full-ci-on-pull-requests): full profile only. A
+ # pull request runs the cheap tier; this job runs in the full-ci dispatch on its
+ # head before merge (merge-train requires full-suite), on every push to master
+ # and on the nightly schedule.
slow-entity-resolve-perf:
- if: ${{ github.event_name != 'workflow_dispatch' || (inputs.native_only != true && inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base) }}
+ if: ${{ github.event_name != 'pull_request' && (github.event_name != 'workflow_dispatch' || (inputs.native_only != true && inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base)) }}
# Dedicated runner for the entity-resolve perf test (~159s, single perf
# describe with one test that builds 5000+ pages and asserts the NEW
# tryPrefixExpansion shape is 5x faster than the OLD shape — not
@@ -765,8 +781,12 @@ jobs:
bun run src/cli.ts init --pglite --no-embedding --non-interactive
bun run src/cli.ts protocol conformance --synthesize
+ # Event parity (docs/TESTING.md#full-ci-on-pull-requests): full profile only. A
+ # pull request runs the cheap tier; this job runs in the full-ci dispatch on its
+ # head before merge (merge-train requires full-suite), on every push to master
+ # and on the nightly schedule.
test:
- if: ${{ github.event_name != 'workflow_dispatch' || (inputs.native_only != true && inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base) }}
+ if: ${{ github.event_name != 'pull_request' && (github.event_name != 'workflow_dispatch' || (inputs.native_only != true && inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base)) }}
# Pure matrix shard — no verify, no serial. Each shard runs its slice
# of the unit test set under one `bun test` invocation.
#
@@ -881,9 +901,13 @@ jobs:
# `always()` is load-bearing: without it, a failed shard skips this job at
# exactly the moment the (degraded) report matters most.
# ──────────────────────────────────────────────────────────────────────
+ # Event parity (docs/TESTING.md#full-ci-on-pull-requests): full profile only. A
+ # pull request runs the cheap tier; this job runs in the full-ci dispatch on its
+ # head before merge (merge-train requires full-suite), on every push to master
+ # and on the nightly schedule.
coverage-report:
needs: [serial-tests, slow-entity-resolve-perf, slow-brainbench-e2e, test]
- if: ${{ always() && (github.event_name != 'workflow_dispatch' || (inputs.native_only != true && inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base)) }}
+ if: ${{ always() && github.event_name != 'pull_request' && (github.event_name != 'workflow_dispatch' || (inputs.native_only != true && inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base)) }}
runs-on: ubicloud-standard-4-ubuntu-2404
timeout-minutes: 10
steps:
@@ -939,16 +963,23 @@ jobs:
if-no-files-found: ignore
overwrite: true
+ # Event parity (docs/TESTING.md#full-ci-on-pull-requests): a pull request (cheap
+ # tier) runs the native cells only when its diff touches native code (scope other
+ # than smoke); the full-ci dispatch, every push and the nightly run them all.
native-locks:
needs: [changes]
- if: ${{ github.event_name != 'workflow_dispatch' || (inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base) }}
+ if: ${{ (github.event_name != 'pull_request' || needs.changes.outputs.native-scope != 'smoke') && (github.event_name != 'workflow_dispatch' || (inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base)) }}
uses: ./.github/workflows/native-locks.yml
with:
scope: ${{ needs.changes.outputs.native-scope }}
+ # Event parity (docs/TESTING.md#full-ci-on-pull-requests): a pull request (cheap
+ # tier) calls it only when its diff can change persistence or managed sync, and
+ # then runs only the crash robot and convergence; the full-ci dispatch, every
+ # push and the nightly run every lane.
persistence-validation:
needs: [changes]
- if: ${{ github.event_name != 'workflow_dispatch' || (inputs.native_only != true && inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base) }}
+ if: ${{ (github.event_name != 'pull_request' || needs.changes.outputs.convergence != 'skip') && (github.event_name != 'workflow_dispatch' || (inputs.native_only != true && inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base)) }}
uses: ./.github/workflows/persistence-validation.yml
with:
convergence: ${{ needs.changes.outputs.convergence || 'run' }}
@@ -987,8 +1018,12 @@ jobs:
with:
mode: race-hunt
+ # Event parity (docs/TESTING.md#full-ci-on-pull-requests): full profile only. A
+ # pull request runs the cheap tier; this job runs in the full-ci dispatch on its
+ # head before merge (merge-train requires full-suite), on every push to master
+ # and on the nightly schedule.
admin-browser:
- if: ${{ github.event_name != 'workflow_dispatch' || (inputs.native_only != true && inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base) }}
+ if: ${{ github.event_name != 'pull_request' && (github.event_name != 'workflow_dispatch' || (inputs.native_only != true && inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base)) }}
runs-on: ubicloud-standard-4-ubuntu-2404
timeout-minutes: 12
steps:
@@ -1035,8 +1070,12 @@ jobs:
include-hidden-files: true
retention-days: 7
+ # Event parity (docs/TESTING.md#full-ci-on-pull-requests): full profile only. A
+ # pull request runs the cheap tier; this job runs in the full-ci dispatch on its
+ # head before merge (merge-train requires full-suite), on every push to master
+ # and on the nightly schedule.
shared-skills-compatibility:
- if: ${{ github.event_name != 'workflow_dispatch' || (inputs.native_only != true && inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base) }}
+ if: ${{ github.event_name != 'pull_request' && (github.event_name != 'workflow_dispatch' || (inputs.native_only != true && inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base)) }}
runs-on: ubicloud-standard-4-ubuntu-2404
timeout-minutes: 10
steps:
@@ -1123,10 +1162,14 @@ jobs:
# The stable aggregate succeeds only when every required lane ran successfully.
# Coverage percentages remain advisory until their separate graduation.
+ # Event parity (docs/TESTING.md#full-ci-on-pull-requests): full profile only. A
+ # pull request runs the cheap tier; this job runs in the full-ci dispatch on its
+ # head before merge (merge-train requires full-suite), on every push to master
+ # and on the nightly schedule.
test-status:
- name: ${{ github.event_name == 'workflow_dispatch' && (inputs.native_only == true || inputs.race_hunt == true || inputs.stress_files != '' || inputs.stress_base != '') && 'full-suite-not-run' || 'test-status' }}
+ name: ${{ (github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && (inputs.native_only == true || inputs.race_hunt == true || inputs.stress_files != '' || inputs.stress_base != ''))) && 'full-suite-not-run' || 'test-status' }}
needs: [gitleaks, security-regressions, dependency-audit, verify, typecheck, serial-tests, slow-entity-resolve-perf, slow-brainbench-e2e, brainbench, test, native-locks, persistence-validation, admin-browser, shared-skills-compatibility, stress-changed-tests]
- if: ${{ always() && (github.event_name != 'workflow_dispatch' || (inputs.native_only != true && inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base)) }}
+ if: ${{ always() && github.event_name != 'pull_request' && (github.event_name != 'workflow_dispatch' || (inputs.native_only != true && inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base)) }}
runs-on: ubicloud-standard-2-ubuntu-2404
timeout-minutes: 5
steps:
@@ -1158,6 +1201,80 @@ jobs:
echo "✓ all gated jobs succeeded — CI green"
+ # Full CI on pull requests (docs/TESTING.md#full-ci-on-pull-requests): the
+ # check merge-train reads. It succeeds only when test-status did on the same
+ # run, and a pull-request run (the cheap tier) names it full-suite-not-run, so
+ # a cheap green can never produce it. Its artifact records the tree the run
+ # tested, which scripts/ci-reuse.ts compares on a push to master.
+ # Event parity (docs/TESTING.md#full-ci-on-pull-requests): full profile only;
+ # a pull request gets it from the full-ci dispatch on its head.
+ full-suite:
+ name: ${{ (github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && (inputs.native_only == true || inputs.race_hunt == true || inputs.stress_files != '' || inputs.stress_base != ''))) && 'full-suite-not-run' || 'full-suite' }}
+ needs: [test-status]
+ if: ${{ always() && github.event_name != 'pull_request' && (github.event_name != 'workflow_dispatch' || (inputs.native_only != true && inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base)) }}
+ runs-on: ubicloud-standard-2-ubuntu-2404
+ timeout-minutes: 5
+ steps:
+ - name: Require test-status
+ env:
+ TEST_STATUS: ${{ needs.test-status.result }}
+ run: |
+ if [ "$TEST_STATUS" != success ]; then
+ echo "::error::full-suite requires test-status to succeed on this run (got $TEST_STATUS)"
+ exit 1
+ fi
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
+ with:
+ persist-credentials: false
+ sparse-checkout: scripts/ci-full-suite-tree.sh
+ sparse-checkout-cone-mode: false
+ - name: Record the tested tree
+ env:
+ ARTIFACT_DIR: ${{ runner.temp }}/full-suite
+ RUN_ID: ${{ github.run_id }}
+ RUN_ATTEMPT: ${{ github.run_attempt }}
+ WORKFLOW: ${{ github.workflow }}
+ EVENT: ${{ github.event_name }}
+ run: bash scripts/ci-full-suite-tree.sh
+ - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
+ with:
+ name: full-suite-tree
+ path: ${{ runner.temp }}/full-suite/tree.json
+ retention-days: 30
+ overwrite: true
+
+ # The cheap tier's result (docs/TESTING.md#full-ci-on-pull-requests). It never
+ # reports test-status or full-suite; its name and step summary say the full
+ # suite did not run. The persistence and native lanes may be skipped only when
+ # their own diff selectors left them out.
+ # Event parity (docs/TESTING.md#full-ci-on-pull-requests): pull requests only;
+ # every other event runs the full profile and reports full-suite instead.
+ cheap-tier:
+ name: cheap-tier (full suite not run)
+ needs: [changes, gitleaks, security-regressions, dependency-audit, verify, typecheck, stress-changed-tests, native-locks, persistence-validation]
+ if: ${{ always() && github.event_name == 'pull_request' }}
+ runs-on: ubicloud-standard-2-ubuntu-2404
+ timeout-minutes: 5
+ steps:
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
+ with:
+ persist-credentials: false
+ sparse-checkout: scripts/ci-cheap-tier.sh
+ sparse-checkout-cone-mode: false
+ - name: Aggregate the cheap tier
+ env:
+ GITLEAKS: ${{ needs.gitleaks.result }}
+ SECURITY: ${{ needs.security-regressions.result }}
+ AUDIT: ${{ needs.dependency-audit.result }}
+ VERIFY: ${{ needs.verify.result }}
+ TYPECHECK: ${{ needs.typecheck.result }}
+ STRESS: ${{ needs.stress-changed-tests.result }}
+ NATIVE: ${{ needs.native-locks.result }}
+ NATIVE_SCOPE: ${{ needs.changes.outputs.native-scope }}
+ PERSISTENCE: ${{ needs.persistence-validation.result }}
+ CONVERGENCE: ${{ needs.changes.outputs.convergence }}
+ run: bash scripts/ci-cheap-tier.sh
+
# A native-only run emits its own scoped result, never the required full-suite check.
native-only-status:
name: Native-only result (full CI not run)
diff --git a/scripts/ci-cheap-tier.sh b/scripts/ci-cheap-tier.sh
new file mode 100755
index 0000000000..c8e7da69ee
--- /dev/null
+++ b/scripts/ci-cheap-tier.sh
@@ -0,0 +1,39 @@
+#!/usr/bin/env bash
+# test.yml cheap-tier aggregator (docs/TESTING.md#full-ci-on-pull-requests).
+# Inputs: job results in GITLEAKS SECURITY AUDIT VERIFY TYPECHECK STRESS NATIVE
+# PERSISTENCE, and the selectors NATIVE_SCOPE and CONVERGENCE.
+# Every cheap lane must succeed. The native and persistence lanes may be
+# skipped only when their selector left them out (native scope smoke,
+# convergence skip); a selected lane that skipped, failed or was cancelled
+# fails the tier. The step summary always says the full suite did not run.
+set -euo pipefail
+
+fail=0
+for pair in "gitleaks=${GITLEAKS:-}" "security-regressions=${SECURITY:-}" "dependency-audit=${AUDIT:-}" \
+ "verify=${VERIFY:-}" "typecheck=${TYPECHECK:-}" "stress-changed-tests=${STRESS:-}"; do
+ name=${pair%%=*} result=${pair#*=}
+ echo "$name=$result"
+ if [ "$result" != success ]; then echo "✗ $name did not succeed (got $result)"; fail=1; fi
+done
+lane() {
+ local name=$1 result=$2 selected=$3
+ echo "$name=$result (selected=$selected)"
+ if [ "$result" = success ]; then return 0; fi
+ if [ "$result" = skipped ] && [ "$selected" = no ]; then return 0; fi
+ echo "✗ $name did not succeed (got $result, selected=$selected)"
+ fail=1
+}
+[ "${NATIVE_SCOPE:-}" = smoke ] && native_selected=no || native_selected=yes
+[ "${CONVERGENCE:-}" = skip ] && persistence_selected=no || persistence_selected=yes
+lane native-locks "${NATIVE:-}" "$native_selected"
+lane persistence-validation "${PERSISTENCE:-}" "$persistence_selected"
+
+{
+ echo "## Full suite not run"
+ echo "This pull request ran the cheap tier: verify, typecheck, gitleaks, security regressions, the dependency audit, the stress gate on changed tests, and the persistence (selected: $persistence_selected) and native (selected: $native_selected) lanes its diff selects. Unit shards, serial, slow, the PostgreSQL arms and E2E did not run."
+ echo "The full suite runs when a maintainer adds the \`full-ci\` label, which dispatches Test and E2E on the head branch (a thread can dispatch them itself). Merge requires the \`full-suite\` and \`e2e-full-suite\` checks on the exact head."
+} >> "${GITHUB_STEP_SUMMARY:-/dev/null}"
+echo "::notice::Full suite not run on this head (cheap tier). Merge requires full-suite from a full-ci run."
+
+if [ "$fail" -ne 0 ]; then echo "✗ cheap tier failed"; exit 1; fi
+echo "✓ cheap tier green (full suite not run)"
diff --git a/scripts/ci-full-suite-tree.sh b/scripts/ci-full-suite-tree.sh
new file mode 100755
index 0000000000..73d6c9087a
--- /dev/null
+++ b/scripts/ci-full-suite-tree.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+# Record the tree a full-profile run tested (docs/TESTING.md#full-ci-on-pull-requests).
+# Called by test.yml `full-suite` and e2e.yml `e2e-full-suite` after their
+# aggregate succeeded. scripts/ci-reuse.ts reads the artifact on a push to master.
+# Input (environment): ARTIFACT_DIR, RUN_ID, RUN_ATTEMPT, WORKFLOW, EVENT.
+# Output: $ARTIFACT_DIR/tree.json and one step-summary line.
+set -euo pipefail
+
+mkdir -p "$ARTIFACT_DIR"
+tree=$(git rev-parse 'HEAD^{tree}')
+jq -n --arg tree "$tree" --arg sha "$(git rev-parse HEAD)" --arg workflow "$WORKFLOW" --arg event "$EVENT" \
+ --argjson run_id "$RUN_ID" --argjson run_attempt "$RUN_ATTEMPT" \
+ '{tree: $tree, sha: $sha, workflow: $workflow, event: $event, run_id: $run_id, run_attempt: $run_attempt, profile: "full"}' \
+ | tee "$ARTIFACT_DIR/tree.json"
+echo "$WORKFLOW full suite passed on tree $tree (commit $(git rev-parse HEAD), run $RUN_ID attempt $RUN_ATTEMPT)." >> "${GITHUB_STEP_SUMMARY:-/dev/null}"
diff --git a/test/scripts/ci-gates.test.ts b/test/scripts/ci-gates.test.ts
index 147c218a8a..8a624c9701 100644
--- a/test/scripts/ci-gates.test.ts
+++ b/test/scripts/ci-gates.test.ts
@@ -36,8 +36,11 @@ describe('CI execution evidence', () => {
expect(source).not.toMatch(/(?:ci|e2e)-pass-|cache-check|cache-write/);
expect(source).toContain('bun-cache-');
expect(source).toContain('pglite-snapshot-');
- expect(workflow.on.pull_request.paths).toBeUndefined();
}
+ expect(unit.on.pull_request.paths).toBeUndefined();
+ // E2E never runs on pull_request events: the full-ci dispatch runs it on the
+ // head before merge (docs/TESTING.md#full-ci-on-pull-requests).
+ expect(e2e.on.pull_request).toBeUndefined();
for (const name of ['gitleaks', 'verify', 'typecheck']) {
expect(unit.jobs[name].needs).toBeUndefined();
expect(unit.jobs[name].if).toBe("${{ github.event_name != 'workflow_dispatch' || (inputs.native_only != true && inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base) }}");
@@ -74,7 +77,7 @@ describe('CI execution evidence', () => {
});
test('unit aggregate rejects failed, cancelled or skipped required jobs', () => {
- expect(unit.jobs['test-status'].if).toBe("${{ always() && (github.event_name != 'workflow_dispatch' || (inputs.native_only != true && inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base)) }}");
+ expect(unit.jobs['test-status'].if).toBe("${{ always() && github.event_name != 'pull_request' && (github.event_name != 'workflow_dispatch' || (inputs.native_only != true && inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base)) }}");
expect(unit.jobs['test-status'].needs).toEqual([
'gitleaks', 'security-regressions', 'dependency-audit', 'verify', 'typecheck', 'serial-tests',
'slow-entity-resolve-perf', 'slow-brainbench-e2e', 'brainbench', 'test', 'native-locks', 'persistence-validation',
diff --git a/test/scripts/ci-pr-scope.test.ts b/test/scripts/ci-pr-scope.test.ts
index 42ee241084..3088f67570 100644
--- a/test/scripts/ci-pr-scope.test.ts
+++ b/test/scripts/ci-pr-scope.test.ts
@@ -150,16 +150,22 @@ esac
} finally { rmSync(dir, { recursive: true, force: true }); }
});
- test('security and persistence matrices run both supported Bun versions on pull requests and merge-queue runs (event parity)', () => {
+ // Pull requests run the cheap tier (docs/TESTING.md#full-ci-on-pull-requests):
+ // of the persistence lanes only the crash robot and convergence; the rest run
+ // in the full-ci dispatch, on every push, in the merge queue and nightly.
+ test('security and persistence matrices run both supported Bun versions on every event that runs them; pull requests run only the crash robot and convergence', () => {
const security = load('test.yml').jobs['security-regressions'];
const persistence = load('persistence-validation.yml').jobs;
- const jobs = [security, ...['read-performance', 'deployment-matrix', 'unit-postgres-arms', 'invariants', 'crash-robot', 'reconciliation', 'convergence'].map(name => persistence[name]!)];
- for (const job of jobs) {
+ const cheap = [security, persistence['crash-robot']!, persistence.convergence!];
+ const fullOnly = ['read-performance', 'deployment-matrix', 'unit-postgres-arms', 'invariants', 'reconciliation'].map(name => persistence[name]!);
+ for (const job of [...cheap, ...fullOnly]) {
expect(job.strategy!.matrix.exclude).toBeUndefined();
const push = cells(job, { github: { event_name: 'push' }, inputs: {} });
- for (const event_name of ['pull_request', 'merge_group', 'schedule', 'workflow_dispatch']) {
+ expect(push.length).toBeGreaterThan(0);
+ for (const event_name of ['merge_group', 'schedule', 'workflow_dispatch']) {
expect(cells(job, { github: { event_name }, inputs: {} })).toEqual(push);
}
+ expect(cells(job, { github: { event_name: 'pull_request' }, inputs: {} })).toEqual(cheap.includes(job) ? push : []);
expect(push.filter(cell => cell.split('/').includes(MINIMUM_BUN_VERSION)).length).toBe(push.length / 2);
}
expect(cells(security, { github: { event_name: 'pull_request' }, inputs: {} })).toHaveLength(6);
diff --git a/test/scripts/native-only-workflow.test.ts b/test/scripts/native-only-workflow.test.ts
index d88bd805c0..56313f51f5 100644
--- a/test/scripts/native-only-workflow.test.ts
+++ b/test/scripts/native-only-workflow.test.ts
@@ -12,18 +12,25 @@ const workflow = load(readFileSync(join(import.meta.dir, '../../.github/workflow
concurrency: { group: string; 'cancel-in-progress': boolean }; jobs: Record<string, Job>;
};
type Diagnostic = { race_hunt?: boolean; stress_files?: string; stress_base?: string };
-function context(event: string, flag?: boolean, diagnostic: Diagnostic = {}) {
+// test.yml `changes` outputs a pull request's diff selectors; the default
+// selects every native target and the persistence lanes.
+type Changes = { 'native-scope'?: string; convergence?: string };
+function context(event: string, flag?: boolean, diagnostic: Diagnostic = {}, changes: Changes = {}) {
// Dispatch inputs carry their declared defaults; other events have no inputs.
const inputs = event === 'workflow_dispatch' ? { native_only: flag, race_hunt: false, stress_files: '', stress_base: '', stress_head: '', ...diagnostic } : {};
return { format: (f: string, ...a: unknown[]) => f.replace(/\{(\d+)\}/g, (_, i) => String(a[Number(i)])), github: { workflow: 'Test', event_name: event, ref: 'refs/heads/example', run_id: '77', event: { pull_request: event === 'pull_request' ? { number: 123 } : {} } },
- inputs, always: () => true };
+ inputs, always: () => true, needs: { changes: { outputs: { 'native-scope': 'full', convergence: 'run', ...changes } } } };
}
-function evaluate(expression: string, event: string, flag?: boolean, diagnostic?: Diagnostic): unknown {
- return runInNewContext(expression.replace(/^\$\{\{\s*|\s*\}\}$/g, ''), context(event, flag, diagnostic), { timeout: 100 });
+function evaluate(expression: string, event: string, flag?: boolean, diagnostic?: Diagnostic, changes?: Changes): unknown {
+ const js = expression.replace(/^\$\{\{\s*|\s*\}\}$/g, '').replace(/outputs\.(\w+(?:-\w+)+)/g, (_, key) => `outputs['${key}']`);
+ return runInNewContext(js, context(event, flag, diagnostic, changes), { timeout: 100 });
}
function template(value: string, event: string, flag?: boolean, diagnostic?: Diagnostic): string {
return value.replace(/\$\{\{(.*?)\}\}/g, (_, expression) => String(evaluate(expression.trim(), event, flag, diagnostic)));
}
+// Jobs a pull request (the cheap tier) never runs (docs/TESTING.md#full-ci-on-pull-requests).
+const FULL_ONLY = new Set(['serial-tests', 'slow-brainbench-e2e', 'brainbench', 'slow-entity-resolve-perf', 'test', 'admin-browser',
+ 'shared-skills-compatibility', 'coverage-report', 'test-status', 'full-suite']);
describe('native-only CI remains separate from full validation', () => {
test('only an explicit manual boolean skips full jobs; default and PR/push gates stay required', () => {
@@ -35,11 +42,13 @@ describe('native-only CI remains separate from full validation', () => {
for (const [name, job] of Object.entries(workflow.jobs)) {
if (ownModes.has(name)) continue;
expect(job.if).toBeDefined();
- const nativeStatus = name === 'native-only-status';
for (const event of ['push', 'pull_request', 'workflow_dispatch']) {
for (const flag of [undefined, false, true]) {
const nativeOnly = event === 'workflow_dispatch' && flag === true;
- expect(Boolean(evaluate(job.if!, event, flag)), `${name}/${event}/${flag}`).toBe(nativeStatus ? nativeOnly : !nativeOnly);
+ const expected = name === 'native-only-status' ? nativeOnly
+ : name === 'cheap-tier' ? event === 'pull_request'
+ : !nativeOnly && !(event === 'pull_request' && FULL_ONLY.has(name));
+ expect(Boolean(evaluate(job.if!, event, flag)), `${name}/${event}/${flag}`).toBe(expected);
}
}
}