Files
faceclaw/tests/texture-cache-protocol.test.cjs
T
James Babcock 25c398d60f Wait for final results from Whisper before completing
<details>
<summary>Prompts Used</summary>
User: This checkout corresponds to https://github.com/jimrandomh/faceclaw/pull/27. Review this branch.

GPT-6 Astra:
> Found one issue:
>
> - **[P2] Wait for Whisper’s final result before completing dictation** — [FaceclawVoiceController.java:729](/Users/jbabcock/repositories/g2/faceclaw/App_Resources/Android/src/main/java/com/faceclaw/app/FaceclawVoiceController.java:729). Skipping partial decodes leaves short utterances without text until release, but the dialog still finalizes after its existing timeout. If decoding exceeds roughly 2.7 seconds (native stop’s 1.5-second wait plus the dialog’s 1.2-second timeout), auto-send can abandon a short command or send an incomplete longer one. Continue can append the late editing instruction literally instead of refining the message. I reproduced these outcomes with delayed transcript events. These flows should await recognition completion.
>
> Validation: TypeScript and a clean Android build passed. All 21 test failures also occur on `main`. Actual Whisper latency was not tested on hardware.

<hr>

User: Thanks, let's fix that issue.

GPT-6 Astra:
> Fixed. Dictation now waits for native recognition to finish before fallback timers run. Auto-send, Continue, and AI Chat preserve delayed Whisper results; cancellation ignores late transcripts.
>
> TypeScript and Android builds pass. All 11 new regression tests pass. The full suite still has the same 21 pre-existing failures.
</details>
2026-09-17 22:12:33 -07:00

24 lines
1.6 KiB
JavaScript

const test = require('node:test');
const fs = require('node:fs');
const os = require('node:os');
const path = require('node:path');
const { execFileSync } = require('node:child_process');
test('256 KiB cache uploads and planner draws preserve wide image and glyph offsets', () => {
const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'faceclaw-texture-java-'));
const javaBin = (name) => process.env.JAVA_HOME ? path.join(process.env.JAVA_HOME, 'bin', name) : name;
const root = path.join(__dirname, '../App_Resources/Android/src/main/java/com/faceclaw/app');
try {
const clock = path.join(directory, 'SystemClock.java');
const log = path.join(directory, 'Log.java');
fs.writeFileSync(clock, 'package android.os; public class SystemClock { public static long elapsedRealtime() { return 0; } }');
fs.writeFileSync(log, 'package android.util; public class Log { public static int i(String tag, String msg) { return 0; } }');
const sources = ['GlyphAtlas.java', 'ImageAtlas.java', 'FwGlyphAtlas.java', 'SurfaceCompositor.java',
'util/BmpUtil.java', 'util/CollectionUtils.java', 'g2protocol/BleProtocol.java',
'g2protocol/BleImageOptimizer.java', 'g2protocol/TextureCacheState.java', 'g2protocol/TexturePlanner.java'];
execFileSync(javaBin('javac'), ['-d', directory, ...sources.map(file => path.join(root, file)),
clock, log, path.join(__dirname, 'fixtures/TextureCacheProtocolTest.java')], { stdio: 'pipe' });
execFileSync(javaBin('java'), ['-ea', '-cp', directory, 'com.faceclaw.app.TextureCacheProtocolTest'], { stdio: 'pipe' });
} finally { fs.rmSync(directory, { recursive: true, force: true }); }
});