Repository navigation
fix: bind profile removal to its original owner #1693
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
Merged
ovitrif
merged 32 commits into
fix/restore-identity-background
from
fix/profile-removal-ownership
Nov 26, 2026
+12,764
−1,687
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
edd6476
fix: bind profile removal to its original owner
ben-kaufman ff4dc35
chore: rename changelog fragment
ben-kaufman 7e2e466
fix: complete profile removal recovery safely
ben-kaufman 7e2fd14
fix: keep pending profile cleanup distinct from expiry
ben-kaufman 188f456
fix: preserve receipt attribution during profile cleanup
ben-kaufman e6a75f0
fix: preserve receipt and recovery state through cleanup
ben-kaufman e1cc3b1
fix: preserve subscription checks in profile removal
ben-kaufman 0dcad96
fix: offer original-owner local disconnect after removal refusal
ben-kaufman 564a54d
Merge current cleanup parent into local profile recovery
ben-kaufman 4d67734
test: wire local disconnect in profile recovery content
ben-kaufman f311807
fix: require acknowledged private endpoint withdrawal
ben-kaufman 716e88e
fix: retain acknowledged profile withdrawal on review
ben-kaufman ebc3910
fix: preserve profile removal across confirmed retries
ben-kaufman b2cd2aa
fix: preserve profile cleanup retries
ben-kaufman 2d8c991
Refresh profile review eligibility after credential failure
ben-kaufman 395314b
fix: recover failed wallet resets before wallet admission
ben-kaufman 011f47f
fix: preserve authenticated recovery for unreadable reset state
ben-kaufman 581fed7
fix: preserve cleanup and local pin recovery
ben-kaufman 595c364
fix: resume migration after cleanup state recovery
ben-kaufman 78f7209
fix: offer retry for unavailable migration status
ben-kaufman a5cd94f
Merge current cleanup parent and bound receipt credential checks
ben-kaufman 3b3b226
fix: keep unreadable recovery retry available with PIN access
ben-kaufman 051f60f
fix: preserve profile ownership with vss retirement
ben-kaufman 32fc96f
fix: keep reset recovery and wallet presence consistent
ben-kaufman c228adb
fix: compose final profile subscription admission
ben-kaufman daee65e
fix: preserve original ownership during profile cleanup
ben-kaufman f9b3ed2
fix: retain recovery guards during profile cleanup
ben-kaufman fc96942
fix: retain recovery with spark balance updates
ben-kaufman 35806d6
fix: preserve recovery with startup cache loading
ben-kaufman a681b2b
Merge validated recovery parent into profile cleanup
ben-kaufman 83155d8
fix: preserve recovery with finished-exit balance updates
ben-kaufman 0fd9345
chore: merge restore identity background into profile removal ownership
ovitrif File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
139 changes: 139 additions & 0 deletions
139
app/src/androidTest/java/to/bitkit/ui/screens/profile/ProfileRecoveryContentTest.kt
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| package to.bitkit.ui.screens.profile | ||
|
|
||
| import androidx.compose.runtime.CompositionLocalProvider | ||
| import androidx.compose.runtime.getValue | ||
| import androidx.compose.runtime.mutableStateOf | ||
| import androidx.compose.runtime.setValue | ||
| import androidx.compose.ui.platform.LocalInspectionMode | ||
| import androidx.compose.ui.test.assertIsDisplayed | ||
| import androidx.compose.ui.test.assertIsNotEnabled | ||
| import androidx.compose.ui.test.junit4.v2.createComposeRule | ||
| import androidx.compose.ui.test.onNodeWithTag | ||
| import androidx.compose.ui.test.onNodeWithText | ||
| import androidx.compose.ui.test.performClick | ||
| import androidx.test.espresso.Espresso.pressBackUnconditionally | ||
| import androidx.test.platform.app.InstrumentationRegistry | ||
| import org.junit.Rule | ||
| import org.junit.Test | ||
| import to.bitkit.R | ||
| import to.bitkit.test.annotations.ComposeUi | ||
| import to.bitkit.ui.theme.AppThemeSurface | ||
| import kotlin.test.assertEquals | ||
|
|
||
| @ComposeUi | ||
| class ProfileRecoveryContentTest { | ||
| @get:Rule | ||
| val compose = createComposeRule() | ||
|
|
||
| private val context get() = InstrumentationRegistry.getInstrumentation().targetContext | ||
|
|
||
| @Test | ||
| fun restartRecoveryWithoutCredentialsRequiresLocalConfirmation() { | ||
| var state by mutableStateOf( | ||
| ProfileUiState(recoveryPending = true, localDisconnect = true), | ||
| ) | ||
| var confirmations = 0 | ||
| var back = 0 | ||
| compose.setContent { | ||
| AppThemeSurface { | ||
| CompositionLocalProvider(LocalInspectionMode provides true) { | ||
| ProfileContent( | ||
| uiState = state, | ||
| onBackClick = { back++ }, | ||
| onClickEdit = { error("Pending recovery must not offer editing") }, | ||
| onClickCopy = {}, | ||
| onClickShare = {}, | ||
| onClickSignOut = { state = state.copy(showSignOutDialog = true) }, | ||
| onDismissSignOutDialog = { state = state.copy(showSignOutDialog = false) }, | ||
| onConfirmSignOut = { | ||
| confirmations++ | ||
| state = state.copy(showSignOutDialog = false, isSigningOut = true) | ||
| }, | ||
| onClickRetry = { error("Pending recovery must not restore credentials") }, | ||
| onClickAddTag = {}, | ||
| onRemoveTag = {}, | ||
| onDismissAddTagSheet = {}, | ||
| onSaveTag = {}, | ||
| onDismissCopiedPopup = {}, | ||
| ) | ||
| } | ||
| } | ||
| } | ||
| compose.onNodeWithText(context.getString(R.string.profile__wallet_recovery_pending)).assertIsDisplayed() | ||
| compose.onNodeWithTag("ProfileRecoveryDisconnect").assertDoesNotExist() | ||
| compose.runOnIdle { state = state.copy(recoveryCanDisconnect = true) } | ||
| compose.onNodeWithText(context.getString(R.string.profile__cleanup_pending)).assertIsDisplayed() | ||
| compose.onNodeWithTag("ProfileRecoveryDisconnect").assertIsDisplayed().performClick() | ||
| compose.onNodeWithText(context.getString(R.string.profile__disconnect_local_description)).assertIsDisplayed() | ||
| compose.runOnIdle { assertEquals(0, confirmations) } | ||
| compose.onNodeWithTag("DialogCancel").performClick() | ||
| val dismissedAt = System.currentTimeMillis() | ||
| compose.runOnIdle { assertEquals(0, confirmations) } | ||
| compose.waitUntil(1_000) { System.currentTimeMillis() - dismissedAt > 600 } | ||
| compose.onNodeWithTag("ProfileRecoveryDisconnect").performClick() | ||
| compose.onNodeWithTag("DialogConfirm").performClick() | ||
| compose.runOnIdle { assertEquals(1, confirmations) } | ||
| compose.onNodeWithTag("ProfileRecoveryDisconnect").assertIsNotEnabled() | ||
| compose.onNodeWithTag("NavigationBack").performClick() | ||
| compose.onNodeWithTag("HeaderMenu").assertDoesNotExist() | ||
| pressBackUnconditionally() | ||
| compose.onNodeWithTag("ProfileRecoveryDisconnect").assertIsDisplayed() | ||
| compose.runOnIdle { assertEquals(0, back) } | ||
| } | ||
|
|
||
| @Test | ||
| fun uncertainDeletionOffersReviewThenSeparateConfirmation() { | ||
| var state by mutableStateOf(EditProfileUiState(showDeleteFailureDialog = true, canReviewRemoval = true)) | ||
| var reviews = 0 | ||
| var deletes = 0 | ||
| editContent({ state }, onReview = { | ||
| reviews++ | ||
| state = state.copy(showDeleteFailureDialog = false, showDeleteDialog = true) | ||
| }, onConfirm = { deletes++ }) | ||
| compose.onNodeWithText(context.getString(R.string.profile__review_removal)).assertIsDisplayed() | ||
| compose.onNodeWithTag("DialogConfirm").performClick() | ||
| compose.runOnIdle { | ||
| assertEquals(1, reviews) | ||
| assertEquals(0, deletes) | ||
| } | ||
| compose.onNodeWithTag("DialogConfirm").performClick() | ||
| compose.runOnIdle { assertEquals(1, deletes) } | ||
| } | ||
|
|
||
| @Test | ||
| fun localCompletionFailureOnlyOffersDisconnectAndClose() { | ||
| var disconnects = 0 | ||
| editContent( | ||
| state = { EditProfileUiState(showDeleteFailureDialog = true, canReviewRemoval = false) }, | ||
| onReview = { error("Local completion cannot repeat remote deletion") }, | ||
| onDisconnect = { disconnects++ }, | ||
| ) | ||
| compose.onNodeWithText(context.getString(R.string.profile__review_removal)).assertDoesNotExist() | ||
| compose.onNodeWithText(context.getString(R.string.common__close)).assertIsDisplayed() | ||
| compose.onNodeWithTag("DialogConfirm").performClick() | ||
| compose.runOnIdle { assertEquals(1, disconnects) } | ||
| } | ||
|
|
||
| private fun editContent( | ||
| state: () -> EditProfileUiState, | ||
| onReview: () -> Unit, | ||
| onDisconnect: () -> Unit = {}, | ||
| onConfirm: () -> Unit = {}, | ||
| ) { | ||
| compose.setContent { | ||
| AppThemeSurface { | ||
| CompositionLocalProvider(LocalInspectionMode provides true) { | ||
| EditProfileContent( | ||
| uiState = state(), | ||
| onBackClick = {}, onNameChange = {}, onBioChange = {}, onLinkUrlChange = { _, _ -> }, | ||
| onAvatarSelected = {}, onAddLink = {}, onRemoveLink = {}, onAddTag = {}, onRemoveTag = {}, | ||
| onSave = {}, onDelete = {}, onDismissDeleteDialog = {}, onConfirmDelete = onConfirm, | ||
| onRetryDelete = onReview, onDismissDeleteFailureDialog = {}, onDisconnectProfile = onDisconnect, | ||
| onLocalDisconnect = { error("Fresh local disconnect is not part of this recovery scenario") }, | ||
| onDismissAddLinkSheet = {}, onSaveLink = { _, _ -> }, onDismissAddTagSheet = {}, onSaveTag = {}, | ||
| ) | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.