Skip to content

[scanner] fix: add schema validation tests for web/src/config/cards#19655

Merged
clubanderson merged 1 commit into
mainfrom
scanner/fix-19647
Jun 25, 2026
Merged

[scanner] fix: add schema validation tests for web/src/config/cards#19655
clubanderson merged 1 commit into
mainfrom
scanner/fix-19647

Conversation

@clubanderson

Copy link
Copy Markdown
Collaborator

Fixes #19647

Adds comprehensive schema validation tests for all card configurations in web/src/config/cards.

Changes

  • Created web/src/config/cards/__tests__/schema-validation.test.ts with comprehensive validation tests
  • Validates all 150+ card configurations conform to the UnifiedCardConfig schema
  • Tests required properties: type, title, category, dataSource, content
  • Tests optional properties: stats, filters, emptyState, loadingState, drillDown
  • Validates data source types: hook, api, static, context
  • Validates content types: list, table, chart, status-grid, stats-grid, custom
  • Ensures proper field types and value constraints across all configurations

Test Coverage

The test suite includes:

  1. Registry validation - Ensures all cards are properly registered with correct key naming
  2. Schema validation - Validates required and optional properties for each card config
  3. DataSource validation - Type-specific validation for each data source type
  4. Content validation - Type-specific validation for each content type (list, table, chart, etc.)
  5. Stats validation - Validates inline stat configurations
  6. Filters validation - Validates filter configurations
  7. EmptyState validation - Validates empty state configurations
  8. LoadingState validation - Validates loading state configurations
  9. DrillDown validation - Validates drill-down action configurations

All tests follow the existing test patterns in web/src/config/__tests__/ and use vitest as the test framework.

- Add comprehensive schema validation tests for all card configurations
- Validate required properties (type, title, category, dataSource, content)
- Validate data source types (hook, api, static, context)
- Validate content types (list, table, chart, status-grid, stats-grid, custom)
- Validate optional properties (stats, filters, emptyState, loadingState, drillDown)
- Ensure all 150+ card configs conform to UnifiedCardConfig schema

Fixes #19647

Signed-off-by: Copilot <copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 25, 2026 22:31
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Jun 25, 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 eeshaansa 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 25, 2026

Copy link
Copy Markdown

Deploy Preview for kubestellarconsole ready!

Name Link
🔨 Latest commit da48af9
🔍 Latest deploy log https://app.netlify.com/projects/kubestellarconsole/deploys/6a3dac38def77c000874ddca
😎 Deploy Preview https://deploy-preview-19655.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

🐝 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.

@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.

@kubestellar-prow kubestellar-prow Bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Jun 25, 2026
] as const

/** Valid renderer types */
const VALID_RENDERERS = [

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 validate the structure of all card configs registered in web/src/config/cards against the UnifiedCardConfig shape, catching missing/invalid fields early.

Changes:

  • Introduces a registry-wide validation test for CARD_CONFIGS (count, key format, key/type consistency, duplicates).
  • Adds per-card validation coverage for required/optional fields, plus type-specific checks for dataSource, content, stats, filters, emptyState, loadingState, and drillDown.

Comment on lines +17 to +34
/** Valid card categories */
const VALID_CATEGORIES = [
'cluster-health',
'workloads',
'events',
'network',
'storage',
'security',
'observability',
'gitops',
'ai-ml',
'gaming',
'utilities',
'compliance',
'identity',
'cost',
'performance',
] as const
Comment on lines +124 to +126
it('has valid category value', () => {
expect(VALID_CATEGORIES).toContain(config.category as any)
})
Comment on lines +517 to +521
it('has valid variant if specified', () => {
if (emptyState.variant !== undefined) {
expect(['info', 'warning', 'error', 'neutral']).toContain(emptyState.variant)
}
})
Comment on lines +432 to +448
if (stat.icon !== undefined) {
expect(typeof stat.icon).toBe('string')
}

if (stat.color !== undefined) {
expect(typeof stat.color).toBe('string')
expect(stat.color).toMatch(/^text-/)
}

if (stat.bgColor !== undefined) {
expect(typeof stat.bgColor).toBe('string')
expect(stat.bgColor).toMatch(/^bg-/)
}

if (stat.label !== undefined) {
expect(typeof stat.label).toBe('string')
}
Comment on lines +52 to +71
/** Valid renderer types */
const VALID_RENDERERS = [
'text',
'number',
'percentage',
'bytes',
'duration',
'date',
'datetime',
'relative-time',
'status-badge',
'cluster-badge',
'namespace-badge',
'progress-bar',
'icon',
'boolean',
'json',
'truncate',
'link',
] as const
@clubanderson clubanderson merged commit 50052a7 into main Jun 25, 2026
42 of 52 checks passed
@kubestellar-prow kubestellar-prow Bot deleted the scanner/fix-19647 branch June 25, 2026 23:26
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

Check out what's new:

Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey

@github-actions

Copy link
Copy Markdown
Contributor

❌ Post-Merge Verification: failed

Commit: 50052a741dd0e2250ae51d1e32655121c7d42142
Specs run: smoke.spec.ts
Report: https://github.com/kubestellar/console/actions/runs/28206913440

@github-actions

Copy link
Copy Markdown
Contributor

Post-merge build verification passed

Both Go and frontend builds compiled successfully against merge commit 50052a741dd0e2250ae51d1e32655121c7d42142.

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. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. tier/1-lightweight

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] Add schema validation tests for web/src/config/cards (batch 1: first 50 files)

2 participants