Skip to content

Bug 2060541 - Recheck auth status on startup, weekly - #7564

Open
bytesized wants to merge 1 commit into
mozilla:mainfrom
bytesized:5386
Open

Bug 2060541 - Recheck auth status on startup, weekly#7564
bytesized wants to merge 1 commit into
mozilla:mainfrom
bytesized:5386

Conversation

@bytesized

Copy link
Copy Markdown

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
  • Quality: This PR builds and tests run cleanly
    • cargo test succeeds locally.
  • Tests: This PR includes thorough tests or an explanation of why it does not
    • No automated testing, but this adds the cargo fxa force-auth-issues command to the example CLI client in order to be able to test this manually.
  • Changelog: This PR includes a changelog entry in CHANGELOG.md or an explanation of why it does not need one
    • This change is small enough that it doesn't seem like it warrants a changelog entry.
  • Dependencies: This PR follows our dependency management guidelines
    • No new dependencies added.

@bytesized

Copy link
Copy Markdown
Author

I have been thinking a fair amount about the part of this patch that I'm the least sure about: the part in components/fxa-client/src/state_machine/mod.rs where we avoid calling on_auth_issues() on the Uninitialized -> AuthIssues transition. When I wrote it, I felt reasonably sure that this change wouldn't have any negative effects because that state transition should only happen after we already transitioned to AuthIssues and because the effects of on_auth_issues should persist through the next initialization. But having thought about it a bit more, I believe that there are ways of having the Uninitialized -> AuthIssues transition without having previously been in the AuthIssues state. So I think I may have to undo that change. But I'm not sure of the correct way to address the issue that it always runs on_auth_issues when we start up in the AuthIssues state, resetting the last_auth_recheck_time timer. I'm going to have to think about this.

@bytesized

Copy link
Copy Markdown
Author

I ended up not putting the logic to reset the auth timer in on_auth_issues() because of the issue I discussed above. To summarize, we always call on_auth_issues() on the Uninitialized to AuthIssues transition which causes the recheck to never happen since we never see an expired timer. But this means that I've basically littered the transition() function with account.reset_auth_recheck_timer() calls. Which doesn't feel great since it makes maintenance of this function kinda nasty. I'm not sure what a better option is but I'm open to ideas.

@bendk
bendk self-requested a review September 2, 2026 22:08
bendk
bendk previously requested changes Sep 3, 2026

@bendk bendk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is looking very good. Thanks for updating the example client.

I had a couple suggestions, but the only blocker is figuring out how we should store the refresh token when we're in the auth-issues state.

Comment thread components/fxa-client/src/internal/state_manager.rs Outdated
Comment thread components/fxa-client/src/state_machine/transitions.rs Outdated
Comment thread components/fxa-client/src/internal/state_persistence.rs Outdated
Comment thread components/fxa-client/src/internal/mod.rs Outdated
@mergify
mergify Bot dismissed bendk’s stale review September 4, 2026 19:32

The pull request has been modified, dismissing previous reviews.

Comment thread components/fxa-client/src/state_machine/transitions.rs
bendk
bendk previously requested changes Sep 8, 2026

@bendk bendk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The changes look great. The last part is updating the methods I noted so that they continue to throw a NoRefreshToken error if logged_out_from_auth_issues=true.

Comment thread components/fxa-client/src/internal/state_persistence.rs Outdated
Comment thread components/fxa-client/src/internal/state_manager.rs
@mergify
mergify Bot dismissed bendk’s stale review September 9, 2026 18:13

The pull request has been modified, dismissing previous reviews.

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