Skip to content

[quality] fix nil-logger SIGSEGV in pkg/dashboard TestHandleRepoActivityReportsPhaseOneHonesty - #4864

Merged
clubanderson merged 1 commit into
v4from
quality/test-fix-repo-activity-nil-logger
Aug 27, 2026
Merged

[quality] fix nil-logger SIGSEGV in pkg/dashboard TestHandleRepoActivityReportsPhaseOneHonesty#4864
clubanderson merged 1 commit into
v4from
quality/test-fix-repo-activity-nil-logger

Conversation

@kubestellar-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Fixes a deterministic panic that fails the entire pkg/dashboard test binary on the default branch.

Files/functions claimed: src/pkg/dashboard/activity_collector_test.goTestHandleRepoActivityReportsPhaseOneHonesty only. 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.RegisterAPI registers contribute routes, and NewContributeWSHub → loadCompletedTasks calls h.logger.Info(...) unconditionally, so the nil *slog.Logger crashes with a SIGSEGV:

--- FAIL: TestHandleRepoActivityReportsPhaseOneHonesty (0.01s)
panic: runtime error: invalid memory address or nil pointer dereference
  log/slog.(*Logger).Enabled ...
  dashboard.(*ContributeWSHub).loadCompletedTasks contribute_ws.go:1386
  dashboard.NewContributeWSHub contribute_ws.go:827
  dashboard.(*Server).RegisterAPI api.go:38

Fix

Pass an io.Discard slog logger, matching every other dashboard test that calls RegisterAPI (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

…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>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Aug 27, 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 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

Copy link
Copy Markdown
Contributor

Changelog: this PR changes code but does not touch CHANGELOG.md.

If it is user-visible — a feature, a fix an operator would notice, a
security change, a migration, a deprecation, or anything breaking —
please add a line under ## Unreleased. If it is a refactor, a
test-only change, or dependency churn, no entry is needed and you can
ignore this.

This is a reminder, not a gate; it never blocks a merge.

@kubestellar-prow kubestellar-prow Bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Aug 27, 2026
@clubanderson
clubanderson merged commit 6cbfc42 into v4 Aug 27, 2026
39 of 40 checks passed
@clubanderson
clubanderson deleted the quality/test-fix-repo-activity-nil-logger branch August 27, 2026 12:18
@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

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

Labels

copilot dco-signoff: yes Indicates the PR's author has signed the DCO. hold size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant