fix(javascript): retain array identity after length mutations

Keep unknown element coverage on arrays whose length may have changed, preserving intrinsic length presence and subsequent slot mutations through semantic graph and export-return consumers.
This commit is contained in:
morluto committed 2026-10-10 06:20:28 +08:00
1 parent 4951a897c5
commit 4bcea1aa76
3 files changed
+65 -32

No files matched your search

@@ -35,7 +35,13 @@ export const invalidateSemanticMutationPath = (
const name = String(key);
// Array length writes can remove every index; ordinary named properties
// and sparse indices affect only their own slot.
if (name === "length") return unknown;
if (name === "length")
return {
status: "array",
items: [],
unknownItems: true,
omittedItems: null,
};
const observed = value.items.some((item) => item.name === name);
const items = value.items.map((item) =>
item.name === name