Improve actionpins spec coverage for fallback, mapping, and context propagation#43871
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This pull request strengthens pkg/actionpins spec coverage by adding targeted tests for previously untested resolution branches in ResolveActionPin/ResolveLatestActionPin, including full-SHA passthrough formatting, mapping validation behavior, fallback behavior on resolution errors, and propagation of caller-provided contexts into dynamic resolution.
Changes:
- Add spec tests for unknown full-SHA passthrough formatting, invalid mapping entries being ignored, and
ResolveLatestActionPinembedded-fallback behavior whenResolveActionPinerrors (including the no-fallback case). - Add a resolver-context propagation test to verify
PinContext.Ctx(including cancellation and values) is forwarded unchanged intoSHAResolver.ResolveSHA. - Refactor/clean up tests for clarity (table-driven enforce-pinned cases,
WaitGroupin concurrency test, and userequire.NotEmptywhere subsequent assertions depend on it), and remove low-signal struct-field-only tests.
Show a summary per file
| File | Description |
|---|---|
| pkg/actionpins/spec_test.go | Adds higher-value spec coverage for action pin resolution edge cases (SHA passthrough, mapping validation, fallback behavior, and context propagation) and refactors existing tests for readability. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Low
|
🧠 Matt Pocock Skills Reviewer failed during the skills-based review. |
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. |
|
|
|
✅ Test Quality Sentinel completed test quality analysis. |
🧪 Test Quality Sentinel Report✅ Test Quality Score: 88/100 — Excellent
📊 Metrics (2 tests)
✅ Changes BreakdownConstants Extracted (3 additions)
Tests Modified (2 functions)
Test Quality Indicators
Verdict
Scoring basis:
This PR improves test quality through strategic refactoring: expanding fallback error handling, clarifying context semantics with better naming, and reducing duplication through extracted constants. All changes are design-focused and add meaningful coverage to behavioral contracts. Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
Design Decision Gate — ADR RequiredThis PR makes significant changes to core business logic ( Draft ADR committed:
What to do next
Once an ADR is linked in the PR body, this gate will re-run and verify the implementation matches the decision. Why ADRs MatterADRs create a searchable, permanent record of why the codebase looks the way it does. Future contributors (and your future self) will thank you. Michael Nygard ADR Format ReferenceAn ADR must contain these four sections to be considered complete:
All ADRs are stored in
|
|
@copilot please run the
|
🤖 PR Triage — Run §28834001067
Score Breakdown:
CI: Rationale: Pure test + ADR doc — no production code changes. Low risk. Recommend auto-merge after human spot-check. Labels applied:
|
PR is ready for maintainer review. Here's the status summary:
Actions taken: Verified branch state, confirmed no unresolved threads, validated all local Hand-off: A maintainer needs to approve and re-trigger the CWI/CGO/Smoke CI workflow runs (close/reopen or trigger via |
|
🎉 This pull request is included in a new release. Release: |
pkg/actionpins/spec_test.gowas missing coverage for several high-value resolution paths inpkg/actionpins/actionpins.go, especially around SHA passthrough, mapping failures, and fallback behavior. This change tightens the spec tests around those branches while simplifying a few low-signal cases.Resolution edge cases
PinContext.Mappingsentries being ignored without altering resolutionResolveLatestActionPinfalling back whenResolveActionPinerrors, including the no-fallback empty caseResolver context propagation
PinContext.Ctxis forwarded unchanged, including context values and pre-cancelled stateTest structure and readability
ResolveActionPinenforce-pinned cases into a table-driven testsync.WaitGroupassert.NotEmptychecks torequire.NotEmptywhere follow-on assertions depend on a non-empty resultSignal-to-noise cleanup
ActionPin,ActionYAMLInput,ContainerPin, andResolutionFailureExample of the newly covered passthrough behavior: