42 Commits

Author SHA1 Message Date
Eric Seidel 96fd32796e feat: stage 2 integration tests — fake patch server + golden path + rollback regression (#355)
Lands the fake HTTP server, the patch fixture pipeline, and the first
two scenarios that exercise the real FFI path end-to-end. Plus a test
that would have caught the patch-to-release rollback bug
(shorebirdtech/shorebird#3728).

Architecture follows the principles surfaced in review:

- Dart tests call the public `ShorebirdUpdater` API only — never the
  raw `Updater` FFI wrapper, never the engine API.
- Engine API stays inside the `library_test_hooks` Rust crate.
  `shorebird_test_init` constructs `AppParameters` + stub
  `FileCallbacks` internally so Dart never sees those types.
  `shorebird_test_simulate_successful_launch` wraps the
  start/success protocol so the Dart layer never knows there's a
  protocol — it just knows "the engine reported a successful boot."
- ffigen scans only the test_hooks header. The engine header
  (updater_engine.h) does not appear in the Dart bindings.
- A `TestEngine` Dart helper concentrates engine-side simulation in
  one place; the test bodies stay focused on `ShorebirdUpdater`.

Implementation choices worth flagging:

- FFI calls run via `Isolate.run`. Synchronous run blocks the main
  isolate, deadlocking against the in-isolate shelf server. The
  test's IsolateRun callback re-opens the cdylib (cheap: dlopen is
  ref-counted) and resets `Updater.bindings` in the sub-isolate
  because Dart isolates do not share static fields.
- `libapp_path` must be a real file on the desktop integration build:
  the non-Android non-iOS non-test `patch_base` reads it directly
  from disk. Tests that install a patch write the fixture's `base`
  bytes to `libapp.so` before init.
- Fake server kept minimal: shelf, no Range support, no auth, no
  concurrency knobs. Stage 3+ scenarios (download cutoff, hash
  mismatch loop, etc.) extend it as needed.

Three scenarios cover three reasons we wanted this suite:

1. `checkForUpdate returns upToDate when server has no patch` —
   baseline: confirms the harness boots cleanly and returns the
   expected enum.
2. `install a patch and boot from it` — golden path: check →
   update → simulateSuccessfulLaunch, then assert
   `readCurrentPatch` / `readNextPatch` / `checkForUpdate`
   transitions match the public API contract.
3. `checkForUpdate returns restartRequired after patch-to-release
   rollback` — regression for shorebirdtech/shorebird#3728. Pre-fix
   this returned `upToDate` and left no signal to prompt a restart.

Verified locally: 232 Rust unit tests + 44 Dart tests (41 existing
unit + 3 new integration) green; clippy/fmt/cspell clean.
2026-05-06 08:11:47 -07:00
Eric Seidel 34509fca3c refactor: split C API into Dart and engine surfaces (#350)
The C surface in `library/src/c_api` was a single bucket of `pub extern "C"`
functions covering both consumers — `package:shorebird_code_push` (via
ffigen) and Shorebird's Flutter engine fork (via direct C++ link). That
made it hard to reason about which symbols are stable ABI versus
internal, and ffigen was generating bindings for engine-only symbols
that no Dart code calls.

Split into two self-contained submodules and two cbindgen-generated
headers:

- `c_api::dart` → `include/updater_dart.h` (stable ABI; ffigen entry
  point). Defines `UpdateResult`, the `SHOREBIRD_*` status constants, and
  the five Dart-stable functions: `shorebird_current_boot_patch_number`,
  `shorebird_next_boot_patch_number`,
  `shorebird_check_for_downloadable_update`,
  `shorebird_update_with_result`, `shorebird_free_update_result`.
- `c_api::engine` → `include/updater_engine.h` (no stability guarantee).
  Defines `AppParameters`, `FileCallbacks`, and the engine-only functions:
  `shorebird_init`, `shorebird_should_auto_update`,
  `shorebird_validate_next_boot_patch`, `shorebird_next_boot_patch_path`,
  `shorebird_free_string`, `shorebird_start_update_thread`, and the
  `shorebird_report_launch_*` trio.

Each bucket file is self-contained: cbindgen scans only the file
(`with_src` in build.rs) and emits the items it defines plus the C
types they reference. There are no exclude/include lists in the
cbindgen configs — adding a function to one bucket automatically lands
it in the right header, and items in the other bucket cannot leak.

`mod.rs` shrinks to a thin layer of private helpers shared by both
buckets (`to_rust`, `allocate_c_string`, `free_c_string`, `log_on_error`)
plus the test module.

`include/updater.h` is removed; consumers include the specific header
for their use case. The Flutter engine's
`shell/common/shorebird/updater.cc` will be updated in a follow-up
engine-repo PR to include `updater_engine.h` directly.

Also drops two retired Dart-side symbols:

- `shorebird_update` (replaced by `shorebird_update_with_result` in the
  Dart 2.0 rewrite, Nov 2024).
- `shorebird_check_for_update` (replaced by
  `shorebird_check_for_downloadable_update` in the same rewrite).

The shorebird_code_push package's `_legacyFallback` was the only path
that still called `shorebird_update`. The package's `flutter: >=3.24.5`
constraint guarantees the engine has `shorebird_update_with_result`, so
the fallback was unreachable in practice. Removing it lets us drop the
ABI symbol.

Bumps shorebird_code_push to 2.0.7. Bindings regenerated via ffigen now
contain only the five Dart-stable symbols.

Follow-up engine PR will: include `updater_engine.h` instead of the
removed `updater.h`; clean up `android_exports.lst` (drop the ghost
`shorebird_active_path` and `shorebird_active_patch_number` exports,
drop `shorebird_check_for_update`).
2026-05-04 15:56:09 -07:00
Eric Seidel f806c7c0cf chore(shorebird_code_push): v2.0.6 (#345) 2026-04-22 02:11:06 +00:00
dependabot[bot] 54977eea2a chore(deps): bump the shorebird_code_push-deps group (#333)
Bumps the shorebird_code_push-deps group in /shorebird_code_push with 2 updates: [ffigen](https://github.com/dart-lang/native/tree/main/pkgs) and [very_good_analysis](https://github.com/VeryGoodOpenSource/very_good_analysis).


Updates `ffigen` from 18.1.0 to 20.1.1
- [Release notes](https://github.com/dart-lang/native/releases)
- [Commits](https://github.com/dart-lang/native/commits/ffigen-v20.1.1/pkgs)

Updates `very_good_analysis` from 7.0.0 to 10.2.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/v7.0.0...v10.2.0)

---
updated-dependencies:
- dependency-name: ffigen
  dependency-version: 20.1.1
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: shorebird_code_push-deps
- dependency-name: very_good_analysis
  dependency-version: 10.2.0
  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>
Co-authored-by: Eric Seidel <eric@shorebird.dev>
2026-04-08 23:11:40 +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
Felix Angelov dffafaff7a chore(shorebird_code_push): v2.0.5 (#294) 2025-09-12 16:51:27 -05:00
Bryan Oltman 5d7690cd37 chore: draft release 2.0.4 (#282) 2025-05-30 14:58:02 -04: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
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
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
Felix Angelov 7b124114ea chore(shorebird_code_push): v2.0.2 (#243) 2024-11-20 11:56:45 -06: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
Bryan Oltman 7648128a1e chore: remove upper Flutter bound in shorebird_code_push as per pub validation warning 2024-11-14 16:33:49 -05:00
Bryan Oltman 47dd248f0e chore: prep version 2.0 (#237) 2024-11-14 16:31:05 -05:00
Felix Angelov 488570d3f0 chore(shorebird_code_push): v2.0.0-dev.2 (#230) 2024-11-05 11:50:35 -06:00
Felix Angelov 6f1be35bd3 feat(shorebird_code_push): rewrite Dart API (#225) 2024-11-04 12:22:37 -06:00
dependabot[bot] daaea653b9 chore(deps): bump ffigen (#222)
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 14.0.1 to 15.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-10-28 09:56:42 -04:00
Bryan Oltman 3384b91597 chore: prepare for release 1.1.6 2024-10-16 16:07:50 -04:00
dependabot[bot] 8dd189a739 chore(deps): bump ffigen (#214)
Bumps the shorebird_code_push-deps group with 1 update in the /shorebird_code_push directory: [ffigen](https://github.com/dart-lang/native/tree/main/pkgs).


Updates `ffigen` from 12.0.0 to 14.0.1
- [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-09-30 15:43:11 -07:00
Bryan Oltman ce9516acb3 chore: bump version to 1.1.5 2024-09-24 11:10:22 -04:00
Eric Seidel 933e231636 feat: add automated publishing to shorebird_code_push (#197)
* feat: add automated publishing to shorebird_code_push

* include version bump
2024-07-25 16:29:21 +00:00
dependabot[bot] cf99f6e426 chore(deps): bump very_good_analysis (#181)
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 5.1.0 to 6.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/v5.1.0...v6.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>
2024-07-09 16:24:46 -04:00
dependabot[bot] 6ab6972c1e chore(deps): bump ffigen (#160)
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 11.0.0 to 12.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-05-17 20:51:38 +00:00
dependabot[bot] 0735b56f52 chore(deps): bump the shorebird_code_push-deps group (#128)
Bumps the shorebird_code_push-deps group in /shorebird_code_push with 2 updates: [ffigen](https://github.com/dart-lang/native/tree/main/pkgs) and [mocktail](https://github.com/felangel/mocktail).


Updates `ffigen` from 8.0.2 to 11.0.0
- [Release notes](https://github.com/dart-lang/native/releases)
- [Commits](https://github.com/dart-lang/native/commits/ffigen-v11.0.0/pkgs)

Updates `mocktail` from 0.3.0 to 1.0.3
- [Release notes](https://github.com/felangel/mocktail/releases)
- [Commits](https://github.com/felangel/mocktail/compare/mocktail-v0.3.0...mocktail-v1.0.3)

---
updated-dependencies:
- dependency-name: ffigen
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: shorebird_code_push-deps
- dependency-name: mocktail
  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>
Co-authored-by: Bryan Oltman <bryanoltman@gmail.com>
2024-03-04 10:24:48 -05:00
Bryan Oltman a6ad4897c4 update version to 1.1.3 2023-10-20 15:44:03 -04:00
Bryan Oltman 3b4b6ebc24 docs: fix method name in readme 2023-10-07 23:41:15 -04:00
Bryan Oltman c2a7665b6a chore: bump version to 1.1.1 2023-10-07 23:34:44 -04:00
Bryan Oltman bec99ff276 chore: format pubspec.yaml 2023-10-07 23:34:29 -04:00
Bryan Oltman 2bbcfa5752 chore: fix repository link in pubspec 2023-10-07 23:33:43 -04:00
Felix Angelov abe4126da5 chore(shorebird_code_push): v1.1.0 (#60) 2023-07-14 16:08:24 -05:00
Bryan Oltman 0be41d9d85 chore(shorebird_code_push): Release 1.0.0, change downloadUpdate to downloadUpdateIfAvailable (#46)
* Release 1.0.0, change downloadUpdate to downloadUpdateIfAvailable

* update readme and contributing

* add dart doc

* add discord badge

* remove doc checkin

* formatting
2023-06-29 16:42:56 -04:00
Bryan Oltman 9336cb3add Release shorebird_code_push 0.1.3 2023-06-23 18:07:14 -04:00
Bryan Oltman ec7b55aecb add ignore_for_file header to generated files 2023-06-23 18:06:00 -04:00
Bryan Oltman aa60264e15 release shorebird_code_push 0.1.2 2023-06-23 14:12:42 -04:00
Bryan Oltman ef13b122f1 doc(shorebird_code_push): lengthen pubspec.yaml description 2023-06-23 14:04:19 -04:00
Bryan Oltman fb89fdd412 Update to version 0.1.1, readme updates 2023-06-21 11:02:30 -04:00
Bryan Oltman 1776b058b4 chore(shorebird_code_push): add CHANGELOG.md (#41)
* chore(shorebird_code_push): add CHANGELOG.md

* remove build number from version

* correct version number
2023-06-20 17:52:12 -04:00
Bryan Oltman 75d10b2585 chore: add homepage to pubspec.yaml (#40)
* chore: add homepage to pubspec.yaml

* update pubspec
2023-06-20 17:45:00 -04:00
Bryan Oltman ea48f6cb4f feat(shorebird_code_push): add updater bindings and dart support (#32)
* feat(shorebird_code_push): add updater bindings and dart support

* newlines

* docs

* Remove unused support for dart cli

* clarify Android-specific setup in readme
2023-06-19 20:53:51 -04:00
Bryan Oltman 27e7984179 feat: add shorebird_code_push package (#30)
* feat: add shorebird_code_push package

* remove example and extra code

* update github workflow

* fix gha
2023-06-17 14:17:03 -04:00