Repository navigation
Sign out only after the local Anisette choice is saved - #317
Merged
Merged
Conversation
clearUser() is built on RxDataStore.updateDataAsync, which starts its write when called rather than when subscribed. Passed straight to andThen, it cleared the session while the chain was being built, so accepting the upgrade signed the user out even if saving the choice failed. Defer it so it runs after the save completes. Found by lazzurs while working on #315. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
parawanderer
temporarily deployed
to
Android Build
November 23, 2026 07:58 — with
GitHub Actions
Inactive
parawanderer
temporarily deployed
to
Android Build
November 23, 2026 07:58 — with
GitHub Actions
Inactive
RxFlows.onlyAfter(first, () -> then) creates `then` only once `first` has completed. MapsActivity uses it for the local Anisette sign-out. The tests stand in for a DataStore write with one that writes when called, and fail with the old `first.andThen(then)`: checked by putting it back, and all three new tests went red. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
parawanderer
temporarily deployed
to
Android Build
November 23, 2026 08:02 — with
GitHub Actions
Inactive
parawanderer
temporarily deployed
to
Android Build
November 23, 2026 08:02 — with
GitHub Actions
Inactive
lazzurs
pushed a commit
to lazzurs/OpenTagViewer
that referenced
this pull request
Nov 23, 2026
parawanderer#317 added RxFlows.onlyAfter for the same eager-DataStore trap this branch worked around with Completable.defer. Settings' sign-out and ThisPhonesTagData's three steps now use it, so there is one way to write "only after" rather than two. AGENTS.md rule 23 points at the helper instead of describing a second convention. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 23, 2026
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MapsActivity.offerLocalAnisetteUpgradeIfDuechainedsaved.andThen(this.userAuthRepo.clearUser()).clearUser()is built onRxDataStore.updateDataAsync, which launches its write when called, not when subscribed, so the session was cleared while the chain was being built. If saving the choice then failed, the user was already signed out while the activity stayed on the map, and the next launch went to sign-in still set to the server.Adds
RxFlows.onlyAfter(first, () -> then), which createsthenonly oncefirsthas completed, and uses it for that sign-out. This was the only DataStore write chained after another step inapp/src/main/java; I checked everyupdateDataAsynccaller.Found by @lazzurs in #315.
Verified:
RxFlowsTesthas three new JVM tests. They use a stand-in that writes when called, asupdateDataAsyncdoes, and assert that the sign-out does not start before the save completes, never starts when the save fails, and does nothing until subscribed.onlyAfterchanged back tofirst.andThen(then.get()), all three fail.:app:testDebugUnitTest: 574 tests, 0 failures.Not covered: nothing stops a bare
andThen(repo.clearUser())being written at a call site again. That would need an Espresso test againstMapsActivitywith a fake settings repository.🤖 Generated with Claude Code