Skip to content

[actionpins] Make per-repo pin sorting mutation explicit in buildByRepoIndex#41427

Closed
Copilot wants to merge 2 commits into
mainfrom
copilot/fp-enhancer-improve-pkg-actionpins
Closed

[actionpins] Make per-repo pin sorting mutation explicit in buildByRepoIndex#41427
Copilot wants to merge 2 commits into
mainfrom
copilot/fp-enhancer-improve-pkg-actionpins

Conversation

Copilot AI commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

This change addresses the fp-enhancer update for pkg/actionpins by making the per-repository sort operation explicit without changing behavior. The previous implementation was correct but relied on implicit slice backing-array mutation through a ranged value copy.

  • Problem scope

    • Touches only pkg/actionpins index construction logic used for action pin resolution.
    • Removes ambiguity in how sorted results are applied back to byRepo.
  • Code change

    • In buildByRepoIndex, replaced map range-by-value sorting with key-based access:
      • from sorting repoPins (range value)
      • to sorting byRepo[key] directly
  • Why this matters

    • Makes in-place mutation intent unambiguous to readers.
    • Reduces risk of future “defensive” rewrites (e.g., redundant re-assignment) around map/slice semantics.
// before
for _, repoPins := range byRepo {
    slices.SortFunc(repoPins, cmpByVersionDesc)
}

// after
for key := range byRepo {
    slices.SortFunc(byRepo[key], cmpByVersionDesc)
}

Copilot AI linked an issue Jun 25, 2026 that may be closed by this pull request
5 tasks
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve action pin resolution in pkg/actionpins [actionpins] Make per-repo pin sorting mutation explicit in buildByRepoIndex Jun 25, 2026
Copilot AI requested a review from pelikhan June 25, 2026 12:53
@pelikhan pelikhan closed this Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[fp-enhancer] Improve pkg/actionpins

2 participants