fix: use cross-context type detection in V8 serializer self-test#1899
fix: use cross-context type detection in V8 serializer self-test#1899mohammedahmed18 wants to merge 1 commit intomainfrom
Conversation
The V8 serialization self-test used `instanceof Map` which fails in Jest's sandboxed VM context where the Map class from v8.deserialize differs from the test environment's Map class. This incorrectly disabled V8 serialization, falling through to msgpack which often also isn't resolvable in monorepo setups. Replaced all `instanceof` checks in the serializer with `Object.prototype.toString.call()` for cross-VM-context compatibility, matching the pattern already used in the msgpack codepath. Trace IDs: 003e1410, fe2ae122, fde51112 (153 affected logs) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Claude finished @mohammedahmed18's task in 2m 8s —— View job PR Review SummaryPrek ChecksNot applicable — only a JavaScript file was changed. No Python linting to run. Code ReviewSMALL PR — focused correctness check. The fix is correct and well-targeted. Replacing
The pattern directly mirrors what was already in the msgpack codepath ( One detail worth noting: No bugs, breaking changes, or security issues found. Duplicate DetectionNo duplicates. This PR aligns the V8 codepath with the cross-context detection pattern already established in the msgpack codepath — it's intentional convergence, not duplication. Test CoverageSMALL PR, skipped per review policy. The PR description notes manual verification of the roundtrip and cross-context behaviour. Bot optimization PRs (#1895, #1891, #1890): All have CI failures across unit-tests, JS optimization tests, tracer-replay, etc. These same checks were already failing on the base branch (all three PRs share the exact same failure pattern). Leaving open for merge once base branch CI is fixed. Last updated: 2026-03-25T16:50:XX |
Summary
serializer.jsusedinstanceof Mapwhich fails in Jest's sandboxed VM context. This incorrectly disabled V8 serialization, then if@msgpack/msgpackalso wasn't resolvable in the monorepo, both serializers were unavailable -- causing "msgpack not available and V8 serialization not available" errors.instanceofchecks withObject.prototype.toString.call()in the V8 self-test,wrapForV8, andunwrapFromV8functions. This matches the cross-context detection pattern already used in the msgpack codepath.Trace IDs
003e1410,fe2ae122,fde51112,7ddc8834(153 affected logs)Test plan
Object.prototype.toString.call()correctly identifies Maps even cross-VM-context🤖 Generated with Claude Code