Skip to content

🐛 fix: Go test alignment unblocking nightly release (#8310 #8313 #8314)#8317

Merged
clubanderson merged 1 commit intomainfrom
fix/nightly-test-failures
Apr 16, 2026
Merged

🐛 fix: Go test alignment unblocking nightly release (#8310 #8313 #8314)#8317
clubanderson merged 1 commit intomainfrom
fix/nightly-test-failures

Conversation

@clubanderson
Copy link
Copy Markdown
Collaborator

Summary

Nightly Release workflow has been failing every night since 2026-04-13 (runs: 24328017228, 24383107176, 24438572049, 24494366158). Root cause is four Go tests that fell out of sync with handler changes shipped in the last two weeks.

Test plan

  • go test ./... — all packages pass locally
  • Each originally-failing test runs green in isolation
  • CI build + lint pass on PR

Fixes #8310, Fixes #8313, Fixes #8314

…8314)

The nightly Release workflow has been red since 2026-04-13 because four
Go tests fell behind handler changes shipped over the past two weeks.
Each test now aligns with the current handler contract:

- `pkg/agent/server_test.go:TestServer_SettingsHandlers` — expected the
  keys endpoint to return 0 providers, but #8248/#8254/#8256 now
  register nine chat-only HTTP providers (3 OpenAI-compatible gateways
  + 6 local LLM runners) so the Settings modal can show per-provider
  base URL overrides. Assert non-empty list and Provider presence.

- `pkg/api/handlers/cards_test.go:TestRecordFocus_BadBody_Returns400` —
  `RecordFocus` now runs `requireEditorOrAdmin` before BodyParser (#7011),
  which calls `store.GetUser`. The test's custom `recordFocusStore`
  never registered `GetUser`, so the mock panicked. Add the admin-user
  expectation.

- `pkg/api/handlers/dashboard_test.go:setupDashboardTest` —
  `CreateDashboard` now calls `store.CountUserDashboards` to enforce
  the per-user dashboard limit (#7010). Register a default
  `Return(0, nil).Maybe()` so the three CreateDashboard tests stay
  under the limit. Tests exercising the limit can override.

- `pkg/api/handlers/setup_test.go` — `TestClusterGroupsCRUD` exercises
  handlers that persist definitions via `SaveClusterGroup` /
  `DeleteClusterGroup` / `ListClusterGroups` (#7013). Register
  permissive `.Maybe()` mocks on the shared `setupTestEnv` MockStore.

Verification: `go test ./...` — all packages pass locally.

Fixes #8310, Fixes #8313, Fixes #8314

Signed-off-by: Andy Anderson <[email protected]>
Copilot AI review requested due to automatic review settings April 16, 2026 06:07
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Apr 16, 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
Copy link
Copy Markdown

netlify Bot commented Apr 16, 2026

Deploy Preview for kubestellarconsole ready!

Name Link
🔨 Latest commit 0078805
🔍 Latest deploy log https://app.netlify.com/projects/kubestellarconsole/deploys/69e07ca326935f00085dbf83
😎 Deploy Preview https://deploy-preview-8317.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.

@clubanderson clubanderson added the ai-generated Pull request generated by AI label Apr 16, 2026
@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/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 16, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates Go unit tests to align with recent handler behavior changes in the API server and kc-agent, unblocking failing nightly release workflows.

Changes:

  • Adjusts kc-agent settings keys test expectations to reflect the now-populated /settings/keys status response.
  • Extends handler test setup mocks to cover newly-added store calls (dashboard count limiting and cluster-group persistence).
  • Fixes RecordFocus test setup to satisfy the new RBAC role check that calls store.GetUser.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
pkg/api/handlers/setup_test.go Adds permissive MockStore expectations for cluster-group persistence methods to prevent panics in CRUD tests.
pkg/api/handlers/dashboard_test.go Adds a default CountUserDashboards mock expectation so CreateDashboard tests remain under the new per-user limit.
pkg/api/handlers/cards_test.go Mocks GetUser for RecordFocus to pass the new requireEditorOrAdmin check before body parsing.
pkg/agent/server_test.go Updates TestServer_SettingsHandlers to expect a non-empty keys status list and validate Provider presence.

@clubanderson clubanderson merged commit 0d30455 into main Apr 16, 2026
30 of 31 checks passed
@kubestellar-prow kubestellar-prow Bot deleted the fix/nightly-test-failures branch April 16, 2026 06:14
@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 build verification passed

Both Go and frontend builds compiled successfully against merge commit 0d304559df053b07e9eee0ef8d3da47dfa8a9116.

@github-actions
Copy link
Copy Markdown
Contributor

✅ Post-Merge Verification: passed

Commit: 0d304559df053b07e9eee0ef8d3da47dfa8a9116
Specs run: smoke.spec.ts
Report: https://github.com/kubestellar/console/actions/runs/24495206324

clubanderson added a commit that referenced this pull request Apr 16, 2026
…nk (#8277)

Addresses 2 of the 5 Copilot review comments on merged PR #8267:

- pkg/agent/server_operations.go:348 — stop setting BaseURLSource="default"
  for local LLM runners using the compiled-in default. KeyStatus docs and
  the frontend type (`'env' | 'config'`) treat empty as the canonical
  signal for "value is the compiled-in default". The "default" string was
  unhandled by the UI and broke the documented contract.
- web/src/components/agent/APIKeySettings.tsx:248 — handleSaveBaseURL with
  an empty trimmed input now sends `{ clearBaseURL: true }` instead of
  `{ baseURL: "" }`, so the backend removes the persisted override and
  reverts to the compiled-in default. Without this the request hit the
  missing_field guard once clearBaseURL was introduced.

Not addressed here (intentional, kept for follow-up):
- The "Configured = URL-present" semantics for local LLMs is contested:
  the existing comment marks it as intentional (#8259), so treating
  compiled-defaults as "not configured" would be a behavior change, not a
  bug fix.
- Populating BaseURL via per-provider resolvers for non-local providers
  (Groq/OpenRouter) so it always shows the effective endpoint — separate
  PR scope, requires resolver-side changes.
- TestServer_SettingsHandlers test mismatch — already fixed in PR #8317.

Fixes #8277

Signed-off-by: Andy Anderson <[email protected]>
clubanderson added a commit that referenced this pull request Apr 16, 2026
…nk (#8277) (#8320)

Addresses 2 of the 5 Copilot review comments on merged PR #8267:

- pkg/agent/server_operations.go:348 — stop setting BaseURLSource="default"
  for local LLM runners using the compiled-in default. KeyStatus docs and
  the frontend type (`'env' | 'config'`) treat empty as the canonical
  signal for "value is the compiled-in default". The "default" string was
  unhandled by the UI and broke the documented contract.
- web/src/components/agent/APIKeySettings.tsx:248 — handleSaveBaseURL with
  an empty trimmed input now sends `{ clearBaseURL: true }` instead of
  `{ baseURL: "" }`, so the backend removes the persisted override and
  reverts to the compiled-in default. Without this the request hit the
  missing_field guard once clearBaseURL was introduced.

Not addressed here (intentional, kept for follow-up):
- The "Configured = URL-present" semantics for local LLMs is contested:
  the existing comment marks it as intentional (#8259), so treating
  compiled-defaults as "not configured" would be a behavior change, not a
  bug fix.
- Populating BaseURL via per-provider resolvers for non-local providers
  (Groq/OpenRouter) so it always shows the effective endpoint — separate
  PR scope, requires resolver-side changes.
- TestServer_SettingsHandlers test mismatch — already fixed in PR #8317.

Fixes #8277

Signed-off-by: Andy Anderson <[email protected]>
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/M Denotes a PR that changes 30-99 lines, ignoring generated files. tier/1-lightweight

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Workflow failure: Release 🚨 nightly release failed: v0.3.21-nightly.20260416 Workflow failure: Nightly Dashboard Health

2 participants