-
-
Notifications
You must be signed in to change notification settings - Fork 9
Fix Clear All Announces to preserve My Contacts (#365) #375
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
Conversation
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
Phase 2.1: Clear Announces Preserves Contacts - Room DAO query modification identified - SQL subquery pattern documented - Identity-scoped filtering strategy defined - Test infrastructure mapped
Phase 02.1: Clear Announces Preserves Contacts (#365) - 2 plan(s) in 2 wave(s) - Wave 1: Production fix (DAO + Repository + ViewModel + UI) - Wave 2: Tests (DAO + ViewModel tests) - Ready for execution
- Add deleteAllAnnouncesExceptContacts(identityHash) to AnnounceDao - SQL subquery excludes contact announces for the given identity - Repository method delegates to DAO - Original deleteAllAnnounces() preserved for backward compatibility
- ViewModel deleteAllAnnounces() now uses identity-aware delete - Gets active identity and calls deleteAllAnnouncesExceptContacts() - Falls back to deleteAllAnnounces() if no active identity - Updated dialog text to mention contact preservation
Tasks completed: 2/2 - Task 1: Add identity-aware delete to DAO and Repository layers - Task 2: Update ViewModel and UI dialog to preserve contacts SUMMARY: .planning/phases/02.1-clear-announces-preserves-contacts/02.1-01-SUMMARY.md
- Add 6 Robolectric tests using in-memory Room database - Test non-contact deletion, contact preservation, identity scoping - Test edge cases: empty contacts, empty announces, other identities - Regression test: original deleteAllAnnounces still deletes everything - All tests execute real SQL queries against Room database Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add mock setup for deleteAllAnnouncesExceptContacts in setup() - Update existing test to verify identity-aware delete is called - Update error handling test to use new method - Add new test for null-identity fallback behavior - All tests use MockK to verify repository method calls Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Tasks completed: 2/2 - Task 1: Add DAO tests for deleteAllAnnouncesExceptContacts - Task 2: Add ViewModel tests for identity-aware delete routing SUMMARY: .planning/phases/02.1-clear-announces-preserves-contacts/02.1-02-SUMMARY.md
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
Greptile OverviewGreptile SummaryThis PR fixes a bug where "Clear All Announces" was deleting contact announces, causing "Node not found" errors when opening conversations with saved contacts. Implementation:
Key changes:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant UI as AnnounceStreamScreen
participant VM as AnnounceStreamViewModel
participant Repo as AnnounceRepository
participant DAO as AnnounceDao
participant DB as Room Database
User->>UI: Tap "Clear All Announces"
UI->>UI: Show ClearAllAnnouncesDialog
User->>UI: Confirm deletion
UI->>VM: deleteAllAnnounces()
VM->>VM: Get active identity
alt Active identity exists
VM->>Repo: deleteAllAnnouncesExceptContacts(identityHash)
Repo->>DAO: deleteAllAnnouncesExceptContacts(identityHash)
DAO->>DB: DELETE FROM announces<br/>WHERE destinationHash NOT IN<br/>(SELECT destinationHash FROM contacts<br/>WHERE identityHash = :identityHash)
DB-->>DAO: Contact announces preserved
DAO-->>Repo: Success
Repo-->>VM: Success
VM->>VM: Log: "Deleted non-contact announces"
else No active identity
VM->>Repo: deleteAllAnnounces()
Repo->>DAO: deleteAllAnnounces()
DAO->>DB: DELETE FROM announces
DB-->>DAO: All announces deleted
DAO-->>Repo: Success
Repo-->>VM: Success
VM->>VM: Log: "Deleted all announces (no active identity)"
end
VM-->>UI: Operation complete
UI->>User: Dialog dismissed, list updated
|
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.
Summary
deleteAllAnnouncesExceptContacts(identityHash)to DAO using a SQL subquery that exempts contacts scoped to the active identitydeleteAllAnnounces()when no active identity existsTest plan
assembleDebug✓testDebugUnitTest✓detektCheck✓Closes #365
🤖 Generated with Claude Code