[quality] test: cover Cadence serialization/formatting branches (pkg/config/cadence.go) - #6196
Conversation
…config/cadence.go) Covers previously untested branches in pkg/config/cadence.go: - IsPaused false for times/cron modes - String/MarshalJSON/MarshalYAML/HumanSummary/ShortLabel/cronSpecs interval branches - UnmarshalYAML decode error and UnmarshalJSON non-object error - Validate missing-tz and invalid-day errors surfaced via JSON decode - NextAfter fail branches (invalid schedule, unparseable/negative/paused interval) - DueOccurrence interval last-kick path, default catch-up window, nothing-due - HumanSummary verbatim fallback for unparseable times - ShortLabel configured-tz fallback when TimezoneAbbrev is empty - cronSpecs skipping unparseable times - daysSummary every-day defaults + Mon-Fri, joinHuman single/pair pkg/config/cadence.go rises from 87.1% to ~98% file coverage; the only uncovered lines left are unreachable defensive marshal-error paths. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: hive-quality <sec-check@hive.kubestellar.io>
|
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. |
|
[APPROVALNOTIFIER] This PR is APPROVED Approval requirements bypassed by manually added approval. This pull-request has been approved by: The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Test Improvement
Adds
src/pkg/config/cadence_branches_test.gocovering ~25 previously untested branches inpkg/config/cadence.go(file coverage 87.1% → ~98%):IsPaused— false for times/cron modesString,MarshalJSON,MarshalYAML,HumanSummary,ShortLabel,cronSpecs— interval-mode branchesUnmarshalYAMLdecode error;UnmarshalJSONnon-string/non-object errorValidate— missing-tz and invalid-day errors surfaced through JSON decodeNextAfter— invalid schedule, unparseable/negative/paused interval fail branchesDueOccurrence— interval last-kick due/not-due, default catch-up window, nothing-due windowHumanSummary— verbatim fallback for unparseable stored timesShortLabel— configured-tz fallback whenTimezoneAbbrevis empty (times and cron)cronSpecs— skips unparseable timesdaysSummary— every-day defaults and Mon–Fri collapse;joinHumansingle/pairRemaining uncovered lines in the file are unreachable defensive marshal-error paths (yaml/json Marshal of plain structs cannot fail; cron specs are pre-validated).
Disjoint from open quality PRs: no open PR touches
pkg/config/cadence.go(#6185 deletes dead kick-cadence code inpkg/dashboard/status_builder.goonly).Verified:
go test ./pkg/config/passes (95.1% package coverage).Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-fable-5