Skip to content

chore(bindings/dart): upgrade flutter_rust_bridge to 2.12.0 and fix native library loading#7472

Merged
asukaminato0721 merged 1 commit into
mainfrom
agent-dart-frb-upgrade
May 2, 2026
Merged

chore(bindings/dart): upgrade flutter_rust_bridge to 2.12.0 and fix native library loading#7472
asukaminato0721 merged 1 commit into
mainfrom
agent-dart-frb-upgrade

Conversation

@TennyZhuang
Copy link
Copy Markdown
Contributor

Which issue does this PR close?

No dedicated issue. This is a prerequisite infrastructure fix found during the OpenDAL binding regression effort — the existing Dart binding had a codegen/runtime version mismatch that caused dart test to fail entirely.

Rationale for this change

flutter_rust_bridge codegen was at 2.12.0 but the runtime dependency in pubspec.yaml and rust/Cargo.toml was pinned to 2.8.0. FRB enforces a codegen/runtime version match at startup, so the binding was broken for any consumer running dart test from a clean checkout.

This PR upgrades both sides to 2.12.0, regenerates all FRB-managed files, and fixes a macOS native library loading path that failed on arm64 native builds (cross-compilation target directory absent).

What changes are included in this PR?

  • pubspec.yaml: flutter_rust_bridge: 2.8.02.12.0
  • rust/Cargo.toml: flutter_rust_bridge = "=2.8.0""=2.12.0"
  • Regenerated FRB bindings: frb_generated.dart, frb_generated.io.dart, frb_generated.web.dart, frb_generated.rs, api/opendal_api.dart
  • lib/opendal.dart:
    • import 'dart:io'import 'dart:io' as io to avoid name collisions after FRB 2.12 changes.
    • macOS native library loading fallback: check whether the cross-compilation target directory contains the expected library file, fall back to rust/target/release/ when not.
    • Internal Operator(scheme: schemeStr, ...) call updated to match FRB 2.12 generated parameter name. The public Storage.init({required String schemeStr, ...}) API is unchanged.

Are there any user-facing changes?

No. Storage.init(schemeStr: ...) public API is preserved. The internal generated Operator constructor parameter was renamed by FRB 2.12 codegen; the wrapper absorbs that change transparently.

Intentional divergence from Rust

None. This is a pure infrastructure fix.

Validation

Internal agent-to-agent pre-review used the required patch artifact flow before PR publication:

  • Patch v1 artifact: id:499b4d7b-a96b-4e10-b321-bc9b980d5f33, SHA-256 f643e7baefc03a9d09c8471eaf0b66edff77727b461245f5f96f71590c246b29 — REQUEST CHANGES (Codex caught a source-breaking Storage.init(schemeStr:)scheme: rename masquerading as infra-only; Commander caught anyhow dep being added in PR A but only used by PR B's read/write methods).
  • Patch v2 artifact: id:13ca0fa7-99a9-4f16-a55e-2b5f2e1cb914, SHA-256 26c9a16c06eef524acc2976936ae4bf1b6533ab98aced99e31c43f0fc040e3bb — Commander APPROVED, Codex APPROVED.

Codex pre-review v2 verification (apache/opendal:agent-dart-frb-upgrade applied cleanly on origin/main):

  • git diff --check / git show --check passed.
  • Public Dart wrapper API preserved: Storage.init({ required String schemeStr, ... }) still exists and internally calls generated Operator(scheme: schemeStr, map: map).
  • Tests still call Storage.init(schemeStr: ...); no public rename leak.
  • bindings/dart/rust/Cargo.toml only bumps flutter_rust_bridge to =2.12.0; no misplaced anyhow dependency.

Reported handoff transcripts:

$ cd bindings/dart/rust && cargo build -r
   Finished release profile [optimized] target(s) in 2.18s

$ cd bindings/dart && dart test tests/opendal_test.dart
00:00 +0: loading tests/opendal_test.dart
00:00 +0: opendal fs schema File and Directory functions in fs schema
00:00 +1: opendal fs schema File and Directory functions in fs schema
00:00 +1: opendal memory schema File and Directory functions in memory schema
00:00 +2: opendal memory schema File and Directory functions in memory schema
00:00 +2: All tests passed!

Codex independent re-run reported the same cargo build -r success and dart test 2/2 pass.

Note: dart analyze is not currently clean in this binding due to a pre-existing reference in lib/src/rust/api/capability.dart to a generated API that is not present. That is unrelated to this PR and is not cited as validation.

AI Usage Statement

This patch was produced by AI agents during an OpenDAL binding regression effort. It was reviewed by separate AI reviewer/commander agents through Slock before publication:

  • Produced by @od-kimi-scout-050121 (Kimi) as Dart Phase 1 infra worker.
  • Pre-reviewed by @od-claude-lead-050121 (Claude, commander) — APPROVED v2.
  • Pre-reviewed by @od-codex-review-050121 (Codex) — APPROVED v2 with verified SHA-256 26c9a16c06eef524acc2976936ae4bf1b6533ab98aced99e31c43f0fc040e3bb.
  • Pushed under shared TennyZhuang auth per the regression-effort hybrid publishing policy.

PR B (Dart File.read/write Phase 1 feature, depends on this PR) follows separately, mapped to #7467.

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. releases-note/chore The PR has a title that begins with "chore" or changes other small things that hard to tell labels May 1, 2026
…ative library loading

Upgrade flutter_rust_bridge from 2.8.0 to 2.12.0 to resolve codegen/runtime
version mismatch that broke dart test.

Changes:
- pubspec.yaml: flutter_rust_bridge 2.8.0 → 2.12.0
- rust/Cargo.toml: flutter_rust_bridge = "=2.8.0" → "=2.12.0"
- Regenerate all FRB bindings with matching codegen/runtime
- Fix lib/opendal.dart constructor parameter: schemeStr → scheme (FRB generated),
  but keep Storage.init(schemeStr:) public API wrapper unchanged
- Fix macOS native library loading: fall back to rust/target/release/ when
  cross-compilation target directory does not exist

No behavior changes; existing tests continue to pass.
@TennyZhuang TennyZhuang force-pushed the agent-dart-frb-upgrade branch from a0f25aa to 391caa5 Compare May 2, 2026 17:45
@asukaminato0721 asukaminato0721 enabled auto-merge (squash) May 2, 2026 18:33
@asukaminato0721 asukaminato0721 merged commit 2ccbad4 into main May 2, 2026
34 checks passed
@asukaminato0721 asukaminato0721 deleted the agent-dart-frb-upgrade branch May 2, 2026 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

releases-note/chore The PR has a title that begins with "chore" or changes other small things that hard to tell size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants