mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-11 05:42:22 +00:00
style(voice): apply exact Prettier 3.9.6 output to #835
Restore unchanged formatter script after ephemeral CI verification. Keep current-main-compatible reason instrumentation, pointer crop and capture cancellation tests.
This commit is contained in:
1 parent
d4980b1b77
commit
cb3b66e38b
3 files changed
+30
-27
No files matched your search
@@ -141,18 +141,6 @@ if (import.meta.url === invoked) {
|
||||
if (mode === '--check' && result.changed.length) {
|
||||
for (const name of result.changed)
|
||||
console.error(`Needs formatting: ${name}`);
|
||||
// Temporary CI-only formatter diagnostic. This commit is never promoted.
|
||||
for (const name of result.changed.filter((file) =>
|
||||
['src/voice/realtimeViewport.js', 'src/voice/realtimeViewportPolicy.test.mjs'].includes(file)
|
||||
)) {
|
||||
const file = path.join(fileURLToPath(new URL('../', import.meta.url)), name);
|
||||
const output = await prettier.format(await readFile(file, 'utf8'), {
|
||||
...(await prettier.resolveConfig(file)), filepath: file,
|
||||
});
|
||||
const encoded = Buffer.from(output).toString('base64');
|
||||
for (let pos = 0; pos < encoded.length; pos += 1000)
|
||||
console.error(`PRETTIER-DATA|${name}|${pos}|${encoded.slice(pos, pos + 1000)}`);
|
||||
}
|
||||
process.exitCode = 1;
|
||||
} else {
|
||||
console.log(
|
||||
|
||||
@@ -112,7 +112,6 @@ export function viewportContextDecision(result, { channelOpen = true } = {}) {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Square source rectangle around a canvas point, clamped inside the canvas,
|
||||
* in drawing-buffer pixels, plus where the point lands in the output image.
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
|
||||
import { RealtimeViewport, viewportContextDecision } from './realtimeViewport.js';
|
||||
import {
|
||||
RealtimeViewport,
|
||||
viewportContextDecision,
|
||||
} from './realtimeViewport.js';
|
||||
|
||||
const localContext = (overrides = {}) => ({
|
||||
action: 'get_entity_context',
|
||||
@@ -99,7 +102,10 @@ test('pointer ground selects the #837 crop path, not a full viewport', () => {
|
||||
},
|
||||
);
|
||||
assert.deepEqual(
|
||||
viewportContextDecision({ ...pointerContext, selected: { id: 'building' } }),
|
||||
viewportContextDecision({
|
||||
...pointerContext,
|
||||
selected: { id: 'building' },
|
||||
}),
|
||||
{
|
||||
send: false,
|
||||
reason: 'pointer-identity-present',
|
||||
@@ -144,8 +150,14 @@ test('runtime dispatch preserves pointer crop and full image separation', async
|
||||
true,
|
||||
);
|
||||
assert.equal(calls.filter((call) => call.kind === 'crop').length, 1);
|
||||
assert.deepEqual(calls.find((call) => call.kind === 'crop').snapshot, pointer);
|
||||
assert.equal(calls.find((call) => call.kind === 'crop').options.viewScale, 'city');
|
||||
assert.deepEqual(
|
||||
calls.find((call) => call.kind === 'crop').snapshot,
|
||||
pointer,
|
||||
);
|
||||
assert.equal(
|
||||
calls.find((call) => call.kind === 'crop').options.viewScale,
|
||||
'city',
|
||||
);
|
||||
assert.equal(calls.filter((call) => call.kind === 'viewport').length, 0);
|
||||
|
||||
assert.equal(await viewport.sendVisualContextIfUseful(localContext()), true);
|
||||
@@ -157,10 +169,13 @@ test('runtime dispatch preserves pointer crop and full image separation', async
|
||||
false,
|
||||
);
|
||||
assert.equal(calls.filter((call) => call.kind === 'viewport').length, 1);
|
||||
assert.ok(calls.some((call) =>
|
||||
call.event === 'viewport_context.decision' &&
|
||||
call.detail.reason === 'pointer-ground-crop'
|
||||
));
|
||||
assert.ok(
|
||||
calls.some(
|
||||
(call) =>
|
||||
call.event === 'viewport_context.decision' &&
|
||||
call.detail.reason === 'pointer-ground-crop',
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
test('closed channel never captures pointer or full viewport', async () => {
|
||||
@@ -232,11 +247,12 @@ test('successful retained send is logged without recording image contents', asyn
|
||||
capture: async () => 'data:image/jpeg;base64,AA==',
|
||||
});
|
||||
assert.equal(await viewport.sendVisualContextIfUseful(localContext()), true);
|
||||
assert.ok(diagnostics.some((item) =>
|
||||
item.event === 'viewport_context.result' && item.detail.reason === 'sent'
|
||||
));
|
||||
assert.equal(
|
||||
JSON.stringify(diagnostics).includes('data:image/jpeg'),
|
||||
false,
|
||||
assert.ok(
|
||||
diagnostics.some(
|
||||
(item) =>
|
||||
item.event === 'viewport_context.result' &&
|
||||
item.detail.reason === 'sent',
|
||||
),
|
||||
);
|
||||
assert.equal(JSON.stringify(diagnostics).includes('data:image/jpeg'), false);
|
||||
});
|
||||
Reference in new issue
Block a user