[quality] test: cover restart-storm drift rollup helpers (appendDriftSignal, applyAgentRestartResetBaselines edges, commonProblemReason) - #6180
Conversation
…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>
|
[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 carries no changelog entry 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. |
Test Improvement
Adds
src/pkg/hub/drift_signal_append_test.gocovering the read-time helpers that fold agent restart storms into a hive'sDriftReportand the fleet rollup's common blocked-reason string:appendDriftSignal(pkg/hub/saas.go, was 0%, now 100%): nil-report guard,Count/Signalslockstep, worst-winsWorstSeverityescalation, 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 inagent_capability_test.go: nil resets no-op, per-agent isolation, unparseableResetAtkeeps 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 -funcconfirms 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.gocovercomputeDriftindrift.go, not thesesaas.go/agent_capability.gohelpers. 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