Repository navigation
Conversation
commit: |
|
/bonk review this |
1 similar comment
|
/bonk review this |
There was a problem hiding this comment.
Reviewed the Map serialization support. The implementation is well thought out and the test coverage is genuinely impressive — the promises inside a Map suite exercises the tricky bits (key/value slots resolving in either order, key collapse under Map semantics, insertion-order preservation, Blob round-trips, and the local deepCopy path). I ran the full node suite (165 passed) and test:types (clean) locally against this branch.
The core design decision — using entries as the source of truth and rebuilding the whole Map on each promise resolution via one-time-use setters — is a clever way to reuse the existing parent[property] = resolved delivery machinery for a structure that has no addressable positions. Nicely mirrors the Set-less-ness reasoning in the comments.
A few non-blocking observations below. None of them are correctness bugs — all tests pass — but the O(n^2) rebuild is worth at least acknowledging.
Notes
-
O(n^2) rebuild on resolution. Each resolved promise slot calls
map.clear()and re-inserts every entry, so a Map with n promise slots does O(n^2) work total. For typical payloads this is fine, but a large Map full of pipelined promises could be pathological. Given the constraint (Map has no stable index to write into), this is a reasonable tradeoff — just flagging it. A future optimization could defer the rebuild until all slots for a given batch have resolved, but that adds bookkeeping complexity that probably isn't worth it now. -
Type coverage for serialization. The
Map<K,V>types already exist insrc/types.d.ts(Stubify/Unstubify/RpcCompatible), so this PR correctly fills the runtime gap. Worth confirming there's a round-trip/type assertion somewhere in__type-tests__that aMapvalue survives —roundTripHeaders(new Map(...))exists but that's Headers-typed, not a Map-typed round trip. Optional.
Overall this looks good to merge. Nice work on the tests.
|
Review submitted successfully. Here's a summary of what I reviewed and posted on PR #232: Review SummaryThe PR adds runtime serialization for Verification I did:
Assessment: looks good to merge. The design is sound:
Non-blocking notes I posted (3 inline + summary):
No correctness bugs found. |
Co-authored-by: teamchong <teamchong@users.noreply.github.com>
🦋 Changeset detectedLatest commit: 97f8cc1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
recheck |
|
All contributors have signed the CLA ✍️ ✅ |
Adds serialization support for
Map. Doesn't special case.map()like we do for arrays, uses the default.Just like #229, we support reject lazy values in keys.
Closes #230