Files
hermeven/docs/test-evidence.md
DanandClaude Fable 5.2 f02715fb64 Address Cody review round 4: CODY-006 state-directory ownership
The state directory must now be owned by the bridge's effective uid. A
directory owned by anyone else is refused with StateDirectoryError before
any file is created or opened, and is left exactly as found, even when its
mode is already 0700. Mode enforcement (exactly 0700) is unchanged and runs
after the ownership check.

Tests: the real /root as an unprivileged user; a deterministic injected-uid
case proving no database/WAL/SHM is created and the directory is not
mutated; a foreign-owned loose-mode directory left unmodified; a user-
namespace fixture using the unmodified production path.

Checks: typecheck clean; npm test 198 passed; client build ok;
test:real-stt 11 passed; test:real-hermes 9 passed; test:simulator 6
passed; git diff --check clean.

Not reviewed. No physical-device, droplet or production evidence.

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

26 KiB

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  131 passed (131)

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 25 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  7 passed (7)

onnx-community/whisper-base, 8-bit weights, run on the CPU in a worker thread of the bridge. 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
Two devices submit recordings at the same moment: both transcribed, in turn pass
A model id that does not exist: speech is unavailable, the bridge keeps answering pass
Closing the adapter stops the worker; a closed adapter refuses work 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 with the model in the bridge's main thread; 3 ms after moving it to a worker thread
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.

Polling intervals

Shortened at Dan's request. These are settings, and their effect on a real answer has not been measured on a phone.

Loop Before Now
Bridge asks Hermes for run status every 500 ms every 150 ms (HERMES_POLL_INTERVAL_MS)
App asks the bridge for the turn every 700 ms every 200 ms for the first 8 s, 400 ms until 30 s, then 1 s

Worst-case delay added by polling to an answer that arrives within 8 s: about 0.35 s, down from about 1.2 s. The app's schedule eases off for long agent runs to limit radio use; battery impact is unmeasured.

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.

Round 3: after Cody's review (2026-11-18)

Cody reviewed 3d5691d and returned NEEDS CHANGES with ten findings. This section records what was run after the fixes. Everything above this heading describes the code before them; where a number differs, this section is the current one.

$ npm run typecheck            exit 0
$ npm test                     Test Files 10 passed (10)   Tests 182 passed (182)   (4 consecutive runs)
$ npm run client:build         built; the development pairing hook is absent from the bundle
$ npm run test:real-stt        Tests 11 passed (11)
$ npm run test:real-hermes     Tests 9 passed (9)
$ npm run test:simulator       Tests 6 passed (6)          (3 consecutive runs)
$ git diff --check             clean

No check was omitted. The offline speech test needs unprivileged network namespaces (unshare -rn); they were available here and the test ran. Where they are not, that test prints "OFFLINE CHECK NOT RUN" rather than passing silently.

Regression tests added, by finding

