Skip to content

fix(database,windows): fix transaction threwing and native error codes dropped - #18559

Merged
Lyokone merged 2 commits into
mainfrom
fix/database-windows
Aug 12, 2026
Merged

fix(database,windows): fix transaction threwing and native error codes dropped#18559
Lyokone merged 2 commits into
mainfrom
fix/database-windows

Conversation

@Lyokone

@Lyokone Lyokone commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes two firebase_database bugs on Windows.

Transaction aborts threw instead of resolving with committed: false. The desktop C++ SDK never emits kErrorTransactionAbortedByUser, so the plugin's benign branch was dead code there. It reports a deliberate abort as kErrorWriteCanceled on the handler's initial invocation, and (because Error error = kErrorNone is declared and never assigned) as kErrorNone on a rerun, which the plugin reported as committed: true. Neither code can be trusted alone: kErrorWriteCanceled also means "cancelled by PurgeOutstandingWrites()" and must stay an error. The transaction context now records the Dart handler's own decision and the data it saw, and the completion handler keys the contract off that.

Native error codes were dropped, so every failure surfaced as unknown. ParseError() and both listener OnCancelled paths used the two-argument FlutterError/EventSink::Error overloads, which send null Pigeon details, and the shared converter read the code only from details. Now the Windows plugin sends a details map keyed code/message (as Android does), and platformExceptionToFirebaseException falls back to PlatformException.code when there is no details payload, which also recovers codes for firebase_storage and firebase_remote_config on Windows.

The new set() test showed Android and Apple lose the code on plain writes too, so those paths now route through the helpers each plugin already had. Windows also gets an e2e job (the suite never ran there) and the example's windows/ runner. Two Windows-only spellings are aligned with the other platforms: operation-failed to failure, write-canceled to write-cancelled. Nothing could depend on them, since no Windows code reached Dart before.

The transaction-based permission-denied test expects unknown on Windows only: the desktop SDK replaces non-datastale server errors on sent transactions with kErrorUnknownError before the plugin sees them (firebase-cpp-sdk#1904). Plain writes are unaffected.

Related Issues

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (melos run analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • I signed the CLA.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

@gemini-code-assist

Copy link
Copy Markdown
Contributor
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

…s gaps

`platformExceptionToFirebaseException` now lower-cases and dashes a code it
takes from `PlatformException.code`, the same normalisation the auth converter
applies to that field, so a native `UNKNOWN` keeps reporting as `unknown`.

Skips three tests on Windows for pre-existing plugin gaps that the new e2e job
exposed, unrelated to this PR: `startAfter` and `endBefore` are mapped onto the
C++ SDK's inclusive `StartAt`/`EndAt` (it has no exclusive cursor), and the
desktop SDK does not resolve `ServerValue.increment` sentinels.

Also wraps a test name that pushed a line past the formatter's limit.
@Lyokone
Lyokone force-pushed the fix/database-windows branch from b133e41 to 63b82d3 Compare August 11, 2026 12:50
@Lyokone
Lyokone merged commit 12f5f32 into main Aug 12, 2026
38 checks passed
@Lyokone
Lyokone deleted the fix/database-windows branch August 12, 2026 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants