Skip to content

[quality] Add unit tests for PipelineFilterContext mergeRepos and sidebar-customizer routes#20540

Merged
kubestellar-hive[bot] merged 7 commits into
mainfrom
quality/test-pipeline-filter-sidebar-routes
Jul 8, 2026
Merged

[quality] Add unit tests for PipelineFilterContext mergeRepos and sidebar-customizer routes#20540
kubestellar-hive[bot] merged 7 commits into
mainfrom
quality/test-pipeline-filter-sidebar-routes

Conversation

@clubanderson

Copy link
Copy Markdown
Collaborator

Test Improvement

Adds unit tests for the pipeline filter context and sidebar-customizer modules identified in #20512 as having low coverage.

New test files

File Tests What's covered
web/src/components/cards/pipelines/__tests__/PipelineFilterContext.test.ts 14 mergeRepos — server repos + user-added - hidden logic
web/src/components/layout/sidebar-customizer/__tests__/knownRoutes.test.ts 14 buildKnownRoutes mapping + constants validation

Source changes

  • PipelineFilterContext.tsx: Added export to mergeRepos function and StoredRepoConfig interface (no logic change)

What this validates

  • PipelineFilterContext: The mergeRepos pure function that determines which repos appear in the filter bar — hidden repos exclusion, user-added repos appending, duplicate prevention, order preservation, and edge cases (all hidden, already in server list, hidden+added overlap)
  • Sidebar customizer: buildKnownRoutes route construction — field completeness, href uniqueness, translation key format, enterprise sub-route presence; constants bounds validation

Partially addresses #20512


Filed by quality agent (ACMM L4/L6 — full mode)

clubanderson and others added 3 commits July 7, 2026 22:51
Adds `export` to the pure `mergeRepos` function and `StoredRepoConfig`
interface — no logic change, enables direct unit testing.

Signed-off-by: clubanderson <club.anderson@gmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Tests the pure mergeRepos function covering: empty config, hidden repos,
user-added repos, combined add+hide, duplicate prevention, and order.

Signed-off-by: clubanderson <club.anderson@gmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ants

Tests buildKnownRoutes pure function: field completeness, href format,
uniqueness, translation key format, and enterprise sub-routes presence.
Also validates sidebar constants for reasonable bounds.

Signed-off-by: clubanderson <club.anderson@gmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 8, 2026 02:52
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Jul 8, 2026
@netlify

netlify Bot commented Jul 8, 2026

Copy link
Copy Markdown

Deploy Preview for kubestellarconsole ready!

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

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

@github-actions github-actions Bot added the ai-generated Pull request generated by AI label Jul 8, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

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

github-actions Bot commented Jul 8, 2026

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 Jul 8, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

✅ Test Coverage Check

All new source files in this PR have corresponding test files.

Checked web/src/hooks/ and web/src/components/ against origin/main.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

♿ Accessibility Audit (WCAG 2.1 AA)

✅ No WCAG 2.1 AA violations detected in audited routes.


Powered by axe-core. Target: WCAG 2.1 AA compliance.

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

This PR improves frontend test coverage by adding unit tests for two previously low-covered areas: the pipelines repo filter merge logic and the sidebar-customizer known-routes builder. It also makes small source adjustments to enable testing of the pipelines merge helper.

Changes:

  • Added unit tests for mergeRepos in PipelineFilterContext (hidden/added/ordering/edge cases).
  • Added unit tests for buildKnownRoutes plus basic invariants around sidebar-customizer constants.
  • Exported mergeRepos and StoredRepoConfig from PipelineFilterContext.tsx to support direct unit testing.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
web/src/components/layout/sidebar-customizer/tests/knownRoutes.test.ts Adds unit tests for buildKnownRoutes and sidebar-customizer constants.
web/src/components/cards/pipelines/PipelineFilterContext.tsx Exports mergeRepos and StoredRepoConfig for testability (no logic change).
web/src/components/cards/pipelines/tests/PipelineFilterContext.test.ts Adds unit tests covering mergeRepos behavior across common and edge cases.

