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

For EXP-3625: Hook up getCoenrollingFeatureIds to NimbusBuilder #5718

Conversation

eliserichards
Copy link
Contributor

@eliserichards eliserichards commented Jul 6, 2023

https://mozilla-hub.atlassian.net/browse/EXP-3625

  • Add getCoenrollingFeatureIds() to
    • Kotlin:
      • NimbusInterface.kt We don't care about exposing this method here
      • NimbusBuilder.kt
    • Swift:
      • NimbusApi.swift Same as above
      • NimbusBuilder.swift

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 dilligence applied in selecting them.

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

@eliserichards eliserichards added the nimbus Nimbus, the experimentation platform. label Jul 6, 2023
@eliserichards eliserichards force-pushed the EXP-3625_connect-coenroll-to-builder branch from 6aafe9a to 74d995a Compare July 6, 2023 22:57
@eliserichards
Copy link
Contributor Author

I'm not quite sure if we need these methods on the NimbusInterface.kt/NimbusApi.swift. What do you think @jhugman?

@eliserichards eliserichards changed the title For EXP-3625: Hook up getCoenrollingFeatureIds to NimbusInterface and NimbusBuilder For EXP-3625: Hook up getCoenrollingFeatureIds to NimbusBuilder Jul 6, 2023
@eliserichards eliserichards marked this pull request as ready for review July 6, 2023 23:05
@jhugman
Copy link
Contributor

jhugman commented Jul 7, 2023

Swift tests are in https://github.com/mozilla/application-services/blob/main/megazords/ios-rust/MozillaTestServices/MozillaTestServicesTests/

There aren’t any specific tests for NimbusBuilderTest.swift — mainly because it is was just so much simpler than the kotlin equivalent (no android components customisation, the fetch/apply listener logic is done by NotificationCenter ). This is likely not sustainable long term. Please could you file a task to test that?

@jhugman
Copy link
Contributor

jhugman commented Jul 7, 2023

I'm not quite sure if we need these methods on the NimbusInterface.kt/NimbusApi.swift. What do you think @jhugman?

I don't think so. There's no functional reason to have them exposed to the apps.

There are tests for the NimbusClient in Rust, so I'm less inclined to expose the getCoenrollingFeatureIds() in Kotlin and Swift for testing purposes.

Copy link
Contributor

@jhugman jhugman left a comment

Choose a reason for hiding this comment

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

I think you should likely remove that test, then land this.

protected fun getCoenrollingFeatureIds(): List<String> =
// This will be changed to use the feature manifest in EXP-3265
listOf()
protected open fun getCoenrollingFeatureIds(): List<String> =
Copy link
Contributor

Choose a reason for hiding this comment

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

Micronit: I wondered about this. Should this be overridable by subclasses? I'm not sure whether we should or not.

Suggested change
protected open fun getCoenrollingFeatureIds(): List<String> =
protected fun getCoenrollingFeatureIds(): List<String> =

Copy link
Member

@jeddai jeddai Jul 7, 2023

Choose a reason for hiding this comment

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

I personally am leaning towards no considering the FML writes the list out, that being said is there a case where it might be useful for testing (in-apps)?

Copy link
Contributor

Choose a reason for hiding this comment

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

I personally am leaning towards no considering the FML writes the list out

I'm not sure I understand?

Copy link
Member

Choose a reason for hiding this comment

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

I may have misunderstood what the FML does with the coenrolling feature ids but doesn't it write them out to the feature manifest kt/Swift file and that's the method being called here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I'm leaning towards no, too. Why would we ever want to use this specific method to do anything other than pass along the list of IDs?

initialExperiments = bundledExperiments
}.build(appInfo)
val result = dummyNimbus.getCoenrollingFeatureIds()
assertEquals(result, listOf<String>())
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this testing? There is no featureManifest here, so is this just testing that the we're defaulting to an empty list?

Copy link
Contributor

Choose a reason for hiding this comment

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

On second thoughts: this test doesn't compile: the NimbusBuilder has getCoenrollingFeatureIds() but not the NimbusInterface object.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had originally put the getCoenrollingFeatureIds() in the NimbusInterfface, but I agree that we don't really want it there 👍 Removing this test.

@eliserichards
Copy link
Contributor Author

New issue for building out the tests for swift NimbusBuilder: https://mozilla-hub.atlassian.net/browse/EXP-3665

@eliserichards eliserichards force-pushed the EXP-3625_connect-coenroll-to-builder branch from ceda838 to 7e27321 Compare July 7, 2023 20:25
@eliserichards eliserichards force-pushed the EXP-3625_connect-coenroll-to-builder branch from 7e27321 to 4f119a2 Compare July 7, 2023 20:50
@eliserichards eliserichards force-pushed the EXP-3625_connect-coenroll-to-builder branch from 4f119a2 to b56ca11 Compare July 7, 2023 20:50
@codecov-commenter
Copy link

Codecov Report

Patch and project coverage have no change.

Comparison is base (5b8d675) 89.86% compared to head (b56ca11) 89.86%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5718   +/-   ##
=======================================
  Coverage   89.86%   89.86%           
=======================================
  Files           1        1           
  Lines         148      148           
=======================================
  Hits          133      133           
  Misses         15       15           

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@eliserichards eliserichards force-pushed the EXP-3625_connect-coenroll-to-builder branch from b56ca11 to a1da763 Compare July 7, 2023 21:30
Copy link
Contributor

@jhugman jhugman left a comment

Choose a reason for hiding this comment

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

Nice! There's one nit, but this is good work! Well done!

@@ -231,8 +231,7 @@ public class NimbusBuilder {
// swiftlint:enable function_body_length

func getCoenrollingFeatureIds() -> [String] {
// This will be changed to use the feature manifest in EXP-3265
[]
featureManifest != nil ? featureManifest!.getCoenrollingFeatureIds() : []
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: ?? is the same as the elvis operator.

Suggested change
featureManifest != nil ? featureManifest!.getCoenrollingFeatureIds() : []
featureManifest?.getCoenrollingFeatureIds() ?? []

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahhh perfect!

@@ -187,8 +187,7 @@ abstract class AbstractNimbusBuilder<T : NimbusInterface>(val context: Context)
* use this to pass into the [NimbusInterface] instance.
*/
protected fun getCoenrollingFeatureIds(): List<String> =
// This will be changed to use the feature manifest in EXP-3265
listOf()
featureManifest?.getCoenrollingFeatureIds() ?: listOf()
Copy link
Contributor

Choose a reason for hiding this comment

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

😻

@eliserichards eliserichards force-pushed the EXP-3625_connect-coenroll-to-builder branch from a1da763 to c2353d0 Compare July 10, 2023 16:37
@eliserichards eliserichards added this pull request to the merge queue Jul 10, 2023
Merged via the queue into mozilla:main with commit 5247bf0 Jul 10, 2023
16 checks passed
@eliserichards eliserichards deleted the EXP-3625_connect-coenroll-to-builder branch July 10, 2023 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nimbus Nimbus, the experimentation platform.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants