Skip to content

Delete groups and profiles in one transaction - #147

Merged
hawkff merged 1 commit into
mainfrom
fix/011-atomic-group-delete
Jul 12, 2026
Merged

Delete groups and profiles in one transaction#147
hawkff merged 1 commit into
mainfrom
fix/011-atomic-group-delete

Conversation

@hawkff

@hawkff hawkff commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • delete group profiles before their parent inside one Room transaction
  • update selection and listeners only after commit
  • cover rollback, ordering, and post-commit side effects

Validation

  • Namespace CI run 29212281997 passed
  • local read-only review reported no correctness findings

Greptile Summary

This PR makes group deletion atomic and delays side effects until the delete commits. The main changes are:

  • Delete group profiles and parent groups inside one Room transaction.
  • Clear the selected profile only after a successful commit.
  • Notify listeners and reconfigure subscriptions after commit.
  • Add tests for success, rollback, selection changes, and public wrappers.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
app/src/main/java/io/nekohasekai/sagernet/database/GroupManager.kt Group deletion now runs profile and group removal in one transaction, with selection clearing and side effects deferred until commit.
app/src/test/java/io/nekohasekai/sagernet/database/GroupManagerDeleteTest.kt Adds tests for single and batch deletion, rollback behavior, selection preservation, and wrapper side effects.

Reviews (2): Last reviewed commit: "fix(database): delete groups and profile..." | Re-trigger Greptile

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 2 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7f2f41ac-7557-464f-aeb7-0897d91e0586

📥 Commits

Reviewing files that changed from the base of the PR and between ff4269f and 8dc11d4.

📒 Files selected for processing (2)
  • app/src/main/java/io/nekohasekai/sagernet/database/GroupManager.kt
  • app/src/test/java/io/nekohasekai/sagernet/database/GroupManagerDeleteTest.kt

Comment @coderabbitai help to get the list of available commands.

Comment thread app/src/main/java/io/nekohasekai/sagernet/database/GroupManager.kt Outdated
Comment thread app/src/main/java/io/nekohasekai/sagernet/database/GroupManager.kt Outdated
@hawkff
hawkff force-pushed the fix/011-atomic-group-delete branch from c99eae6 to 8dc11d4 Compare July 12, 2026 23:19
@hawkff

hawkff commented Jul 12, 2026

Copy link
Copy Markdown
Owner Author

Latest commit passed Namespace CI run 29213193002.

@hawkff
hawkff merged commit ecab49c into main Jul 12, 2026
9 checks passed
@hawkff
hawkff deleted the fix/011-atomic-group-delete branch July 13, 2026 01:29
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