Comment on lines +68 to +72
it('includes enterprise sub-routes', () => {
const routes = buildKnownRoutes(mockT)
const enterpriseRoutes = routes.filter(r => r.href.startsWith('/enterprise'))
expect(enterpriseRoutes.length).toBeGreaterThan(5)
})
Comment on lines 50 to 52
/** Merge server repos + user config into the visible list */
function mergeRepos(serverRepos: string[], config: StoredRepoConfig): string[] {
export function mergeRepos(serverRepos: string[], config: StoredRepoConfig): string[] {
const hidden = new Set(config.hidden)
kubestellar-hive[bot] and others added 2 commits July 7, 2026 23:35
…xport

Add eslint-disable-next-line to mergeRepos export to satisfy the
react-refresh/only-export-components rule. mergeRepos is a helper used
by tests and other files; keeping it here alongside the context avoids
churn to imports across the codebase.

Signed-off-by: kubestellar-hive[bot] <197575415+kubestellar-hive[bot]@users.noreply.github.com>
…ble comment

The eslint-disable-next-line comment added in the previous commit shifted
all subsequent line numbers by one, causing existing baseline violations
to appear as new violations in the lint-baseline-check.

Update the baseline so react-hooks/exhaustive-deps entries for
PipelineFilterContext.tsx reflect the new line positions (131→132,
135→136, 176→177, 188→189, 199→200), and the react-refresh entry
for usePipelineFilter shifts from 238 to 239.

Also remove the now-suppressed react-refresh violation for mergeRepos
which is silenced by the eslint-disable-next-line comment.

Signed-off-by: kubestellar-hive[bot] <197575415+kubestellar-hive[bot]@users.noreply.github.com>
Signed-off-by: kubestellar-hive[bot] <kubestellar-hive[bot]@users.noreply.github.com>
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

❌ Playwright Tests Failed

📊 View Full Report

Download the playwright-report artifact from the workflow run for screenshots and detailed traces.

To view the report locally:

# Download and extract playwright-report.zip
npx playwright show-report path/to/playwright-report

kubestellar-hive Bot and others added 2 commits July 8, 2026 02:23
Resolve conflict in PipelineFilterContext.tsx where main moved
mergeRepos to pulse-utils.ts. Update the added
PipelineFilterContext.test.ts to import mergeRepos from pulse-utils
while keeping StoredRepoConfig type import from PipelineFilterContext.

Also picks up main's improvements, resolving the dirty/conflicting
merge state so this PR can proceed.

Signed-off-by: kubestellar-hive[bot] <kubestellar-hive[bot]@users.noreply.github.com>
The react-hooks/exhaustive-deps violation for the resetToDefaults
useCallback in PipelineFilterContext.tsx is at line 176, col 6.
The baseline incorrectly recorded it as line 177 after the PR's
line-number shift, causing CI to report it as a new violation.

Signed-off-by: Scanner Bot <scanner@hive.local>
@kubestellar-hive kubestellar-hive Bot merged commit 26e636b into main Jul 8, 2026
43 of 46 checks passed
@kubestellar-prow kubestellar-prow Bot deleted the quality/test-pipeline-filter-sidebar-routes branch July 8, 2026 09:26
@github-actions

github-actions Bot commented Jul 8, 2026

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

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Post-merge build verification passed

Both Go and frontend builds compiled successfully against merge commit 26e636b2eb31f594740e2abfe59132b043afdb84.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

✅ Post-Merge Verification: passed

Commit: 26e636b2eb31f594740e2abfe59132b043afdb84
Specs run: Dashboard.spec.ts navbar-responsive.spec.ts smoke.spec.ts
Report: https://github.com/kubestellar/console/actions/runs/28932210512

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-generated Pull request generated by AI 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. tier/2-standard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants