Skip to content

feat: Improve channel migration logic and add tests#4294

Merged
jamesarich merged 2 commits into
mainfrom
fix/channels
Jan 25, 2026
Merged

feat: Improve channel migration logic and add tests#4294
jamesarich merged 2 commits into
mainfrom
fix/channels

Conversation

@jamesarich

Copy link
Copy Markdown
Collaborator

Improves the channel migration logic in PacketDao.migrateChannelsByPSK. The new implementation is more robust in handling channel reordering and ambiguity.

When multiple new channels share the same Pre-Shared Key (PSK), the migration now attempts to disambiguate by matching channel names. If ambiguity still exists, it prefers to map the channel to the same index if possible.

This change also adds MigrationTest.kt with unit tests for various migration scenarios, including:

  • Reordering of channels.
  • Disambiguation by name when PSKs are identical.
  • Prioritizing the original index when ambiguity remains.
  • Handling duplicate PSKs.

Additionally, testing dependencies such as Robolectric, AndroidX Test, and Room Testing have been added to support these new database tests.

resolves #4293

Improves the channel migration logic in `PacketDao.migrateChannelsByPSK`. The new implementation is more robust in handling channel reordering and ambiguity.

When multiple new channels share the same Pre-Shared Key (PSK), the migration now attempts to disambiguate by matching channel names. If ambiguity still exists, it prefers to map the channel to the same index if possible.

This change also adds `MigrationTest.kt` with unit tests for various migration scenarios, including:
- Reordering of channels.
- Disambiguation by name when PSKs are identical.
- Prioritizing the original index when ambiguity remains.
- Handling duplicate PSKs.

Additionally, testing dependencies such as Robolectric, AndroidX Test, and Room Testing have been added to support these new database tests.
@github-actions github-actions Bot added the bugfix PR tag label Jan 23, 2026
@codecov

codecov Bot commented Jan 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (833f1ca) to head (3602232).
⚠️ Report is 8 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #4294   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files          3       3           
  Lines         23      23           
  Branches       7       7           
=====================================
  Misses        23      23           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jamesarich jamesarich added this pull request to the merge queue Jan 25, 2026
Merged via the queue into main with commit d8c7a51 Jan 25, 2026
9 checks passed
@jamesarich jamesarich deleted the fix/channels branch January 25, 2026 03:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix PR tag

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: migrateChannelsByPSK misclassifies messages when there are multiple with the same key

1 participant