Skip to content

fix(memories): keep local-only deletes deleted - #10862

Merged
Git-on-my-level merged 1 commit into
BasedHardware:mainfrom
Git-on-my-level:fix/memories-local-identity-delete-10446
Jul 29, 2026
Merged

Git-on-my-level merged 1 commit into
BasedHardware:mainfrom
Git-on-my-level:fix/memories-local-identity-delete-10446

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Jul 29, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Resolve local_<rowid> memory IDs to SQLite rows for delete and undo, without issuing a backend DELETE for local-only memories.
  • Keep desktop deletion pending through backend finalization and restore mobile UI state if a delete fails; refreshes now respect an active undo window.
  • Add desktop and Flutter regression coverage, plus a macOS changelog fragment.

Product invariants affected

  • INV-MEM-1 — preserves the existing three-tier projection by resolving local identity rather than adding a collection or tier.

Context

The reporter Firebase UID cannot be verified from this environment.

Verification

  • bash app/test.sh test/providers/memories_provider_deletion_test.dart
  • app/scripts/analyze_ratchet.sh
  • xcrun swift build -c debug --package-path Desktop
  • The desktop XCTest target was attempted, but a fresh test-only SwiftWhisper submodule checkout stalled locally; CI must run MemoryLocalIdentityMutationTests.

Closes #10446

Failure-Class: FC-split-mutation-authority

Review in cubic

Failure-Class: FC-split-mutation-authority
Co-authored-by: multica-agent <[email protected]>

@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: a17e549a68

ℹ️ 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 +1414 to +1415
if MemoryIdentity(surfacedId: memory.id).isLocalOnly {
return

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Resolve the row's current identity before skipping DELETE

When a local memory's in-flight create finishes during the four-second undo window, MemoryStorage.markSynced can attach a real backend ID to the SQLite row while this captured ServerMemory still has its old local_<rowid> ID. This branch then skips the backend DELETE based on that stale surfaced ID, leaving the newly created server memory undeleted and able to reappear on a later refresh. Resolve the row's authoritative current identity at finalization rather than treating the UI snapshot as permanent.

AGENTS.md reference: AGENTS.md:L41-L43

Useful? React with 👍 / 👎.

Comment on lines 1401 to +1402
await performActualDelete(memory)
}

OmiMotion.withGated(.easeInOut(duration: 0.2)) {
pendingDeleteMemory = nil
undoTimeRemaining = 0
guard self.pendingDeleteMemory?.id == memory.id else { return }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Disable undo once backend finalization starts

When the countdown expires or the close button starts a slow backend DELETE, this await leaves pendingDeleteMemory set, so the toast continues presenting an enabled Undo button. undoDelete() can then restore the local row but cannot cancel the already-running request; if that request succeeds, the user's apparent undo is later lost when the cache reconciles with the server. Transition out of the undoable state before starting the irreversible request, or make finalization cancellable/disable Undo while it is in flight.

AGENTS.md reference: AGENTS.md:L41-L43

Useful? React with 👍 / 👎.

@Git-on-my-level
Git-on-my-level merged commit 80fe201 into BasedHardware:main Jul 29, 2026
32 checks passed
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.

Memories out of sync across phone vs desktop; deleted memories reappear

1 participant