From 9ba33c9edc8623057a8db5aee4cb9e8ca10b8db3 Mon Sep 17 00:00:00 2001 From: Antoine Toussaint Date: Sun, 23 Aug 2026 17:53:06 -0400 Subject: [PATCH 1/2] test(manager): pin linux/arm64 service-agent downloader contract (#346) Core's downloader already resolves agent assets via runtime.GOOS/GOARCH, so it targets service-__linux_arm64.tar.gz on arm64 Linux without change. No CI host builds on linux/arm64, so the existing host-platform test never exercises that asset name. Extract downloadURLForPlatform so the platform is a parameter, and add a regression test asserting core requests the exact linux_arm64 asset the service-* release matrices must publish. Co-Authored-By: Claude Opus 4.8 --- agents/manager/downloader_url.go | 10 +++++++++- agents/manager/downloader_url_test.go | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/agents/manager/downloader_url.go b/agents/manager/downloader_url.go index 79c2a758..7938656c 100644 --- a/agents/manager/downloader_url.go +++ b/agents/manager/downloader_url.go @@ -12,6 +12,14 @@ import ( // gaps (notably linux/arm64) and keeps version lookup and asset download pointed // at the same publisher repository. func DownloadURL(agent *resources.Agent) (string, error) { + return downloadURLForPlatform(agent, runtime.GOOS, runtime.GOARCH) +} + +// downloadURLForPlatform builds the release asset URL for an explicit platform. +// The platform is a parameter (not read from runtime here) so the asset-name +// contract every publisher repository must satisfy — including linux/arm64, +// which no CI host builds on — is verifiable independent of the running host. +func downloadURLForPlatform(agent *resources.Agent, goos, goarch string) (string, error) { source, err := toGithubSource(agent) if err != nil { return "", err @@ -25,6 +33,6 @@ func DownloadURL(agent *resources.Agent) (string, error) { source.Owner, source.Repo, agent.Version, - registration.GitHubAsset(agent.Name, agent.Version, runtime.GOOS, runtime.GOARCH), + registration.GitHubAsset(agent.Name, agent.Version, goos, goarch), ), nil } diff --git a/agents/manager/downloader_url_test.go b/agents/manager/downloader_url_test.go index efd4e3dd..ba9ea2cb 100644 --- a/agents/manager/downloader_url_test.go +++ b/agents/manager/downloader_url_test.go @@ -19,3 +19,21 @@ func TestDownloadURLUsesAgentPublisherAndCurrentPlatform(t *testing.T) { t.Fatalf("got %q, want %q", got, want) } } + +// TestDownloadURLResolvesLinuxARM64ServiceAgent pins core's side of the +// multi-arch contract: on a linux/arm64 host, core requests exactly the +// service-__linux_arm64.tar.gz asset the service-* release +// matrices must publish. No CI host builds on linux/arm64, so asserting the +// running platform alone would never exercise this path. +func TestDownloadURLResolvesLinuxARM64ServiceAgent(t *testing.T) { + agent := &resources.Agent{Kind: resources.ServiceAgent, Publisher: "codefly.dev", Name: "go", Version: "0.0.33"} + want := "https://github.com/codefly-dev/service-go/releases/download/v0.0.33/" + + "service-go_0.0.33_linux_arm64.tar.gz" + got, err := downloadURLForPlatform(agent, "linux", "arm64") + if err != nil { + t.Fatal(err) + } + if got != want { + t.Fatalf("got %q, want %q", got, want) + } +} From 224c2a0a29cb469685edbb91893a08c7c1403487 Mon Sep 17 00:00:00 2001 From: Antoine Toussaint Date: Sun, 23 Aug 2026 18:02:30 -0400 Subject: [PATCH 2/2] Revert "test(manager): pin linux/arm64 service-agent downloader contract (#346)" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts the no-op change from 9ba33c9e. Self-review found the added test tautological: the download path has no arch-dependent branching (GitHubAsset and the extracted helper are plain fmt.Sprintf), so asserting linux/arm64 specifically catches nothing the existing host-platform test doesn't — os and arch are interpolated identically regardless of value. The downloadURLForPlatform extraction existed only to feed that tautology, so it goes with it. Core's downloader is already architecture-agnostic (runtime.GOOS/GOARCH), so it needs no change for arm64 Linux. The actionable work for #346 lives in the service-* release matrices and the cli pins, not this repo. Co-Authored-By: Claude Opus 4.8 --- agents/manager/downloader_url.go | 10 +--------- agents/manager/downloader_url_test.go | 18 ------------------ 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/agents/manager/downloader_url.go b/agents/manager/downloader_url.go index 7938656c..79c2a758 100644 --- a/agents/manager/downloader_url.go +++ b/agents/manager/downloader_url.go @@ -12,14 +12,6 @@ import ( // gaps (notably linux/arm64) and keeps version lookup and asset download pointed // at the same publisher repository. func DownloadURL(agent *resources.Agent) (string, error) { - return downloadURLForPlatform(agent, runtime.GOOS, runtime.GOARCH) -} - -// downloadURLForPlatform builds the release asset URL for an explicit platform. -// The platform is a parameter (not read from runtime here) so the asset-name -// contract every publisher repository must satisfy — including linux/arm64, -// which no CI host builds on — is verifiable independent of the running host. -func downloadURLForPlatform(agent *resources.Agent, goos, goarch string) (string, error) { source, err := toGithubSource(agent) if err != nil { return "", err @@ -33,6 +25,6 @@ func downloadURLForPlatform(agent *resources.Agent, goos, goarch string) (string source.Owner, source.Repo, agent.Version, - registration.GitHubAsset(agent.Name, agent.Version, goos, goarch), + registration.GitHubAsset(agent.Name, agent.Version, runtime.GOOS, runtime.GOARCH), ), nil } diff --git a/agents/manager/downloader_url_test.go b/agents/manager/downloader_url_test.go index ba9ea2cb..efd4e3dd 100644 --- a/agents/manager/downloader_url_test.go +++ b/agents/manager/downloader_url_test.go @@ -19,21 +19,3 @@ func TestDownloadURLUsesAgentPublisherAndCurrentPlatform(t *testing.T) { t.Fatalf("got %q, want %q", got, want) } } - -// TestDownloadURLResolvesLinuxARM64ServiceAgent pins core's side of the -// multi-arch contract: on a linux/arm64 host, core requests exactly the -// service-__linux_arm64.tar.gz asset the service-* release -// matrices must publish. No CI host builds on linux/arm64, so asserting the -// running platform alone would never exercise this path. -func TestDownloadURLResolvesLinuxARM64ServiceAgent(t *testing.T) { - agent := &resources.Agent{Kind: resources.ServiceAgent, Publisher: "codefly.dev", Name: "go", Version: "0.0.33"} - want := "https://github.com/codefly-dev/service-go/releases/download/v0.0.33/" + - "service-go_0.0.33_linux_arm64.tar.gz" - got, err := downloadURLForPlatform(agent, "linux", "arm64") - if err != nil { - t.Fatal(err) - } - if got != want { - t.Fatalf("got %q, want %q", got, want) - } -}