UI/fix: Add direct routing-rule deletion and prevent duplicate-ID crashes - #6201
Open
eliotcougar wants to merge 2 commits into
Open
eliotcougar wants to merge 2 commits into
eliotcougar wants to merge 2 commits into
Conversation
Place Delete next to Edit and reuse the existing routing-rule confirmation dialog. Keep the pending rule ID across recreation and resolve that ID against stored rules when confirming, rather than retaining a list position. Perform removal on IO and update the visible list after it completes; log exceptions and show the existing failure message. Extract the list-deletion flow from the accessibility assembly without importing custom actions, semantic changes, new dialog wording, or edit/toggle/reordering refactors. Validation: 75 JVM tests passed, including five deletion regressions; Play Store debug Kotlin compilation and x86_64 assembly passed. Emulator checks covered touch, keyboard Enter, D-pad center, cancel, rotation, and persisted deletion by rule ID. Original emulator rules and APK were restored. TalkBack speech and concurrent-mutation stress tests were not run.
Prevent legacy missing, null, blank, and repeated rule IDs from reaching keyed routing rows. Reserve existing IDs before generating replacements, persist repaired identities before exposing them to the UI, and keep header keys separate from imported string IDs. Normalize every routing-list write without changing raw core-routing reads. Retain existing locked rules without appending their exact exported copies, comparing contents independently of repaired IDs. Preserve genuinely different rules and existing duplicate contents. Serialize migration and ID deletion with routing writes within the process, respect failed writes, and discard stale reload results after newer list changes. Keep the upstream index-based Add/Edit flow rather than restoring the reverted migration; guard obsolete lookup and removal positions. This covers the duplicate-key and Add regressions discussed in closed PRs 2dust#6171 and 2dust#6185 without taking their editor refactor. Validation: all 87 Play Store debug JVM tests, Kotlin compilation, and x86_64 assembly passed. Emulator checks covered legacy duplicate/missing IDs, two UI export/reimport cycles, three old-export imports, Add/Save, and deleting only the intended locked duplicate. Original emulator rules and APK were restored. Physical-device, TalkBack speech, QR/preset UI, and cross-process stress checks were not run.
eliotcougar
force-pushed
the
feat/routing-rule-list-delete
branch
from
September 10, 2026 07:41
0fd27a3 to
858fc9b
Compare
Owner
|
routing 数量也不多,就保持现有的逻辑吧,不要改了 |
Contributor
Author
It isn't necessary. I agree. It was done only to make all item lists follow the same logic. For uniformity. |
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
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
Add a Delete button beside Edit in routing-rule rows, with the existing localized confirmation dialog. Harden rule identities so this new list action and the already-keyed Compose list remain safe with legacy data and repeated imports containing locked rules.
This is a standalone, non-accessibility extraction based on current
master(2020807c255b76b09c9ced4255c95600250aef48). It does not restore the reverted ID-based editor migration.Background: the reverted change and closed PRs
The duplicate-ID problem is not limited to the reverted editor: the routing list still uses rule IDs as Compose/reorderable keys. A normal export/import round trip retains the current locked rules and imports their exported copies again. Repairing only empty IDs does not prevent duplicate nonempty keys, and merely assigning new IDs to every imported copy still allows locked-rule contents to multiply on successive imports. Duplicate names themselves are valid and must not be treated as duplicate identities.
This PR addresses those data/key prerequisites while leaving the current Add/Edit and toggle contracts in place.
Addition: delete directly from the list
Dispatchers.IO; remove the visible row only after storage completes successfully. A missing target does not delete another rule, and write failures are logged and reported using the existing failure message.Fixes and advantages
domain_strategycannot collide with non-rule content.The user-facing benefit is fewer navigation steps for deletion. The correctness benefit is that the new action has an unambiguous target and the list can safely display ordinary legacy/imported data. The implementation is independent of the accessibility PRs and can be reviewed without their semantics, custom actions, or localization changes.
Validation
:app:compilePlaystoreDebugKotlinand:app:assemblePlaystoreDebug -PABI_FILTERS=x86_64passed;git diff --checkpassed.domain_strategyID plus null/blank/missing IDs; confirmed five unique persisted identities and no list crash. Exported through the UI and reimported twice, then imported the pre-repair export three times through the normal settings import method. Counts and retained locked IDs remained stable.Not run: physical devices/other Android versions, TalkBack speech, full theme matrices, QR-scanner/preset-import UI, F-Droid builds, and concurrent/cross-process mutation stress. Clipboard, QR, and preset imports share the tested merge/write path; the in-process synchronization is not a cross-process transaction guarantee. No new Android instrumentation-test source folder is included.
No import/export fields are renamed or removed, no native dependencies change, and no accessibility-specific behavior is bundled.