Skip to content

feat(settings) default push for inbox - #11535

Merged
dani-zilla merged 8 commits into
thunderbird:mainfrom
dani-zilla:11299-default-push-for-inbox
Oct 5, 2026
Merged

dani-zilla merged 8 commits into
thunderbird:mainfrom
dani-zilla:11299-default-push-for-inbox

Conversation

@dani-zilla

@dani-zilla dani-zilla commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Closes: #11299
Closes: #11616

RFC / Technical Design (if applicable): RFC 0005
feature-flag: push_enabled_on_inbox_by_default

Description

Enables push on the inbox by default for accounts created through the new account creation process (email and OAuth/password)

Stacked PR Info

  1. (This PR) e14827e — feat(settings) default push for inbox #11535
  2. 3f53815 — feat(notification-settings): Adds Default Push to QR Code Imports #11666

AI Disclosure

Select one of the following (mandatory)

  • This contribution does not include any changes created or assisted by AI.
  • This contribution includes changes assisted by AI.
  • This contribution includes changes created by AI.

Contribution Checklist

  • I have read and affirm that my contribution adheres to Mozilla’s Community Participation Guidelines
  • This contribution is in Kotlin where possible
  • This contribution does not use merge commits
  • This contribution adheres to the existing codestyle (run gradlew spotlessCheck to check and gradlew spotlessApply to format your source code; will be checked by CI).
  • This contribution does not break existing unit tests (run gradlew testDebugUnitTest; will be checked by CI).
  • This contribution includes tests for any new functionality, and maintains tests for any updated functionality.
  • This contribution adheres to our Engineering process (RFC/Technical Design/ADR)
  • This PR has a descriptive title and body that accurately outlines all changes made, and contains a reference to any issues that it fixes (e.g. Closes #XXX or Fixes #XXX).

@dani-zilla
dani-zilla requested a review from a team as a code owner September 10, 2026 00:35
@dani-zilla dani-zilla added report: include Include changes in user-facing reports. feature-flag Changes guarded by a feature flag. Please add a comment stating the name: "feature-flag: abc" labels Sep 10, 2026
@github-actions github-actions Bot added the tb-team Tasks and features handled by project maintainers label Sep 10, 2026
@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ Validation Passed: All report and feature-flag labels are correctly set.

@dani-zilla

Copy link
Copy Markdown
Contributor Author

I still have a bit of cleanup to do here. It is functional, this works as intended now and can be tested. Although besides a little bit of formatting (I notice one class has been changed that I didn't otherwise touch and want to fix that), my current concern is testing the AccountCreator. Currently, our account creator test doesn't actually test that an account is created. The test that exists basically just tests the use case can work as a holder of a function and return the right types. It does not check that, given a set of account state criteria, does it produce a full user account?

So the question because how to test this. I don't think the answer is to refactor the executed use case code to make it directly testable. We'd have to mock quite a bit and create a few fakes to store the account, it would be an undertaking that would further delay this project. On the other hand, I was hoping for some advice on if we already have any tests in place that do something like this. Rather than testing the use case directly, they test account creation defaults. I'm going to look into this more today, but would also be welcome to any pointers.

@dani-zilla
dani-zilla force-pushed the 11299-default-push-for-inbox branch from f2ca047 to 5eef8f3 Compare September 10, 2026 16:27
@dani-zilla dani-zilla changed the title Draft: 11299 default push for inbox 11299 default push for inbox Sep 10, 2026
@dani-zilla

Copy link
Copy Markdown
Contributor Author

Looks like it's in good shape. I added the feature flag test changes as well as a new test in the folder settings tests to check that the modification is called by the use case.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A UseCase should be tested.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A UseCase should be tested.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The closest I have for this right now is the SetPushForFolderUseCase should call setPushEnabled test. Which does test that the push enabled change function gets called when the function that uses the usecase is called.

I had wondered how to do the testing for this. I had looked at the CreateAccountTest and had initially thought about doing it there, but the created account here is mocked, and the function being tested is mocked as well. Basically it tests that the function can take a lambda and that the lambda spits out an account, but the test is designed to basically always do that. I wasn't sure what was being tested.

Obviously there's something more I could do here, but I'm a bit stumped on how we can write a meaningful test for this, given how mocked the account creation process and test is already. It seems like I could create a mock account, with mock folders, and mock folder settings, and make sure that the function changes that when the use case is called directly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sorry to bump this, but do you have any suggestions for testing this? I could wrap it similar to the account creation use case, but doing so won't test the actual functionality. The other option is completely mocking or faking the data it accesses. The SetPushForFolderUseCase should call setPushEnabled test does ensure that it's called, but doesn't ensure it's changing the setting. I think we should probably do this with a large mockup of the user's settings and see that it's changed, but the way this is set up, that involves doing a lot of fake data object creation. I assume that's why we did the account creation use case testing the way we did. What would be the best way forward on it?

@wmontwe wmontwe Sep 29, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@dani-zilla To re-request a review, click the re-request icon (the circle button) next to the reviewer's name to flag the PR for reconsideration. This is particularly important if the person commenting is not officially assigned as a reviewer. Since this fix is urgent, using @mentions may also be helpful to ensure it gets seen quickly.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Although this use case involves minimal logic, returning a value if a type is set and null otherwise, it still constitutes business logic and should be unit tested to ensure correctness.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@wmontwe I'm not against the idea of testing it. I think, outside of the SetPushForFolderUseCase should call setPushEnabled test, directly testing if the use cases are returning the right folder and also changing that folder's settings may require some pretty massive fakes. I assume that's why the account creation unit test doesn't actually test that a new account is created. One option is to say that, because the functionality is so hard to isolate in a test environment, it shouldn't be isolated as a use case. But if included directly in the account creation function called by the account creation use case would ensure that it's only tested manually.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@dani-zilla I agree that testing the full account creation flow with realistic storage fakes would be too complex. We do not need that level of detail for the folder lookup now. GetFolderIdsForTypeUseCase can be tested using a small fake account manager and a stubbed message store.

Additionally, SetPushForFolderUseCase does not require a test because it only delegates properties to the MessageStore. If a repository is implemented in the future, we could use it directly instead of the use case provided that no additional business logic is required.

@dani-zilla dani-zilla changed the title 11299 default push for inbox feat(settings) default push for inbox Sep 18, 2026
@wmontwe wmontwe assigned wmontwe and unassigned rafaeltonholo Sep 29, 2026
@wmontwe
wmontwe removed the request for review from rafaeltonholo September 29, 2026 07:10
@dani-zilla
dani-zilla force-pushed the 11299-default-push-for-inbox branch from 9bdd386 to c6d3d09 Compare September 29, 2026 21:29
@dani-zilla
dani-zilla requested a review from wmontwe September 30, 2026 18:02
@dani-zilla

Copy link
Copy Markdown
Contributor Author

Let me rebase. I believe Rafael fixed those dependency checks in his PR already. Those aren't from this PR.

@dani-zilla
dani-zilla force-pushed the 11299-default-push-for-inbox branch from 1218275 to e14827e Compare October 1, 2026 14:31
@dani-zilla

Copy link
Copy Markdown
Contributor Author

Yup, that was all it was! Rebase fixed the dependency guard check, ready to review 👍

@dani-zilla dani-zilla added the pr: stacked Must be used on a PR that is stacked on top of other(s) label Oct 1, 2026
@dani-zilla
dani-zilla force-pushed the 11299-default-push-for-inbox branch from e14827e to b44933f Compare October 2, 2026 14:33
@dani-zilla
dani-zilla force-pushed the 11299-default-push-for-inbox branch from f1301c4 to 3cea5d7 Compare October 2, 2026 20:09

@wmontwe wmontwe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@dani-zilla
dani-zilla merged commit 34ca0e4 into thunderbird:main Oct 5, 2026
16 checks passed

This branch was successfully deployed

1 active (outdated) deployment
botmobile — 3cea5d7e Deployed Oct 5, 2026 by dani-zilla via pr-merged #578
review — be932b4f Deployed Sep 10, 2026 by dani-zilla via label-tb-team #490
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature-flag Changes guarded by a feature flag. Please add a comment stating the name: "feature-flag: abc" pr: stacked Must be used on a PR that is stacked on top of other(s) report: include Include changes in user-facing reports. tb-team Tasks and features handled by project maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Notificaiton Settings — Test New Use Cases Notification Settings — Default IMAP IDLE "Push" Notifications on Newly Added Accounts by Default

3 participants