Skip to content

Strengthen action pin mapping spec coverage and assertion rigor in pkg/actionpins#45340

Merged
pelikhan merged 3 commits into
mainfrom
copilot/testify-expert-improve-test-quality-another-one
Jul 14, 2026
Merged

Strengthen action pin mapping spec coverage and assertion rigor in pkg/actionpins#45340
pelikhan merged 3 commits into
mainfrom
copilot/testify-expert-improve-test-quality-another-one

Conversation

Copilot AI commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

pkg/actionpins/spec_test.go had identified test-quality gaps around mapping edge cases, assertion strictness, and test organization. This update tightens the spec tests to cover unmapped/invalid mapping targets more explicitly and improves failure signal in internal table assertions.

  • Coverage: mapping edge cases

    • Added TestSpec_PublicAPI_ResolveActionPin_MappingTargetUnknown to verify mapped-to-unknown repos resolve to an empty result without panic.
    • Added TestApplyActionPinMapping_TargetWithoutRefSeparatorSkipped to verify mapping targets missing @ref are ignored.
  • Assertion quality improvements

    • Replaced slice-index assert.Equal calls with require.Equal after require.Len in TestBuildByRepoIndex_GroupsByRepoAndSortsDescending, improving fail-fast behavior and reducing misleading follow-on failures.
    • Improved assertion messages in indexed checks to pinpoint which expected ordering failed.
  • Spec/readability cleanup

    • Moved testSHAResolver near the top of spec_test.go (after constants) for easier fixture discovery.
    • Removed/normalized SPEC_MISMATCH comment locations by asserting current implementation behavior directly in tests.
func TestSpec_PublicAPI_ResolveActionPin_MappingTargetUnknown(t *testing.T) {
	ctx := &actionpins.PinContext{
		Warnings: make(map[string]bool),
		Mappings: map[string]string{
			"actions/checkout@v4": "does-not-exist/unknown-action-xyzzy@v1",
		},
	}

	require.NotPanics(t, func() {
		result, err := actionpins.ResolveActionPin("actions/checkout", "v4", ctx)
		require.NoError(t, err)
		assert.Empty(t, result)
	})
}

Copilot AI and others added 2 commits July 13, 2026 22:20
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve test quality in pkg/actionpins/spec_test.go Strengthen action pin mapping spec coverage and assertion rigor in pkg/actionpins Jul 13, 2026
Copilot AI requested a review from pelikhan July 13, 2026 22:30
@pelikhan pelikhan marked this pull request as ready for review July 14, 2026 02:41
Copilot AI review requested due to automatic review settings July 14, 2026 02:41
@pelikhan pelikhan merged commit 4e19d7b into main Jul 14, 2026
@pelikhan pelikhan deleted the copilot/testify-expert-improve-test-quality-another-one branch July 14, 2026 02:41

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

Strengthens pkg/actionpins test coverage and assertion precision.

Changes:

  • Covers unknown and malformed action-pin mapping targets.
  • Improves ordering assertions and test fixture organization.
  • Aligns spec tests with current behavior.
Show a summary per file
File Description
pkg/actionpins/spec_test.go Adds unknown-target coverage and reorganizes fixtures.
pkg/actionpins/actionpins_internal_test.go Tightens assertions and tests malformed mappings.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Medium

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/actionpins/spec_test.go

3 participants