Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update remote settings errors #6408

Merged
merged 1 commit into from
Oct 10, 2024
Merged

Update remote settings errors #6408

merged 1 commit into from
Oct 10, 2024

Conversation

bendk
Copy link
Contributor

@bendk bendk commented Oct 8, 2024

Use fields inside the error enum, rather than the UniFFI "flat" errors which ignore the inner data. This is prep for moving to proc-macros.

Switched to using error_support and define both internal and public error types.

Switch app-services consumers to using the RemoteSettings type rather than Client. This way they're using the same public API as everyone else. This required adding a couple more pub RemoteSettings methods that I didn't expose via UniFFI. I didn't feel like adding new features to this client, because I'm hoping to replace it (#6378).

Pull Request checklist

  • Breaking changes: This PR follows our breaking change policy
    • This PR follows the breaking change policy:
      • This PR has no breaking API changes, or
      • There are corresponding PRs for our consumer applications that resolve the breaking changes and have been approved
  • Quality: This PR builds and tests run cleanly
    • Note:
      • For changes that need extra cross-platform testing, consider adding [ci full] to the PR title.
      • If this pull request includes a breaking change, consider cutting a new release after merging.
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry in CHANGELOG.md or an explanation of why it does not need one
    • Any breaking changes to Swift or Kotlin binding APIs are noted explicitly
  • Dependencies: This PR follows our dependency management guidelines
    • Any new dependencies are accompanied by a summary of the due diligence applied in selecting them.

Branch builds: add [firefox-android: branch-name] to the PR title.

@bendk bendk requested review from ncloudioj and jeddai October 8, 2024 15:18

impl SettingsClient for Client {
impl SettingsClient for RemoteSettings {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These nimbus changes seem pretty harmless, but please double-check my work here.

/// Internal version of `url()`.
///
/// The difference is that it uses `Error` instead of `ApiError`. This is what we need to use
/// inside the crate.
Copy link
Contributor Author

@bendk bendk Oct 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is one annoying part about splitting up the errors into internal vs external errors. url() needs to return an ApiResult since it's pub and used by consumers (nimbus), but then Client::new can't use it since it returns a Result<> type.

I've thought about solutions for this for a while, but hasn't been annoying enough to take any action.

@codecov-commenter
Copy link

codecov-commenter commented Oct 8, 2024

Codecov Report

Attention: Patch coverage is 0% with 36 lines in your changes missing coverage. Please review.

Project coverage is 25.49%. Comparing base (bfe363c) to head (815b4e2).

Files with missing lines Patch % Lines
components/remote_settings/src/error.rs 0.00% 17 Missing ⚠️
components/remote_settings/src/lib.rs 0.00% 8 Missing ⚠️
components/remote_settings/src/client.rs 0.00% 7 Missing ⚠️
components/remote_settings/src/config.rs 0.00% 3 Missing ⚠️
.../support/nimbus-cli/src/sources/experiment_list.rs 0.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (bfe363c) and HEAD (815b4e2). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (bfe363c) HEAD (815b4e2)
2 1
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #6408       +/-   ##
===========================================
- Coverage   49.30%   25.49%   -23.82%     
===========================================
  Files         146      284      +138     
  Lines       13708    26515    +12807     
===========================================
  Hits         6759     6759               
- Misses       6949    19756    +12807     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bendk bendk force-pushed the push-nlwmntwttruv branch 2 times, most recently from 1e19535 to 34f164c Compare October 8, 2024 15:56
Copy link
Member

@ncloudioj ncloudioj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, r=nanj.

Use fields inside the error enum, rather than the UniFFI "flat" errors
which ignore the inner data.  This is prep for moving to proc-macros.

Switched to using error_support and define both internal and public
error types.

Switch app-services consumers to using the `RemoteSettings` type rather
than `Client`.  This way they're using the same public API as everyone
else.  This required adding a couple more pub RemoteSettings methods
that I didn't expose via UniFFI.  I didn't feel like adding new features
to this client, because I'm hoping to replace it (mozilla#6378).
@bendk bendk enabled auto-merge October 10, 2024 13:37
@bendk bendk added this pull request to the merge queue Oct 10, 2024
Merged via the queue into mozilla:main with commit 197fe99 Oct 10, 2024
17 checks passed
@bendk bendk deleted the push-nlwmntwttruv branch October 10, 2024 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants