Skip to content

fix(device-config): surface and migrate deprecated Repeater role (#2025)#2109

Open
bruschill wants to merge 1 commit into
meshtastic:mainfrom
bruschill:fix/deprecated-repeater-role-2025
Open

fix(device-config): surface and migrate deprecated Repeater role (#2025)#2109
bruschill wants to merge 1 commit into
meshtastic:mainfrom
bruschill:fix/deprecated-repeater-role-2025

Conversation

@bruschill

@bruschill bruschill commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

What changed?

Added handling for the deprecated REPEATER device role (Config.DeviceConfig.Role.repeater, rawValue 4), which previously had no DeviceRoles enum case — so DeviceRoles(rawValue: 4) returned nil everywhere.

  • DeviceEnums.swift: added a deprecated case repeater = 4 (name "Repeater (Deprecated)", migration-oriented description, wifi.router icon, protoEnumValue().repeater) and a computed var isDeprecated.
  • DeviceConfig.swift: the role picker now iterates availableDeviceRoles = allCases.filter { !$0.isDeprecated || $0.rawValue == deviceRole }, hiding deprecated roles from new selection while keeping the currently-set role visible so an existing repeater node can be seen and reconfigured. Added an orange warning label guiding the user to a Router-based role.
  • Updated docs/user/settings.md and regenerated the bundled docs.
  • Updated enum tests (allCases.count 11 → 12 in both suites) and added coverage for the .repeater case / isDeprecated.

Fixes #2025

Why did it change?

Existing nodes still reporting REPEATER could not be displayed (role showed as "Unknown") and could not be safely reconfigured — and opening their Device Config and saving would crash on the force-unwrap in the save path. This surfaces the role and provides a migration path to a Router-based role, mirroring Android (filtered from new selection, but visible for existing nodes).

How is this tested?

  • Updated/added unit tests in EnumComprehensiveTests.swift and LoraDeviceEnumTests.swift (case count, rawValue, isDeprecated, and that repeater is the only deprecated role).
  • SourceKit-LSP: no diagnostics on changed files. SwiftLint: clean.
  • Reviewed with the project's Swift reviewer — confirmed picker selection logic (currently-set role always present, migration is one-way, no blank/duplicate selection), the now-safe save-path unwrap, and read-side resolution across NodeDetail / NodeListItem / AppSettings / AccessoryManager.

Screenshots/Videos (when applicable)

N/A

Checklist

  • My code adheres to the project's coding and style guidelines.
  • I have conducted a self-review of my code.
  • I have commented my code, particularly in complex areas.
  • I have verified whether these changes require updates to the in-app documentation under docs/user/ or docs/developer/, and updated accordingly — added a deprecated-Repeater note to docs/user/settings.md and regenerated the bundled docs under Meshtastic/Resources/docs/.
  • I have tested the change to ensure that it works as intended.

…htastic#2025)

Existing nodes reporting the deprecated REPEATER role (rawValue 4) had no
DeviceRoles case, so DeviceRoles(rawValue: 4) returned nil — the role could
not be displayed and the node could not be safely reconfigured.

- Add a deprecated .repeater case so reads resolve everywhere (node detail,
  node list, settings) as "Repeater (Deprecated)".
- Add DeviceRoles.isDeprecated; hide deprecated roles from new selection in
  the Device Config picker, but keep the current role visible so an existing
  repeater node can be seen and switched to a supported role.
- Show a migration hint guiding users to a Router-based role.
- Update enum tests for the new case and deprecation flag.
@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds the deprecated .repeater device role, preserves display and conversion for legacy nodes, excludes it from new selections, shows migration guidance, and updates tests and settings documentation.

Changes

Repeater role migration

Layer / File(s) Summary
Repeater role contract and enum mapping
Meshtastic/Enums/DeviceEnums.swift, MeshtasticTests/*
Adds raw value 4, deprecation metadata, localized display values, protobuf conversion, and comprehensive enum assertions for .repeater.
Deprecated role settings behavior
Meshtastic/Views/Settings/Config/DeviceConfig.swift
Hides deprecated roles from new selections while retaining the current repeater role and showing an orange migration warning.
Repeater deprecation documentation
Meshtastic/Resources/docs/..., docs/user/settings.md
Documents the deprecated role, legacy display label, and migration to Router or Router Late roles; updates settings index metadata.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ExistingNode
  participant DeviceRoles
  participant DeviceConfig
  participant User
  ExistingNode->>DeviceRoles: Reports role raw value 4
  DeviceRoles->>DeviceConfig: Decodes as .repeater
  DeviceConfig->>DeviceRoles: Filters deprecated roles
  DeviceRoles-->>DeviceConfig: Keeps current repeater role visible
  DeviceConfig->>User: Shows deprecated warning and router migration guidance
Loading

Suggested reviewers: garthvh

Poem

A bunny found a repeater in the mesh,
With legacy ears and a warning afresh.
“Choose Router,” it whispered with cheer,
“Or Router Late—your path is clear!”
The picker now guides every hop.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy #2025 by surfacing deprecated REPEATER nodes, hiding them from new selection, and guiding users toward router roles.
Out of Scope Changes check ✅ Passed The docs and test updates support the Repeater migration work and do not appear unrelated to the stated objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly summarizes the main change: handling the deprecated Repeater role in device config.
Description check ✅ Passed The description follows the required template and covers the change, rationale, testing, screenshots, and checklist.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

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.

Handle deprecated DeviceConfig.Role.REPEATER (migration for existing repeater nodes)

1 participant