Skip to content

[fp-enhancer] Improve pkg/actionpins immutability - #76470

Merged
pelikhan merged 1 commit into
mainfrom
fp-enhancer-actionpins-0d80e345c8399460
Nov 10, 2026
Merged

pelikhan merged 1 commit into
mainfrom
fp-enhancer-actionpins-0d80e345c8399460

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Overview

Processed pkg/actionpins as the first package in the documented round-robin order. Replaced the fixed package-level ghesArtifactPins map with a pure switch-based lookup that returns an independent ActionPin value on each call.

Key changes

  • Removed shared mutable GHES pin registry state.
  • Preserved both existing GHES artifact pins and lookup behavior.
  • Added direct coverage for a known pin and an unknown repository.

Validation

  • make fmt passed.
  • go test ./pkg/actionpins -count=1 passed.
  • Final gate custom Go linters, schema freshness, and impacted Go tests passed.
  • Go lint could not run because golangci-lint is 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.

Generated by 🔧 Functional Pragmatist · codex · gpt56 · ~4 AIC · ⌖ ~2 AIC · ⊞ 19.3K · ◷

  • expires on Nov 11, 2026, 1:36 AM UTC-08:00

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.

ðŸŸĒ 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)

@pelikhan
pelikhan marked this pull request as ready for review November 10, 2026 14:35
@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

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.

Generated from Test Quality Sentinel · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 7.2K · ◷

🧊 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor Author

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

Matt Pocock Skills Reviewer

Outcome: reported_action

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.

Generated from Matt Pocock Skills Reviewer · routed: haiku55 xhigh · ~2 AIC · ⌖ ~2 AIC · ⊞ 6.6K · ◷

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Ponytail Reviewer completed successfully!

Generated by Ponytail Reviewer for #76470

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ 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: reported_no_action

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.

Generated from Design Decision Gate 🏗ïļ Â· routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 8.5K · ◷

🏗ïļ ADR gate enforced by Design Decision Gate 🏗ïļ

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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:

  1. 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) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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 TestGHESArtifactPin table does not directly assert the download-artifact branch (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 ghesArtifactPins identifier.
  • ✅ go test ./pkg/actionpins and go vet pass 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"},

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[/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) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[/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.

@pelikhan
pelikhan merged commit 258408a into main Nov 10, 2026
126 of 149 checks passed
@pelikhan
pelikhan deleted the fp-enhancer-actionpins-0d80e345c8399460 branch November 10, 2026 15:47
@github-actions

Copy link
Copy Markdown
Contributor Author

🎉 This pull request is included in a new release.

Release: v1.2.3

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.

2 participants