Files
hermeven/docs/handoff/2026-11-18-cody-round-4.md
DanandClaude Fable 5.2 1507cea077 Address Cody review round 3: CODY-003 and CODY-006
CODY-003 Request identity is durable before submission. Storage results are
         explicit at the DevicePort boundary (storageSet resolves true only
         on the host's own timely confirmation; storageGet distinguishes
         unknown from empty). A request is not sent until the phone has
         confirmed storing its id; a timeout or refusal holds it back,
         unsent and retryable under the same id. Unreadable storage at
         start is not treated as unpaired; an unsaveable pairing is revoked.
CODY-006 The state directory is set to 0700 on every open, including when
         it already existed, and the bridge refuses to start with an
         operator-facing error if it cannot be. Deployment guide creates
         it with install -d -m 0700.

Checks: typecheck clean; npm test 194 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:29:05 -08:00

75 lines
4.2 KiB
Markdown

# Handoff for Cody, Round 4
From: Claude (implementation). Date: 2026-11-18.
**Not reviewed.** Cody's Round 3 verdict applies to `e1c02d5` only. Whether CODY-003 and CODY-006
are now closed is Cody's call on the new SHA.
| Item | Value |
|---|---|
| Repository | `git@git.xylo.gg:Xylo-Digital/hermeven.git` |
| Branch | `cody/slice-1-review` |
| Reviewed in Round 3 | `e1c02d52661987df7caaec9bd132855df90cb814` |
| `main` | `0c9dcd864f16782097471e5bbf57cbd701c26616` (unchanged; nothing merged) |
| New head for Round 4 | the tip of `cody/slice-1-review` after this push; exact SHA in the push report |
## CODY-003: request identity durable before submission
| Required correction | What was done |
|---|---|
| 1. Storage success/failure explicit at the DevicePort boundary | `storageSet` returns `Promise<boolean>`; `storageGet` returns `{ ok: true, value } \| { ok: false }` (`device/port.ts`). All three implementations updated. |
| 2. Never submit until persistence is positively confirmed | `Controller.submit()` returns without contacting the bridge unless `setActiveRequest()` resolved `true`. The controller tracks the last id the host confirmed (`confirmedActive`), so an unconfirmed id is written again on the next attempt instead of being assumed stored. |
| 3. On timeout or failure, remain safely unsent and show a retryable state | New `not_saved` event: phase `disconnected`, reason `storage`, resend allowed. The pending question is kept in memory. |
| 4. Same immutable request id across deliberate retries | The retry is the existing `resubmit` effect with the original request id. |
| 5. A caller timeout is not evidence the write succeeded | `EvenDevice.storageSet` returns `true` only for a host `true` received before the timeout. |
Beyond the letter of the finding, because it is the same failure on the read side: storage that
cannot be read at start is reported as unknown rather than as "not paired", and pairing over it is
refused. A pairing the phone cannot save is revoked on the bridge instead of living in memory.
## CODY-006: pre-existing state directories
| Required correction | What was done |
|---|---|
| 1. Enforce 0700 even when the directory exists | `secureStateDir()` in `db.ts` runs on every open, before anything is created inside. |
| 2. Clear operator-facing error if it cannot be secured | `StateDirectoryError` names the directory, the required mode and the remedy; `main.ts` prints it as "Cannot start: ...". |
| 3. Deployment instructions create or chmod explicitly | `docs/deploy-droplet.md` uses `install -d -m 0700 -o hermeven -g hermeven /var/lib/hermeven`. |
| 4. Database, WAL, SHM stay 0600 | Unchanged, and re-asserted in the new tests. |
## Checks
| Check | Result |
|---|---|
| `npm run typecheck` | exit 0 |
| `npm test` | 194 passed, 0 failed (was 182) |
| `npm run client:build` | built |
| `npm run test:real-stt` | 11 passed, 0 failed (all 11 existing tests) |
| `npm run test:real-hermes` | 9 passed, 0 failed |
| `npm run test:simulator` | 6 passed, 0 failed |
| `git diff --check` | clean |
No check was omitted. The proofs are listed in `docs/test-evidence.md` under "Round 4".
## The eight resolved findings
Not touched in substance. Their regression tests are unchanged and passing, apart from one
assertion in the CODY-002 queue test that now expects the explicit `{ ok: false }` read result.
## Things the author is unsure about
- **Whether the Even phone app confirms `setLocalStorage` promptly, or at all.** The simulator's
host does. If the phone's does not, this gate stops every question. That would be the correct
failure under this finding, but it would make the app unusable, and it can only be learned on a
device.
- While a host storage call is stuck, HUD updates queued behind it are not drawn (a consequence of
CODY-002's strict serialisation). The "could not save" message therefore appears only once the
host answers again.
- `secureStateDir` will set any directory it is pointed at to 0700. Pointing the database into a
directory shared with other software would lock that software out.
- The refusal test relies on `/tmp` being owned by another user; where it is not, the test reports
"NOT RUN" instead of passing.
## Not claimed
No physical device, no droplet, no deployment, no production change. Nothing merged to `main`.