Skip to content

Commit b0172c7

Browse files
os-zhuangclaude
andauthored
test(charts): the chart-dialect guard fails on new dialect, not on the spec adopting one (#2945) (#3016)
The parity guard added in #3011 asserted `dialect === ['combo']` — an exact match against the one name objectui draws that the resolved spec does not define. That is the wrong shape for a drift guard: framework#4070 has already promoted `combo` into `ChartTypeSchema`, so the moment objectui bumps to a spec version carrying it, `dialect` becomes `[]` and the test fails with "expected [] to deeply equal ['combo']" — a cryptic red for the good outcome, landing on whoever does the bump rather than on whoever adds dialect. Now the tracked set is an upper bound: only UNTRACKED dialect fails, so the list shrinks silently as the spec adopts a name, and an entry the spec has since defined is reported via console.info so it gets pruned instead of accumulating as a stale exception. No renderer change; the coverage assertions are untouched. Refs #2945, #2943 Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 9cdc992 commit b0172c7

1 file changed

Lines changed: 30 additions & 5 deletions

File tree

packages/plugin-charts/src/__tests__/chart-type-spec-parity.test.tsx

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,37 @@ describe('plugin-charts covers the spec chart-type vocabulary', () => {
5252
).toEqual([]);
5353
});
5454

55-
it("the only renderer-local dialect is the documented 'combo'", () => {
55+
it('carries no renderer-local dialect beyond the tracked exceptions', () => {
56+
/**
57+
* Dialect this renderer is knowingly ahead of the resolved spec on. Each
58+
* entry needs a promote-or-delete decision (objectui#2945) — the set is an
59+
* upper bound, not an expectation, so it shrinks silently as the spec
60+
* adopts a name and only GROWING it fails.
61+
*
62+
* `combo`: promoted into `ChartTypeSchema` by framework#4070, which is not
63+
* in a published spec version yet. When objectui bumps to a spec that
64+
* includes it, this entry becomes dead weight — drop it then; nothing
65+
* fails in the meantime.
66+
*/
67+
const TRACKED_DIALECT = new Set(['combo']);
5668
const implemented = [...RENDERABLE, ...SINGLE_VALUE_CHART_TYPES, ...TABULAR_CHART_TYPES];
57-
const dialect = implemented.filter((name) => !specNames.includes(name));
58-
// `combo` is tracked in #2945 ("promote or delete"); anything else
59-
// appearing here is NEW dialect and needs the same decision first.
60-
expect(dialect).toEqual(['combo']);
69+
const untracked = implemented.filter(
70+
(name) => !specNames.includes(name) && !TRACKED_DIALECT.has(name),
71+
);
72+
expect(
73+
untracked,
74+
'new renderer-local chart dialect — promote it into @objectstack/spec or delete it (objectui#2945)',
75+
).toEqual([]);
76+
77+
// Report entries the spec has since adopted, so the list gets pruned
78+
// instead of quietly accumulating stale exceptions.
79+
const adopted = [...TRACKED_DIALECT].filter((name) => specNames.includes(name));
80+
if (adopted.length > 0) {
81+
// eslint-disable-next-line no-console
82+
console.info(
83+
`[chart-type parity] the spec now defines ${adopted.join(', ')} — remove them from TRACKED_DIALECT.`,
84+
);
85+
}
6186
});
6287
});
6388

0 commit comments

Comments
 (0)