* test: isolate embedding configuration between unit fixtures Reset model-probe gateway state and pin chunk-sanitization fixtures to the shared legacy embedding dimensions. Preserve the original persistence and hash assertions. * feat: add existing-agent memory and unified hosted access (v0.49.0.0) Add isolated in-agent setup and repair, private PGLite backup and relocated restore, shared hosted grants and live delegation enforcement, secure credential handoff and recovery, and capability discovery and verification. Make local and hosted onboarding prominent in dedicated Grok Bot and Muse guides. Preserve explicit native-harness acceptance gates, update generated references and release metadata, and keep withdrawn facts out of active memory after synchronization. Co-Authored-By: OpenAI Codex <noreply@openai.com> * docs: sync harness documentation for v0.49.0.0 * fix: update security dependencies and confine restored configuration Refresh patched dependency versions, traverse only owned configuration properties during restore, and trust the CI checkout before calculating the Semgrep baseline. Add a regression that preserves inherited path objects. --------- Co-authored-by: OpenAI Codex <noreply@openai.com>
519 lines
29 KiB
YAML
519 lines
29 KiB
YAML
name: Test
|
||
|
||
on:
|
||
push:
|
||
branches: [master]
|
||
pull_request:
|
||
branches: [master]
|
||
# Manual dispatch lets a local dev/agent offload the suite to GitHub's
|
||
# on-demand runners from ANY branch (see scripts/ship-remote-tests.sh).
|
||
# Frees a load-saturated local machine (e.g. many Conductor agents running
|
||
# their own bun-test suites at once — load avg 120 on 16 cores).
|
||
workflow_dispatch:
|
||
|
||
permissions:
|
||
contents: read
|
||
|
||
# Cancel a superseded run when a newer commit lands on the same PR/branch.
|
||
# Keyed on the PR number for pull_request events (unique per PR, so two PRs
|
||
# from forks sharing a branch name don't cancel each other) and falls back to
|
||
# github.ref for push/scheduled runs. Mirrors heavy-tests.yml; frees runners
|
||
# and stops a stale-SHA run from reporting a flaky failure on an obsolete commit.
|
||
concurrency:
|
||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||
cancel-in-progress: true
|
||
|
||
jobs:
|
||
# Re-run checks for every event. Only dependencies and PGLite snapshots are cached.
|
||
gitleaks:
|
||
runs-on: ubuntu-latest
|
||
timeout-minutes: 10
|
||
steps:
|
||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||
with:
|
||
fetch-depth: 0
|
||
# Use the open-source gitleaks CLI, not gitleaks-action@v2: the v2 action
|
||
# now enforces a paid GITLEAKS_LICENSE (fails the job with "missing
|
||
# gitleaks license" for accounts it can't validate). The CLI is free, uses
|
||
# the committed .gitleaks.toml allowlist, and scans the same commit range.
|
||
- name: Cache gitleaks tarball
|
||
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||
with:
|
||
path: /tmp/gitleaks-dl
|
||
key: gitleaks-8.30.1-linux-x64
|
||
- name: Install gitleaks (pinned + checksum-verified)
|
||
run: |
|
||
set -euo pipefail
|
||
VER=8.30.1
|
||
BASE="gitleaks_${VER}_linux_x64.tar.gz"
|
||
URL="https://github.com/gitleaks/gitleaks/releases/download/v${VER}"
|
||
mkdir -p /tmp/gitleaks-dl
|
||
[ -f "/tmp/gitleaks-dl/${BASE}" ] || curl -fsSL -o "/tmp/gitleaks-dl/${BASE}" "${URL}/${BASE}"
|
||
# Checksums fetched fresh EVERY run: a cache-restored tarball is
|
||
# re-verified against the published digest, never trusted.
|
||
curl -fsSL -o /tmp/gitleaks_checksums.txt "${URL}/gitleaks_${VER}_checksums.txt"
|
||
( cd /tmp/gitleaks-dl && grep " ${BASE}\$" /tmp/gitleaks_checksums.txt | sha256sum -c - )
|
||
tar -xzf "/tmp/gitleaks-dl/${BASE}" -C /tmp gitleaks
|
||
install /tmp/gitleaks /usr/local/bin/gitleaks
|
||
gitleaks version
|
||
- name: Scan for secrets (gitleaks CLI, .gitleaks.toml)
|
||
run: |
|
||
set -euo pipefail
|
||
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
||
RANGE="${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}"
|
||
else
|
||
BEFORE="${{ github.event.before }}"
|
||
case "$BEFORE" in
|
||
""|0000000000000000000000000000000000000000) RANGE="${{ github.sha }}~1..${{ github.sha }}" ;;
|
||
*) RANGE="${BEFORE}..${{ github.sha }}" ;;
|
||
esac
|
||
fi
|
||
echo "Scanning commit range: $RANGE"
|
||
gitleaks detect --redact --no-banner --log-opts "$RANGE"
|
||
|
||
verify:
|
||
# Pre-test gates: privacy/jsonb/source-id/etc + typecheck + admin-build.
|
||
# Lives in its own runner so the matrix shards aren't carrying ~2-3min
|
||
# of verify work in addition to their test files (the old shape stuffed
|
||
# this into `test (1)` via `if: matrix.shard == 1`, which made shard 1
|
||
# the slowest matrix worker). scripts/run-verify-parallel.sh fans out
|
||
# the 20 checks via & + wait (~5s vs ~15-25s sequential).
|
||
runs-on: ubuntu-latest
|
||
timeout-minutes: 12
|
||
steps:
|
||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
|
||
with:
|
||
bun-version: 1.3.13
|
||
# This job is the ONE designated saver of the bun cache (the others
|
||
# restore-only, so 5 redundant post-job save attempts disappear).
|
||
# admin/bun.lock is in the key because verify's check:admin-build
|
||
# installs from it.
|
||
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||
with:
|
||
path: ~/.bun/install/cache
|
||
key: bun-cache-${{ runner.os }}-${{ hashFiles('bun.lock', 'admin/bun.lock') }}
|
||
restore-keys: bun-cache-${{ runner.os }}-
|
||
# verify's runner sources test-env.sh and builds the snapshot for its
|
||
# PGLite-booting eval checks — restore the cache so it's the ~40ms
|
||
# freshness check, not a cold build ahead of all ~47 checks.
|
||
- uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||
with:
|
||
path: |
|
||
test/fixtures/pglite-snapshot.tar
|
||
test/fixtures/pglite-snapshot.version
|
||
key: pglite-snapshot-${{ runner.os }}-${{ hashFiles('src/core/migrate.ts', 'src/core/pglite-schema.ts', 'src/core/pglite-engine.ts', 'src/core/fts-language.ts', 'src/core/vector-index.ts', 'src/core/ai/defaults.ts', 'src/core/timeline-dedup-repair.ts', 'src/core/pages-upsert-arbiter.ts', 'src/core/link-extraction.ts', 'src/core/grants/*.ts', 'src/core/scope.ts', 'src/core/sql-query.ts', 'src/core/minions/tools/brain-allowlist.ts', 'src/core/facts/withdrawal-schema.ts', 'test/helpers/legacy-embedding-config.ts', 'scripts/build-pglite-snapshot.ts') }}
|
||
- run: bun install --frozen-lockfile
|
||
- run: bun run verify
|
||
# Guard: no bare `bun test` in workflows/scripts — bun ignores
|
||
# bunfig.toml's timeout, and hooks (beforeAll/afterAll) get the 5s
|
||
# default regardless of per-test third-arg timeouts. Runs directly
|
||
# (not via verify's CHECKS array) to avoid a package.json edit.
|
||
- run: bash scripts/check-bun-test-timeout.sh
|
||
|
||
serial-tests:
|
||
# *.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
|
||
# contract never required). Lives in its own runner so the matrix shards
|
||
# aren't carrying the serial tail.
|
||
runs-on: ubuntu-latest
|
||
# 25, not 15: on smaller runners the memory clamp in
|
||
# scripts/run-serial-tests.sh sizes the pool to 1, and the fully
|
||
# sequential suite runs 12-13 minutes — a slow runner then hits a 15m
|
||
# cap with every test passing (observed: canceled at exactly 15:00
|
||
# with zero failures). On 4-core runners pool=4 finishes in ~3m and
|
||
# the extra headroom is never used.
|
||
timeout-minutes: 25
|
||
steps:
|
||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
|
||
with:
|
||
bun-version: 1.3.13
|
||
- uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||
with:
|
||
path: ~/.bun/install/cache
|
||
key: bun-cache-${{ runner.os }}-${{ hashFiles('bun.lock') }}
|
||
restore-keys: bun-cache-${{ runner.os }}-
|
||
# PGLite schema snapshot (~42MB): the runner builds it when absent or
|
||
# stale (its runtime hash is authoritative — a stale restore is rebuilt,
|
||
# never trusted). Cached so the build is paid once per schema change,
|
||
# not once per job per run. This job SAVES; verify + matrix + slow jobs
|
||
# restore-only. The key is an approximation on purpose: it only has to
|
||
# be a superset-trigger of real schema changes.
|
||
# KEY HAS 11 HOMES (this save + 5 restores here: verify, matrix,
|
||
# slow-eval, slow-perf, slow-brainbench; + 5 restores in e2e.yml:
|
||
# jsonb-parity, selected-e2e, tier1, tier2, coverage-full-e2e) — edit
|
||
# all together, or drift shows up only as silent rebuild cost.
|
||
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||
with:
|
||
path: |
|
||
test/fixtures/pglite-snapshot.tar
|
||
test/fixtures/pglite-snapshot.version
|
||
key: pglite-snapshot-${{ runner.os }}-${{ hashFiles('src/core/migrate.ts', 'src/core/pglite-schema.ts', 'src/core/pglite-engine.ts', 'src/core/fts-language.ts', 'src/core/vector-index.ts', 'src/core/ai/defaults.ts', 'src/core/timeline-dedup-repair.ts', 'src/core/pages-upsert-arbiter.ts', 'src/core/link-extraction.ts', 'src/core/grants/*.ts', 'src/core/scope.ts', 'src/core/sql-query.ts', 'src/core/minions/tools/brain-allowlist.ts', 'src/core/facts/withdrawal-schema.ts', 'test/helpers/legacy-embedding-config.ts', 'scripts/build-pglite-snapshot.ts') }}
|
||
- run: bun install --frozen-lockfile
|
||
- run: bun run test:serial
|
||
env:
|
||
COVERAGE_DIR: ${{ runner.temp }}/coverage
|
||
- name: Upload coverage (serial lane)
|
||
if: always()
|
||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
||
with:
|
||
name: coverage-serial
|
||
path: ${{ runner.temp }}/coverage
|
||
retention-days: 14
|
||
if-no-files-found: ignore
|
||
overwrite: true
|
||
|
||
slow-eval-longmemeval:
|
||
# Dedicated runner for the LongMemEval end-to-end test file. The file
|
||
# was originally 359s. TODO #1 (engine-sharing in runEvalLongMemEval
|
||
# via RunOpts.engine) cut it to ~200s by amortizing PGLite cold-create
|
||
# across all 13 runEvalLongMemEval calls in one beforeAll-shared brain.
|
||
# Pulled out of the matrix (see scripts/test-shard.sh) so a single 200s
|
||
# atom doesn't dominate a shard's wallclock. Companion file
|
||
# test/eval-longmemeval.slow.test.ts (the pure-bucket half) stays in
|
||
# the matrix because it's light (~42s).
|
||
runs-on: ubuntu-latest
|
||
timeout-minutes: 12
|
||
steps:
|
||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
|
||
with:
|
||
bun-version: 1.3.13
|
||
- uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||
with:
|
||
path: ~/.bun/install/cache
|
||
key: bun-cache-${{ runner.os }}-${{ hashFiles('bun.lock') }}
|
||
restore-keys: bun-cache-${{ runner.os }}-
|
||
- uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||
with:
|
||
path: |
|
||
test/fixtures/pglite-snapshot.tar
|
||
test/fixtures/pglite-snapshot.version
|
||
key: pglite-snapshot-${{ runner.os }}-${{ hashFiles('src/core/migrate.ts', 'src/core/pglite-schema.ts', 'src/core/pglite-engine.ts', 'src/core/fts-language.ts', 'src/core/vector-index.ts', 'src/core/ai/defaults.ts', 'src/core/timeline-dedup-repair.ts', 'src/core/pages-upsert-arbiter.ts', 'src/core/link-extraction.ts', 'src/core/grants/*.ts', 'src/core/scope.ts', 'src/core/sql-query.ts', 'src/core/minions/tools/brain-allowlist.ts', 'src/core/facts/withdrawal-schema.ts', 'test/helpers/legacy-embedding-config.ts', 'scripts/build-pglite-snapshot.ts') }}
|
||
- run: bun install --frozen-lockfile
|
||
- name: Ensure PGLite snapshot (build-or-validate, non-fatal)
|
||
run: bash -c '. scripts/lib/test-env.sh && ensure_pglite_snapshot slow-eval && echo "GBRAIN_PGLITE_SNAPSHOT=${GBRAIN_PGLITE_SNAPSHOT:-}" >> "$GITHUB_ENV"'
|
||
- run: bun test test/eval-longmemeval-e2e.slow.test.ts --timeout=60000 --coverage --coverage-reporter=lcov --coverage-dir=${{ runner.temp }}/coverage/sloweval
|
||
- name: Write coverage lane manifest
|
||
run: |
|
||
printf '{"lane":"sloweval","sha":"%s","lcovCount":%s,"complete":true}\n' \
|
||
"$GITHUB_SHA" "$(find "$RUNNER_TEMP/coverage" -name lcov.info | wc -l | tr -d ' ')" \
|
||
> "$RUNNER_TEMP/coverage/lane-manifest.json"
|
||
- name: Upload coverage (slow-eval lane)
|
||
if: always()
|
||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
||
with:
|
||
name: coverage-sloweval
|
||
path: ${{ runner.temp }}/coverage
|
||
retention-days: 14
|
||
if-no-files-found: ignore
|
||
overwrite: true
|
||
|
||
slow-brainbench-e2e:
|
||
# 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
|
||
# + deleting the CI-gate-duplicated full-corpus test) cut it to ~72s
|
||
# local, still far past the ~40s keep-in-matrix bar. Same pattern as
|
||
# slow-eval-longmemeval above.
|
||
runs-on: ubuntu-latest
|
||
timeout-minutes: 12
|
||
steps:
|
||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
|
||
with:
|
||
bun-version: 1.3.13
|
||
- uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||
with:
|
||
path: ~/.bun/install/cache
|
||
key: bun-cache-${{ runner.os }}-${{ hashFiles('bun.lock') }}
|
||
restore-keys: bun-cache-${{ runner.os }}-
|
||
- uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||
with:
|
||
path: |
|
||
test/fixtures/pglite-snapshot.tar
|
||
test/fixtures/pglite-snapshot.version
|
||
key: pglite-snapshot-${{ runner.os }}-${{ hashFiles('src/core/migrate.ts', 'src/core/pglite-schema.ts', 'src/core/pglite-engine.ts', 'src/core/fts-language.ts', 'src/core/vector-index.ts', 'src/core/ai/defaults.ts', 'src/core/timeline-dedup-repair.ts', 'src/core/pages-upsert-arbiter.ts', 'src/core/link-extraction.ts', 'src/core/grants/*.ts', 'src/core/scope.ts', 'src/core/sql-query.ts', 'src/core/minions/tools/brain-allowlist.ts', 'src/core/facts/withdrawal-schema.ts', 'test/helpers/legacy-embedding-config.ts', 'scripts/build-pglite-snapshot.ts') }}
|
||
- run: bun install --frozen-lockfile
|
||
- name: Ensure PGLite snapshot (build-or-validate, non-fatal)
|
||
# Absolutized: this file's batch jobs spawn CLI children with varying
|
||
# cwd (the outside-cwd case) where a relative path would silently miss.
|
||
run: |
|
||
. scripts/lib/test-env.sh
|
||
ensure_pglite_snapshot slow-brainbench
|
||
# Export absolute (CLI children spawn with varying cwd); keep an
|
||
# already-absolute inherited path as-is; export nothing on build failure.
|
||
if [ -n "${GBRAIN_PGLITE_SNAPSHOT:-}" ]; then
|
||
case "$GBRAIN_PGLITE_SNAPSHOT" in
|
||
/*) echo "GBRAIN_PGLITE_SNAPSHOT=$GBRAIN_PGLITE_SNAPSHOT" >> "$GITHUB_ENV" ;;
|
||
*) echo "GBRAIN_PGLITE_SNAPSHOT=$PWD/$GBRAIN_PGLITE_SNAPSHOT" >> "$GITHUB_ENV" ;;
|
||
esac
|
||
fi
|
||
- run: bun test test/eval-brainbench-e2e.slow.test.ts --timeout=300000 --coverage --coverage-reporter=lcov --coverage-dir=${{ runner.temp }}/coverage/slowbrainbench
|
||
- name: Write coverage lane manifest
|
||
run: |
|
||
printf '{"lane":"slowbrainbench","sha":"%s","lcovCount":%s,"complete":true}\n' \
|
||
"$GITHUB_SHA" "$(find "$RUNNER_TEMP/coverage" -name lcov.info | wc -l | tr -d ' ')" \
|
||
> "$RUNNER_TEMP/coverage/lane-manifest.json"
|
||
- name: Upload coverage (slow-brainbench lane)
|
||
if: always()
|
||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
||
with:
|
||
name: coverage-slowbrainbench
|
||
path: ${{ runner.temp }}/coverage
|
||
retention-days: 14
|
||
if-no-files-found: ignore
|
||
overwrite: true
|
||
|
||
brainbench:
|
||
# 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
|
||
# baseline via `git show origin/master:evals/brainbench/baselines/main.json`
|
||
# — a PR cannot rewrite the thing it's compared against. Exit 1 blocks the
|
||
# merge until the regression is fixed or blessed (justification in the
|
||
# updated baseline / fixture diff in corpus-bless mode).
|
||
runs-on: ubuntu-latest
|
||
timeout-minutes: 10 # ~15s hermetic run; matches the per-job-timeout hardening (#2254)
|
||
steps:
|
||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||
- name: Fetch origin/master baseline ref (shallow)
|
||
# The gate reads ONE file via `git show origin/master:...` — a depth-1
|
||
# fetch of the master ref replaces the previous full 3700-commit clone.
|
||
run: git fetch --no-tags --depth=1 origin +refs/heads/master:refs/remotes/origin/master
|
||
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
|
||
with:
|
||
bun-version: 1.3.13
|
||
- uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||
with:
|
||
path: ~/.bun/install/cache
|
||
key: bun-cache-${{ runner.os }}-${{ hashFiles('bun.lock') }}
|
||
restore-keys: bun-cache-${{ runner.os }}-
|
||
- run: bun install --frozen-lockfile
|
||
- run: bash scripts/ci-brainbench-gate.sh
|
||
env:
|
||
BRAINBENCH_OUT: ${{ runner.temp }}/brainbench-result.json
|
||
- name: BrainBench delta → step summary
|
||
if: always()
|
||
run: |
|
||
if [ -f "${{ runner.temp }}/brainbench-result.json" ]; then
|
||
bun scripts/render-brainbench-delta.ts "${{ runner.temp }}/brainbench-result.json" >> "$GITHUB_STEP_SUMMARY"
|
||
fi
|
||
|
||
slow-entity-resolve-perf:
|
||
# 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
|
||
# subdivisible without weakening the perf guarantee). Pulled out of the
|
||
# matrix (see scripts/test-shard.sh) so a single 159s atom doesn't
|
||
# dominate a shard's wallclock. Runs in parallel with the matrix.
|
||
runs-on: ubuntu-latest
|
||
timeout-minutes: 12
|
||
steps:
|
||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
|
||
with:
|
||
bun-version: 1.3.13
|
||
- uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||
with:
|
||
path: ~/.bun/install/cache
|
||
key: bun-cache-${{ runner.os }}-${{ hashFiles('bun.lock') }}
|
||
restore-keys: bun-cache-${{ runner.os }}-
|
||
- uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||
with:
|
||
path: |
|
||
test/fixtures/pglite-snapshot.tar
|
||
test/fixtures/pglite-snapshot.version
|
||
key: pglite-snapshot-${{ runner.os }}-${{ hashFiles('src/core/migrate.ts', 'src/core/pglite-schema.ts', 'src/core/pglite-engine.ts', 'src/core/fts-language.ts', 'src/core/vector-index.ts', 'src/core/ai/defaults.ts', 'src/core/timeline-dedup-repair.ts', 'src/core/pages-upsert-arbiter.ts', 'src/core/link-extraction.ts', 'src/core/grants/*.ts', 'src/core/scope.ts', 'src/core/sql-query.ts', 'src/core/minions/tools/brain-allowlist.ts', 'src/core/facts/withdrawal-schema.ts', 'test/helpers/legacy-embedding-config.ts', 'scripts/build-pglite-snapshot.ts') }}
|
||
- run: bun install --frozen-lockfile
|
||
- name: Ensure PGLite snapshot (build-or-validate, non-fatal)
|
||
run: bash -c '. scripts/lib/test-env.sh && ensure_pglite_snapshot slow-perf && echo "GBRAIN_PGLITE_SNAPSHOT=${GBRAIN_PGLITE_SNAPSHOT:-}" >> "$GITHUB_ENV"'
|
||
# Two bun processes: each needs its own coverage dir (a reused dir is
|
||
# silently overwritten by the second process).
|
||
- run: bun test test/entity-resolve-perf.slow.test.ts --timeout=300000 --coverage --coverage-reporter=lcov --coverage-dir=${{ runner.temp }}/coverage/perf-a
|
||
# MEMORY_VERBS v1 (Cathedral 1): the entity() p99 < 100ms contract gate
|
||
# (20K-page corpus + ratio guard) shares this runner — same perf-job
|
||
# shape, runs in parallel with the matrix.
|
||
- run: bun test test/entity-card-perf.slow.test.ts --timeout=300000 --coverage --coverage-reporter=lcov --coverage-dir=${{ runner.temp }}/coverage/perf-b
|
||
- name: Write coverage lane manifest
|
||
run: |
|
||
printf '{"lane":"slowperf","sha":"%s","lcovCount":%s,"complete":true}\n' \
|
||
"$GITHUB_SHA" "$(find "$RUNNER_TEMP/coverage" -name lcov.info | wc -l | tr -d ' ')" \
|
||
> "$RUNNER_TEMP/coverage/lane-manifest.json"
|
||
- name: Upload coverage (slow-perf lane)
|
||
if: always()
|
||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
||
with:
|
||
name: coverage-slowperf
|
||
path: ${{ runner.temp }}/coverage
|
||
retention-days: 14
|
||
if-no-files-found: ignore
|
||
overwrite: true
|
||
# Protocol self-certification: init a scratch brain and run the
|
||
# conformance kit against gbrain's own stdio server. --synthesize is
|
||
# safe here: no LLM key in CI, so it asserts the clean `unavailable`
|
||
# protocol error instead of spending tokens.
|
||
- name: MEMORY_VERBS conformance (self-certify, stdio)
|
||
run: |
|
||
export GBRAIN_HOME="$RUNNER_TEMP/gbrain-conformance"
|
||
bun run src/cli.ts init --pglite --no-embedding --non-interactive
|
||
bun run src/cli.ts protocol conformance --synthesize
|
||
|
||
test:
|
||
# Pure matrix shard — no verify, no serial. Each shard runs its slice
|
||
# of the unit test set under one `bun test` invocation.
|
||
#
|
||
# 10 shards (was 6) drops per-shard total from 532s → 287s. With the two
|
||
# dedicated jobs (slow-eval-longmemeval, slow-entity-resolve-perf) also
|
||
# pulled out, the matrix is bounded by ~287s ≈ 4.8 min. Total CI ≈ max
|
||
# of matrix + slow-eval (~3.3 min after engine-sharing in TODO #1) +
|
||
# slow-entity-resolve-perf (~2.6 min) ≈ 4.8 min.
|
||
#
|
||
# Concurrency budget: 10 shards + verify + serial + slow-eval +
|
||
# slow-entity-resolve-perf + slow-brainbench-e2e + brainbench + gitleaks +
|
||
# test-status = ~18 jobs × 2 concurrent PRs = 36. GitHub free-tier
|
||
# caps at ~20 concurrent jobs, so multi-PR days will see some queue
|
||
# pressure. Single-PR runs are unaffected.
|
||
#
|
||
# Partition policy is weight-aware LPT bin-packing via scripts/sharding.ts
|
||
# (replaces FNV-1a path hash). Weights live in scripts/test-weights.json,
|
||
# mined from real CI logs via scripts/mine-shard-weights.ts. Missing
|
||
# weights fall back to corpus median — new test files work immediately.
|
||
runs-on: ubuntu-latest
|
||
# 22, not 15: under parallel PR load the PGLite WASM cold-starts stretch a
|
||
# shard past 15 min while every test is still passing — the timeout then
|
||
# cancels the job and the test-status gate reads it as a failure. 13 runs
|
||
# died this way on 2026-07-21/22 alone.
|
||
timeout-minutes: 22
|
||
strategy:
|
||
fail-fast: false
|
||
matrix:
|
||
shard: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
||
steps:
|
||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
|
||
with:
|
||
bun-version: 1.3.13
|
||
- uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||
with:
|
||
path: ~/.bun/install/cache
|
||
key: bun-cache-${{ runner.os }}-${{ hashFiles('bun.lock') }}
|
||
restore-keys: bun-cache-${{ runner.os }}-
|
||
# Restore-only: test-shard.sh validates the snapshot's runtime hash and
|
||
# rebuilds when stale (the serial-tests job is the designated saver).
|
||
- uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||
with:
|
||
path: |
|
||
test/fixtures/pglite-snapshot.tar
|
||
test/fixtures/pglite-snapshot.version
|
||
key: pglite-snapshot-${{ runner.os }}-${{ hashFiles('src/core/migrate.ts', 'src/core/pglite-schema.ts', 'src/core/pglite-engine.ts', 'src/core/fts-language.ts', 'src/core/vector-index.ts', 'src/core/ai/defaults.ts', 'src/core/timeline-dedup-repair.ts', 'src/core/pages-upsert-arbiter.ts', 'src/core/link-extraction.ts', 'src/core/grants/*.ts', 'src/core/scope.ts', 'src/core/sql-query.ts', 'src/core/minions/tools/brain-allowlist.ts', 'src/core/facts/withdrawal-schema.ts', 'test/helpers/legacy-embedding-config.ts', 'scripts/build-pglite-snapshot.ts') }}
|
||
- run: bun install --frozen-lockfile
|
||
- name: Run test shard ${{ matrix.shard }}/10
|
||
run: scripts/test-shard.sh ${{ matrix.shard }} 10
|
||
env:
|
||
COVERAGE_DIR: ${{ runner.temp }}/coverage
|
||
- name: Upload coverage (shard lane)
|
||
if: always()
|
||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
||
with:
|
||
name: coverage-shard-${{ matrix.shard }}
|
||
path: ${{ runner.temp }}/coverage
|
||
retention-days: 14
|
||
if-no-files-found: ignore
|
||
overwrite: true
|
||
|
||
# ──────────────────────────────────────────────────────────────────────
|
||
# coverage-report: merges the PR corpus (10 shards + serial + 2 slow
|
||
# lanes) into one honest number, renders it to the step summary, and runs
|
||
# the diff + baseline gates in report-only mode (COVERAGE_GATE_ENFORCE=0).
|
||
# ADVISORY during the report-only window: deliberately NOT in test-status's
|
||
# required set — coverage reporting stays advisory until the gate
|
||
# graduates (that PR adds it to the aggregate and flips ENFORCE).
|
||
# `always()` is load-bearing: without it, a failed shard skips this job at
|
||
# exactly the moment the (degraded) report matters most.
|
||
# ──────────────────────────────────────────────────────────────────────
|
||
coverage-report:
|
||
needs: [serial-tests, slow-eval-longmemeval, slow-entity-resolve-perf, slow-brainbench-e2e, test]
|
||
if: always()
|
||
runs-on: ubuntu-latest
|
||
timeout-minutes: 10
|
||
steps:
|
||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||
with:
|
||
fetch-depth: 0 # diff gate needs origin/master; baseline gate reads git show origin/master:
|
||
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
|
||
with:
|
||
bun-version: 1.3.13
|
||
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||
with:
|
||
path: ~/.bun/install/cache
|
||
key: bun-cache-${{ runner.os }}-${{ hashFiles('bun.lock') }}
|
||
- run: bun install --frozen-lockfile
|
||
- name: Download per-lane coverage artifacts
|
||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||
with:
|
||
pattern: coverage-*
|
||
path: ${{ runner.temp }}/coverage-artifacts
|
||
- name: Merge lanes
|
||
env:
|
||
COVERAGE_CORPUS: prCorpus
|
||
run: |
|
||
bun scripts/merge-lcov.ts \
|
||
--out-lcov "$RUNNER_TEMP/coverage-merged/lcov.info" \
|
||
--out-json "$RUNNER_TEMP/coverage-merged/summary.json" \
|
||
--manifest-expect shard-1,shard-2,shard-3,shard-4,shard-5,shard-6,shard-7,shard-8,shard-9,shard-10,serial,sloweval,slowperf,slowbrainbench \
|
||
"$RUNNER_TEMP/coverage-artifacts"
|
||
- name: Coverage summary → step summary
|
||
run: bun scripts/render-coverage-summary.ts --summary "$RUNNER_TEMP/coverage-merged/summary.json" --structural scripts/structural-suites.tsv >> "$GITHUB_STEP_SUMMARY"
|
||
- name: Diff coverage gate (report-only until graduation)
|
||
# shell: bash is load-bearing: the default `bash -e {0}` has NO
|
||
# pipefail, so the tee pipe would mask the gate's exit code — the
|
||
# graduated gate could never fail the job.
|
||
shell: bash
|
||
env:
|
||
COVERAGE_GATE_ENFORCE: '0'
|
||
run: bun scripts/coverage-diff-gate.ts --summary "$RUNNER_TEMP/coverage-merged/summary.json" | tee -a "$GITHUB_STEP_SUMMARY"
|
||
- name: Baseline gate (prCorpus, like-for-like)
|
||
shell: bash
|
||
env:
|
||
COVERAGE_GATE_ENFORCE: '0'
|
||
run: bun scripts/coverage-baseline-gate.ts --summary "$RUNNER_TEMP/coverage-merged/summary.json" --corpus prCorpus | tee -a "$GITHUB_STEP_SUMMARY"
|
||
- name: Upload merged coverage
|
||
if: always()
|
||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
||
with:
|
||
name: coverage-merged
|
||
path: ${{ runner.temp }}/coverage-merged
|
||
retention-days: 14
|
||
if-no-files-found: ignore
|
||
overwrite: true
|
||
|
||
# The stable aggregate succeeds only when every required lane ran successfully.
|
||
# Coverage percentages remain advisory until their separate graduation.
|
||
test-status:
|
||
needs: [gitleaks, verify, serial-tests, slow-eval-longmemeval, slow-entity-resolve-perf, slow-brainbench-e2e, brainbench, test]
|
||
if: always()
|
||
runs-on: ubuntu-latest
|
||
timeout-minutes: 5
|
||
steps:
|
||
- name: Aggregate result
|
||
run: |
|
||
GITLEAKS="${{ needs.gitleaks.result }}"
|
||
VERIFY="${{ needs.verify.result }}"
|
||
SERIAL="${{ needs.serial-tests.result }}"
|
||
SLOW_EVAL="${{ needs.slow-eval-longmemeval.result }}"
|
||
SLOW_PERF="${{ needs.slow-entity-resolve-perf.result }}"
|
||
SLOW_BRAINBENCH="${{ needs.slow-brainbench-e2e.result }}"
|
||
BRAINBENCH="${{ needs.brainbench.result }}"
|
||
TEST="${{ needs.test.result }}"
|
||
echo "gitleaks=$GITLEAKS verify=$VERIFY serial-tests=$SERIAL slow-eval-longmemeval=$SLOW_EVAL slow-entity-resolve-perf=$SLOW_PERF slow-brainbench-e2e=$SLOW_BRAINBENCH brainbench=$BRAINBENCH test=$TEST"
|
||
for r in "$GITLEAKS" "$VERIFY" "$SERIAL" "$SLOW_EVAL" "$SLOW_PERF" "$SLOW_BRAINBENCH" "$BRAINBENCH" "$TEST"; do
|
||
if [ "$r" != "success" ]; then
|
||
echo "✗ gated job did not succeed (got $r) — CI fail"
|
||
exit 1
|
||
fi
|
||
done
|
||
echo "✓ all gated jobs succeeded — CI green"
|