Deduplicate relay events after verification - #6
Conversation
|
Please let me know when this is ready for review |
f7c932a to
09e87d7
Compare
|
Ready for review at Rebased onto the current Local validation passed with Node 24.19.0 and Go 1.27.1: the full The separate #7 integration concerns remain tracked in #7 (comment). |
…pe stripping Two findings from review of the branch (edgepillar, PR sol-znn#7). The Web Lock wrapper discarded the promise that locks.request returns. A request the manager rejects before granting -- the specification allows a SecurityError -- never invokes the holder, so nothing answered the call and it hung past the API timeout, which starts only once the lock is held. The rejection is now handled: before a grant it answers the call as a refusal, naming the reason; once the holder is running it changes nothing, because the work is under way and its save may already have landed, so the only true answer is the work's own. The answer goes through a once, so no path can send twice on the channel from a browser callback, and a manager that throws synchronously releases both callbacks it never took. The smoke suite stands in a lock manager for each shape: refused before grant, granting in order and serialising two calls, rejecting after the holder has released, rejecting while it still runs, and throwing; and it counts any rejection left unhandled as a failure. EngineError declared its code as a constructor parameter property, which Node's type stripping refuses. Nothing under Node reached wasm.ts on this branch alone, but sol-znn#6's relay test loads useSession.ts, which now imports isStaleWrite from it, so the combined tree failed to load. The field is declared and assigned instead. Verified by merging sol-znn#6 on top and running its relay:delivery on Node 24: fails before, 12/12 after. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TiMc1yHDcGagiEPA6udCjm
Record relay event IDs only after the existing WASM verification succeeds. A synchronous acceptance gate lets session and board consumers apply each verified event once, including when multiple copies finish verification concurrently. Pending verification and deliveries from retired connections are prevented from updating a replacement session or board.
Adds 12 offline regression tests using the actual relay pool, session, board, and Vue modules with fake sockets and stubbed API replies. The suite runs through
npm testand the existing build workflow. No dependencies are added.Targets
092026-auditat028c03d01c27494a420dc19df121fb39d6da3be8, including the merged #8 and #9 changes. Both the date-formatting and relay-delivery checks are retained innpm testand the build workflow. The contribution remains limited to six files and the relay-delivery scope discussed in #5.Local validation of
09e87d70aed58dcba9554acdc611f9ee75310aacwith Node 24.19.0 and Go 1.27.1:npm testpassed: Go tests, wallet-provider checks, printed-command checks, date-formatting checks, 12/12 relay tests, and production WASM smoke checks. The relay suite uses its existing runner without TypeScript transformation flags.npm run typecheckandnpm run lintpassed.go test -race ./..., hostgo vet ./..., andGOOS=js GOARCH=wasm go vet ./...passed.The relay fixtures are synthetic and contain no keys or signed messages. JavaScript fetch access was disabled through a local preload for
npm testand the development smoke run; Go HTTP tests used their own local test servers. Dependencies were reused from an installation with the identical lockfile. These are local results, with no live wallet/chain or hosted-CI validation claimed.