thing-contract-ts: present's slot names are held by a test, and its forwarded getters are not enumerable (Stryker survivors)
Some checks failed
Portable Eve contracts and browser lowering / ubuntu-latest eve-browser-lowering (pull_request) Has been cancelled
Portable Eve contracts and browser lowering / ubuntu-latest eve-contracts (pull_request) Has been cancelled

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-11-27 20:28:15 +01:00
commit 47fba57a6d
2 changed files with 12 additions and 2 deletions

View file

@ -73,8 +73,8 @@ export function present(codec: Codec<unknown>): Codec<unknown> {
if (!("names" in codec)) return held;
const record = codec as SlotsCodec<object>;
return Object.defineProperties(held, {
names: { get: () => record.names, enumerable: true },
members: { get: () => record.members, enumerable: true },
names: { get: () => record.names },
members: { get: () => record.members },
});
}

View file

@ -53,3 +53,13 @@ test("TextInputNode's slot 2 is inputKind, and the name set holds no Kind-only s
assert.ok(names.has(`${NS}InputKind`));
assert.equal([...names].filter((name) => name.endsWith(".Kind")).length, 0);
});
test("a record keeps its slot names and members through presence, and a union, a list and a leaf carry none", () => {
const shapes = codecs as unknown as Record<string, object>;
for (const record of ["boxNode", "bind", "nodeCommon", "rgba", "dimensionPx"]) {
assert.ok("names" in shapes[record] && "members" in shapes[record], record);
}
for (const other of ["node", "memberStep", "dimension", "colorRef"]) {
assert.ok(!("names" in shapes[other]) && !("members" in shapes[other]), other);
}
});