Files
opencode/packages
Kit Langton 7006de8935 refactor(http-recorder): tighten cassette safety, fix WS leaks + docs
Cleanup pass after sub-agent review.

Correctness fixes:
- WebSocket error messages no longer leak unredacted client frames or
  URLs into error output. websocket.ts passes `actual` through
  `safeText` (drops content with secret-pattern matches; truncates
  at 300 chars) and the "no recorded interaction" die message uses
  `redactUrl(request.url)`.
- WebSocket replay sendText: compare-then-advance ordering. Previous
  code advanced the cursor before the assertion, so a mid-stream
  mismatch left the cursor pointing past the failing frame.
- WebSocket record mode now uses `Stream.tap` (pure side-effect)
  instead of `Stream.map` for capturing server frames.

API tightening:
- `Cassette.Interface.append` returns `Effect<void, UnsafeCassetteError>`
  directly. The `appendOrFail` helper and `AppendResult` type are
  gone — the cassette adapter owns the safety contract. Both
  `fileSystem` and `memory` adapters fail with `UnsafeCassetteError`
  on findings.
- `UnsafeCassetteError` moved from recorder.ts to cassette.ts.
- `ResolvedMode` type alias dropped — inlined the union.
- Mid-file `import { Schema }` in redaction.ts moved to the top.

Tests added (5):
- passthrough mode bypasses recorder + writes nothing
- auto mode records to disk when cassette is missing
- UnsafeCassetteError blocks the request when recording would write
  a known secret
- Cassette.list enumerates recorded cassette names
- WebSocket replay decodes binary frames recorded as base64

Docs:
- Audit example in README compiles (was using `entry.name` after
  list() shape changed to plain strings).
- Layout table no longer references the deleted `storage.ts`.
- recorder.ts row reflects current contents (resolveAutoMode +
  ReplayState; appendOrFail removed).
2026-05-10 12:47:58 -04:00
..
2026-05-10 02:34:36 +00:00
2026-05-10 12:14:11 -04:00
2026-05-10 02:34:36 +00:00
2026-01-21 14:36:21 -06:00
2026-05-10 02:34:36 +00:00
2026-05-10 16:22:29 +00:00
2026-05-10 02:34:36 +00:00
2026-05-10 02:34:36 +00:00
2026-05-10 03:51:34 -04:00