Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(stress): a pooler-gated file its owning pooled job requires is not stressed; publication-deadline-pgbouncer runs in persistence-validation

time-attackdb876aa12913
diff --git a/.github/workflows/persistence-validation.yml b/.github/workflows/persistence-validation.yml
index f65e17257e..6e0d119e40 100644
--- a/.github/workflows/persistence-validation.yml
+++ b/.github/workflows/persistence-validation.yml
@@ -151,6 +151,7 @@ jobs:
test/persistence-reconcile.test.ts
test/persistence-reconcile-additive-5974.test.ts
test/e2e/reconcile-pgbouncer.test.ts
+ test/e2e/publication-deadline-pgbouncer.test.ts
test/e2e/extract-atoms-page-state.test.ts
- if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
diff --git a/scripts/stress/README.md b/scripts/stress/README.md
index 9d4cda245e..a92954cd51 100644
--- a/scripts/stress/README.md
+++ b/scripts/stress/README.md
@@ -61,8 +61,10 @@ Paid-provider files (`*.live.test.ts`, `test/live/`,
`scripts/e2e-live-key-only.txt`) are listed as not stressed. A file whose
every test skips on this platform, skips without an unavailable secret, or
skips without a prerequisite its owning job in `heavy-tests.yml`,
-`native-locks.yml` or `macos-validation.yml` installs, is listed as not
-stressed with that reason; any other run with zero executed tests fails.
+`native-locks.yml` or `macos-validation.yml` installs, or skips without the
+PgBouncer fixture (`GBRAIN_PGBOUNCER_URL`) that a workflow step setting
+`GBRAIN_CI_REQUIRE_PGBOUNCER` runs it with, is listed as not stressed with that
+reason; any other run with zero executed tests fails.
## Isolation and receipts
diff --git a/scripts/stress/run.ts b/scripts/stress/run.ts
index c2bebd8cd7..b4ca5439e7 100644
--- a/scripts/stress/run.ts
+++ b/scripts/stress/run.ts
@@ -356,6 +356,10 @@ function skipReason(file: string): string | null {
if (keys.length) return `every test skipped without ${keys.join(', ')} (secret not available here); not stressed`;
const owner = OWNING_WORKFLOWS.find(w => { const p = join(ROOT, '.github/workflows', w); return existsSync(p) && readFileSync(p, 'utf8').includes(file); });
if (owner) return `every test skipped here: its prerequisite (agent binary or native target) comes from its owning job in .github/workflows/${owner}; not stressed`;
+ if (/process\.env\.GBRAIN_PGBOUNCER_URL/.test(text) && !process.env.GBRAIN_PGBOUNCER_URL) {
+ const pooled = readdirSync(join(ROOT, '.github/workflows')).find(w => { const body = readFileSync(join(ROOT, '.github/workflows', w), 'utf8'); return body.includes(file) && body.includes('GBRAIN_CI_REQUIRE_PGBOUNCER'); });
+ if (pooled) return `every test skipped without the PgBouncer fixture (GBRAIN_PGBOUNCER_URL); its owning pooled job in .github/workflows/${pooled} requires it; not stressed`;
+ }
return null;
}
diff --git a/test/scripts/test-stress.test.ts b/test/scripts/test-stress.test.ts
index ec43c4a5c0..922d38d20b 100644
--- a/test/scripts/test-stress.test.ts
+++ b/test/scripts/test-stress.test.ts
@@ -88,6 +88,20 @@ describe('test:stress runner', () => {
expect(r.manifest.files[0]).toMatchObject({ status: 'not-stressed', reason: expect.stringContaining('owning job in .github/workflows/heavy-tests.yml') });
});
+ test('a file that skips without the PgBouncer fixture its owning pooled job requires is not stressed', () => {
+ const body = "import { test } from 'bun:test';\nconst pooled = process.env.GBRAIN_PGBOUNCER_URL;\ntest.skipIf(!pooled)('pooled', () => {});\n";
+ const root = tree({
+ 'test/pooled.test.ts': body,
+ 'test/orphan-pooled.test.ts': body,
+ '.github/workflows/persistence-validation.yml': 'jobs:\n pooled:\n steps:\n - env:\n GBRAIN_CI_REQUIRE_PGBOUNCER: \'1\'\n run: bun test test/pooled.test.ts\n',
+ });
+ const owned = stress(root, 'test/orphan-pooled.test.ts', 'test/pooled.test.ts', '--iterations', '2');
+ const byFile = Object.fromEntries(owned.manifest.files.map((f: { file: string }) => [f.file, f]));
+ expect(byFile['test/pooled.test.ts']).toMatchObject({ status: 'not-stressed', reason: expect.stringContaining('owning pooled job in .github/workflows/persistence-validation.yml') });
+ expect(byFile['test/orphan-pooled.test.ts']).toMatchObject({ status: 'fail' });
+ expect(owned.code, owned.out).toBe(1);
+ });
+
test('a test that ran in the first iteration and skips later is an unexpected skip', () => {
const root = tree({ 'test/vanish.test.ts': "import { test } from 'bun:test';\nif (Number(process.env.GBRAIN_TEST_SEED) % 2 === 1) test('sometimes', () => {});\ntest('always', () => {});\n" });
const r = stress(root, 'test/vanish.test.ts', '--iterations', '2', '--seed', '1');