Bumped UniFFI to 0.28.2
Added a tool to run uniffi-bindgen in library mode. It can input either
a specific library path or the megazord crate name.
Use that simplify several build scripts -- especially the generate docs
ones. The best part of this is that we no longer have to maintain
hand-written modulemaps, which makes adding a new component harder than
it needs to be.
Split out the uniffi-bindgen commands from `build-xcframework.sh`. This
way you can run them standalone and see the results, even if you don't
have XCode setup.
One change is that
automation/swift-components-docs/generate-swift-project.sh now uses
`megazord_ios` rather than `megazord`. I think this should result in
slightly more accurate docs, since historically some components in the
Android megazord aren't in the iOS one (Although, I think they match at
the present).
This commit demotes the `TabsNotClosed` error case from a
`DeviceCommandError` variant, to a `CloseTabsResult` variant
specifically for "close tabs".
`FirefoxAccount::close_tabs` only throws `FxaError`s for
account-related errors, as before. Successes and partial successes
are reported via `CloseTabsResult`.
This commit:
* Introduces a new `DeviceCommandError` type for
device command-related operations.
* Adds a `DeviceCommandError::TabsNotClosed` error variant, which
includes the URLs of any tabs that couldn't be sent in a
"close tabs" command.
* Reworks `FirefoxAccount::close_tabs` to pack URLs that exceed the
maximum payload size (16 KB by default) into multiple
device commands.
* Abstracts the API towards being more general-purpose "tab command" rather than
being purely about closing individual tabs, with the intention that it's
easier to add, say, "close all inactive" (because with 100% certainty I
know this will be a very early request)
* Updates the schema creation code to be less foot-gun-y.
* Renaming a few things so that we consistently use `device_id` for the fxa id
and `client_id` for the Sync client ID.
* Fixes the case when syncing when the device ID != fxa id.
c6fdae855c caused Send Tab commands to
be sent with `"ttl": "null"` to the FxA server, since Send Tab
doesn't specify an explicit TTL.
This fixes bug 1895711.
This commit refactors the FxA telemetry logic so that it no longer
assumes the only command we report is Send Tab. We'll use this to
report telemetry for the Close Tabs command separately.
This commit also adds default values for `flow_id` and `stream_id`
to the `SendTabPayload` binding, to prepare for its eventual removal.
Handle the case where a public event results in an immediate public
state transition (i.e. the initial state of the internal state machine
is `Complete(new_state)`). Copied the code that does this from
`handle_internal_event` to `handle_public_event`.
Also reworked a couple of the breadcrumb messages. In particular, I got
confused because was both the public and internal event handlers sent
out breadcrumbs that look the same.
Transition to the `Disconnected` state in this case to match the
behavior of android-components.
I'm not sure which behavior is better or worse, but this one will make
the state machine checker happy.
- Added the `simulate_network_error` method.
- Hooked up the methods to the Android wrapper
- Added the `CallGetProfile` event, which forces a call to
`get_profile`. This was the best method I found to check the error
handling, since `get_profile` requires both a network request and an
access token.
My current theory is that this happens when we send FxA an invalid
refresh token. Maybe this extra data in the breadcrumb will help
identify that. See the bug for details.
- Include more state transition details in the breadcrumbs
- Updating the error handling log messages to include the report class
if present. This makes ADB grepping easier.
When looking through the logs, I found myself wanting a couple things:
- When a public state transition starts/ends
- Better messaging when an unexpected state is observed
This implements some of the functionality from the `FxaAccountManager`
classes that exist in `android-components` and in our Swift wrapper
layer.
The goal is move the functionality into Rust so that it's easier to
maintain and also so that other appliations can use it without depending
on `android-components`.
I created a new module directory for this code rather than putting it in
`internal`. This felt better to me since the state machine exists in a
layer above `FirefoxAccount`.
Added a document that describes the state machines. I wasn't sure where
to put it, but I felt like the best place was inline with the code.
Mostly mechanical, the one extra step was to add the `serde::derive`
feature to `remote_settings`. I guess it's not pulling that feature in
from `uniffi` anymore.
oneshot is a new dependency for UniFFI. It specifies its license in
Cargo.toml but doesn't include the file, so I linked to the official
Apache 2.0 license text.
NoExistingAuthFlow can happen when users manually navigate through the
oauth flow URLs. Just count the errors in Glean rather than report them
to Sentry. Use a separate label for the errors, and reserve `fxa_other`
for unexpected errors.
Handle OriginMismatch the same, which can happen when trying to pair two
firefox instances that are configured to use different servers.
BackoffError was similar, but I kept the sentry reporting for this one,
since it seems useful to see the reason for backoff errors. Going
through the current list of backoff errors lead me to open #5918