Commit Graph

277 Commits

Author SHA1 Message Date
Eric Seidel 2057fd4f46 fix: resolve all Dependabot security vulnerabilities (#316)
Run `cargo update` to bump transitive dependencies, fixing 10 of 11
alerts (h2, ring, idna, mio, tokio, bytes, time, quinn-proto,
rustls-webpki, unsafe-libyaml).

Replace deprecated `tempdir` dev-dependency with `tempfile` to
eliminate the `remove_dir_all` vulnerability (the last alert).
2026-04-01 15:36:12 +00:00
Eric Seidel c6647a2dfe refactor: replace reqwest with ureq to reduce binary size (#317)
* refactor: replace reqwest with ureq to reduce binary size

reqwest's blocking API is built on top of its async implementation,
pulling in tokio, hyper, futures, and ~84 other transitive dependencies
even though we only make simple synchronous HTTP calls.

ureq is a synchronous-only HTTP client that eliminates the async
runtime entirely. This reduces transitive dependencies from 227 to 143
and the linked dylib from 4.5 MB to 3.7 MB (-18%). The .a archive
drops from 28 MB to 26 MB, but real savings will be larger once
linked into libflutter with dead code stripping.

The network API surface is unchanged — three functions (patch check,
file download, event reporting) using POST/GET with JSON.

* chore: add ureq to spell check dictionary

* refactor: use into_body() instead of body_mut() where response is consumed

* fix: simplify network error matching to avoid fragile string checks

Consolidate HostNotFound, ConnectionFailed, and all Io errors into
a single network-error arm instead of pattern-matching on error
message strings that could change across OS versions or locales.

* chore: add TODO for misleading network error message
2026-04-01 08:23:48 -07:00
Eric Seidel 4ff2839cdb feat: add tests and docs for boot state machine (#309)
* test: test api calls

* chore: add docs

* chore: fix cspell

* fix: use no-op network hooks in multi_engine tests

Set no-op network hooks after init_for_testing so the fire-and-forget
thread spawned by report_launch_success completes instantly without
network I/O, preventing leaked threads from interfering with subsequent
serial tests that use mock servers.
2026-03-30 23:01:50 +00:00
Eric Seidel 6d0e4a1193 chore(deps): bump Rust and Dart dependencies (#315)
* chore(deps): bump Rust and Dart dependencies

Bump Rust dependencies in library/ and patch/:
- comde: 0.2.3 → 0.3.1 (library), 0.2.3 → 0.3.0 (patch)
- zip: 0.6.4 → 3.0.0 (breaking: FileOptions → SimpleFileOptions)
- android_logger: 0.13.0 → 0.15.0
- mockall: 0.12.1 → 0.13.1
- serial_test: 2.0.0 → 3.2.0
- cbindgen: 0.24.0 → 0.28.0

Bump Dart dev dependency in shorebird_code_push/:
- ffigen: upper bound <17.0.0 → <19.0.0

Updated zip API usage (FileOptions → SimpleFileOptions) and
adjusted test assertion for changed error message.

Binary size impact (macOS release, arm64):
- libupdater.a: +83 KB (+0.28%)
- libupdater.dylib: +34 KB (+0.75%)

Closes #206, #271, #273.

* chore: add EOCD to cspell dictionary

The zip 3.0 crate changed its error message to reference "EOCD"
(End of Central Directory), which cspell doesn't recognize.
2026-03-30 15:50:44 -07:00
Eric Seidel 6fe57f4ec8 fix: checkForUpdate reports restartRequired when current patch is rolled back (#312)
Previously, checkForUpdate returned upToDate after a rollback because
the condition `next != null && current?.number != next.number` treated
a null next patch as "up to date". After a rollback, the Rust updater
correctly uninstalls the patch (next becomes null), but the app is still
running the rolled-back patch (current is non-null). The simplified
condition `current?.number != next?.number` correctly detects this
mismatch and returns restartRequired.

Fixes https://github.com/shorebirdtech/shorebird/issues/3206
2026-03-30 14:45:00 -07:00
Eric Seidel ed8cea1463 fix: improve inflate error handling and validate compressed patches (#314)
* fix: improve inflate error handling and validate compressed patches

Addresses #2989: "pipe reader has been dropped" / "failed to fill whole
buffer" errors during patch inflation were masking the real root cause.

Three changes:

1. Join the decompression thread and propagate its error as the primary
   failure, rather than fire-and-forget logging. The patching thread's
   broken-pipe error is a side-effect, not the cause. Also drop the pipe
   reader before joining to avoid deadlock when patching fails.

2. Validate the downloaded compressed patch (non-empty, valid zstd magic
   bytes) before attempting decompression, so corrupt/truncated downloads
   produce a clear error instead of cryptic pipe errors.

3. Log the download size in download_to_path to help diagnose truncated
   downloads in the field.

* docs: expand comment on drop(fresh_r) to clarify deadlock risk

* feat: log app_id, patch number, and version before download

* test: add inflate tests for corrupt data and invalid magic

* test: cover decompression-error-as-primary-cause path in inflate

Uses a valid zstd frame followed by a corrupt second frame so that
bipatch::Reader::new succeeds but decompression fails midway, verifying
that the decompression error is reported as the primary cause.
2026-03-27 12:54:00 -07:00
Eric Seidel dc2cd0a86a docs: warn that checkForUpdate/update make network calls (#311)
Users sometimes gate app startup on checkForUpdate() or update()
completing (e.g. awaiting in initState before showing content), which
can cause the app to appear stuck on the splash screen when the
network is slow.

Add warning doc comments to both methods recommending the .then()
pattern for startup code, and update README examples to use .then().

Fixes https://github.com/shorebirdtech/shorebird/issues/3179
2026-02-10 16:55:24 -08:00
Brandon DeRosier eeec42efb7 feat: add enhanced error messages for file operations (#310)
* feat: add enhanced error messages for file operations

Add a file_errors module that provides context-aware error messages
for file operations. When file operations fail, users now see:
- The specific operation that failed (create, read, write, rename, etc.)
- The full path involved
- Helpful hints about possible causes based on error type
- Android-specific hints for permission errors (SELinux, Work Profile,
  MDM/Knox policies, app cloning features)

This helps diagnose issues like "Permission denied (os error 13)" by
indicating which operation failed and suggesting possible causes.
2026-02-04 12:36:39 -08:00
Eric Seidel 08fb9df932 fix: Rare bug if rollback happens during second update call
The scenario is:

1. User is running patch 2 (booted successfully, so last_booted_patch = 2)
2. While the app is still running, they call the check-for-update API
3. Patch 3 is downloaded and installed (next_boot_patch = 3)
4. Before the app restarts, they check again and patch 4 is available
5. The buggy code is supposed to delete patch 3 (never booted), but instead deletes patch 2 (the last known-good patch)
6. Patch 4 is set as next_boot_patch

If patch 4 boots fine, nobody notices. But if patch 4 fails to boot and the system tries to roll back to patch 2, those artifacts are gone.
2026-01-29 10:18:14 -08:00
Eric Seidel 8691c8f60e feat: add verification_mode config option (#308)
* feat: move patch verification from boot time to install time

* feat: make it switchable

* chore: update comments

* fix: test invalid yaml

* chore: update readme

* feat: add more comments to readme

* doc: more readme updates

* chore: rename to patch_verification
2026-01-11 15:04:59 -08:00
Bryan Oltman 9db198a634 fix: checking for update should not overwrite good next patch (#307)
* chore: remove unnecessary mutability of self in next_boot_patch

* fix: checking for update should not overwrite good next patch
2025-12-19 13:18:08 -05:00
Bryan Oltman 58a5bcc0b0 chore: remove unnecessary mutability of self in next_boot_patch (#305) 2025-12-19 10:02:33 -05:00
dawn-ducky 504a0af1f6 Chore: Revise README for better structure and links (#303)
Updated README.md to improve branding, formatting and clarity.
2025-12-03 16:50:36 -06:00
Bryan Oltman 76f005940d feat: add uuid to updater state, patch check request (#300)
* feat: add uuid to updater state

* add client_id to patch check request

* cleanup

* comments

* cleanup

* more comments

* delete commented-out code

* Update library/src/cache/updater_state.rs

Co-authored-by: Eric Seidel <eric@shorebird.dev>

* formatting

---------

Co-authored-by: Eric Seidel <eric@shorebird.dev>
2025-10-29 15:57:06 -04:00
Bryan Oltman 8bfe1bac47 fix: separate validation checks from next_boot_patch getter (#297)
* fix: separate validation checks from next_boot_patch getter

* coverage

* coverage

* coverage
2025-10-08 17:55:29 -04:00
Felix Angelov b2fbf7c3ee chore: various platforms updates (#295) 2025-09-17 16:48:24 -05:00
Eric Seidel abfc76662d fix(example): analysis warning (#293)
Co-authored-by: Felix Angelov <felix@shorebird.dev>
2025-09-12 16:58:13 -05:00
Felix Angelov dffafaff7a chore(shorebird_code_push): v2.0.5 (#294) 2025-09-12 16:51:27 -05:00
Nguyễn Văn Biên d47321b633 Update README.md: Update Discord logo (#283) 2025-06-22 04:43:32 +00:00
Bryan Oltman 5d7690cd37 chore: draft release 2.0.4 (#282) 2025-05-30 14:58:02 -04:00
Bryan Oltman f7b157f56f feat: allow for arbitrary track names (#281)
* feat: allow for arbitrary track names

* update readme
2025-05-29 17:58:05 -04:00
Albin PK 12f697d08b fix(shorebird_code_push): update error message to reflect desktop support (#279)
Co-authored-by: Bryan Oltman <bryanoltman@gmail.com>
2025-05-19 15:32:45 +00:00
Felix Angelov 8ec886b409 chore(example): update gradle 2025-05-16 10:16:13 -05:00
Bryan Oltman ab23721e35 fix: roll back patches in check_for_downloadable_update (#270)
* fix: roll back patches in check_for_downloadable_update

* Update docs
2025-02-12 20:29:06 +00:00
Felix Angelov 6edfb6eb78 refactor(shorebird_code_push): upgrade analysis_options (#269) 2025-02-07 16:09:32 -06:00
Felix Angelov cbe348ce3f chore(shorebird_code_push): v2.0.3 (#268) 2025-02-07 15:51:50 -06:00
0xcf2f 38efba0e6a feat(shorebird_code_push): override toString in exceptions (#266)
Co-authored-by: Felix Angelov <felix@shorebird.dev>
2025-02-07 15:47:56 -06:00
Bryan Oltman 78c84e5bf7 chore: more logging 2025-02-07 14:18:03 -05:00
Bryan Oltman 67f8643242 chore: add more info-level logging around patch downloads (#267) 2025-02-07 14:07:19 -05:00
dependabot[bot] 4ca08d31bf chore(deps): bump very_good_analysis (#260)
Bumps the shorebird_code_push-deps group in /shorebird_code_push with 1 update: [very_good_analysis](https://github.com/VeryGoodOpenSource/very_good_analysis).


Updates `very_good_analysis` from 6.0.0 to 7.0.0
- [Release notes](https://github.com/VeryGoodOpenSource/very_good_analysis/releases)
- [Changelog](https://github.com/VeryGoodOpenSource/very_good_analysis/blob/main/CHANGELOG.md)
- [Commits](https://github.com/VeryGoodOpenSource/very_good_analysis/compare/v6.0.0...v7.0.0)

---
updated-dependencies:
- dependency-name: very_good_analysis
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: shorebird_code_push-deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-02 17:43:34 -08:00
bryanoltman d735d107eb update gradle 2025-01-30 10:24:02 -05:00
bryanoltman dd6d4352d0 chore: update macOS project entitlements 2025-01-30 10:22:07 -05:00
Bryan Oltman a4a7255796 feat: configure logging on linux (#263) 2025-01-28 10:28:48 -05:00
Bryan Oltman 69468a0c9f fix multiple definitions of patch_base 2025-01-24 15:00:09 -05:00
Bryan Oltman 707346df33 fix multiple definitions of patch_base 2025-01-24 14:55:41 -05:00
Bryan Oltman ba52a62b5d feat: change updater to support intel macs (#262)
* feat: change updater to support intel macs

* cleanup

* Fix targeting in patch_base function
2025-01-24 13:58:30 -05:00
Bryan Oltman 71b5ed65fa feat: add windows support (#259)
* feat: add windows support

* Cleanup
2024-12-20 14:35:28 -08:00
Felix Angelov 54e1e2ce2f fix(updater): re-export shorebird_check_for_update for backward compat (#258) 2024-12-19 15:51:07 -06:00
Bryan Oltman 38aadee1c5 feat: enable updater logging on windows (#256) 2024-12-18 14:10:37 -08:00
Bryan Oltman a6c761f50f fix: build updater with static runtime to prevent flutter engine build linking errors (#254)
* fix: build updater with static runtime to prevent flutter engine build linking errors

* Update library/.cargo/config.toml

Co-authored-by: Eric Seidel <eric@shorebird.dev>

* cspell

---------

Co-authored-by: Eric Seidel <eric@shorebird.dev>
2024-12-17 21:34:20 +00:00
dependabot[bot] c112de1229 chore(deps): bump ffigen (#245)
Bumps the shorebird_code_push-deps group in /shorebird_code_push with 1 update: [ffigen](https://github.com/dart-lang/native/tree/main/pkgs).


Updates `ffigen` from 15.0.0 to 16.0.0
- [Release notes](https://github.com/dart-lang/native/releases)
- [Commits](https://github.com/dart-lang/native/commits/HEAD/pkgs)

---
updated-dependencies:
- dependency-name: ffigen
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: shorebird_code_push-deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-16 09:24:59 -08:00
Bryan Oltman 1e4efce65f fix: make tests pass on Windows (#252)
* fix: make tests pass on Windows

* Run ci on all supported building OSes

* Add os name to CI step

* Build rust crates on all oses

* tweak

* Only run rust on multiple oses for now
2024-12-11 12:09:04 -05:00
Bryan Oltman b4775d30dd feat: support macOS (#247)
* feat: support macOS

* fix tests
2024-12-05 17:53:45 -05:00
Eric Seidel 6298d37d86 chore: add cspell checking and make pass (#244)
* chore: add cspell checking and make pass

* chore(shorebird_code_push): minor improvements to example (#242)

* chore(shorebird_code_push): v2.0.2 (#243)

* chore: fix cspell

---------

Co-authored-by: Felix Angelov <felix@shorebird.dev>
2024-11-20 13:50:16 -05:00
Felix Angelov 7b124114ea chore(shorebird_code_push): v2.0.2 (#243) 2024-11-20 11:56:45 -06:00
Felix Angelov e0b533c3d6 chore(shorebird_code_push): minor improvements to example (#242) 2024-11-20 11:53:07 -06:00
Eric Seidel 2ae6afbb65 fix: unbreak web build for 2.x (#241)
* fix: unbreak web build

* chore: add cspell config
2024-11-20 11:35:49 -06:00
Bryan Oltman 8e40228558 fix typo 2024-11-20 09:51:02 -05:00
Bryan Oltman 60c38dc647 feat: 2.0.1 2024-11-20 09:50:21 -05:00
Bryan Oltman acfa307a94 fix: increase minimum flutter version to 3.24.5 (#240) 2024-11-20 09:47:18 -05:00