Repository navigation
Conversation
lib.dom types postMessage as a window API, so checking the worker module failed on the transfer list. Cast once at the runtime boundary, where the worker runtime does accept a transfer list.
(cherry picked from commit 685852c)
ofriw
marked this pull request as ready for review
October 29, 2026 15:12
This was referenced Oct 29, 2026
Closed
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.
Note: This PR was generated by an AI agent. If you'd like to talk with other humans, drop by our Discord!
The problem
GoatDB kept the same knowledge about
CoreTypein three separate switch statements:base-encoder.ts,clone.ts, andequals.ts. Each new type demanded three edits. Forget one, and that type fell through with no error: a wrong clone, a wrong equality result, or a wrong byte on the wire. Nothing caught the gap at compile time.The change
base/core-types/type-ops.tsnow holds clone, equals, encode and childrenOf for every CoreType in one frozen table.kTypeOpsis declaredsatisfies Record<CoreType, CoreTypeOps>, so the compiler rejects a missing entry. The three switches are gone. The public helpers are thin now.The table recurses by calling itself, never the public wrappers. This keeps the module graph acyclic.
convertValueandfillRefsread the table too, so the encoder and the cyclical encoder share the same source of truth.Grouped changes
1. One home for type knowledge —
type-ops.tsaddsCoreTypeOps,CoreCloneContext,CoreChildrenand a sharedkNoChildrenconstant.clone.tsdrops from 139 lines to a single context allocation.equals.tsdrops its 242-line switch.BaseEncoderdeclaresconvert*methodspublic abstract, so the table can call them while subclasses keep control of encoding.2. A cycle removed —
encoding/encoded-ref.tsis a new leaf module. It owns theEncodedRefshapes and theisEncodedRefguards.cyclical.tsre-exports them, so no caller changes. The formertype-ops/cyclicalcycle is gone.3. Declared behavior changes —
CHANGELOG.mdrecords three items, so no reader must discover them: clone keeps shared references across array and set siblings;coreValueHashis removed in favor ofencodableValueHash;objectFilterFieldsequality is now symmetric. The last item fixes a real bug: the second comparison loop handed the wrong object to the filter.4. Known quirk kept, not fixed — Ref collection does not apply
iterableFilter. Final JSON encoding does. This is the pre-existing behavior, pinned by tests and markedTODO(#58-followup). A silent change here would move every__r/__dpayload.5. Tests that hold the line —
tests/core-value-serialization.test.tsadds 1094 lines of inline goldens: per-type JSON, error behavior, the cyclical ref matrix, checksums, clone aliasing, equality, and a frozen-and-exhaustive table check. If a later refactor moves a byte, the diff shows it, and a reviewer decides.6. Verification prerequisites — Only changes this branch needed to pass its own gates. Pins for Playwright 1.64.1, esbuild 0.25.12 and the esbuild plugin 1.2.1; regenerated build assets; a
node:httpoverload fix for the pinned Deno floor; a typedpostMessagetransfer list; a type-only import in the log entry; and a compile fixture that links local GoatDB before it installs app dependencies.Impact
Type dispatch has one owner. A new CoreType is one entry plus one classifier branch, and the compiler enforces the rest. Serialized output stays where it was, because goldens say so, not because reviewers hoped so.