From 61429e26b90901a580811ce8e6e438c0f212212f Mon Sep 17 00:00:00 2001 From: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Date: Thu, 30 Jul 2026 18:27:42 +0800 Subject: [PATCH] test(charts): the chart-dialect guard fails on new dialect, not on the spec adopting one (#2945) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: Claude Fable 5 --- .../__tests__/chart-type-spec-parity.test.tsx | 35 ++++++++++++++++--- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/packages/plugin-charts/src/__tests__/chart-type-spec-parity.test.tsx b/packages/plugin-charts/src/__tests__/chart-type-spec-parity.test.tsx index 1ac846280..13a092b09 100644 --- a/packages/plugin-charts/src/__tests__/chart-type-spec-parity.test.tsx +++ b/packages/plugin-charts/src/__tests__/chart-type-spec-parity.test.tsx @@ -52,12 +52,37 @@ describe('plugin-charts covers the spec chart-type vocabulary', () => { ).toEqual([]); }); - it("the only renderer-local dialect is the documented 'combo'", () => { + it('carries no renderer-local dialect beyond the tracked exceptions', () => { + /** + * Dialect this renderer is knowingly ahead of the resolved spec on. Each + * entry needs a promote-or-delete decision (objectui#2945) — the set is an + * upper bound, not an expectation, so it shrinks silently as the spec + * adopts a name and only GROWING it fails. + * + * `combo`: promoted into `ChartTypeSchema` by framework#4070, which is not + * in a published spec version yet. When objectui bumps to a spec that + * includes it, this entry becomes dead weight — drop it then; nothing + * fails in the meantime. + */ + const TRACKED_DIALECT = new Set(['combo']); const implemented = [...RENDERABLE, ...SINGLE_VALUE_CHART_TYPES, ...TABULAR_CHART_TYPES]; - const dialect = implemented.filter((name) => !specNames.includes(name)); - // `combo` is tracked in #2945 ("promote or delete"); anything else - // appearing here is NEW dialect and needs the same decision first. - expect(dialect).toEqual(['combo']); + const untracked = implemented.filter( + (name) => !specNames.includes(name) && !TRACKED_DIALECT.has(name), + ); + expect( + untracked, + 'new renderer-local chart dialect — promote it into @objectstack/spec or delete it (objectui#2945)', + ).toEqual([]); + + // Report entries the spec has since adopted, so the list gets pruned + // instead of quietly accumulating stale exceptions. + const adopted = [...TRACKED_DIALECT].filter((name) => specNames.includes(name)); + if (adopted.length > 0) { + // eslint-disable-next-line no-console + console.info( + `[chart-type parity] the spec now defines ${adopted.join(', ')} — remove them from TRACKED_DIALECT.`, + ); + } }); });