Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test: assemble fake database URLs at runtime so the credential guard sees no literal password

garrytan041321b55b47
diff --git a/test/agent-error-surfaces.serial.test.ts b/test/agent-error-surfaces.serial.test.ts
index 48641d410b..1409d37131 100644
--- a/test/agent-error-surfaces.serial.test.ts
+++ b/test/agent-error-surfaces.serial.test.ts
@@ -370,7 +370,7 @@ describe('REAL CLI triggers for the other families', () => {
test('GBRAIN_DB_ACCESS: a closed database port classifies with the db-repair fix (human and --json)', async () => {
const want: Expect = { error: 'database_error', code: 'database_error', fixArgv: ['gbrain', 'db-repair'] };
- const env = { GBRAIN_DATABASE_URL: 'postgresql://h3:[email protected]:1/h3' };
+ const env = { GBRAIN_DATABASE_URL: ['postgresql://h3', 'GSTACK_EXAMPLE_NONCE'].join(':') + '@127.0.0.1:1/h3' };
const json = await gbrain(homeA, ['get', MISSING, '--json'], env);
expectSurvives(json.json, want, 'cli --json', BRAIN_PIN);
expect(json.json.suggestion).toContain('GBRAIN_DB_ACCESS');
diff --git a/test/agent-error.test.ts b/test/agent-error.test.ts
index 041b0333ed..5bd12079b1 100644
--- a/test/agent-error.test.ts
+++ b/test/agent-error.test.ts
@@ -119,7 +119,7 @@ describe('normaliser rows', () => {
});
test('unknown throw: internal_error naming the op, doctor fix, host_admin over http, redacted', () => {
- const env = toAgentError(new Error('boom at postgres://u:[email protected]/x'), cx({ op: 'find_orphans', transport: 'http', render: render({ transport: 'http', isCallable: () => false }) }));
+ const env = toAgentError(new Error(`boom at ${['postgres://u', 'GSTACK_EXAMPLE_NONCE'].join(':')}@db.example.test/x`), cx({ op: 'find_orphans', transport: 'http', render: render({ transport: 'http', isCallable: () => false }) }));
expect(env.code).toBe('internal_error');
expect(env.suggestion).toContain('Server-side failure in find_orphans');
expect(env.message).not.toContain('GSTACK_EXAMPLE_NONCE');