Skip to content

Cover untested Resolver branches in pkg/intent/resolver_test.go - #52941

Merged
pelikhan merged 2 commits into
mainfrom
copilot/testify-expert-improve-test-quality-again
Aug 15, 2026
Merged

Cover untested Resolver branches in pkg/intent/resolver_test.go#52941
pelikhan merged 2 commits into
mainfrom
copilot/testify-expert-improve-test-quality-again

Conversation

Copilot AI commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

resolver_test.go exercised only the ResolvePullRequest closing-issue/artifact/ambiguous paths. The explicit-intent branch, most of ResolveIssue, and statusForLabels's MatchLabels == nil case had no direct coverage, and the unlinked/ambiguous tests asserted only non-zero fields.

Test-only change; resolver.go is untouched.

New tests

  • Explicit intentResolvePullRequest returns the record as-is when ResolverVersion is set, and fills it from the resolver when blank. Also asserts the caller's record is not mutated (relies on the value copy in resolver.go:74).
  • ResolveIssue — no labels → unlinked, unmapped labels, and cloneStrings isolation (mutating the caller's slice after the call does not affect intent.Labels).
  • statusForLabels with nil MatchLabels — covered from both entry points (PR artifact-label fallback and ResolveIssue), which previously fell through untested to AttributionUnmapped.

Tightened existing assertions

TestResolverResolvePullRequestNoSourcesUnlinked and ...MultipleClosingIssuesAmbiguous now compare the whole struct, so zero-value fields are asserted and unexpected fields are caught:

assert.Equal(t, IntentRecord{
	Status:          AttributionAmbiguous,
	Source:          SourceClosingIssue,
	Rule:            "multiple_closing_issues",
	ResolverVersion: "test-v1",
}, intent)

Both resolvers now set an explicit ResolverVersion so that field participates in the comparison rather than matching the zero value by accident.

The optional table-driven refactor and t.Run regrouping from the issue were skipped to keep the diff additive; the existing one-function-per-branch layout stays consistent with the rest of the package.


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 7.49 AIC · ⌖ 5.77 AIC · ⊞ 8.7K ·
Comment /souschef to run again

@github-actions

Copy link
Copy Markdown
Contributor

PR Triage

  • Category: test | Risk: low | Score: 20/100 (Impact 5, Urgency 5, Quality 10)
  • Action: defer
  • WIP/draft PR with 0 diff so far (branch not yet populated). Revisit once commits land.

Generated by 🔧 PR Triage Agent · auto · 37.4 AIC · ⌖ 2.04 AIC · ⊞ 8.1K ·

…atchLabels

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve test quality for resolver_test.go Cover untested Resolver branches in pkg/intent/resolver_test.go Aug 15, 2026
Copilot AI requested a review from pelikhan August 15, 2026 18:23
@pelikhan
pelikhan marked this pull request as ready for review August 15, 2026 19:06
Copilot AI balanced review requested due to automatic review settings August 15, 2026 19:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds direct coverage for previously untested resolver branches and strengthens assertions.

Changes:

  • Tests explicit-intent version handling and immutability.
  • Covers ResolveIssue, nil matchers, and label cloning.
  • Uses full-record assertions for unlinked and ambiguous results.
Show a summary per file
File Description
pkg/intent/resolver_test.go Expands resolver branch coverage and tightens expected results.

Review details

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@pelikhan
pelikhan merged commit b940697 into main Aug 15, 2026
29 of 30 checks passed
@pelikhan
pelikhan deleted the copilot/testify-expert-improve-test-quality-again branch August 15, 2026 19:20
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Maintainers will want another pass here before investigating.

Please refresh the branch, fix the failing check, and then run the pr-finisher skill.

Failed checks:

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 7.49 AIC · ⌖ 5.77 AIC · ⊞ 8.7K ·
Comment /souschef to run again

@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.87.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[testify-expert] Improve Test Quality: pkg/intent/resolver_test.go

4 participants