Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
ci(tla-spec): set scratch paths in a step, repeat the path filter for push, explicit bun test timeouts
garrytan1bde6684cd85
diff --git a/.github/workflows/tla-spec.yml b/.github/workflows/tla-spec.ymlindex c0d83f554a..98928202f9 100644--- a/.github/workflows/tla-spec.yml+++ b/.github/workflows/tla-spec.yml@@ -8,7 +8,7 @@ on:pull_request:branches: [master]# Event parity (docs/ci-event-parity.md): path-gated named exception; covered by the nightly TLA+ specs schedule.- paths: &paths+ paths:- 'spec/tla/**'- 'scripts/spec/**'- '.github/workflows/tla-spec.yml'@@ -31,7 +31,27 @@ on:- 'test/helpers/persistence-postgres.ts'push:branches: [master]- paths: *paths+ paths: # the same list as pull_request (actionlint does not accept YAML aliases)+ - 'spec/tla/**'+ - 'scripts/spec/**'+ - '.github/workflows/tla-spec.yml'+ - 'src/core/persistence/sync-lease.ts'+ - 'src/core/db-lock.ts'+ - 'src/core/persistence/sync-pass-fold.ts'+ - 'src/core/persistence/sync-prepare.ts'+ - 'test/spec-drain-lease-constants.test.ts'+ - 'test/persistence-sync-lease.test.ts'+ - 'test/db-lock-auto-takeover.test.ts'+ - 'test/db-lock-fencing.test.ts'+ - 'test/sync-fenced-slices-gbra133.test.ts'+ - 'test/e2e/drain-lease-fence-postgres.test.ts'+ - 'test/drain-lease-guards.test.ts'+ - 'test/e2e/drain-lease-guards-postgres.test.ts'+ - 'test/drain-lease-stamp-fence.test.ts'+ - 'test/e2e/drain-lease-stamp-fence-postgres.test.ts'+ - 'test/helpers/managed-brain.ts'+ - 'test/helpers/test-backends.ts'+ - 'test/helpers/persistence-postgres.ts'schedule:- cron: '40 9 * * *' # nightly, 09:40 UTCworkflow_dispatch:@@ -59,9 +79,6 @@ jobs:options: >---health-cmd "pg_isready -U gbrain_test -d gbrain_test"--health-interval 5s --health-timeout 5s --health-retries 20- env:- TLC_OUT: ${{ runner.temp }}/tlc- TLA_CACHE: ${{ runner.temp }}/tla-cachesteps:- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4- uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1@@ -71,6 +88,11 @@ jobs:- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2with:bun-version: 1.4.4+ # The runner context is not available at job level, so the scratch paths are set here.+ - name: Scratch paths+ run: |+ echo "TLC_OUT=$RUNNER_TEMP/tlc" >> "$GITHUB_ENV"+ echo "TLA_CACHE=$RUNNER_TEMP/tla-cache" >> "$GITHUB_ENV"- name: Install dependencies (bounded, retried once)timeout-minutes: 8run: bun scripts/ci-bun-install.ts --frozen-lockfile --ignore-scripts@@ -80,7 +102,7 @@ jobs:jar="$(bash scripts/spec/tla-jar.sh)" || exit "$?"printf 'TLA2TOOLS=%s\n' "$jar" >> "$GITHUB_ENV"- name: The configs match the code- run: bun test test/spec-drain-lease-constants.test.ts+ run: bun test --timeout=60000 test/spec-drain-lease-constants.test.ts- name: Model-check every config (the *Nightly.cfg ones on the schedule and on dispatch)env:TLC_NIGHTLY: ${{ (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && '1' || '0' }}diff --git a/scripts/spec/mutants.ts b/scripts/spec/mutants.tsindex 5040ac3b14..f7a4b872e8 100644--- a/scripts/spec/mutants.ts+++ b/scripts/spec/mutants.ts@@ -108,10 +108,10 @@ interface TestRun { outcome: 'passed' | 'assertion' | 'broken'; why: string; logfunction bunTest(cwd: string, t: CodeTest, log: string): TestRun {const junit = log.replace(/[.]log$/, '.xml');rmSync(junit, { force: true });- const r = spawnSync('bun', ['test', '--timeout=300000', '--reporter=junit', `--reporter-outfile=${junit}`, t.test, '-t', t.filter],- { cwd, encoding: 'utf8', env: process.env, timeout: 600_000 });+ const argv = ['test', '--timeout=300000', '--reporter=junit', `--reporter-outfile=${junit}`, t.test, '-t', t.filter];+ const r = spawnSync('bun', argv, { cwd, encoding: 'utf8', env: process.env, timeout: 600_000 });const text = `${r.stdout ?? ''}${r.stderr ?? ''}`;- writeFileSync(log, `$ bun test ${t.test} -t ${JSON.stringify(t.filter)}\nexit ${r.status} signal ${r.signal} error ${r.error?.message ?? 'none'}\n\n${text}`);+ writeFileSync(log, `$ bun ${argv.map(a => JSON.stringify(a)).join(' ')}\nexit ${r.status} signal ${r.signal} error ${r.error?.message ?? 'none'}\n\n${text}`);const broken = (why: string): TestRun => ({ outcome: 'broken', why, log });if (r.error) return broken(`bun did not run (${(r.error as NodeJS.ErrnoException).code ?? r.error.message})`);if (r.signal) return broken(`bun was terminated by ${r.signal}`);diff --git a/test/spec-drain-lease-constants.test.ts b/test/spec-drain-lease-constants.test.tsindex 35acc36a60..c1ce35a972 100644--- a/test/spec-drain-lease-constants.test.ts+++ b/test/spec-drain-lease-constants.test.ts@@ -80,5 +80,7 @@ describe('the TLA+ workflow runs when anything a mutant names changes', () => {const { mutants } = JSON.parse(readFileSync(join(SPEC, 'mutants.json'), 'utf8')) as { mutants: Array<{ code?: { edits: Array<{ file: string }>; tests: Array<{ test: string }> } }> };const named = new Set(mutants.flatMap(m => m.code ? [...m.code.edits.map(e => e.file), ...m.code.tests.map(t => t.test)] : []));expect([...named].filter(file => !paths.has(file)), 'add these to on.pull_request.paths in .github/workflows/tla-spec.yml').toEqual([]);+ const list = (from: string, to: string) => [...workflow.slice(workflow.indexOf(from), workflow.indexOf(to)).matchAll(/^\s+- '([^']+)'$/gm)].map(m => m[1]);+ expect(list(' push:', ' schedule:'), 'on.push.paths must repeat on.pull_request.paths exactly').toEqual(list(' pull_request:', ' push:'));});});