Repository navigation
[fp-enhancer] Improve pkg/actionpins immutability - #76470
Conversation
There was a problem hiding this comment.
ðĒ Approval recommended
No active review issues are identified, and the change preserves existing lookup behavior while adding coverage for known and unknown repositories.
No open issues ð
What changed in this PR
This PR makes the fixed GHES artifact-pin lookup immutable by replacing shared package-level map state with switch-based value lookup while preserving existing pin values and fallback behavior.
Changes:
- Replaced the mutable GHES artifact-pin map with switch-based lookup logic.
- Preserved GHES upload/download pins and lookup precedence.
- Added tests for known and unknown artifact repositories.
| File | Description |
|---|---|
| pkg/âactionpins/âresolve.go | Implements immutable switch-based GHES artifact-pin lookup and preserves existing resolution behavior. |
| pkg/âactionpins/âactionpins_internal_test.go | Adds direct coverage for known and unknown GHES artifact-pin lookups. |
Review effort: Lite (auto)
|
â Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
â PR Code Quality Reviewer completed the code quality review.
|
|
ð§ Matt Pocock Skills Reviewer has completed the skills-based review. â Matt Pocock Skills ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
â Ponytail Reviewer completed successfully!
|
|
â Design Decision Gate ðïļ completed the design decision gate check. See the comment below for the result and any generated ADR draft. Design Decision Gate ðïļOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
There was a problem hiding this comment.
What this change does: It replaces the fixed GHES artifact pin map with a switch that returns a fresh value. It adds coverage for a known pin and an unknown repository.
Should fix:
-
Remove duplicate pin coverage
- What this is: The new test checks the private lookup.
- Problem: The existing compatibility test already checks the upload pin through the public resolver, so its values must now be maintained twice.
- Fix: Delete the new test and retain the unknown-repository check through
ResolveGHESActionPin. - If we skip it: Each pin update requires duplicate test changes.
Verdict: Ship.
Lean: -26 lines possible.
Generated by âïļ Ponytail Reviewer for #76470 · codex · routed: gpt61 medium · ~4 AIC · â ~1 AIC · â 181
Comment /ponytail to run again
| } | ||
| } | ||
|
|
||
| func TestGHESArtifactPin(t *testing.T) { |
There was a problem hiding this comment.
Should fix: This tests the private lookup, but TestResolveActionPin_GHESArtifactCompatibility already checks the same upload pin through the public resolver. Delete this test and keep the unknown-repository case as three assertions against ResolveGHESActionPin; otherwise the same pin values must be maintained in two tests.
There was a problem hiding this comment.
Reviewed the changed action pin lookup and tests. The switch preserves both GHES artifact pins and exact-match behavior; existing compatibility coverage verifies the public download-artifact result. No actionable correctness, performance, security, or maintainability issues found in the changed lines.
ð Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~2 AIC · â ~1 AIC · â 1.6K
Comment /review to run again
There was a problem hiding this comment.
Skills-Based Review ð§
Applied /tdd (test coverage and consistency) and /codebase-design (immutability and seam shape). The refactor is behavior-preserving; two small test items remain.
ð Key Themes & Highlights
Answer to the review focus
Yes, the switch-based ghesArtifactPin is a good fit for a two-entry fixed registry. Each call builds a fresh ActionPin value, so callers cannot mutate shared state. ActionPin.Inputs is nil in both the old and new paths. The values match the removed map byte for byte, and ResolveGHESActionPin keeps its fallback behavior.
Key themes
- Test coverage: the new
TestGHESArtifactPintable does not directly assert thedownload-artifactbranch (inline comment on the test file). - Consistency: the new subtests omit
t.Parallel(), unlike the sibling GHES test (inline comment).
Positive highlights
- â Removing the package-level mutable map eliminates shared state, which is the stated goal.
- â
No remaining references to the removed
ghesArtifactPinsidentifier. - â
go test ./pkg/actionpinsandgo vetpass locally.
@copilot please address the review comments above.
ð§ Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~2 AIC · â ~2 AIC · â 6.6K
Comment /matt to run again
| }, | ||
| ok: true, | ||
| }, | ||
| {repo: "unknown/action"}, |
There was a problem hiding this comment.
[/tdd] The table covers only upload-artifact and an unknown repo, so the download-artifact branch of ghesArtifactPin has no direct assertion. The existing TestResolveActionPin_GHESArtifactCompatibility exercises it indirectly, but a unit test for the new function should cover every known branch.
ðĄ Suggested case
{
repo: "actions/download-artifact",
want: ActionPin{
Repo: "actions/download-artifact",
Version: "v3.1.0",
SHA: "a9bc5e6ef2cb54c177f32aa5726adaa15e7e2d59",
},
ok: true,
},This makes the direct test cover both known pins.
@copilot please address this.
| } | ||
|
|
||
| for _, tt := range tests { | ||
| t.Run(tt.repo, func(t *testing.T) { |
There was a problem hiding this comment.
[/tdd] Minor: these subtests do not call t.Parallel(), unlike the sibling TestResolveActionPin_GHESArtifactCompatibility, which parallelises each subtest. Adding it keeps the two GHES tests consistent.
@copilot please address this.
|
ð This pull request is included in a new release. Release: |
Overview
Processed
pkg/actionpinsas the first package in the documented round-robin order. Replaced the fixed package-levelghesArtifactPinsmap with a pure switch-based lookup that returns an independentActionPinvalue on each call.Key changes
Validation
make fmtpassed.go test ./pkg/actionpins -count=1passed.golangci-lintis not installed in the environment.Review focus
Confirm the switch-based immutable lookup remains the preferred representation for this small fixed registry and that GHES fallback behavior is unchanged.