Skip to content

1.5.0: arm64 + dynamic CloudFront source URL (LOC-6563)#39

Open
yashdsaraf wants to merge 2 commits into
masterfrom
LOC-6563-arm64-cloudfront-parity
Open

1.5.0: arm64 + dynamic CloudFront source URL (LOC-6563)#39
yashdsaraf wants to merge 2 commits into
masterfrom
LOC-6563-arm64-cloudfront-parity

Conversation

@yashdsaraf
Copy link
Copy Markdown
Collaborator

@yashdsaraf yashdsaraf commented Jun 1, 2026

Summary

  • Linux arm64 supportRbConfig::CONFIG['host_cpu'] =~ /arm64|aarch64/ selects BrowserStackLocal-linux-arm64. Branch order mirrors the Node SDK (arm64 wins over alpine on musl).
  • Dynamic source URL — new BrowserStack::FetchDownloadSourceUrl POSTs to local.browserstack.com/binary/api/v1/endpoint to discover the current CDN base. CloudFront is the primary; CloudFlare is requested as fallback on the 5th-remaining retry via X-Local-Fallback-Cloudflare: true header + error_message body field. Joins the Node SDK pattern that has been in prod for years.
  • Proxy passthrough on binary downloadproxyHost/proxyPort from Local#start are now also threaded into the endpoint POST and binary GET. Users behind a forward proxy can now download (was: proxy was only applied to the running binary, not the download).
  • User-Agentbrowserstack-local-ruby/<version> header on both the endpoint POST and the binary GET. Helps server-side telemetry attribute downloads by binding+version.
  • TLS certificate verification now enforced (OpenSSL::SSL::VERIFY_PEER). Previous releases used VERIFY_NONE. The new POST carries the user's auth_token — shipping that under VERIFY_NONE would have been a security regression. CHANGELOG calls this out; users relying on disabled verification can pin to 1.4.3.

Background

Tracks LOC-6563. C# parity PR ships in coordination — see browserstack-local-csharp #LOC-6563.

Files

  • New: `lib/browserstack/fetch_download_source_url.rb`, `lib/browserstack/version.rb`
  • Rewritten: `lib/browserstack/localbinary.rb` (arm64, dynamic URL, retry-with-fallback, proxy, VERIFY_PEER, UA)
  • Modified: `lib/browserstack/local.rb` (threads conf into LocalBinary.new), `browserstack-local.gemspec` (1.4.3 → 1.5.0 + files list), `CHANGELOG.md` (1.5.0 entry with VERIFY_PEER callout), `test/browserstack-local-test.rb` (8 new unit tests)

Test plan

  • `ruby -Ilib -Itest test/browserstack-local-test.rb -n '/BrowserStackLocalBinaryTest/'` — 8 new unit tests pass (arm64 gnu/musl, alpine, darwin arm64, default + custom UA, proxy passthrough)
  • Manual on darwin: `ruby -Ilib -e 'require "browserstack/local"; b = BrowserStack::Local.new(ENV["BROWSERSTACK_ACCESS_KEY"]); b.start; puts "pid=#{b.pid}"; sleep 1; b.stop'` downloads + verifies
  • Manual on Linux arm64 — picks `BrowserStackLocal-linux-arm64`
  • Manual behind a forward proxy — `Local.new.start({"proxyHost" => ..., "proxyPort" => ...})` downloads via proxy
  • Travis / existing integration tests pass with a real `BROWSERSTACK_ACCESS_KEY`

🤖 Generated with Claude Code

- New FetchDownloadSourceUrl module POSTs to /binary/api/v1/endpoint to
  discover the current CDN base URL (CloudFront primary; CloudFlare
  requested as fallback via X-Local-Fallback-Cloudflare header on retry).
- Linux arm64 host now downloads BrowserStackLocal-linux-arm64. Branch
  order mirrors Node SDK: arm64 wins over alpine on musl.
- proxyHost/proxyPort from Local#start now also flow into the binary
  download (previously ignored for download, used only for running binary).
- User-Agent: browserstack-local-ruby/<version> on endpoint POST + GET.
- TLS verification now enforced (VERIFY_PEER); was VERIFY_NONE.
  CHANGELOG calls this out for users on broken trust stores.

Tracks LOC-6563.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Net::HTTP defaults to 60s open + 60s read. A hung
local.browserstack.com or CDN can stall the binary download for
multiple minutes before the user sees an error.

- fetch_download_source_url.rb: open_timeout=10, read_timeout=15
  (small JSON response, fast)
- localbinary.rb download_to: open_timeout=10, read_timeout=30
  (read_timeout bounds per-read stalls, not total transfer)

Code review finding from LOC-6563 review.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@yashdsaraf yashdsaraf marked this pull request as ready for review June 1, 2026 18:10
@yashdsaraf yashdsaraf requested a review from a team as a code owner June 1, 2026 18:10
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.

1 participant