Files
scriptc/tests
Malte UblandClaude Opus 5.5 ea9b70d1ad Cross island records of intersection types out as copies
An island export whose declared type is an INTERSECTION of record types —
typebox's `Type.Unsafe<{[K in "fg" | "bg"]: V} & {[K in "accent"]?: V}>`,
the mapped halves of pi's ThemeColorValues read off the island's theme
schema — was refused with SC8010 ("an island value of type … only primitives
and strings are copied"). The crossing classified values with
exportedByReference, which requires the object flag, so an intersection of
records looked like a value with no native representation even though
mapTypeOf maps it to the record its parts make.

The copy decision for a value crossing OUT is now copiedRecordType: the
object types exportedByReference names, and intersections of them (nullish
arms aside). Such a value crosses as the deep checked copy the record path
already uses, so a field that contradicts the declaration throws
`TypeError: expected string at $.fg, got number` instead of entering
natively typed memory (types don't lie). Copy, not view, for the reason
9a8e964 chose for arrays: nothing native can alias the island's object.

Test: tests/corpus/6899-node-island-unsafe-record (differential to Node,
plain and sanitized) and the lying-record case in
tests/harness/node-island-handles.test.ts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 19:14:36 -07:00
..
…