From 222ab48f2f3860c0504be805022a6bafa0cc933a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Mar 2026 18:50:05 +0000 Subject: [PATCH 1/2] Initial plan From c02c57e19eec5594b5cb09cd06cd6a81d3356b1c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Mar 2026 19:12:27 +0000 Subject: [PATCH 2/2] fix: make TestGetActionPinsSorting resilient to JSON pin count changes Instead of hardcoding the expected pin count (34), the test now dynamically derives the expected count by parsing actionPinsJSON directly. This ensures: - The test always validates that getActionPins() returns all entries from JSON - No manual count updates needed when new pins are added - Resilient to Go test cache issues where stale binaries could cause failures Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> --- pkg/workflow/action_pins_test.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/pkg/workflow/action_pins_test.go b/pkg/workflow/action_pins_test.go index 62ab46ccf12..469c9579de5 100644 --- a/pkg/workflow/action_pins_test.go +++ b/pkg/workflow/action_pins_test.go @@ -4,6 +4,7 @@ package workflow import ( "bytes" + "encoding/json" "os" "regexp" "strings" @@ -297,9 +298,18 @@ func TestApplyActionPinToStep(t *testing.T) { func TestGetActionPinsSorting(t *testing.T) { pins := getActionPins() - // Verify we got all the pins (34 as of March 2026) - if len(pins) != 34 { - t.Errorf("getActionPins() returned %d pins, expected 34", len(pins)) + // Dynamically derive the expected count from the JSON file to avoid + // hardcoding a number that breaks when new pins are added or when + // the Go test cache contains a stale binary. + var jsonData ActionPinsData + if err := json.Unmarshal(actionPinsJSON, &jsonData); err != nil { + t.Fatalf("Failed to parse action_pins.json: %v", err) + } + expectedCount := len(jsonData.Entries) + + // Verify we got all the pins from the JSON (catches parsing bugs) + if len(pins) != expectedCount { + t.Errorf("getActionPins() returned %d pins, expected %d (from action_pins.json)", len(pins), expectedCount) } // Verify they are sorted by version (descending) then by repository name (ascending)