Finding Test (file) What it proves
CODY-001 tests/integration/clientSecurity.test.ts 15 public, private-LAN and look-alike HTTP addresses rejected; HTTPS accepted; HTTP accepted only for localhost, 127.x.x.x, [::1]; the HTTP client refuses a remote HTTP base URL; manifest generation exits 1 and writes nothing for remote HTTP
CODY-002 same file, fake timers and a host whose calls settle on command Start times out, host opens the microphone late: a stop follows and the microphone ends closed; at most one host call in flight throughout; stop requested during a pending start waits its turn; calls queued behind a stuck call are sent one at a time
CODY-003 tests/integration/client-bridge.test.ts Every reply dropped after the bridge admitted the turn, then a client restart: one Hermes execution for that request, re-attached under the same request id, the HUD never said "not sent"; a request that truly never arrived is reported only after the bridge confirms it has no record; an undeliverable cancel is retried on the next start
CODY-004 tests/integration/bridge.test.ts Revoking over HTTP during a hanging run: one stop request reaches Hermes, the turn settles as cancelled, every later request is 401; the same through the CLI path (database only); revocation during transcription aborts it within 250 ms, in-process and via the sweep; another device's turn is untouched
CODY-005 services/bridge/test/modelStore.test.ts, tests/real-stt/realStt.test.ts Branch, tag and short revisions refused; unknown model without a manifest refused; a hub serving different bytes fails the fetch and leaves nothing behind; a changed or missing file refuses to load, with no network request; real pinned artifacts fetched from the real hub and verified; one flipped byte in the real model refuses to load; transcription from a read-only store; transcription inside a network namespace with no interfaces
CODY-006 services/bridge/test/units.test.ts In a child process under umask 0022: directory 0700, database, WAL and SHM 0600, and none of the three was group- or world-accessible at any point observed during creation
CODY-007 tests/integration/client-bridge.test.ts Credential expires during a live session: asking, waiting for an answer, status refresh, renew and new conversation each clear the stored pairing and return to the pairing screen; pairing again works
CODY-008 tests/integration/bridge.test.ts Restart before the original agent deadline: approval timeout still fires 700 ms after the approval was first seen, not after the restart; restart after the original agent deadline: still classified approval_timeout; approved after a restart: the paused deadline is stored and survives a second restart; a run that never finishes afterwards ends as agent_timeout
CODY-009 tests/integration/client-bridge.test.ts, apps/even-client/test/reducer.test.ts "New conversation" twice plus an immediate question with the reply delayed: one create, one stored id equal to the bridge's active conversation, the question succeeds; cancel-and-ask-again during a pending lazy create: one create; a reset during a pending create with the first reply arriving late: its result is dropped before persistence, the second create is not sent until the first settles, app and bridge agree
CODY-010 tests/integration/bridge.test.ts 40 wrong guesses, then the real code still pairs; every failure (wrong, expired, used) is byte-identical; a client is cut off after its 5 attempts per minute

Did the new tests have teeth?

Each fix was removed or broken in turn, 20 ways, and the default suite re-run. 16 were caught at once. Two more exposed missing coverage (the CLI-path sweep during transcription; a database file created loose and tightened a moment later); tests were added and both are now caught. The remaining two are redundant safeguards whose removal changes nothing observable: the directory chmod after mkdir with mode 0700 (a umask can only remove permissions), and the final permission pass after a file that was already created owner-only.

Real deployment sequence, run by hand on the development desktop

verify-model on an empty store exited 1 ("missing"). The bridge started without the model, answered /healthz, and logged stt.load_failed with reason: missing and the command to run. fetch-model downloaded 7 files (79 MB) from huggingface.co at the pinned commit in 4 s and verified them. verify-model then exited 0, and the bridge logged stt.ready in 1.1 s. The state directory was 700 and the database, WAL and SHM files 600.

This was not a droplet. deploy/ and docs/deploy-droplet.md remain unrun.

Still not tested

Unchanged from the list above: no physical G2, no audio from the glasses, no real model or tools behind Hermes, no approval prompt from a real Hermes, no droplet, no HTTPS termination.

Round 4: after Cody's Round 3 review (2026-11-18)

Cody reviewed e1c02d5: eight findings resolved, CODY-003 and CODY-006 still open. This section records what was run after correcting those two.

$ npm run typecheck            exit 0
$ npm test                     Test Files 11 passed (11)   Tests 194 passed (194)   (3 consecutive runs)
$ npm run client:build         built
$ npm run test:real-stt        Tests 11 passed (11)        (all 11 existing tests, including the no-network run)
$ npm run test:real-hermes     Tests 9 passed (9)
$ npm run test:simulator       Tests 6 passed (6)          (3 consecutive runs)
$ git diff --check             clean

No check was omitted.

CODY-003: request identity durable before submission

tests/integration/durableRequestId.test.ts uses the production EvenDevice adapter with a stand-in Even host whose setLocalStorage completes only when the test releases it. The bridge is real; Hermes is the test fake.

