[quality] 🧪 test: pin self-authored auto-merge sweep merge-safety guards - #4808
Conversation
Cover the untested guard branches of the self-authored sweep path: - trySweepSelfAuthoredPR (71.4% -> 98.0%): gone/fetch-pr, closed, draft, not-app-authored at eval, missing-head-sha, not-mergeable, commitGreen error, status-pending, recheck gone/error, head-changed-since-eval (vanished and pushed), merge-failed, merge-not-applied, plus the green merge happy path. - refreshRateLimitCache (33.3% -> 100%): success writes back to the go-github cache via GET /rate_limit; API errors are swallowed. - isHiveAppReviewAuthor (66.7% -> 100%): nil client, nil review, blank appBotLogin, forged author, and trusted App author. - requiredStatusCheckContexts (76.2% -> 95.2%): blank branch, ErrBranchNotProtected as known-empty-set, API error fails closed, contexts+checks parsing with nil check entries. pkg/github coverage: 91.9% -> 92.5%. Refs #4807 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: sec-check <sec-check@hive.kubestellar.io>
|
Changelog: this PR changes code but does not touch 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. |
|
Review record: tests drive the REAL /lgtm |
|
LGTM label has been added. DetailsGit tree hash: f9a64352ee1397c4a5891e9cfff1418af6aaa454 |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: clubanderson 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. Check out what's new:
Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey |
#4808) Cover the untested guard branches of the self-authored sweep path: - trySweepSelfAuthoredPR (71.4% -> 98.0%): gone/fetch-pr, closed, draft, not-app-authored at eval, missing-head-sha, not-mergeable, commitGreen error, status-pending, recheck gone/error, head-changed-since-eval (vanished and pushed), merge-failed, merge-not-applied, plus the green merge happy path. - refreshRateLimitCache (33.3% -> 100%): success writes back to the go-github cache via GET /rate_limit; API errors are swallowed. - isHiveAppReviewAuthor (66.7% -> 100%): nil client, nil review, blank appBotLogin, forged author, and trusted App author. - requiredStatusCheckContexts (76.2% -> 95.2%): blank branch, ErrBranchNotProtected as known-empty-set, API error fails closed, contexts+checks parsing with nil check entries. pkg/github coverage: 91.9% -> 92.5%. Refs #4807 Signed-off-by: sec-check <sec-check@hive.kubestellar.io> Co-authored-by: sec-check <sec-check@hive.kubestellar.io> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
#4808) Cover the untested guard branches of the self-authored sweep path: - trySweepSelfAuthoredPR (71.4% -> 98.0%): gone/fetch-pr, closed, draft, not-app-authored at eval, missing-head-sha, not-mergeable, commitGreen error, status-pending, recheck gone/error, head-changed-since-eval (vanished and pushed), merge-failed, merge-not-applied, plus the green merge happy path. - refreshRateLimitCache (33.3% -> 100%): success writes back to the go-github cache via GET /rate_limit; API errors are swallowed. - isHiveAppReviewAuthor (66.7% -> 100%): nil client, nil review, blank appBotLogin, forged author, and trusted App author. - requiredStatusCheckContexts (76.2% -> 95.2%): blank branch, ErrBranchNotProtected as known-empty-set, API error fails closed, contexts+checks parsing with nil check entries. pkg/github coverage: 91.9% -> 92.5%. Refs #4807 Signed-off-by: sec-check <sec-check@hive.kubestellar.io> Co-authored-by: sec-check <sec-check@hive.kubestellar.io> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: kubestellar-hive[bot] <280983584+kubestellar-hive[bot]@users.noreply.github.com>
#4808) Cover the untested guard branches of the self-authored sweep path: - trySweepSelfAuthoredPR (71.4% -> 98.0%): gone/fetch-pr, closed, draft, not-app-authored at eval, missing-head-sha, not-mergeable, commitGreen error, status-pending, recheck gone/error, head-changed-since-eval (vanished and pushed), merge-failed, merge-not-applied, plus the green merge happy path. - refreshRateLimitCache (33.3% -> 100%): success writes back to the go-github cache via GET /rate_limit; API errors are swallowed. - isHiveAppReviewAuthor (66.7% -> 100%): nil client, nil review, blank appBotLogin, forged author, and trusted App author. - requiredStatusCheckContexts (76.2% -> 95.2%): blank branch, ErrBranchNotProtected as known-empty-set, API error fails closed, contexts+checks parsing with nil check entries. pkg/github coverage: 91.9% -> 92.5%. Refs #4807 Signed-off-by: sec-check <sec-check@hive.kubestellar.io> Co-authored-by: sec-check <sec-check@hive.kubestellar.io> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Andy Anderson <andy@clubanderson.com>
Test Improvement
Adds
src/pkg/github/automerge_sweep_guards_test.gocovering the untested merge-safety branches of the self-authored auto-merge sweep — the path where the Hive App squash-merges its own PRs with no human review:pkg/github: 91.9% → 92.5%. Full
go test ./pkg/github/passes; gofmt/vet clean. Test-only change — no production code touched.Related Issue
Fixes #4807
Bead: da00972f-57b
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-fable-5