Skip to content

Commit 0c21631

Browse files
committed
test(spec): pin the non-array permissions guard on a value that is not iterable
The first ablation leg measured the previous fixture as GREEN under the mutation: a string value iterates its own characters, so removing the `Array.isArray` guard changed nothing for it. Map format — the shape a hand-built stack most plausibly carries for a collection key — is not iterable, so the fixture now fails without the guard and the ablation reads red for all six malformed cases. Claude-Session: https://claude.ai/code/session_01T3YsvpK1PvYf9n1YUhYP6W Co-authored-by: Claude <noreply@anthropic.com>
1 parent b63b526 commit 0c21631

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎packages/spec/src/stack-artifact-crossref.test.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,12 @@ describe('#18202 — a malformed collection on an unparsed input is skipped, nev
426426
composeStacks([serviceStack(), stack], { manifest: 'preserve' });
427427

428428
it('a non-array `permissions` composes, and the key is warned about exactly once', () => {
429-
const { warnings, thrown } = warningsDuring(composeWith(malformed({ permissions: 'not-an-array' })));
429+
// Map format, which `permissions` does not support — the shape a
430+
// hand-built stack most plausibly carries. It is NOT iterable, which is
431+
// what makes this the case that distinguishes the guard: a string value
432+
// would iterate its characters and never throw either way.
433+
const mapShaped = { sales_rep: { label: 'Sales Rep', objects: { [NOWHERE]: { allowRead: true } } } };
434+
const { warnings, thrown } = warningsDuring(composeWith(malformed({ permissions: mapShaped })));
430435
expect(thrown).toBeNull();
431436
expect(warnings.filter((w) => w.includes("top-level key 'permissions'"))).toHaveLength(1);
432437
});

0 commit comments

Comments
 (0)