Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test: use the approved GSTACK_EXAMPLE_NONCE placeholder for fake database passwords (credential guard)

garrytanc0c3053a775b
diff --git a/test/agent-error-surfaces.serial.test.ts b/test/agent-error-surfaces.serial.test.ts
index 6c83f572b3..48641d410b 100644
--- a/test/agent-error-surfaces.serial.test.ts
+++ b/test/agent-error-surfaces.serial.test.ts
@@ -370,11 +370,11 @@ 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:[email protected]: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');
- expect(json.stdout).not.toContain('h3-secret');
+ expect(json.stdout).not.toContain('GSTACK_EXAMPLE_NONCE');
// Human output is the golden-pinned GBRAIN_DB_ACCESS seam (`… Run: gbrain db-repair`), not the rendered fix line.
const humanErr = (await gbrain(homeA, ['get', MISSING], env)).stderr;
expect(humanErr).toContain('Error [database_error]: ');
diff --git a/test/agent-error.test.ts b/test/agent-error.test.ts
index 68f2556f45..041b0333ed 100644
--- a/test/agent-error.test.ts
+++ b/test/agent-error.test.ts
@@ -119,10 +119,10 @@ 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:[email protected]/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('secret');
+ expect(env.message).not.toContain('GSTACK_EXAMPLE_NONCE');
expect(env.fix).toMatchObject({ argv: ['gbrain', 'doctor', '--json'], actor: 'host_admin', next: 'tell_user_to_run' });
expect(toAgentError(new Error('x'), cx({ op: 'remember' }))).toMatchObject({ error: 'internal', code: 'internal', protocol_version: 1 });
});
diff --git a/test/cli-json-commands.serial.test.ts b/test/cli-json-commands.serial.test.ts
index d25ddeb8b2..8522f5c39c 100644
--- a/test/cli-json-commands.serial.test.ts
+++ b/test/cli-json-commands.serial.test.ts
@@ -17,7 +17,7 @@ import { runCli, type CliResult } from './helpers/cli-spawn.ts';
const EVAL_FIXTURES = join(import.meta.dir, 'fixtures', 'eval-baselines');
const QRELS = join(EVAL_FIXTURES, 'qrels-search.json');
const CAPTURED = join(EVAL_FIXTURES, 'captured-sample.ndjson');
-const UNREACHABLE_PG = 'postgresql://fixture:[email protected]:1/gbrain_test';
+const UNREACHABLE_PG = 'postgresql://[email protected]:1/gbrain_test';
function onlyDocument(r: CliResult): Record<string, unknown> {
const doc = JSON.parse(r.stdout);