copilot-sdk icon indicating copy to clipboard operation
copilot-sdk copied to clipboard

fix(go): select the host CLI package in E2E tests

Open Pybsama opened this issue 4 months ago • 0 comments

Closes #2116.

What this changes

The Go E2E harness now derives exact @github/copilot-<platform>-<arch> package candidates from ffihost.PrebuildsFolder() instead of globbing every copilot-* directory and taking the first sorted result.

  • macOS and Windows probe only their exact host package;
  • Linux probes the detected glibc/musl package first and the sibling libc variant second;
  • unrelated or foreign-platform copilot-* packages are ignored;
  • CLIPath(testing.TB) reports the packages tried and those actually present, replacing the duplicated empty-path guards at its call sites; and
  • go/test.sh applies the same exact host OS/architecture mapping.

The shared .github/actions/setup-copilot action is intentionally unchanged, as called out in the Issue.

Tests

Added unit coverage for:

  • macOS, Windows, Linux glibc, and Linux musl candidate generation;
  • ignoring alphabetically earlier foreign and non-platform packages;
  • respecting Linux libc candidate order;
  • rejecting a package without an index.js; and
  • listing installed packages for failure diagnostics.

Local validation:

  • GOTOOLCHAIN=go1.24.0 go test ./internal/e2e/testharness
  • go test ./...
  • env -u COPILOT_CLI_PATH bash test.sh
  • COPILOT_SDK_DEFAULT_CONNECTION=inprocess GOFLAGS=-tags=copilot_inprocess env -u COPILOT_CLI_PATH bash test.sh
  • golangci-lint run ./... --timeout=5m (0 issues)
  • bash -n go/test.sh
  • cross-compiled the testharness tests for Linux, Windows, and macOS on amd64 and arm64

Both the default and in-process full race-enabled test runs passed.

Pybsama avatar Jul 30 '26 13:07 Pybsama