Skip to content

[quality] test: cover pkg/hubbackup sealed-archive error branches (Build/Finish seal failures, Verify malformed plaintext, Extract fs errors, VerifyLatest store errors) - #6220

Open
kubestellar-hive[bot] wants to merge 1 commit into
v4from
quality/test-hubbackup-error-branches

Conversation

@kubestellar-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds src/pkg/hubbackup/error_branches_test.go covering the reachable error branches the existing happy-path suites leave unexercised. Package coverage: 92.7% → 95.8%, all existing tests unchanged and passing.

Branches covered (file:line of the previously-uncovered block)

  • Sealing failures: Build with a non-AES-256 key (backup.go:470), Builder.Finish seal failure (builder_export.go:130), double Finish (builder_export.go:112), AddBytes after Finish (backup.go:318)
  • Tree walking: builder.addTree missing root warn-and-skip (backup.go:337), excludedDirs subtree pruning (backup.go:349), exported AddTree per-file skip callback (builder_export.go:74)
  • Verify on malformed plaintext: sealed non-gzip (backup.go:484) and gzip-but-not-tar (backup.go:498) streams
  • Extract filesystem failures: member parent path occupied by a file (backup.go:570), member path occupied by a directory (backup.go:573)
  • parseSpokeStream: corrupt base64 flushed by the next @@FILE@@ marker (collect.go:424)
  • ObjectStore: unparseable key DER (objectstore.go:129), region default (objectstore.go:140), do() invalid method (objectstore.go:220) and dead endpoint (objectstore.go:228)
  • VerifyLatest: missing credentials (run.go:181), failing List (run.go:185), failing Get (run.go:192)
  • Run: a failed Prune is a warning, not a failed backup (run.go:168)

Remaining uncovered blocks in the package are defense-in-depth branches that are practically unreachable (GCM construction on a valid AES block, tar/gzip writes into a strings.Builder, post-Verify re-decode paths in Extract, RSA sign failure, the 256 MiB decompression-bomb member).

Validation

go test -count=1 -coverprofile ./pkg/hubbackup → ok, 95.8% of statements; go vet ./pkg/hubbackup clean; new file is gofmt-clean.

Disjointness

No open PR touches pkg/hubbackup; this claims only src/pkg/hubbackup/error_branches_test.go (new file). Test-only change — no production code touched.


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

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

Covers the reachable error branches the happy-path suites left
unexercised, raising pkg/hubbackup coverage from 92.7% to 95.8%:

- Build/Builder.Finish seal failure with a non-AES-256 key, double
  Finish, and AddBytes after Finish (backup.go, builder_export.go)
- builder.addTree missing root and excludedDirs subtree pruning;
  exported AddTree per-file skip callback (builder_export.go:74)
- Verify on sealed-but-malformed plaintext: non-gzip and non-tar
  streams (backup.go:484, :498)
- Extract filesystem failures: parent path occupied by a file,
  member path occupied by a directory (backup.go:570, :573)
- parseSpokeStream flush failure on the NEXT @@file@@ marker
  (collect.go:424)
- NewObjectStore unparseable key bytes and region default
  (objectstore.go:129, :140); do() invalid method and dead endpoint
  (objectstore.go:220, :228)
- VerifyLatest store-error paths: missing credentials, failing List,
  failing Get (run.go:181, :185, :192)
- Run tolerates a failed Prune as a warning (run.go:168)

Test-only change; no production code touched.

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

github-actions Bot commented Sep 7, 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.

@kubestellar-prow kubestellar-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 7, 2026
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