From cb3b66e38b4c1f1d8ce2d00576efd2641d487b08 Mon Sep 17 00:00:00 2001 From: Kevin Rajan <7121943+kvnloo@users.noreply.github.com> Date: Fri, 16 Oct 2026 23:41:12 -0500 Subject: [PATCH] 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. --- scripts/format.mjs | 12 ------- src/voice/realtimeViewport.js | 1 - src/voice/realtimeViewportPolicy.test.mjs | 44 +++++++++++++++-------- 3 files changed, 30 insertions(+), 27 deletions(-) diff --git a/scripts/format.mjs b/scripts/format.mjs index 1828bd84e..25311ba29 100644 --- a/scripts/format.mjs +++ b/scripts/format.mjs @@ -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( diff --git a/src/voice/realtimeViewport.js b/src/voice/realtimeViewport.js index 8ba50c73b..18d06093f 100644 --- a/src/voice/realtimeViewport.js +++ b/src/voice/realtimeViewport.js @@ -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. diff --git a/src/voice/realtimeViewportPolicy.test.mjs b/src/voice/realtimeViewportPolicy.test.mjs index 3398f2a09..0d679559f 100644 --- a/src/voice/realtimeViewportPolicy.test.mjs +++ b/src/voice/realtimeViewportPolicy.test.mjs @@ -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); });