Skip to content

fix(accounts): retire private memory on removal - #456

Open
veryCrunchy wants to merge 12 commits into
fix/dynamic-memory-account-retirementfrom
fix/private-memory-account-retirement
Open

fix(accounts): retire private memory on removal#456
veryCrunchy wants to merge 12 commits into
fix/dynamic-memory-account-retirementfrom
fix/private-memory-account-retirement

Conversation

@veryCrunchy

@veryCrunchy veryCrunchy commented Sep 6, 2026

Copy link
Copy Markdown
Member

Outcome

Clear account-private previews, Notes cache entries, support drafts, and related in-memory holders before a removed account can be replaced. Reactivate account holders only after confirming the current account incarnation.

The shared Memories timeline cache now retains at most four account scopes. Cache hits, active reads, and activation update recency. Publishing a fifth scope evicts the least recently used index without changing pending-load identities or account-retirement fences.

Verification

  • Full repository and architecture checks and git diff --check passed.
  • Added regressions for fifth/sixth-scope eviction, read recency, and an in-flight refresh completing after eviction.
  • Earlier private-memory lifecycle validation does not cover the new cache-bound fix or newly inherited parent fixes.
  • Exact integrated-head desktop tests and Android compilation remain pending because the dedicated build host is unavailable. Hosted checks and real marketing-capture refresh are required after this push.

Compatibility and risk

Android and desktop in-memory account state are affected. Persisted server data and DAV behavior are unchanged. This PR is stacked on #455 and includes main at 92dd2ae9cec1dc7dac16907e66d7b870694ebbbf.

No intended visual changes. The shared production input change still requires a real capture refresh.

@obiente-cloud
obiente-cloud Bot temporarily deployed to Obiente Preview / PR #456 / NC Native September 6, 2026 04:48 Destroyed
@obiente-cloud

obiente-cloud Bot commented Sep 6, 2026

Copy link
Copy Markdown

Obiente preview

NC Native · f42ea36ca8e7 · Ready

Open preview

View in Obiente

Obiente updates this comment as the preview changes.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 6, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-09T07:22:00.956106Z cf27a24 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@veryCrunchy veryCrunchy changed the title fix/private memory account retirement fix(accounts): retire private memory on removal Sep 6, 2026
@obiente-cloud
obiente-cloud Bot temporarily deployed to Obiente Preview / PR #456 / NC Native September 6, 2026 04:55 Destroyed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0cb85a5c16

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@veryCrunchy
veryCrunchy force-pushed the fix/private-memory-account-retirement branch from 9923bf6 to 8590a8d Compare September 6, 2026 06:38
@obiente-cloud
obiente-cloud Bot temporarily deployed to Obiente Preview / PR #456 / NC Native September 6, 2026 06:38 Destroyed
@obiente-cloud
obiente-cloud Bot temporarily deployed to Obiente Preview / PR #456 / NC Native September 6, 2026 06:45 Destroyed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8590a8dd08

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@veryCrunchy
veryCrunchy force-pushed the fix/private-memory-account-retirement branch from e1d3c1e to 0db18d5 Compare September 6, 2026 06:52
@obiente-cloud
obiente-cloud Bot temporarily deployed to Obiente Preview / PR #456 / NC Native September 6, 2026 06:52 Destroyed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0db18d5065

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@veryCrunchy
veryCrunchy force-pushed the fix/private-memory-account-retirement branch from 0db18d5 to d21e351 Compare September 6, 2026 12:45
@obiente-cloud
obiente-cloud Bot temporarily deployed to Obiente Preview / PR #456 / NC Native September 6, 2026 12:45 Destroyed
@veryCrunchy
veryCrunchy force-pushed the fix/private-memory-account-retirement branch from d21e351 to d42e69b Compare September 9, 2026 05:11
@obiente-cloud
obiente-cloud Bot temporarily deployed to Obiente Preview / PR #456 / NC Native September 9, 2026 05:11 Destroyed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d42e69b65c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +80 to +81
accounts.remove(scope)
accounts[scope] = state

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Bound the shared Memories index cache

When a user opens the timeline across many retained accounts, every parsed day index remains in accounts until that account is explicitly removed; the registry permits 64 accounts and each index permits 20,000 days. The previous service-local cache retained only one index, while the new shared cache inserts entries without the four-account LRU used by the other process caches, so normal account switching can retain a large amount of private timeline metadata for the life of the process. Evict older account scopes when publishing a new index.

Useful? React with 👍 / 👎.

@veryCrunchy
veryCrunchy force-pushed the fix/private-memory-account-retirement branch from d42e69b to bc3ef02 Compare September 9, 2026 05:49
@obiente-cloud
obiente-cloud Bot temporarily deployed to Obiente Preview / PR #456 / NC Native September 9, 2026 05:49 Destroyed
@obiente-cloud
obiente-cloud Bot temporarily deployed to Obiente Preview / PR #456 / NC Native September 9, 2026 05:55 Destroyed
@obiente-cloud
obiente-cloud Bot temporarily deployed to Obiente Preview / PR #456 / NC Native September 9, 2026 07:05 Destroyed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cf27a2431b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +38 to +41
accountStates.remove(accountStorageKey)?.let { retired ->
retired.timeline.value = PhotoTimelineState(pageSize = MAX_PHOTO_TIMELINE_PAGE_SIZE)
retired.backupStatuses.value = emptyMap()
retired.initialLoadCompleted.value = false

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fence retired photo timeline holders against late writes

If an in-flight timeline load completes after account retirement but before the old AuthenticatedApp composition is disposed, this purge only clears the retained PhotoTimelineUiState; it does not revoke writes to that object. Fresh evidence in this revision is that loadTimelinePage still assigns the private page and backup statuses directly at NextcloudNativeApp.kt:8922-8948 without an incarnation producer, so a late completion can repopulate the cleared holder and briefly render or retain the removed account's media metadata. Make these state publications gate-aware rather than relying only on removing and resetting the registry entry.

AGENTS.md reference: AGENTS.md:L327-L328

Useful? React with 👍 / 👎.

"ui/src/commonMain/kotlin/dev/obiente/nextcloudnative/app/AccountPrivateMemoryLifecycle.kt": "36c9267a53d9f6f59fc38862d8a073fca6b6c3c1275730ddc65d138d5e09ce82",
"ui/src/commonMain/kotlin/dev/obiente/nextcloudnative/app/AccountSettingsScreen.kt": "7b93d571553fa8c364681f172edecde3109b45db9a4ff6f9f6fb12f8f6280a0e",
"ui/src/commonMain/kotlin/dev/obiente/nextcloudnative/app/AccountWorkspaceMemoryCaches.kt": "11e6f0eab522b4fc799a67bf6e3881f96a62f458a9fff07648bacb5e3eaba9d5",
"ui/src/commonMain/kotlin/dev/obiente/nextcloudnative/app/AccountPrivateMemoryCleanup.kt": "35c13216a14662f9bc2b47cee36b29f9d7d8602373b937536fcc5cc01da67e4f",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Regenerate captures before blessing the new source hashes

This patch updates the manifest's source hashes even though no screenshot asset was regenerated, and the commit's own verification states that a real capture refresh remains pending. Because verify:captures:fresh trusts these declared hashes, the manifest now presents the existing images as current and prevents the refresh workflow from distinguishing a manually blessed stale catalog from one rendered against this revision; run the capture generator and commit its actual output instead.

AGENTS.md reference: AGENTS.md:L99-L101

Useful? React with 👍 / 👎.

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.

1 participant