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
2026-10-10 06:20:10 +08:00
parent 4951a897c5
commit 4bcea1aa76
3 changed files with 65 additions and 32 deletions
@@ -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