-
Notifications
You must be signed in to change notification settings - Fork 5
fix(accounts): retire dynamic memory on removal #455
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
Open
veryCrunchy
wants to merge
13
commits into
fix/durable-upload-scheduling-recovery-stack
from
fix/dynamic-memory-account-retirement
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
49d595b
fix(accounts): retire dynamic memory on removal
veryCrunchy d7878ce
refactor(android): own dynamic account activation
veryCrunchy 41bac2c
test: enforce Unit memory retirement methods
veryCrunchy 8fd5d33
fix(accounts): distinguish uncertain desktop cleanup
veryCrunchy eb26a77
refactor(accounts): preserve reduced service boundaries
veryCrunchy 4501be3
refactor(dynamic): seal cache producer identity
veryCrunchy 8bfdd42
test(dynamic): supply cleanup cache producers
veryCrunchy 9d1c1d0
fix(dynamic): preserve producer API visibility
veryCrunchy 7c1b2d9
test(desktop): update account cleanup callback contract
veryCrunchy a377604
chore(website): refresh marketing captures
obiente-automations[bot] 9e6259b
fix(desktop): scope legacy cleanup activation blocks
veryCrunchy 07ba4cd
Merge branch 'fix/durable-upload-scheduling-recovery-stack' into fix/…
veryCrunchy 41120a5
chore(website): refresh marketing captures
obiente-automations[bot] 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
16 changes: 16 additions & 0 deletions
16
androidApp/src/main/kotlin/dev/obiente/nextcloudnative/AndroidDynamicAccountActivation.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,16 @@ | ||
| package dev.obiente.nextcloudnative | ||
|
|
||
| import dev.obiente.nextcloudnative.app.DynamicApiRequestCoalescer | ||
| import dev.obiente.nextcloudnative.app.DynamicNativeMemoryAccountLifecycle | ||
| import dev.obiente.nextcloudnative.app.NextcloudApiResponse | ||
| import dev.obiente.nextcloudnative.app.NextcloudSession | ||
|
|
||
| internal class AndroidDynamicAccountActivation( | ||
| private val coalescer: DynamicApiRequestCoalescer<NextcloudApiResponse>, | ||
| private val activateMemory: (String) -> Unit = DynamicNativeMemoryAccountLifecycle::activateAccount, | ||
| ) { | ||
| suspend fun afterCredentialSave(persistedSession: NextcloudSession) { | ||
| activateMemory(persistedSession.accountId.storageKey) | ||
| coalescer.activateAccount(NextcloudDocumentIds.cacheAccountId(persistedSession)) | ||
| } | ||
| } |
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
34 changes: 34 additions & 0 deletions
34
...oidApp/src/test/kotlin/dev/obiente/nextcloudnative/AndroidDynamicAccountActivationTest.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,34 @@ | ||
| package dev.obiente.nextcloudnative | ||
|
|
||
| import dev.obiente.nextcloudnative.app.DynamicApiRequestCoalescer | ||
| import dev.obiente.nextcloudnative.app.NextcloudApiResponse | ||
| import dev.obiente.nextcloudnative.app.NextcloudSession | ||
| import kotlin.test.Test | ||
| import kotlin.test.assertEquals | ||
| import kotlinx.coroutines.runBlocking | ||
|
|
||
| class AndroidDynamicAccountActivationTest { | ||
| @Test | ||
| fun currentCredentialSaveReopensBothDynamicCaches() = runBlocking { | ||
| val session = NextcloudSession("https://cloud.example.test", "alice", "password") | ||
| val cacheAccountId = NextcloudDocumentIds.cacheAccountId(session) | ||
| val coalescer = DynamicApiRequestCoalescer<NextcloudApiResponse>() | ||
| coalescer.fenceAccount(cacheAccountId) {} | ||
| var activatedMemoryAccount: String? = null | ||
| val activation = AndroidDynamicAccountActivation( | ||
| coalescer = coalescer, | ||
| activateMemory = { activatedMemoryAccount = it }, | ||
| ) | ||
|
|
||
| activation.afterCredentialSave(session) | ||
|
|
||
| assertEquals(session.accountId.storageKey, activatedMemoryAccount) | ||
| assertEquals( | ||
| 200, | ||
| coalescer.execute(cacheAccountId, "GET /status", load = { | ||
| NextcloudApiResponse(200, byteArrayOf(), null, null) | ||
| }).status, | ||
| ) | ||
| } | ||
|
|
||
| } |
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
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
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,7 @@ | ||
| category: fix | ||
| issue: 172 | ||
| pull: none | ||
| platforms: android, desktop | ||
| user-facing: yes | ||
|
|
||
| Account removal clears dynamic app memory and rejects late responses even after the account is added again. Pending cleanup from older desktop versions no longer prevents unrelated accounts from loading. |
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When retrying a two-field legacy removal journal,
previewCacheIdentityis null even though this overload has the exactsession; this branch therefore retires only process memory and skips both the request-coalescer fence anddynamicApiState.cache.invalidateAccount().saveSession()can then clear the cleanup journal and reactivate the account while its persisted dynamic responses underNextcloudDocumentIds.cacheAccountId(session)remain available, allowing private data from the prior account incarnation to be shown after the same server/login identity is added again. Derive the full cache identity fromsessionand run the normal fenced cleanup for this legacy case.AGENTS.md reference: AGENTS.md:L410-L413
Useful? React with 👍 / 👎.