Skip to content

feat(build): add BROWSEROS_SKIP_R2_DOWNLOAD escape hatch for external builds#999

Open
Aarjav Jain (A2rjav) wants to merge 1 commit into
browseros-ai:devfrom
A2rjav:fix/792-skip-r2-for-external-builds
Open

feat(build): add BROWSEROS_SKIP_R2_DOWNLOAD escape hatch for external builds#999
Aarjav Jain (A2rjav) wants to merge 1 commit into
browseros-ai:devfrom
A2rjav:fix/792-skip-r2-for-external-builds

Conversation

@A2rjav
Copy link
Copy Markdown

Summary

Closes #792

The download_resources build module hard-failed validation when R2 credentials were missing, blocking external contributors from running a local Chromium build. The maintainer noted in #792 that the R2 bucket is for internal build infra and not actually required for a local build — but until now there was no documented or supported way to skip it.

This PR adds a documented escape hatch: set BROWSEROS_SKIP_R2_DOWNLOAD=1 and the download_resources step short-circuits cleanly.

Changes

Code

  • packages/browseros/build/common/env.py — adds EnvConfig.skip_r2_download property. Reads BROWSEROS_SKIP_R2_DOWNLOAD and accepts 1 / true / yes / on (case-insensitive, trimmed).
  • packages/browseros/build/modules/storage/download.py
    • validate() returns early when the flag is set, bypassing both the boto3 import check and the R2 config check.
    • execute() logs a clear log_warning and returns before any R2 call.
    • The existing "R2 configuration not set" ValidationError now points users at the new flag, so contributors who hit the error see the workaround immediately.

Testspackages/browseros/build/modules/storage/download_test.py

  • test_validate_skips_all_checks_when_flag_set — validates with has_r2_config() returning False, must not raise.
  • test_validate_still_requires_r2_when_flag_unset — flag off, missing creds → still raises ValidationError (no regression).
  • test_execute_returns_early_when_flag_set — asserts get_r2_client is never invoked and a warning is emitted. log_warning is mocked so the test is portable across hosts whose console encoding can't render the warning emoji (e.g. Windows CP1252).

DocsCONTRIBUTING.md gets a new "Building Without R2 Credentials (External Contributors)" section under Browser Development with POSIX + PowerShell examples and an explicit caveat that copy_resources may still need a populated resources/binaries/browseros_server/ cache for a full build.

Test plan

  • python -m unittest build.modules.storage.download_test -v — all 7 tests pass (4 existing + 3 new)
  • EnvConfig.skip_r2_download smoke test across 9 input values (1, true, TRUE, yes, on, 0, false, "", " 1 ") — all produce expected booleans
  • On a clean fork with no R2 creds in .env: BROWSEROS_SKIP_R2_DOWNLOAD=1 python build/build.py --config build/config/debug.<os>.yaml --chromium-src ... --build should reach the configure/build steps without failing at download_resources
  • Without the flag, missing R2 creds should still fail validation with the improved error message that mentions the flag

… builds

Closes browseros-ai#792

The download_resources build module hard-failed validation when R2 credentials
were missing, blocking external contributors who don't have access to the
private bucket from running a local Chromium build at all.

- Add EnvConfig.skip_r2_download property reading BROWSEROS_SKIP_R2_DOWNLOAD
  (accepts 1 / true / yes / on, case-insensitive)
- DownloadResourcesModule.validate() returns early when the flag is set,
  bypassing the boto3 and R2-config checks
- DownloadResourcesModule.execute() logs a clear warning and short-circuits
  before any R2 calls, so the build proceeds with whatever is cached locally
- Improve the existing "R2 configuration not set" error to point external
  contributors at the new flag
- Add unit tests covering both the validation bypass and the execute-time
  short-circuit (mocking log_warning so the test is portable across hosts
  whose console encoding can't render the warning emoji)
- Document the flag in CONTRIBUTING.md with PowerShell and POSIX examples
  and a clear caveat about copy_resources steps that still depend on the
  cached binaries
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 12, 2026

PR author is not in the allowed authors list.

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.

Windows build fails: R2 private bucket dependency missing from contributor setup docs

1 participant