Repository navigation
Description
Summary
ruflet run --web and ruflet run --desktop fail with "client not found" when the prebuilt client is already cached, the periodic update check is due (every 6 hours by default), and GitHub cannot be reached: offline, a DNS failure, a 5xx, or the unauthenticated API rate limit (60 requests/hour; each check makes 4 API calls). The cache is still complete on disk, and the run goes back to working once the network does, or when the check is not due, or with RUFLET_CLIENT_AUTO_UPDATE=0.
Seen on main (dd924eb) and in the published gem 0.0.23.
Reproduce
- Have a complete prebuilt web client cached at
~/.ruflet/client/<version>/<platform>/web(index.htmlplusmain.dart.js), with amanifest.jsonwhosechecked_atis more than 6 hours old. Or setRUFLET_CLIENT_UPDATE_INTERVAL=0. - Make GitHub unreachable, for example
export http_proxy=http://127.0.0.1:9 HTTP_PROXY=http://127.0.0.1:9(connection refused). - Run
ruflet run main.rb --webin an app created byruflet new.
Actual:
Prebuilt client bootstrap failed: Errno::ECONNREFUSED: Failed to open TCP connection to 127.0.0.1:9 (Connection refused - connect(2) for "127.0.0.1" port 9)
Web client build not found and prebuilt download failed.
Build one with `ruflet build web`, or set RUFLET_CLIENT_DIR.
The exit status is 1, and the cached web/ directory is still on disk. ruflet run main.rb --desktop prints Desktop client executable not found. instead of launching the cached app. When GitHub answers 503 or 403, the first line reads Prebuilt client bootstrap failed: RuntimeError: GitHub API failed (503) instead.
Expected
A cache that passes prebuilt_assets_present? is still used when the optional freshness check cannot run. The README says the client channel is checked "at most once every six hours", so the check is a refresh, not a requirement.
Cause
packages/ruflet/lib/ruflet/cli/run_command.rb, ensure_prebuilt_client:
- In the
cache_readybranch, anilfromfetch_release_for_versionalready falls back to the cache:release.nil?marks the cache checked and returnscache_root. release_by_tagrescues errors and returnsnil, butrelease_latestdoes not.fetch_release_for_versionalways callsrelease_latestlast, so a network error or non-2xx response raises out of it.- The method-level
rescue StandardErrorthen returnsnil, so the cached client is never returned and the run caller reports it missing.
Scope note
ruflet update goes through the same method. There, failing to check should stay a failed update (exit 1, "Failed to update web client for macos"). Reporting "Updated ..." from a check that never ran would be misleading. Only the run path should fall back to the cache.
Activity