Files
hermeven/docs/test-evidence.md
T
DanandClaude Fable 5.2 6d74f9e121 Build speech-to-text into the bridge; add droplet deployment examples
STT_PROVIDER now defaults to "builtin": Whisper (onnx-community/whisper-base,
q8) runs in the bridge process on the CPU via @huggingface/transformers, so
no provider account is needed and recordings stay on the bridge host. Silent
captures are detected by level before the model runs. The external
OpenAI-compatible adapter remains available.

Tests: 130 unit/integration; 4 scenarios with the real model on a real
speech recording (npm run test:real-stt). Not tested on audio from the
glasses or on a droplet.

deploy/ and docs/deploy-droplet.md are examples that have not been run.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-18 18:31:30 -08:00

239 lines
13 KiB
Markdown

# Test evidence
Recorded 2026-11-18 on the development machine (Linux x64, Node 22.23.2). The first slice was
recorded at commit `4687cc0`; the built-in speech-to-text section was added afterwards and all
suites were re-run with it in place.
These are the results of commands that were actually run. Nothing here is device evidence.
## What kind of evidence each suite is
| Suite | Real | Fake or stubbed | Shows | Does not show |
|---|---|---|---|---|
| `npm test` | Client and bridge code, HTTP between them, SQLite, Even's `pretext` measurement, the SDK's event parser | Glasses, STT, Hermes | Hermeven's own logic and failure handling | Anything about Even hardware, real STT or real Hermes |
| `npm run test:simulator` | The client running in Even's simulator 0.9.5 through the real SDK bridge; the bridge | STT, Hermes; audio is ALSA's silent null device | The app boots, draws, takes gestures and uploads audio in Even's own simulator | Hardware behaviour, real audio pacing, lock screen, lifecycle |
| `npm run test:real-hermes` | The bridge and a real `hermes gateway` v0.23.1 | The language model behind Hermes | Hermes's admission, idempotency, session continuity and stop behave as the adapter assumes | A real model, tools, approvals, or Dan's deployment |
| `npm run test:real-stt` | The bridge and its built-in Whisper model, on a real speech recording | Glasses, Hermes | Speech uploaded as a capture is really transcribed and the words reach the agent | The G2 microphone, noise, accents, other languages, a droplet's speed |
## Results
### Type check
```
$ npm run typecheck
```
Exit 0, no diagnostics, for contracts, bridge, client and tests.
### Unit and integration (fakes)
```
$ npm test
Test Files 8 passed (8)
Tests 130 passed (130)
```
Run after a clean `npm ci`. Six consecutive full runs were green after the fix described under
"Problems found" below.
| File | Tests | Covers |
|---|---|---|
| `packages/contracts/test/contracts.test.ts` | 4 | Schema acceptance and rejection, error-code retryability |
| `services/bridge/test/units.test.ts` | 13 | Config guards, credential expiry and renewal, pairing codes, adapter helpers |
| `services/bridge/test/builtinWhisper.test.ts` | 8 | Built-in STT adapter with a stand-in recogniser: silence gate, language, ordering, cancel, load failure |
| `apps/even-client/test/reducer.test.ts` | 24 | State transitions, cancellation, stale and late results, connection loss |
| `apps/even-client/test/layout.test.ts` | 16 | Pagination, Unicode, long answers, plain-text conversion, HUD frames fit |
| `apps/even-client/test/events.test.ts` | 8 | Gesture mapping through the SDK's parser, the tap-has-no-eventType quirk |
| `tests/integration/bridge.test.ts` | 40 | Auth, device binding, limits, rate limiting, STT and Hermes outcomes, duplicates, cancel, restart, redaction |
| `tests/integration/client-bridge.test.ts` | 17 | Whole software path: capture to paged answer, follow-up, cancel, loss, restart, revocation |
Requirements from spec section 9 and where they are tested:
| Requirement | Test |
|---|---|
| State machine, cancellation, stale-response races | `reducer.test.ts`; `client-bridge` "late answer never reaches the HUD" |
| Layout, pagination, Unicode, long answers | `layout.test.ts` |
| Contract validation, auth, device/profile binding, body limits, rate limiting, redaction | `bridge.test.ts`, `units.test.ts`, `contracts.test.ts` |
| STT failure and timeout | `bridge.test.ts` "STT failures" |
| Hermes failure, cancellation, incomplete, approval | `bridge.test.ts` "turn lifecycle" |
| Duplicate submit | 8 concurrent identical submits: 1 execution |
| Retry after network loss | Lost Hermes reply retried under one key; client resend of an undelivered request |
| Bridge restart | Mid-run re-attach; crash between send and recording the run id; restart during transcription |
| Repeated cancel | 5 concurrent cancels: one stop sent to Hermes |
| Unknown downstream outcome | Unanswered submit; Hermes `unknown`; run forgotten; unconfirmed stop |
### Did the tests have teeth?
Because the suites passed on first run, ten deliberate faults were injected one at a time and
the suite re-run. Eight were caught immediately. Two survived, which exposed two missing tests;
both were added and both faults are now caught.
| Injected fault | Caught |
|---|---|
| Client accepts stale turn results | Not at first; test added; now 2 failures |
| Bridge skips request-id deduplication | 3 failures |
| New idempotency key on every Hermes attempt | 3 failures |
| Cancel does not ask Hermes to stop | 5 failures |
| Turn lookup ignores device ownership | 1 failure |
| Unanswered submit treated as safely retryable | Not at first; test added; now 1 failure |
| Recovery discards an in-flight run | 2 failures |
| Microphone reopens on glasses reconnect | 2 failures |
| Transcript written to the log | 1 failure |
| Pagination ignores the line budget | 5 failures |
### Simulator
```
$ npm run test:simulator
Tests 6 passed (6)
```
Even Hub simulator 0.9.5, launched with `--automation-port`, `--no-glow`, `--aid alsa:null`.
Ten consecutive runs passed in the final form of the test.
| Scenario | Result |
|---|---|
| Boots through the SDK bridge, creates the HUD page (with the menu declaration), pairs | pass |
| Tap opens the microphone; frames arrive; capture is uploaded as 16 kHz mono 16-bit WAV; answer is drawn across pages | pass |
| Swipe down changes the page; swipe up returns a pixel-identical first page | pass |
| A second question continues the same Hermes session (fake) | pass |
| Double tap while recording cancels with no upload; double tap again returns to Ready | pass |
| No uncaught errors, unhandled rejections or failed fetches in the WebView | pass |
Screenshots from the simulator (not from glasses) are in `docs/evidence/simulator/`.
Caveats, all of them material:
- **Audio pacing was not tested.** The silent null device was chosen so the test would not open
the machine's real microphone. It is not paced in real time: between 19 and 120 "seconds" of
silence arrived within a few hundred milliseconds. So "tap again to stop" is sometimes pre-empted
by the capture cap in this test, and the elapsed-time display was never seen counting in real
time. The test asserts what holds on either path.
- **The simulator test was flaky before it was fixed.** Across three earlier revisions of the
test, 10 runs were made: 6 passed fully and 4 had one or two failing scenarios (the cap fired
before the scripted second tap; an instant second tap recorded nothing). Those were faults in
the test's timing assumptions, corrected as above; the app's behaviour in both cases was the
designed one. The 10 consecutive passes are of the final revision only.
- **The contextual menu was declared but no item was selected.**
- **Status events are not emitted by the simulator**, so glasses connect/disconnect is untested here.
- The simulator's event source is always the right temple. Ring and left temple are untested.
### Real Hermes, stub model
```
$ npm run test:real-hermes
Tests 9 passed (9)
```
hermes-agent v0.23.1 (`/health` reported `"version":"0.23.1"`), started with a throwaway
`HERMES_HOME` and pointed at a local stub model. The operator's own Hermes home was not read or
written (its `state.db`, `config.yaml` and `gateway_state.json` modification times were unchanged).
| Scenario | Result |
|---|---|
| Capabilities advertise run submission, status, stop, and durable idempotency (86,400 s retention) | pass |
| Device status reports the agent reachable | pass |
| Typed question answered through Hermes; Hermeven's per-request instructions reach the model's system prompt | pass |
| Follow-up: the model was handed both user turns by Hermes although the bridge sent only the new one; a new conversation starts clean | pass |
| Six concurrent identical submits reach the model once | pass |
| Hermes replays an identical keyed request and answers 409 to a changed one | pass |
| Cancel during a slow turn settles as cancelled with no answer | pass (about 200 ms to confirm) |
| Bridge restart mid-turn re-attaches; the model is called once | pass |
| Wrong Hermes key: rejected, nothing runs | pass |
Two of the nine failed on the first run because the stub model mistook Hermes's background
"name this chat" request for an agent turn. That was a fault in the stub, fixed.
Timings seen here (stub model, loopback, one sample each): first turn about 1.4 s in Hermes;
later turns well under 1 s. These are not performance figures for anything real.
### Built-in speech-to-text, real model, real speech
```
$ npm run test:real-stt
Tests 4 passed (4)
```
`onnx-community/whisper-base`, 8-bit weights, run in the bridge process on the CPU. The input is
`tests/real-stt/fixtures/jfk.wav`, 11.0 s of clean archive speech, uploaded through
`POST /v1/turns` as raw PCM exactly as the client uploads a capture.
| Scenario | Result |
|---|---|
| Real speech is transcribed and the transcript is what the (fake) agent receives | pass |
| Three seconds of digital silence: `stt_empty`, the agent is not called | pass |
| Three seconds of very quiet noise: `stt_empty` | pass |
| A second recording with the model already loaded | pass |
Transcript produced: "And so my fellow Americans, ask not what your country can do for you, ask
what you can do for your country." That matches the recording.
Measurements from this run, one sample each, on an Intel i7-13850HX desktop:
| Measurement | Value |
|---|---|
| Model load (files already cached) | 1.2 to 3.8 s |
| 11.0 s of speech | 1.6 s |
| Memory (resident) after loading / after transcribing | about 0.5 GB / 0.8 GB |
| Longest event-loop pause during transcription | 0.39 s |
| Same clip with the process pinned to one core | 1.7 s (no slower) |
Things this run also showed that are worth knowing:
- When the same clip was cut off mid-sentence at 6 s, the model wrote "ask not what you are
coming" for the truncated ending. A recording that stops mid-word (for example at the capture
cap) can end in invented words.
- Whisper produces short invented phrases for silent input, which is why silence is detected by
level before the model runs. The level threshold (-55 dBFS) was chosen without any G2 audio and
may be wrong for the real microphone in either direction.
- Nothing here measures a droplet. See `docs/deploy-droplet.md`.
The bridge process was also started with default settings: it logged `stt.loading`, then
`stt.ready`, and answered `/healthz` throughout.
### Build and packaging
```
$ npm run client:build # 291 kB JS (88 kB gzip), 2 kB CSS
$ HERMEVEN_BRIDGE_ORIGIN=https://bridge.example.invalid node apps/even-client/scripts/write-manifest.mjs
$ evenhub pack dist-manifest/app.json dist --sdk-ver 0.0.16
Stamped ... (95914 bytes) min_app_version 2.2.10
```
The official CLI accepted the generated manifest. The package was not uploaded anywhere. The
production bundle was searched for server key names and the development-only pairing hook; none
were present.
### Process smoke test
`npm run bridge` started, `/healthz` answered `{"status":"ok","schema_version":1}`, an
unauthenticated `/v1/device` answered 401, `bridge:cli -- pair` printed a code, and starting with
`HERMEVEN_HOST=0.0.0.0` was refused with the configuration error.
## Problems found while testing
| Problem | Kind | Resolution |
|---|---|---|
| A stopped client controller kept polling and could draw or emit afterwards | Product bug | `Controller.stop()` is now final; found by an intermittent cross-test failure |
| Two faults not detected by the suite | Test gap | Two tests added |
| `evenhub-simulator` command link missing after `npm ci` | Tooling quirk | `npm run simulate` calls the package directly |
| Simulator test timing assumptions | Test fault | Described above |
| Stub model counted housekeeping calls as turns | Test fault | Fixed |
## Not tested at all
- A physical G2, the R1 ring, the Even phone app, any phone.
- The microphone with the phone locked or the app in the background.
- Speech-to-text on audio from the glasses, with background noise, or in any language but English.
- The external (`openai-compatible`) STT adapter against a real provider.
- Anything on a DigitalOcean droplet: `docs/deploy-droplet.md` and `deploy/*` are untested.
- A real language model, real tools, a real approval prompt.
- Hermes `waiting_for_approval`, `unknown`, `interrupted` and stopped-short runs against real
Hermes (fake only).
- Dan's target Hermes deployment and any multi-profile routing.
- HTTPS termination, reverse proxy, or any network other than loopback.
- CORS from the real WebView origin; the network whitelist on a packaged build.
- Battery use, latency percentiles, legibility.
- Selecting a contextual-menu item.
The checklist for the hardware items is `docs/device-test-plan.md`.