mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 19:04:02 +00:00
Merge origin/main into fix/realtime-debug-log-hardening
# Conflicts: # CHANGELOG.md # src/tooling/localServices.test.mjs
This commit is contained in:
commit
a948274326
161 files changed
+19838
-6545
No files matched your search
@@ -279,11 +279,65 @@ test('Realtime service configuration selects compatible endpoint/model without f
|
||||
url: '/?tier=arbitrary-model&model=other',
|
||||
});
|
||||
assert.equal(response.status, 200);
|
||||
assert.deepEqual(response.json(), { value: 'short-lived-fixture' });
|
||||
assert.equal(response.headers['x-gev-voice-model'], 'configured-model');
|
||||
assert.equal(response.headers['cache-control'], 'no-store');
|
||||
assert.doesNotMatch(response.body, /server-fixture|voice\.example/);
|
||||
});
|
||||
|
||||
test('OpenAI routes answer generically when the upstream or the request fails', async (t) => {
|
||||
env(t, 'OPENAI_API_KEY', 'fixture-upstream-secret');
|
||||
env(t, 'GEV_RATELIMIT_OPENAI_PER_MIN', undefined);
|
||||
const leak =
|
||||
'fixture-upstream-secret req_fixture_1234 org-fixture quota exhausted';
|
||||
|
||||
// `data.error.message` is OpenAI's own wording — request ids, organization
|
||||
// hints, quota phrasing — and was relayed verbatim whenever upstream was not ok.
|
||||
t.mock.method(globalThis, 'fetch', async () =>
|
||||
Response.json({ error: { message: leak } }, { status: 429 }),
|
||||
);
|
||||
const summary = await request(
|
||||
install(openAiRealtimeProxy()).get('/api/openai/hud-summary'),
|
||||
{ method: 'POST', body: JSON.stringify({ context: {} }) },
|
||||
);
|
||||
assert.equal(summary.json().error, 'OpenAI HUD summary request failed');
|
||||
assert.equal(summary.body.includes('req_fixture_1234'), false);
|
||||
assert.equal(summary.body.includes('fixture-upstream-secret'), false);
|
||||
|
||||
// An HTTP error from the client-secret endpoint carries the same upstream
|
||||
// detail, while a successful response must still pass the ephemeral secret.
|
||||
t.mock.restoreAll();
|
||||
t.mock.method(globalThis, 'fetch', async () =>
|
||||
Response.json({ error: { message: leak } }, { status: 429 }),
|
||||
);
|
||||
const rejectedToken = await request(
|
||||
install(openAiRealtimeProxy()).get('/api/realtime/token'),
|
||||
);
|
||||
assert.equal(rejectedToken.status, 429);
|
||||
assert.equal(
|
||||
rejectedToken.headers['content-type'],
|
||||
'application/json; charset=utf-8',
|
||||
);
|
||||
assert.deepEqual(rejectedToken.json(), {
|
||||
error: 'Failed to create Realtime token',
|
||||
});
|
||||
assert.equal(rejectedToken.body.includes('req_fixture_1234'), false);
|
||||
assert.equal(rejectedToken.body.includes('fixture-upstream-secret'), false);
|
||||
|
||||
// A network fault surfaced a resolver message naming the upstream host.
|
||||
t.mock.restoreAll();
|
||||
t.mock.method(globalThis, 'fetch', async () => {
|
||||
throw Error(`getaddrinfo ENOTFOUND api.openai.com ${leak}`);
|
||||
});
|
||||
const token = await request(
|
||||
install(openAiRealtimeProxy()).get('/api/realtime/token'),
|
||||
);
|
||||
assert.equal(token.status, 502);
|
||||
assert.deepEqual(token.json(), { error: 'Failed to create Realtime token' });
|
||||
assert.equal(token.body.includes('api.openai.com'), false);
|
||||
assert.equal(token.body.includes('fixture-upstream-secret'), false);
|
||||
});
|
||||
|
||||
test('the debug-log sink stays bounded, rate limited, and quiet about failures', async (t) => {
|
||||
const sourceRoot = root(t);
|
||||
const handler = install(openAiRealtimeProxy({ sourceRoot })).get(
|
||||
|
||||
Reference in new issue
Block a user