You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
@ark/schema & JIT: symbol-keyed meta cache leak, MorphNode middle-pipe refs, prototype-key TypeError, unknown alias error, and +:"reject" JIT parity #1778
Five remaining runtime/JIT edge bugs in @ark/schema and arksets:
Repros
// 1. Symbol-keyed meta leaks between Types via schema node cacheconstsym=Symbol("tag")type("string").configure({description: "d",[sym]: "v"});(type("string").configure({description: "d"}).metaasany)[sym]// "v" (leaked)// 2. MorphNode middle piped node missing from hasAlias / otherRefsconstCyclic=scope({N: {a: "string","b?": "N"}}).export().Nconstm=type("string.json.parse").pipe(Cyclic,x=>x)m.internal.hasAlias// false (expected true); m.internal.otherRefs.length === 0// 3. type.schema prototype key crashes with TypeError instead of ParseErrortype.schema({domain: "string",toString: 1})// TypeError: Cannot read properties of undefined (reading '0')// 4. Unknown alias reference throws InternalArktypeError instead of ParseErrorrootSchema({reference: "constructor"})// InternalArktypeError: Unexpected resolution for reference constructorrootSchema({reference: "__proto__"})// InternalArktypeError: Unexpected resolution for reference __proto__// 5. JIT vs jitless mismatch on "+": "reject" for inherited/non-enumerable/getter keysconstU=type({size: "0",x: "string"}).or({size: "1"}).or({"+": "reject"})U.allows(newMap())// cold (uncompiled): true; warm (JIT): false
Causes & Fixes
1 (schema node cache): Node serialization/hashing ignores symbol keys in meta, returning the cached node with the earlier Type's symbol metadata. Include symbol keys in meta identity or bypass caching when symbol meta is present.
2 (ark/schema/roots/morph.ts:97-99, 121-135):includePiped and otherRefs only inspect morphs[morphs.length - 1]. Walk all intermediate hasArkKind(m, "root") entries in this.piped.
3 (ark/schema/parse.ts:148):impl.keys[k] lacks hasOwn, so Object.prototype keys pass truthiness and crash on keyImpl.child / indexing.
4 (ark/schema/roots/alias.ts:146, 163, ark/schema/shared/registry.ts:25):nodesById is {} rather than Object.create(null), so "constructor" / "__proto__" resolve to Object / Object.prototype and hit throwInternalError.
5 (ark/sets/roots/union.ts:1442-1490):disjointEntryLeavesKeyOverlap special-cases isBuiltinNonEnumerableKey rather than treating any disjoint from own-enumerable-only checks ("+": "reject", index signatures, getters, Object.create prototypes) uniformly against data?.[key] discriminant switches.
Minor:type.unit(new Date(NaN)).expression (ark/schema/roots/unit.ts:111-112) prints "Invalid Date", which cannot be parsed back.
Activity
fix(sets): keep an object that isn't an array in the case of an index…
fix(schema,type): collect cyclic Types in GC, fix schema/JIT edge bug…
ssalbdivad commentedon Dec 3, 2026
all five
@ark/schema& JIT edge bugs were fixed in 3.0.0 (b9cd9e6f2,6596894ce) — closing.