mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-14 15:22:21 +00:00
test(voice): pin diagnostics wiring and in-flight crop dedupe; tighten docs
Third review pass on #835. No runtime change. - Controller test: viewport decisions reach the controller's debug log. - Policy test: a second request for a snapshot still being captured is logged pointer-already-requested and is not captured twice. - CURRENT-STATE: pointer-not-fresh also covers a missing snapshot, already-requested covers an earlier attempt that threw, and the image step runs when any tool output of the response was sent. - Changelog: describe what is recorded rather than a fixed miscount.
This commit is contained in:
1 parent
d0a612786a
commit
df37c9360d
4 files changed
+55
-5
No files matched your search
@@ -3708,3 +3708,29 @@ test('voice runs app actions itself and other tools through the catalog', async
|
||||
assert.deepEqual(disposals, [['removed']]);
|
||||
assert.equal(withToolCatalog(runner, undefined), runner);
|
||||
});
|
||||
|
||||
test('the controller forwards viewport escalation diagnostics to its debug log', async () => {
|
||||
const records = [];
|
||||
const controller = new GevRealtimeController({
|
||||
ui: createTestVoiceUi(),
|
||||
runner: async () => ({ ok: true }),
|
||||
radioLayer: { subscribePlaybackControls: () => () => {}, setVoiceDucked() {} },
|
||||
});
|
||||
controller.debugLog = (event, detail) => records.push({ event, detail });
|
||||
controller.dc = { readyState: 'open', send() {}, close() {} };
|
||||
|
||||
assert.equal(
|
||||
await controller.sendVisualContextIfUseful({
|
||||
action: 'get_entity_context',
|
||||
scene: { basemap: { viewScale: 'regional' } },
|
||||
}),
|
||||
false,
|
||||
);
|
||||
assert.deepEqual(
|
||||
records.filter((record) => record.event.startsWith('viewport_context.')),
|
||||
[{
|
||||
event: 'viewport_context.decision',
|
||||
detail: { contextId: 1, send: false, reason: 'view-scale-not-local', viewScale: 'regional' },
|
||||
}],
|
||||
);
|
||||
});
|
||||
@@ -557,3 +557,27 @@ test('a throw after a real send still logs it as sent', async () => {
|
||||
[['viewport_context.result', 'sent']],
|
||||
);
|
||||
});
|
||||
|
||||
test('a second request for a snapshot still being captured is not sent twice', async () => {
|
||||
const releases = [];
|
||||
const snapshot = groundSnapshot();
|
||||
const { viewport, events } = recordingViewport({
|
||||
readPointer: () => snapshot,
|
||||
capturePointer: () => new Promise((resolve) => releases.push(resolve)),
|
||||
});
|
||||
const first = viewport.sendVisualContextIfUseful(pointerGround());
|
||||
const second = viewport.sendVisualContextIfUseful(pointerGround());
|
||||
await Promise.resolve();
|
||||
for (const release of releases)
|
||||
release({ dataUrl: 'data:image/jpeg;base64,AA==', rect: {} });
|
||||
assert.deepEqual([await first, await second], [true, false]);
|
||||
assert.equal(releases.length, 1);
|
||||
const outcomes = events.filter((item) => outcomeEvents.has(item.event));
|
||||
assert.deepEqual(
|
||||
outcomes.map((item) => [item.detail.contextId, item.detail.reason]),
|
||||
[
|
||||
[2, 'pointer-already-requested'],
|
||||
[1, 'sent'],
|
||||
],
|
||||
);
|
||||
});
|
||||
Reference in new issue
Block a user