Skip to content

[quality] test: cover the fleet-report issue-lifecycle state machine in pkg/dashboard/api_fleet_report.go - #7312

Merged
clubanderson merged 1 commit into
v4from
quality/test-fleet-report-state
Sep 17, 2026
Merged

clubanderson merged 1 commit into
v4from
quality/test-fleet-report-state

Conversation

@kubestellar-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Covers the five 0%-covered fleet-report lifecycle functions in src/pkg/dashboard/api_fleet_report.goSetFleetReportBuildInfo, MarkFleetReportPosted, FleetReportOpenIssue, MarkFleetReportRecovered, ClearFleetReportOpen — all now at 100% (go tool cover -func).

Changes:

  • api_fleet_report.go: fleetReportStatePath const → var, plus SetFleetReportStatePathForTest (test-lifetime seam, same convention as knowledge.SetBaseDirForTest at src/pkg/knowledge/api.go:23). Production behavior unchanged.
  • New fleet_report_state_test.go pinning:
    • posted → recovered → cleared fingerprint lifecycle round-trip
    • OpenedByHive is never demoted by a re-post with openedByHive=false (gates whether recovery closes the issue)
    • recovery/clear on unknown fingerprints are safe no-ops
    • corrupt state file degrades to empty state and stays writable
    • build-info setter/getter round-trip

Verified: go test ./pkg/dashboard/ passes (99s, full package), go vet clean, new files gofmt-clean.

Deliberately out of scope (noted in the issue): publishFleetReports in cmd/hive (needs a github.Client seam) and AttachFleetReport's persist branch.

Related Issue

Refs #7311 — the cmd/hive publishFleetReports half of the gap is deliberately left open; this PR resolves only the pkg/dashboard state-machine half.


Filed by quality agent (hold-gated mode). Human review required.

— hive: agent=quality backend=copilot model=claude-fable-5 copilot=1.0.78

MarkFleetReportPosted, FleetReportOpenIssue, MarkFleetReportRecovered and
ClearFleetReportOpen were 0% covered because fleetReportStatePath was a
hardcoded /data const. This makes the path a var with a
SetFleetReportStatePathForTest seam (same convention as
knowledge.SetBaseDirForTest) and pins the posted -> recovered -> cleared
fingerprint lifecycle, OpenedByHive non-demotion, corrupt-state-file
tolerance, and SetFleetReportBuildInfo.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: hive-quality <quality@hive.local>
@kubestellar-hive

Copy link
Copy Markdown
Contributor Author

Important

Held for human review by the hive's ACMM level gate.

This PR was opened by the "quality" agent while Hive policy required a human checkpoint for that agent. Non-outreach agents are held at ACMM L3–L5; the outreach agent is always held because it publishes project-facing communication.

Hive will automatically remove the hold label once current policy no longer requires a level hold for "quality". If this is an outreach PR, a human must review it and remove the label.

@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Sep 17, 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 carries no changelog entry
(no changelog.d/ fragment and no CHANGELOG.md edit).

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 fragment file changelog.d/<category>-<pr-or-slug>.md
containing exactly your entry (see changelog.d/README.md; the
category is one of added/changed/deprecated/fixed/security). Please
do not append to CHANGELOG.md's ## Unreleased directly — that
shared section is the merge-conflict generator fragments replaced
(#5675). 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/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 17, 2026
@kubestellar-hive kubestellar-hive Bot added quality testing agent/quality Approved by a Hive merger/owner for auto-merge on green CI hive/hosted-available-oke-11-placeholder-r05x Approved by a Hive merger/owner for auto-merge on green CI labels Sep 17, 2026
@clubanderson clubanderson added no-changelog No changelog fragment required and removed hold labels Sep 17, 2026

@clubanderson clubanderson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Test-only state machine coverage with a standard test-path seam. LGTM.

@clubanderson
clubanderson merged commit dcb7dce into v4 Sep 17, 2026
68 of 77 checks passed
@kubestellar-prow kubestellar-prow Bot added the lgtm Indicates that a PR is ready to be merged. label Sep 17, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: 6803682ae579c3fc2f57589b6c40118467e84d67

@clubanderson
clubanderson deleted the quality/test-fleet-report-state branch September 17, 2026 11:18
@github-actions

Copy link
Copy Markdown
Contributor

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

We'd love to hear how your experience was: share feedback

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

Labels

agent/quality Approved by a Hive merger/owner for auto-merge on green CI copilot dco-signoff: yes Indicates the PR's author has signed the DCO. hive/hosted-available-oke-11-placeholder-r05x Approved by a Hive merger/owner for auto-merge on green CI lgtm Indicates that a PR is ready to be merged. no-changelog No changelog fragment required quality size/L Denotes a PR that changes 100-499 lines, ignoring generated files. testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant