[quality] deep schema validation tests for all 200+ card configs#19661
[quality] deep schema validation tests for all 200+ card configs#19661clubanderson wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
✅ Deploy Preview for kubestellarconsole ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
👋 Hey @clubanderson — thanks for opening this PR!
This is an automated message. |
|
🐝 Hi @clubanderson! I'm Trusted users — org members and contributors with write access — can mention Automation may take a moment to start, and follow-up happens through workflow activity rather than chat replies. |
There was a problem hiding this comment.
Pull request overview
Adds a new Vitest suite intended to perform “deep schema” validation across the entire unified card registry (200+ card configs) to catch config drift beyond the existing smoke tests.
Changes:
- Introduces
card-config-deep-schema.test.tswhich iterates all registered card types and validates key UnifiedCardConfig invariants (width/height, datasource/content discriminators, list columns, stats, projects, etc.). - Adds registry-level assertions for minimum card count and duplicate type identifiers.
| /** | ||
| * Deep Schema Validation Tests for Card Configs | ||
| * | ||
| * Goes beyond the basic smoke tests in registerCardConfigTest to validate: | ||
| * - CardWidth is within allowed enum values (3|4|5|6|8|12) | ||
| * - Stats arrays have required fields (id, icon, color, label, valueSource) | ||
| * - Content list columns have required field property | ||
| * - DataSource discriminated union consistency (hook configs need hook name, etc.) | ||
| * - EmptyState and footer cross-field integrity | ||
| * - No duplicate card types in registry | ||
| * - Category values are from the known set | ||
| */ |
| const VALID_EMPTY_STATE_VARIANTS = new Set([ | ||
| 'info', 'success', 'warning', 'error', 'neutral', undefined, | ||
| ]) |
| it('emptyState variant is valid when present', () => { | ||
| const c = getCardConfig(cardType)! | ||
| if (c.emptyState?.variant) { | ||
| expect(VALID_EMPTY_STATE_VARIANTS.has(c.emptyState.variant)).toBe(true) | ||
| } | ||
| }) |
| it('custom content has component name', () => { | ||
| const c = getCardConfig(cardType)! | ||
| if (c.content.type === 'custom') { | ||
| const content = c.content as { type: 'custom'; component?: string } | ||
| expect(typeof content.component).toBe('string') | ||
| expect(content.component!.length).toBeGreaterThan(0) | ||
| } | ||
| }) |
| describe.each(allTypes)('card "%s"', (cardType) => { | ||
| let config: UnifiedCardConfig | ||
|
|
||
| it('is retrievable from registry', () => { | ||
| const c = getCardConfig(cardType) | ||
| expect(c).toBeDefined() | ||
| config = c! | ||
| }) |
Validates card width enum, dataSource discriminated union consistency, content column requirements, stats uniqueness, and emptyState variants across all 200+ card configurations. Signed-off-by: kubestellar-hive[bot] <kubestellar-hive[bot]@users.noreply.github.com>
45ac24c to
c293c2f
Compare
Test Improvement
Adds a comprehensive deep schema validation test that validates ALL 200+ card configurations against the full
UnifiedCardConfigtype contract.What this validates (beyond existing smoke tests)
The existing
registerCardConfigTestonly checks 5 basic fields (type,title,category,dataSource.type,content.type). This new test adds 14 validation checks per card:defaultWidthenumCardWidthtypedefaultHeightpositive integerhookname, API sources missingendpointfieldproperty on column defsid,icon,color,label, orvalueSourcetypenot matching its registry keyWhy
With 209 card config files contributed by many authors, schema drift is a significant regression risk. The existing 3-assertion test catches gross errors but misses subtle field-level violations that cause runtime crashes (e.g.,
Cannot read property 'field' of undefinedwhen a column is malformed).Fixes #19631
Filed by quality agent (hold-gated mode). Human review required.