Skip to content

[quality] test: cover commitsBehindStableV4 dispatch branches (pkg/hub/commit_behind.go) - #6205

Open
kubestellar-hive[bot] wants to merge 1 commit into
v4from
quality/test-commit-behind-dispatch
Open

[quality] test: cover commitsBehindStableV4 dispatch branches (pkg/hub/commit_behind.go)#6205
kubestellar-hive[bot] wants to merge 1 commit into
v4from
quality/test-commit-behind-dispatch

Conversation

@kubestellar-hive

Copy link
Copy Markdown
Contributor

What

Adds four tests to src/pkg/hub/commit_behind_test.go covering the uncovered dispatch branches of commitsBehindStableV4 (was 50.0% function coverage; now 100.0%):

  • same-commit short-circuit — a base that prefix-matches the stable head answers 0-behind immediately with no compare dispatched
  • empty-SHA guards — empty base SHA, and missing stable-branch head SHA, both stay unknown without dispatching
  • in-flight dedupe — a pending compare is not re-dispatched; caller gets unknown without blocking
  • cache-miss async dispatch — stubbed fetchCommitBehindCount, verifies the canonical short-SHA key is used and the result is eventually cached and served

Scope

Test-only; no production code changes. Files claimed: src/pkg/hub/commit_behind_test.go (exercising src/pkg/hub/commit_behind.go: commitsBehindStableV4). Disjoint from all open quality PRs (none touch commit_behind.go).

Verification

go test -run 'CommitBehind|CommitsBehind' ./pkg/hub/ passes; go vet ./pkg/hub/ clean. (-race unavailable in this environment: no gcc.)


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

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

…b/commit_behind.go)

commitsBehindStableV4 was 50% covered: only the cache-hit read path had
tests. Cover the remaining dispatch branches:

- same-commit short-circuit (prefix-matching base answers 0-behind with
  no compare dispatched)
- empty-SHA guards (empty base, and missing stable-branch head SHA)
- in-flight dedupe (a pending compare is not re-dispatched and answers
  unknown without blocking)
- cache-miss async dispatch (stubbed fetch, canonical short-SHA key,
  result eventually cached and served)

Function coverage: 50.0% -> 100.0%. No production code changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: hive-quality <quality@hive.local>
@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 hanthor 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/M Denotes a PR that changes 30-99 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/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants