* 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>
648 lines
34 KiB
YAML
648 lines
34 KiB
YAML
name: E2E Tests
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
pull_request:
|
|
branches: [master]
|
|
schedule:
|
|
- cron: '0 6 * * *' # Nightly at 6am UTC
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
# Cancel a superseded run when a newer commit lands on the same PR/branch.
|
|
# PR number for pull_request events (fork-safe), github.ref fallback for
|
|
# push/scheduled runs.
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
# Test results are never cached; selection and live-provider state vary by run.
|
|
jsonb-parity:
|
|
# Dedicated required guard for the JSONB double-encode bug-class (#2339).
|
|
# PGLite parses a double-encoded jsonb string silently, so this assertion can
|
|
# ONLY be made on real Postgres — a normal gated e2e file would skip without
|
|
# DATABASE_URL and let the bug ship green (as #2339 did). This job provisions
|
|
# Postgres and HARD-FAILS if DATABASE_URL is missing, so the guard can never
|
|
# silently skip.
|
|
name: JSONB parity (#2339 regression guard)
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
services:
|
|
postgres:
|
|
image: pgvector/pgvector:pg16
|
|
env:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: gbrain_test
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
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 snapshot (restore-only; test.yml's serial-tests job saves).
|
|
# run-e2e.sh builds it when absent/stale — this just avoids paying the
|
|
# build once per job. KEY: byte-identical with the homes in test.yml.
|
|
- 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
|
|
# This job runs bare `bun test` (not run-e2e.sh), so the snapshot must
|
|
# be activated here or the restored tar is never read (the engine gates
|
|
# on the env var). Absolutized for varying-cwd CLI children.
|
|
- name: Ensure PGLite snapshot (build-or-validate, non-fatal)
|
|
run: |
|
|
. scripts/lib/test-env.sh
|
|
ensure_pglite_snapshot jsonb-parity
|
|
# 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
|
|
- name: Require DATABASE_URL (no silent skip)
|
|
env:
|
|
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/gbrain_test
|
|
run: |
|
|
if [ -z "$DATABASE_URL" ]; then
|
|
echo "::error::DATABASE_URL must be set for the jsonb-parity job — the #2339 guard would silently skip (the exact failure PGLite hides). Failing the job." >&2
|
|
exit 1
|
|
fi
|
|
- name: Run JSONB double-encode parity tests on real Postgres
|
|
env:
|
|
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/gbrain_test
|
|
# #3485 preload guard: this job intentionally tests against a DB.
|
|
GBRAIN_TEST_ALLOW_DATABASE_URL: '1'
|
|
# --timeout also raises bun's 5s default hook budget (beforeAll/afterAll
|
|
# do NOT inherit a test's third-arg timeout; verified on bun 1.3.x).
|
|
# Every runner script in scripts/ passes it; bare invocations must too.
|
|
# phantom-redirect rides this job: its Postgres arm is the other
|
|
# engine-parity backstop and no other CI lane carries DATABASE_URL to it
|
|
# (the unit wrappers strip the URL per #3485).
|
|
run: bun test --timeout=60000 test/e2e/op-checkpoint-jsonb-parity.test.ts test/e2e/jsonb-roundtrip.test.ts test/phantom-redirect-engine-parity.test.ts
|
|
|
|
# ──────────────────────────────────────────────────────────────────────
|
|
# selected-e2e (test-gap plan G1): PR-time signal for the e2e files that
|
|
# otherwise run only in the scheduled nightly full glob.
|
|
# scripts/select-e2e.ts picks the diff-relevant files — fail-closed:
|
|
# uncertain diffs emit ALL, git failure exits 2 and FAILS this job (the
|
|
# run step must never be wrapped in `|| true`). Files already carried by
|
|
# the named jobs and the live-key token spenders are excluded with a loud
|
|
# per-file echo (no silent caps); the nightly full glob remains the
|
|
# backstop for the excluded set. Fork PRs: this job needs ONLY the
|
|
# Postgres service container (no repository secrets), so outside
|
|
# contributors run it natively — no skip path needed. select-e2e's
|
|
# --classify-only mode is load-bearing in coverage-diff-gate.ts on every
|
|
# PR; this job consumes the default file-selection mode and must not
|
|
# change the script's exit semantics. On scheduled runs the step
|
|
# early-exits green: coverage-full-e2e already runs the full glob that
|
|
# night. The aggregate requires that full-corpus execution on schedules.
|
|
selected-e2e:
|
|
name: Selected E2E (diff-relevant)
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 60
|
|
services:
|
|
postgres:
|
|
image: pgvector/pgvector:pg16
|
|
env:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: gbrain_test
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
steps:
|
|
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
|
with:
|
|
# select-e2e diffs origin/master...HEAD — needs real history.
|
|
fetch-depth: 0
|
|
- 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 snapshot (restore-only; test.yml's serial-tests job saves).
|
|
# run-e2e.sh builds it when absent/stale — this just avoids paying the
|
|
# build once per job. KEY: byte-identical with the homes in test.yml.
|
|
- 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: Select and run diff-relevant E2E files
|
|
env:
|
|
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/gbrain_test
|
|
# #3485 preload guard: this job intentionally tests against a DB.
|
|
GBRAIN_TEST_ALLOW_DATABASE_URL: '1'
|
|
run: |
|
|
if [ "${{ github.event_name }}" = "schedule" ]; then
|
|
echo "scheduled run — coverage-full-e2e carries the full glob tonight; nothing to select"
|
|
exit 0
|
|
fi
|
|
git fetch origin master --quiet
|
|
# exit 2 from the selector fails this step — fail-loud by design.
|
|
bun scripts/select-e2e.ts > /tmp/selected.txt
|
|
# Exclusions (echoed per file, never silent): files the named jobs
|
|
# above already run this same workflow, plus live-key token
|
|
# spenders (this job carries no provider keys, so they would
|
|
# self-skip anyway — the list makes the spend guarantee explicit).
|
|
EXCLUDE='test/e2e/op-checkpoint-jsonb-parity.test.ts test/e2e/jsonb-roundtrip.test.ts test/e2e/mechanical.test.ts test/e2e/mcp.test.ts test/e2e/job-isolation.test.ts test/e2e/sync-reconcile-postgres.test.ts test/e2e/engine-parity.test.ts test/e2e/serve-http-multi-agent.test.ts test/e2e/postgres-bootstrap.test.ts test/e2e/sync-delegation-under-serve.serial.test.ts test/e2e/dream-synthesize-pglite.test.ts test/e2e/skills.test.ts test/e2e/zeroentropy-live.test.ts test/e2e/voyage-rerank-live.test.ts test/e2e/voyage-multimodal.test.ts'
|
|
: > /tmp/run.txt
|
|
while IFS= read -r f; do
|
|
[ -z "$f" ] && continue
|
|
case " $EXCLUDE " in
|
|
*" $f "*) echo "excluded (named-job / live-key lane): $f" ;;
|
|
*) echo "$f" >> /tmp/run.txt ;;
|
|
esac
|
|
done < /tmp/selected.txt
|
|
COUNT=$(wc -l < /tmp/run.txt | tr -d ' ')
|
|
echo "selector emitted $(wc -l < /tmp/selected.txt | tr -d ' ') file(s); running $COUNT after exclusions"
|
|
if [ "$COUNT" -eq 0 ]; then
|
|
echo "doc-only or fully-excluded diff — nothing to run here"
|
|
exit 0
|
|
fi
|
|
xargs -a /tmp/run.txt bash scripts/run-e2e.sh
|
|
|
|
tier1:
|
|
name: Tier 1 (Mechanical)
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
services:
|
|
postgres:
|
|
image: pgvector/pgvector:pg16
|
|
env:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: gbrain_test
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
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 snapshot (restore-only; test.yml's serial-tests job saves).
|
|
# run-e2e.sh builds it when absent/stale — this just avoids paying the
|
|
# build once per job. KEY: byte-identical with the homes in test.yml.
|
|
- 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
|
|
# Bare `bun test` job — activate the restored snapshot (see jsonb-parity).
|
|
- name: Ensure PGLite snapshot (build-or-validate, non-fatal)
|
|
run: |
|
|
. scripts/lib/test-env.sh
|
|
ensure_pglite_snapshot tier1
|
|
# 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
|
|
- name: Run Tier 1 E2E tests
|
|
# job-isolation rides tier1 deliberately: e2e.yml runs only explicitly
|
|
# NAMED files (no glob) — an unwired e2e file is silent coverage loss.
|
|
# sync-reconcile-postgres joins for the same reason (#4568): it only
|
|
# ran nightly via the coverage-full-e2e schedule-only glob, so a
|
|
# regression in the reconcile's real-Postgres array-parameter
|
|
# binding path could reach master with every PR lane green. It
|
|
# already uses the same setupDB/teardownDB TRUNCATE-reset pattern
|
|
# (test/e2e/helpers.ts) as the other DB-backed files on this line.
|
|
# Also added to the selected-e2e EXCLUDE list above so a PR
|
|
# touching sync.ts doesn't run it a second time there.
|
|
run: bun test --timeout=60000 test/e2e/mechanical.test.ts test/e2e/mcp.test.ts test/e2e/job-isolation.test.ts test/e2e/sync-reconcile-postgres.test.ts
|
|
env:
|
|
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/gbrain_test
|
|
# #3485 preload guard: this job intentionally tests against a DB.
|
|
GBRAIN_TEST_ALLOW_DATABASE_URL: '1'
|
|
- name: Run engine parity suite
|
|
# The behavioral parity pin for the two engines (containment-sprint
|
|
# engine peels lean on it). Own invocation line: this suite has only
|
|
# ever run one-process-per-file via run-e2e.sh — do not fold it into
|
|
# the shared-process tier1 line above.
|
|
run: bun test --timeout=60000 test/e2e/engine-parity.test.ts
|
|
env:
|
|
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/gbrain_test
|
|
GBRAIN_TEST_ALLOW_DATABASE_URL: '1'
|
|
- name: Run multi-agent serve suite
|
|
# cathedral-6 (T7): multi-agent continuity + isolation over a real
|
|
# `gbrain serve --http`. Own invocation line (engine-parity
|
|
# precedent): the file spawns two serves on fixed ports
|
|
# (19133/19134) and SIGKILLs one mid-hammer — never fold it into the
|
|
# shared-process tier1 line above. Named files only, no glob.
|
|
run: bun test --timeout=60000 test/e2e/serve-http-multi-agent.test.ts
|
|
env:
|
|
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/gbrain_test
|
|
GBRAIN_TEST_ALLOW_DATABASE_URL: '1'
|
|
- name: Create isolated database for the bootstrap suite
|
|
# The bootstrap suite rewinds the schema ledger and replays every
|
|
# migration; replayed constraint-adds (e.g. facts_source_id_fkey)
|
|
# break on rows earlier tier1 suites legitimately leave in
|
|
# gbrain_test (the suite's own TRUNCATE list predates facts). The
|
|
# nightly lane masks this via preceding files' TRUNCATE CASCADE —
|
|
# here it gets a database of its own instead.
|
|
run: PGPASSWORD=postgres psql -h localhost -U postgres -d gbrain_test -c 'CREATE DATABASE gbrain_bootstrap_test'
|
|
- name: Run Postgres bootstrap suite
|
|
# Forward-reference bootstrap on REAL Postgres (#366/#375/#378, the
|
|
# v121/#2626 wedge class, v0.46.26 private-queue lifecycle incl. the
|
|
# token-only probe). Previously reachable only via the nightly
|
|
# coverage-full-e2e glob, so a broken PostgresEngine bootstrap block
|
|
# could reach master with every PR lane green. Own invocation line
|
|
# and its OWN database (see the step above). Named files only, no glob.
|
|
run: bun test --timeout=60000 test/e2e/postgres-bootstrap.test.ts
|
|
env:
|
|
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/gbrain_bootstrap_test
|
|
# #3485 preload guard: this job intentionally tests against a DB.
|
|
GBRAIN_TEST_ALLOW_DATABASE_URL: '1'
|
|
- name: Run serve-delegated sync suite
|
|
# Serve-delegated sync (PGLite): a real `gbrain serve` owns the
|
|
# single-writer lock while real `gbrain sync` subprocesses delegate
|
|
# through its IPC socket, get SIGKILLed mid-run, and resume. Own
|
|
# invocation line, and deliberately NO DATABASE_URL — the suite is
|
|
# PGLite-only (env DATABASE_URL is a live gbrain config source and
|
|
# would flip the sandboxed brain to Postgres; the file also
|
|
# self-strips). Named files only, no glob.
|
|
run: bun test --timeout=240000 test/e2e/sync-delegation-under-serve.serial.test.ts
|
|
- name: Run PGLite inline subagent drain suite
|
|
# dream-synthesize-pglite pins the inline drain's per-child lease
|
|
# keepalive (v0.46.26 private-queue lifecycle) — previously nightly-
|
|
# glob-only, where the keepalive pin broke silently. Deliberately NO
|
|
# DATABASE_URL: the suite is PGLite-only. Named files only, no glob.
|
|
run: bun test --timeout=120000 test/e2e/dream-synthesize-pglite.test.ts
|
|
|
|
tier2:
|
|
name: Tier 2 (LLM Skills)
|
|
# Runs on every push/PR (promoted from schedule-only in v0.19.0), in
|
|
# PARALLEL with tier1 (own postgres service — the old `needs: tier1`
|
|
# serialized ~2min for no shared state). The jsonb-parity gate (~40s)
|
|
# stays in front as the broken-build SPEND gate: this job burns real
|
|
# OpenAI/Anthropic/ZeroEntropy tokens and must not fire when the build
|
|
# can't even pass the cheapest DB guard.
|
|
needs: jsonb-parity
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
services:
|
|
postgres:
|
|
image: pgvector/pgvector:pg16
|
|
env:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: gbrain_test
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
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 snapshot (restore-only; test.yml's serial-tests job saves).
|
|
# run-e2e.sh builds it when absent/stale — this just avoids paying the
|
|
# build once per job. KEY: byte-identical with the homes in test.yml.
|
|
- 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
|
|
# Bare `bun test` job — activate the restored snapshot (see jsonb-parity).
|
|
- name: Ensure PGLite snapshot (build-or-validate, non-fatal)
|
|
run: |
|
|
. scripts/lib/test-env.sh
|
|
ensure_pglite_snapshot tier2
|
|
# 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
|
|
- name: Install OpenClaw
|
|
# Bound + retry the install: a transient npm/registry stall here used to
|
|
# hang unbounded and (since the v0.42.50.0 job timeout) burn the entire
|
|
# 30m Tier 2 budget before failing — even though the install normally
|
|
# finishes in well under a minute. `timeout` kills a hung attempt fast;
|
|
# up to 3 attempts ride out a flaky registry. Step cap is a backstop.
|
|
timeout-minutes: 8
|
|
run: |
|
|
for attempt in 1 2 3; do
|
|
if timeout 120 npm install -g openclaw@2026.4.9; then
|
|
exit 0
|
|
fi
|
|
echo "::warning::openclaw install attempt $attempt failed or timed out; retrying in 10s" >&2
|
|
sleep 10
|
|
done
|
|
echo "::error::openclaw install failed after 3 attempts" >&2
|
|
exit 1
|
|
- name: Configure OpenClaw MCP
|
|
run: |
|
|
mkdir -p ~/.openclaw
|
|
cat > ~/.openclaw/config.json << 'EOF'
|
|
{
|
|
"mcpServers": {
|
|
"gbrain": {
|
|
"command": "bun",
|
|
"args": ["run", "src/cli.ts", "serve"],
|
|
"env": {
|
|
"DATABASE_URL": "${{ env.DATABASE_URL }}"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
EOF
|
|
- name: Run Tier 2 skill tests
|
|
run: bun test --timeout=60000 test/e2e/skills.test.ts test/e2e/zeroentropy-live.test.ts
|
|
env:
|
|
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/gbrain_test
|
|
# #3485 preload guard: this job intentionally tests against a DB.
|
|
GBRAIN_TEST_ALLOW_DATABASE_URL: '1'
|
|
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
# v0.33.3.0: ZE live API tests skip gracefully when this is unset,
|
|
# so forks without the secret stay green. The test exercises the
|
|
# zeroEntropyCompatFetch response-rewriter + URL rewrite + flexible
|
|
# dim handling + gateway.rerank against the real provider.
|
|
ZEROENTROPY_API_KEY: ${{ secrets.ZEROENTROPY_API_KEY }}
|
|
|
|
# ──────────────────────────────────────────────────────────────────────
|
|
# Nightly coverage-full pipeline (schedule-only). The honest
|
|
# "unit + serial + E2E merged" number the containment sprint mandates:
|
|
# every lane runs WITH coverage inside THIS workflow (no cross-workflow
|
|
# artifact fetch — that channel is racy by construction), then one merge
|
|
# job compares against the fullCorpus baseline and uploads the trend
|
|
# artifact. PR runs never pay this cost; the schedule gate on every job
|
|
# below is load-bearing.
|
|
# ──────────────────────────────────────────────────────────────────────
|
|
coverage-full-unit:
|
|
if: github.event_name == 'schedule'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
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
|
|
- run: bun install --frozen-lockfile
|
|
- name: Coverage shard ${{ matrix.shard }}/10
|
|
run: scripts/test-shard.sh ${{ matrix.shard }} 10
|
|
env:
|
|
COVERAGE_DIR: ${{ runner.temp }}/coverage
|
|
- name: Upload coverage
|
|
if: always()
|
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
|
with:
|
|
name: coverage-full-shard-${{ matrix.shard }}
|
|
path: ${{ runner.temp }}/coverage
|
|
retention-days: 14
|
|
if-no-files-found: ignore
|
|
overwrite: true
|
|
|
|
coverage-full-serial:
|
|
if: github.event_name == 'schedule'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
steps:
|
|
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
|
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
|
|
with:
|
|
bun-version: 1.3.13
|
|
- run: bun install --frozen-lockfile
|
|
- run: bun run test:serial
|
|
env:
|
|
COVERAGE_DIR: ${{ runner.temp }}/coverage
|
|
- name: Upload coverage
|
|
if: always()
|
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
|
with:
|
|
name: coverage-full-serial
|
|
path: ${{ runner.temp }}/coverage
|
|
retention-days: 14
|
|
if-no-files-found: ignore
|
|
overwrite: true
|
|
|
|
coverage-full-slow:
|
|
if: github.event_name == 'schedule'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 25
|
|
steps:
|
|
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
|
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
|
|
with:
|
|
bun-version: 1.3.13
|
|
- run: bun install --frozen-lockfile
|
|
# Separate coverage dirs per bun process (a reused dir is overwritten).
|
|
- run: bun test test/eval-longmemeval-e2e.slow.test.ts --timeout=60000 --coverage --coverage-reporter=lcov --coverage-dir=${{ runner.temp }}/coverage/slow-a
|
|
- run: bun test test/entity-resolve-perf.slow.test.ts --timeout=300000 --coverage --coverage-reporter=lcov --coverage-dir=${{ runner.temp }}/coverage/slow-b
|
|
- run: bun test test/entity-card-perf.slow.test.ts --timeout=300000 --coverage --coverage-reporter=lcov --coverage-dir=${{ runner.temp }}/coverage/slow-c
|
|
- run: bun test test/eval-brainbench-e2e.slow.test.ts --timeout=300000 --coverage --coverage-reporter=lcov --coverage-dir=${{ runner.temp }}/coverage/slow-d
|
|
- name: Write coverage lane manifest
|
|
run: |
|
|
printf '{"lane":"slow","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
|
|
if: always()
|
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
|
with:
|
|
name: coverage-full-slow
|
|
path: ${{ runner.temp }}/coverage
|
|
retention-days: 14
|
|
if-no-files-found: ignore
|
|
overwrite: true
|
|
|
|
coverage-full-e2e:
|
|
if: github.event_name == 'schedule'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 60
|
|
services:
|
|
postgres:
|
|
image: pgvector/pgvector:pg16
|
|
env:
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: gbrain_test
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
steps:
|
|
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
|
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
|
|
with:
|
|
bun-version: 1.3.13
|
|
# PGLite snapshot (restore-only; test.yml's serial-tests job saves).
|
|
- 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: Full e2e glob with coverage (all files, incl. engine-parity)
|
|
# run-e2e.sh redirects HOME, so COVERAGE_DIR must be absolute; its
|
|
# env scrub keeps non-GBRAIN vars, so COVERAGE_DIR and
|
|
# E2E_FILE_TIMEOUT_SECS survive. 300s/file absorbs instrumentation
|
|
# overhead on the slowest files (the default cap is 180s).
|
|
run: bash scripts/run-e2e.sh
|
|
env:
|
|
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/gbrain_test
|
|
GBRAIN_TEST_ALLOW_DATABASE_URL: '1'
|
|
COVERAGE_DIR: ${{ runner.temp }}/coverage
|
|
E2E_FILE_TIMEOUT_SECS: '300'
|
|
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
ZEROENTROPY_API_KEY: ${{ secrets.ZEROENTROPY_API_KEY }}
|
|
- name: Upload coverage
|
|
if: always()
|
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
|
with:
|
|
name: coverage-full-e2e
|
|
path: ${{ runner.temp }}/coverage
|
|
retention-days: 14
|
|
if-no-files-found: ignore
|
|
overwrite: true
|
|
|
|
coverage-full-report:
|
|
needs: [coverage-full-unit, coverage-full-serial, coverage-full-slow, coverage-full-e2e]
|
|
if: always() && github.event_name == 'schedule'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
steps:
|
|
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
|
with:
|
|
fetch-depth: 0 # baseline gate reads git show origin/master:
|
|
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
|
|
with:
|
|
bun-version: 1.3.13
|
|
- run: bun install --frozen-lockfile
|
|
- name: Download per-lane coverage artifacts
|
|
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
|
with:
|
|
pattern: coverage-full-*
|
|
path: ${{ runner.temp }}/coverage-artifacts
|
|
- name: Merge full corpus
|
|
env:
|
|
COVERAGE_CORPUS: fullCorpus
|
|
run: |
|
|
bun scripts/merge-lcov.ts \
|
|
--out-lcov "$RUNNER_TEMP/coverage-full-merged/lcov.info" \
|
|
--out-json "$RUNNER_TEMP/coverage-full-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,slow,e2e \
|
|
"$RUNNER_TEMP/coverage-artifacts"
|
|
- name: Coverage summary → step summary
|
|
run: bun scripts/render-coverage-summary.ts --summary "$RUNNER_TEMP/coverage-full-merged/summary.json" --structural scripts/structural-suites.tsv >> "$GITHUB_STEP_SUMMARY"
|
|
- name: Baseline gate (fullCorpus, like-for-like)
|
|
# shell: bash → pipefail, so tee can't mask the gate's exit code.
|
|
shell: bash
|
|
env:
|
|
COVERAGE_GATE_ENFORCE: '0'
|
|
run: bun scripts/coverage-baseline-gate.ts --summary "$RUNNER_TEMP/coverage-full-merged/summary.json" --corpus fullCorpus | tee -a "$GITHUB_STEP_SUMMARY"
|
|
- name: Upload merged full-corpus coverage (trend artifact)
|
|
if: always()
|
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
|
with:
|
|
name: coverage-full-merged
|
|
path: ${{ runner.temp }}/coverage-full-merged
|
|
retention-days: 30
|
|
if-no-files-found: ignore
|
|
overwrite: true
|
|
|
|
# The stable aggregate includes nightly execution lanes on schedules.
|
|
# Coverage reporting itself remains advisory; failed tests never do.
|
|
e2e-status:
|
|
needs: [jsonb-parity, tier1, tier2, selected-e2e, coverage-full-unit, coverage-full-serial, coverage-full-slow, coverage-full-e2e]
|
|
if: always()
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
steps:
|
|
- name: Aggregate result
|
|
run: |
|
|
JSONB="${{ needs.jsonb-parity.result }}"
|
|
TIER1="${{ needs.tier1.result }}"
|
|
TIER2="${{ needs.tier2.result }}"
|
|
SELECTED="${{ needs.selected-e2e.result }}"
|
|
EVENT="${{ github.event_name }}"
|
|
echo "event=$EVENT"
|
|
echo "jsonb-parity=$JSONB tier1=$TIER1 tier2=$TIER2 selected-e2e=$SELECTED"
|
|
for r in "$JSONB" "$TIER1" "$TIER2" "$SELECTED"; do
|
|
if [ "$r" != "success" ]; then
|
|
echo "✗ gated e2e job did not succeed (got $r) — E2E fail"
|
|
exit 1
|
|
fi
|
|
done
|
|
if [ "$EVENT" = "schedule" ]; then
|
|
FULL_UNIT="${{ needs.coverage-full-unit.result }}"
|
|
FULL_SERIAL="${{ needs.coverage-full-serial.result }}"
|
|
FULL_SLOW="${{ needs.coverage-full-slow.result }}"
|
|
FULL_E2E="${{ needs.coverage-full-e2e.result }}"
|
|
echo "full-unit=$FULL_UNIT full-serial=$FULL_SERIAL full-slow=$FULL_SLOW full-e2e=$FULL_E2E"
|
|
for r in "$FULL_UNIT" "$FULL_SERIAL" "$FULL_SLOW" "$FULL_E2E"; do
|
|
if [ "$r" != "success" ]; then
|
|
echo "✗ scheduled full-corpus job did not succeed (got $r) — E2E fail"
|
|
exit 1
|
|
fi
|
|
done
|
|
fi
|
|
echo "✓ all required e2e jobs succeeded — E2E green"
|