Skip to content

[quality] test: cover restart-storm drift rollup helpers (appendDriftSignal, applyAgentRestartResetBaselines edges, commonProblemReason) - #6180

Open
kubestellar-hive[bot] wants to merge 1 commit into
v4from
quality/test-drift-signal-append
Open

[quality] test: cover restart-storm drift rollup helpers (appendDriftSignal, applyAgentRestartResetBaselines edges, commonProblemReason)#6180
kubestellar-hive[bot] wants to merge 1 commit into
v4from
quality/test-drift-signal-append

Conversation

@kubestellar-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds src/pkg/hub/drift_signal_append_test.go covering the read-time helpers that fold agent restart storms into a hive's DriftReport and the fleet rollup's common blocked-reason string:

  • appendDriftSignal (pkg/hub/saas.go, was 0%, now 100%): nil-report guard, Count/Signals lockstep, worst-wins WorstSeverity escalation, and no downgrade when a milder signal follows a critical one.
  • applyAgentRestartResetBaselines (pkg/hub/saas.go, was 75%, now 100%) — edge branches only; the happy path stays in agent_capability_test.go: nil resets no-op, per-agent isolation, unparseable ResetAt keeps attribution but not the delta, >24h reset expiry, negative-delta clamp to zero.
  • commonProblemReason (pkg/hub/agent_capability.go, was 50%, now 100%): blank/whitespace next, first-wins, identical-keep, disagreement → "mixed".

Verified with go test -run 'TestAppendDriftSignal|TestApplyAgentRestartResetBaselines|TestCommonProblemReason' ./pkg/hub/ — all pass; go tool cover -func confirms all three functions at 100%.

Overlap check

Compared against every open quality/architect PR: #6091 is docs-only (fleet drift-signals operator reference, no test files); drift_test.go/drift_identity_test.go cover computeDrift in drift.go, not these saas.go/agent_capability.go helpers. No open PR touches these functions.


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

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

…Signal, applyAgentRestartResetBaselines edges, commonProblemReason)

appendDriftSignal (pkg/hub/saas.go) was at 0% coverage,
applyAgentRestartResetBaselines at 75%, and commonProblemReason
(pkg/hub/agent_capability.go) at 50%. These are the read-time helpers
that fold agent restart storms into a hive's DriftReport and the fleet
rollup's common blocked-reason string.

New tests pin:
- appendDriftSignal: nil-report guard, Count/Signals lockstep,
  worst-wins severity escalation and no downgrade
- applyAgentRestartResetBaselines: nil resets no-op, per-agent
  isolation, unparseable ResetAt keeps attribution but not the delta,
  >24h reset expiry, negative-delta clamp to zero
- commonProblemReason: blank/whitespace next, first-wins, identical
  keep, disagreement -> "mixed"

All three functions now at 100% coverage.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: sec-check <sec-check@hive.kubestellar.io>
@kubestellar-hive kubestellar-hive Bot added the hold label Sep 6, 2026
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Sep 6, 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 danathar 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 commented Sep 6, 2026

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.

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/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants