[quality] fix nil-logger SIGSEGV in pkg/dashboard TestHandleRepoActivityReportsPhaseOneHonesty - #4864
Conversation
…neHonesty TestHandleRepoActivityReportsPhaseOneHonesty constructed the dashboard server with NewServer(0, nil). Server.RegisterAPI wires the contribute routes, and NewContributeWSHub -> loadCompletedTasks logs unconditionally via h.logger.Info, so the nil logger crashed the whole pkg/dashboard test binary with a SIGSEGV on every 'go test ./...' run. Pass an io.Discard slog logger, matching every other dashboard test (e.g. advisory_state_test.go, api_contribute_handler_branches_test.go). Test-only change; no production code touched. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: sec-check <sec-check@hive.kubestellar.io>
|
[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 |
|
Changelog: this PR changes code but does not touch If it is user-visible — a feature, a fix an operator would notice, a This is a reminder, not a gate; it never blocks a merge. |
|
Thank you for your contribution! Your PR has been merged. Check out what's new:
Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey |
Test Improvement
Fixes a deterministic panic that fails the entire
pkg/dashboardtest binary on the default branch.Files/functions claimed:
src/pkg/dashboard/activity_collector_test.go—TestHandleRepoActivityReportsPhaseOneHonestyonly. Disjoint from open PRs #4863 (src/pkg/dashboard/audit.go) and #4032 (proxy/github auth injection).Problem
The test built the server with
NewServer(0, nil).Server.RegisterAPIregisters contribute routes, andNewContributeWSHub → loadCompletedTaskscallsh.logger.Info(...)unconditionally, so the nil*slog.Loggercrashes with a SIGSEGV:Fix
Pass an
io.Discardslog logger, matching every other dashboard test that callsRegisterAPI(e.g.advisory_state_test.go,api_contribute_handler_branches_test.go).Test-only change; no production code touched. Verified:
go test -run 'TestHandleRepoActivity|TestActivityCollector' ./pkg/dashboard/passes.Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-fable-5 copilot=1.0.78