Download the FOSSA CLI build matching the host architecture - #178
Open
cmboling wants to merge 1 commit into
Open
Download the FOSSA CLI build matching the host architecture#178cmboling wants to merge 1 commit into
cmboling wants to merge 1 commit into
Conversation
Broker requested the `amd64` FOSSA CLI asset on every platform. On ARM64 hosts that binary cannot run, and the resulting failure is difficult to diagnose: on Apple Silicon the OS terminates the process rather than reporting an error, so every integration surfaces a scan failure naming the user's repository, with nothing pointing at the CLI. The version check in `find_or_download` works by running the binary, so the unusable download was also re-fetched on every run rather than being replaced. Select the asset matching the host architecture instead. FOSSA CLI publishes `darwin_arm64` and `linux_arm64`; Windows has no ARM64 asset and continues to use `amd64`, which runs under emulation on Windows on ARM. Two tests cover this: one asserts the URL names the architecture Broker is running on, and an ignored test performs a HEAD request to confirm the asset Broker asks for is actually published, so a typo in an asset name cannot pass review by only being wrong at runtime. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011hi2pPurvYteMvsaPjZtSL
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: ASSERTIVE Plan: Team Run ID: Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Download the FOSSA CLI build matching the host architecture
Branch:
fix/arm64-cli-download→mainType: Bug fix
Problem
Broker requests the
amd64FOSSA CLI asset on every platform.src/fossa_cli.rssaid so explicitly:
// We only support "amd64" right now, so no need to look at target_archOn an ARM64 host that binary cannot run, and the failure is unusually hard to
diagnose:
returning an error. Under Rosetta the GHC-built binary fails with
__thread_starts section missing.failure naming the user's repository, with a message suggesting they debug their
own project. Nothing points at the CLI.
find_or_downloadchecks the local version by running the binary. That checkfails too, so the unusable download is re-fetched on every run instead of being
replaced.
The practical effect is that Broker does not work on a modern Mac, and the error
message sends the user to the wrong place.
Fix
Select the asset matching the host architecture. FOSSA CLI already publishes what
is needed — verified against the v3.18.2 release:
Windows has no ARM64 asset and continues to use
amd64, which runs under emulationon Windows on ARM.
Tests
download_url_targets_the_running_architecture— asserts the URL names thearchitecture Broker is running on.
download_url_asset_exists(#[ignore]) — performs a HEAD request against therelease to confirm the asset Broker asks for is actually published. Without this,
a typo in an asset name would pass unit tests and fail only at runtime, in exactly
the silent way the original bug did.
Verification
Reproduced and fixed on an Apple Silicon Mac. Deleting the cached binary and letting
Broker download it unaided:
Against a real 19-repository config:
Same config, same credentials, same repositories — only the CLI architecture changed.
cargo fmt --check,cargo clippy --all-targets --all-features -- -D warnings, andthe test suite all pass.
Upgrade note
An existing bad binary is cached and Broker will not replace it on its own, because
the version check cannot run it. Users on ARM64 should delete it once:
rm ~/.config/fossa/broker/fossaThis is called out in the changelog.