Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

feat(desktop): let a debug build exercise the updater, behind a dart-define

0xken154d163ca9f43b
diff --git a/desktop/RELEASE.md b/desktop/RELEASE.md
index 7b6df0cd3..971be75bb 100644
--- a/desktop/RELEASE.md
+++ b/desktop/RELEASE.md
@@ -375,6 +375,23 @@ gh workflow run release-desktop.yml -f version=1.3.0 -f metadata_path=harness/de
flutter run -d macos --dart-define=DESKTOP_UPDATE_METADATA_URL=https://storage.googleapis.com/s3-autonomous-upgrade-3/harness/desktop/metadata-test.json
```
+A debug build does not check at all (`canCheck` wants release mode), so the line above only does
+something in a release build. To exercise the band, its percentage and the install itself while
+developing, add `--dart-define=DESKTOP_UPDATE_FORCE=true` — and always with a scratch manifest, or
+the debug build will offer to replace itself with the current public release:
+
+```bash
+flutter run -d macos \
+ --dart-define=DESKTOP_UPDATE_FORCE=true \
+ --dart-define=DESKTOP_UPDATE_METADATA_URL=http://127.0.0.1:8899/metadata.json
+```
+
+A local origin is enough for that manifest: serve a zip of any `Harness.app` (its
+`CFBundleShortVersionString` must match the version the manifest advertises, which the staging step
+verifies) with its real `size` and `sha256`, and write the body slowly if you want to read the
+percentage rather than watch it jump to 100. `applyStaged` replaces the bundle it is running from,
+so run a COPY of the build rather than the one `flutter run` owns.
+
## Internal builds — an unlisted link, not a release
`../.github/workflows/desktop-internal-build.yml` builds any branch the way a release would — both macOS
diff --git a/desktop/lib/update/desktop_updater.dart b/desktop/lib/update/desktop_updater.dart
index 954949674..2ccfb5d13 100644
--- a/desktop/lib/update/desktop_updater.dart
+++ b/desktop/lib/update/desktop_updater.dart
@@ -19,6 +19,13 @@ const _metadataUrlOverride = String.fromEnvironment(
'DESKTOP_UPDATE_METADATA_URL',
);
+/// Lets a DEBUG build check and install, so the update band and its percentage
+/// can be exercised without cutting a release. Off unless asked for
+/// (`--dart-define=DESKTOP_UPDATE_FORCE=true`), and pointless on its own: pair
+/// it with [_metadataUrlOverride] pointing at a scratch manifest, or the debug
+/// build will poll the real one and offer to replace itself with a release.
+const _forceUpdateChecks = bool.fromEnvironment('DESKTOP_UPDATE_FORCE');
+
/// The macOS build every Mac can run, rendered on Skia: what an Intel Mac installs, what every install
/// from before the Intel/Apple Silicon split polls on either CPU, and what the website download
/// serves. Must match the `intel` row of scripts/publish-macos-variant.sh — RELEASE.md, "Two macOS
@@ -202,7 +209,7 @@ class DesktopUpdater {
),
_launchDetached = launchDetached ?? _defaultLaunchDetached,
_metadataUrlForInstance = metadataUrl ?? _metadataUrl,
- _releaseMode = releaseMode ?? kReleaseMode,
+ _releaseMode = releaseMode ?? (kReleaseMode || _forceUpdateChecks),
_isLinux = isLinux ?? Platform.isLinux,
_architecture = architecture ?? _currentArchitecture();