Scenario Result
Host write stalled past the adapter timeout: zero POST /v1/turns, no turn on the bridge, no Hermes run, the durable copy does not hold the id; a retry while still stalled is held back again under the same id pass
Host completes the write: the id becomes durable and that alone sends nothing. Deliberate retry: admitted, every reply dropped. Page restart: re-attached under the same request id, exactly one Hermes run for it, and no HUD text after admission says "not sent" pass
Same sequence with a hanging agent, restart, then double tap: Hermes is asked to stop and the turn settles as cancelled pass
Cancel while still held back for storage: nothing is sent, nothing exists on the bridge pass
Host answers the write with false: held back; succeeds on retry once the host accepts pass
Page dies during the stall and the host writes late: the next start finds no such turn on the bridge and says so pass
Storage unreadable at start: not treated as "not paired"; pairing over it is refused and the code is not spent pass
Pairing that the phone cannot save: revoked on the bridge, not kept in memory pass
Adapter unit test (fake timers): only a timely true is success; timeout and false are "not confirmed"; a stalled read is "unknown", not "empty" pass

In the simulator, the real SDK host answered storage writes with a confirmation, so questions were sent normally (the simulator suite would otherwise fail). Whether the Even phone app confirms setLocalStorage the same way, and how quickly, is unknown until it runs on a phone. If the phone never confirms a write, no question can be sent; the HUD would say "Could not save your request on the phone".

One consequence worth knowing: host calls are sent strictly one at a time, so while a storage write is stuck, HUD updates queued behind it are not drawn until it completes.

CODY-006: state directory permissions

services/bridge/test/units.test.ts:

Scenario Result
Child process under umask 0022, state directory pre-created at 0755: after opening the database and creating WAL and SHM, directory 0700, database, WAL and SHM 0600 pass
Pre-existing directories at 0750, 0777, 0711 and 0701 all end at exactly 0700 pass
A directory that cannot be secured (/tmp, owned by another user): StateDirectoryError naming the directory, the required mode and the fix; no file created; the directory left unchanged pass
A path whose parent is a file: refused pass
Retained: new directory under umask 0022, and the check that no state file is ever group- or world-accessible during creation pass

Did the new tests have teeth?

Eight ways of removing these two fixes were tried against the default suite; all eight were caught (between 1 and 6 failing tests each).

Round 5: after Cody's Round 4 review (2026-11-18)

Cody reviewed 1507cea: CODY-003 resolved; CODY-006 still open because secureStateDir() accepted a directory already at 0700 that belonged to another user (reviewer proof: secureStateDir('/root') returned successfully for uid 1000).

$ npm run typecheck            exit 0
$ npm test                     Test Files 11 passed (11)   Tests 198 passed (198)   (3 consecutive runs)
$ npm run client:build         built
$ npm run test:real-stt        Tests 11 passed (11)
$ npm run test:real-hermes     Tests 9 passed (9)
$ npm run test:simulator       Tests 6 passed (6)
$ git diff --check             clean

No check was omitted, and none of the new tests printed "NOT RUN" on this machine.

Cody's reproduction, re-run on the corrected code as uid 1000:

secureStateDir('/root')
StateDirectoryError: The state directory /root is owned by uid 0, not by the bridge, and has
been left untouched. The bridge keeps device credentials there and needs a directory of its own,
owned by uid 1000, the user it runs as, with mode 0700. ...

New tests in services/bridge/test/units.test.ts:

Scenario Result
The real /root (uid 0, mode 0700) as uid 1000: StateDirectoryError from both secureStateDir and openDb; mode, owner, mtime and ctime of /root unchanged pass
Deterministic, any machine: a 0700 directory whose owner differs from the bridge's uid (the uid is injected, the directory is real): StateDirectoryError; the directory stays empty (no database, WAL or SHM); mode, owner and timestamps unchanged. With an existing empty database file present: not opened, still 0 bytes pass
Foreign-owned directory at 0755: refused, and still 0755 afterwards (not "fixed" for someone else) pass
Isolated user fixture: in a user namespace (unshare -r), with the unmodified production code path and the process's real uid, a foreign-owned 0700 directory is refused and unchanged pass

Retained and passing: new directory under umask 0022; pre-existing 0755 directory tightened to 0700 with database, WAL and SHM at 0600; the loose-mode matrix (0750, 0777, 0711, 0701); the transient-permission check; the cannot-secure refusal with its operator message; the parent-is-a-file refusal.

Three ways of removing the ownership check were tried against the suite; all three were caught (2 to 4 failing tests each).