Skip to content

Commit fd45313

Browse files
os-zhuangclaude
andauthored
test(app-shell): make field-rule 'non-CEL dialect' fixture forward-compatible (#2696)
The 'skips non-CEL dialect envelopes' test used `{ dialect: 'js', source: '!!!' }`. framework#3278 (spec PR #3291) retires the `js` expression dialect from `ExpressionDialect` (now `cel|cron|template`), which will make that envelope shape-invalid once objectui bumps to the narrowed spec, breaking the `.toEqual([])` assertion via a spec-Zod issue at `fields.status.visibleWhen`. Swap to `{ dialect: 'template', source: '!!!' }` — a well-typed NON-CEL dialect that survives the narrowing. It must stay non-CEL: `predicateSource` only lints `dialect: undefined | 'cel'`, so `dialect: 'cel'` would make the lint OWN the garbage source and flag it, flipping the assertion. Behavior-neutral against the current spec (15.1.1, `js` still present) and the future narrowed spec alike. Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent ce86822 commit fd45313

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

packages/app-shell/src/views/metadata-admin/clientValidation.fieldRules.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,14 @@ describe('validateMetadataDraft — object field conditional rules (real engine)
7676
});
7777

7878
it('skips non-CEL dialect envelopes (the engine owns that error, not the CEL lint)', async () => {
79+
// A well-typed NON-CEL dialect whose garbage `source` the CEL lint must
80+
// leave alone (`predicateSource` only extracts `dialect: undefined | 'cel'`).
81+
// Must stay a non-CEL dialect: `dialect: 'cel'` would make the lint OWN
82+
// `'!!!'` and flag it, flipping this assertion. `template` survives the
83+
// spec's `ExpressionDialect` narrowing (framework#3278 retired `js`).
7984
const res = await validateMetadataDraft(
8085
'object',
81-
draftWith({ status: { type: 'text', visibleWhen: { dialect: 'js', source: '!!!' } } }),
86+
draftWith({ status: { type: 'text', visibleWhen: { dialect: 'template', source: '!!!' } } }),
8287
);
8388
expect(res.issues.filter((i) => RULE_PATH.test(i.path))).toEqual([]);
8489
});

0 commit comments

Comments
 (0)