Skip to content

test(server): pin mutation/command error paths with wire-level tests#4

Open
grrowl wants to merge 1 commit into
feat/ssrfrom
advisor/001-server-error-path-tests
Open

test(server): pin mutation/command error paths with wire-level tests#4
grrowl wants to merge 1 commit into
feat/ssrfrom
advisor/001-server-error-path-tests

Conversation

@grrowl

@grrowl grrowl commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Executes plan 001 from the advisor audit (deep audit @ 8e157ef). Tests only — no src changes.

What

9 wire-level tests in tests/error-paths.test.ts (+ a throwing boom command in the test worker) pinning the previously-untested error paths:

  • execute throw mid-transactionSync → rejected, rolled back, no delta leak
  • whole-batch rollback when op 2 of a multi-op mutation throws
  • authorize failure on op 2 rejects before any write
  • unknown mutation type / unknown command (UNKNOWN_COMMAND) rejections
  • retried rejected txId replays the rejection (exactly-once in failure)
  • retention-floor reconnect: reset followed by fresh snapshot, order asserted
  • readSyncSnapshot throws on unknown collection

Review notes

  • Adversarially reviewed: done criteria re-run, scope clean, tests audited as falsifiable.
  • One documented deviation, verified correct on merit: the floor-reset test needed 3 rows/prune-2 (the plan's 2-row setup lands on the since >= floor-1 catch-up branch by design).

Base for the stacked PRs #—(004) and #—(005).

🤖 Generated with Claude Code

Adds 9 tests in tests/error-paths.test.ts covering the server's
previously-uncovered error paths: execute-throw atomicity (single and
multi-op rollback), authorize-fail before any write, unknown mutation/
command rejection, exactly-once replay of a rejected txId, command-boom
execute throw, unknown-command UNKNOWN_COMMAND code, retention-floor
reconnect reset + fresh snapshot, and readSyncSnapshot unknown-collection
throw.

Also adds a `boom` command to tests/test-worker.ts (one defineCommand only).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant