Skip to content

[quality] deep schema validation tests for all 200+ card configs#19661

Open
clubanderson wants to merge 1 commit into
mainfrom
quality/test-cards-deep-schema
Open

[quality] deep schema validation tests for all 200+ card configs#19661
clubanderson wants to merge 1 commit into
mainfrom
quality/test-cards-deep-schema

Conversation

@clubanderson

Copy link
Copy Markdown
Collaborator

Test Improvement

Adds a comprehensive deep schema validation test that validates ALL 200+ card configurations against the full UnifiedCardConfig type contract.

What this validates (beyond existing smoke tests)

The existing registerCardConfigTest only checks 5 basic fields (type, title, category, dataSource.type, content.type). This new test adds 14 validation checks per card:

Check What it catches
defaultWidth enum Invalid widths like 7, 10 that aren't in CardWidth type
defaultHeight positive integer Fractional or negative heights
DataSource union consistency Hook sources missing hook name, API sources missing endpoint
Content type enum Typos in content type strings
List content columns Missing field property on column defs
Stats required fields Missing id, icon, color, label, or valueSource
Stats unique IDs Duplicate stat IDs within same card causing key conflicts
EmptyState variant enum Invalid variant strings
Custom content component Missing component name
Projects array integrity Empty strings in projects array
Type matches registry key Config type not matching its registry key
No duplicate types Two configs registering the same type

Why

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 undefined when a column is malformed).

Fixes #19631


Filed by quality agent (hold-gated mode). Human review required.

Copilot AI review requested due to automatic review settings June 26, 2026 00:25
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Jun 26, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign mikespreitzer for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@netlify

netlify Bot commented Jun 26, 2026

Copy link
Copy Markdown

Deploy Preview for kubestellarconsole ready!

Name Link
🔨 Latest commit c293c2f
🔍 Latest deploy log https://app.netlify.com/projects/kubestellarconsole/deploys/6a429bdd7e96c9000884a8af
😎 Deploy Preview https://deploy-preview-19661.console-deploy-preview.kubestellar.io
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Hey @clubanderson — thanks for opening this PR!

🤖 This project is developed exclusively using AI coding assistants.

Please do not attempt to code anything for this project manually.
All contributions should be authored using an AI coding tool such as:

This ensures consistency in code style, architecture patterns, test coverage,
and commit quality across the entire codebase.


This is an automated message.

@github-actions

Copy link
Copy Markdown
Contributor

🐝 Hi @clubanderson! I'm kubestellar-hive[bot], an automation bot for this repo.

Trusted users — org members and contributors with write access — can mention @kubestellar-hive in a comment to trigger repo automation.
On issues, that mention queues an automated fix attempt. On pull requests, it records extra context for existing automation.
This is not an interactive Q&A bot, so mentions should be treated as requests for automation rather than a conversation.

Automation may take a moment to start, and follow-up happens through workflow activity rather than chat replies.

@kubestellar-prow kubestellar-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 26, 2026
@clubanderson clubanderson added hold Blocked — do not touch quality testing and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. dco-signoff: yes Indicates the PR's author has signed the DCO. tier/1-lightweight labels Jun 26, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ts which 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.

Comment on lines +1 to +12
/**
* 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
*/
Comment on lines +25 to +27
const VALID_EMPTY_STATE_VARIANTS = new Set([
'info', 'success', 'warning', 'error', 'neutral', undefined,
])
Comment on lines +144 to +149
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)
}
})
Comment on lines +151 to +158
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)
}
})
Comment on lines +44 to +51
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>
@clubanderson clubanderson force-pushed the quality/test-cards-deep-schema branch from 45ac24c to c293c2f Compare June 29, 2026 16:22
@kubestellar-prow kubestellar-prow Bot added dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. hold Blocked — do not touch quality size/L Denotes a PR that changes 100-499 lines, ignoring generated files. testing tier/1-lightweight

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] web/src/config/cards: 209 source files with zero test coverage

2 participants