Skip to content

[fp-enhancer] Improve pkg/actionpins #41413

Description

@github-actions

Caution

Protected files were modified in this change.
This pull request is in request_review mode and requires explicit human scrutiny before merge.

Protected files: .github/fp-enhancer-cache.json

Summary

First run of the Functional and Immutability Enhancer workflow, processing pkg/actionpins (round-robin pass 1).

Package processed

pkg/actionpins — Action pin resolution for GitHub Actions

Improvement made

Explicit sort mutation in buildByRepoIndex

File: pkg/actionpins/actionpins.go

Replaced the range-value sort pattern with key-indexed access:

// Before — sorts via implicit backing-array sharing (correct but non-obvious)
for _, repoPins := range byRepo {
    slices.SortFunc(repoPins, ...)
}

// After — mutation intent is explicit
for key := range byRepo {
    slices.SortFunc(byRepo[key], ...)
}

Why this matters: When ranging over a map[K][]T, the loop variable is a copy of the slice header. slices.SortFunc sorts the shared backing array in-place, so the original pattern is correct — but a reader could reasonably conclude the sort is lost on the copy. Using byRepo[key] directly:

  • Makes the mutation intent unambiguous
  • Removes the implicit reliance on backing-array sharing
  • Prevents a future "fix" that adds a redundant byRepo[key] = repoPins reassignment

Cache initialised

.github/fp-enhancer-cache.json created to track round-robin progress.
Next run will process: pkg/agentdrain

Checklist

  • All tests pass (go test ./pkg/actionpins/... -cover — 93.1%)
  • make fmt clean
  • No behavior changes (sort semantics identical)
  • Change is tasteful and idiomatic Go

References: §28163510263

Generated by 🔧 Functional Pragmatist · 77.7 AIC · ⌖ 6.32 AIC · ⊞ 11.1K ·

  • expires on Jun 26, 2026, 2:32 AM UTC-08:00

Note

This was originally intended as a pull request, but the git push operation failed.

Original error: pushSignedCommits: refusing unsigned push for branch 'fp-enhancer/pkg-actionpins-9f50014669df00f7': Signed-commit payload violates file-protection policy (request_review): .github/fp-enhancer-cache.json

Workflow Run: View run details and download bundle artifact

The bundle file is available in the agent artifact in the workflow run linked above.

To create a pull request with the changes:

# Download the artifact from the workflow run
gh run download 28163510263 -n agent -D /tmp/agent-28163510263

# Fetch the bundle into a temporary ref, then update the local branch
git fetch /tmp/agent-28163510263/aw-fp-enhancer-pkg-actionpins.bundle refs/heads/fp-enhancer/pkg-actionpins:refs/bundles/create-pr-fp-enhancer-pkg-actionpins-9f50014669df00f7-ddaedd23
git update-ref refs/heads/fp-enhancer/pkg-actionpins-9f50014669df00f7 refs/bundles/create-pr-fp-enhancer-pkg-actionpins-9f50014669df00f7-ddaedd23
git checkout fp-enhancer/pkg-actionpins-9f50014669df00f7
# Ensure the working tree matches the updated branch
git reset --hard
# Remove the temporary bundle ref
git update-ref -d refs/bundles/create-pr-fp-enhancer-pkg-actionpins-9f50014669df00f7-ddaedd23

# Push the branch to origin
git push origin fp-enhancer/pkg-actionpins-9f50014669df00f7

# Create the pull request
gh pr create --title '[fp-enhancer] Improve pkg/actionpins' --base main --head fp-enhancer/pkg-actionpins-9f50014669df00f7 --repo github/gh-aw

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions