feat(sim): the wire — vendored runtime, route B, headless tests - #16
Merged
Conversation
Milestone 1b (docs: design/playground-simulation.md). - app/src/sim/runtime/ — @comline/runtime src/ copied verbatim from comline-typescript @ 5c20074 (unpublished workspace package; pinned by copy, VENDORED.md records the commit + re-vendor steps). Plus the generated chat.ts fixture for the drift guard. - transport.ts — Tap (records every frame, notifies listeners) and TappedTransport wrapping one duplex() end; `wire(a, b)` builds a tapped connection with an optional fixed delivery latency. - generic.ts — GenericClient / GenericDispatch: read a ProtocolShape and do what a generated <Proto>Client / dispatcher does, so any compiled schema is wireable with no codegen. SimRemoteError maps an err ordinal back to its name via the calling function's throws. - wire.test.ts (node --test via tsx): send round-trips a decoded reply over datagram and JSON-RPC; a raised error comes back as SimRemoteError with the ordinal's name; a one-way call sends a request and no reply; and the drift guard — GenericDispatch's frames are byte-identical to the generated ChatDispatcher's for a send call. - CI runs `npm test` (node 22) before the site build; tsconfig.test.json typechecks the sim scope with @types/node. No UI, no app-bundle change (nothing imports sim/ from an entry yet).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Milestone 1b of playground simulation.
Vendored
@comline/runtimeapp/src/sim/runtime/isruntime/src/fromcomline-typescript@5c20074, copied verbatim (unpublished workspace package,version 0.0.0— pinned by copy the waywasm/Cargo.tomlpinscomline-coreby rev).VENDORED.mdrecords the commit and the re-vendor steps._fixture_chat.tsis the generatedchat.tsfrom the same commit, its@comline/runtimeimport repointed — it's the drift guard's reference.transport.ts— the tapped wireTaprecords every frame ({ seq, from, to, bytes, at, kind }) and notifies listeners;TappedTransportwraps oneduplex()end and passessend/recvstraight through (optional fixed delivery latency).wire(a, b)= a tapped connection between two named endpoints.generic.ts— route BGenericClient/GenericDispatchread aProtocolShapeand do what a generated<Proto>Client/<Proto>Dispatcherdoes — any compiled schema is wireable with no codegen.SimRemoteErrormaps anerrordinal back to its name via the calling function'sthrows.Tests —
node --testviatsxThe drift guard runs a
sendcall throughGenericDispatchand through the committed generatedChatDispatcher/serveChaton separate tapped wires and asserts the post-handshake frames are byte-identical.CI runs
npm test(Node 22) before the site build;tsconfig.test.jsontypechecks thesim/scope with@types/node(kept out of the browser build, which still excludes*.test.ts).No UI, no app-bundle change — nothing imports
sim/from an entry yet (that's 1d).