Skip to content

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

Open
bruschill wants to merge 4 commits 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 4 commits 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.

Summary by CodeRabbit

  • New Features

    • Added support for the legacy Repeater device role as deprecated-only behavior.
    • Repeater now appears as “Repeater (Deprecated)” and includes guidance to migrate to Router or Router Late.
    • The device role picker hides deprecated roles from new selection and shows a warning when a deprecated role is currently active.
  • Documentation

    • Updated device settings docs (HTML and markdown) with Repeater deprecation and migration instructions.
  • Tests

    • Expanded enum comprehensive checks to cover the new deprecated role behavior.

…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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 613ff796-57b7-48fd-8224-e8432bd14a5e

📥 Commits

Reviewing files that changed from the base of the PR and between 3306a86 and 9692b5a.

📒 Files selected for processing (1)
  • Meshtastic/Resources/docs/index.json

📝 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 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
Title check ✅ Passed The title clearly summarizes the main change: surfacing and migrating the deprecated Repeater role.
Description check ✅ Passed The description covers what changed, why, testing, screenshots, and the checklist items from the template.
Linked Issues check ✅ Passed The changes satisfy #2025 by surfacing existing repeater nodes, hiding Repeater from new selection, and guiding migration to router roles.
Out of Scope Changes check ✅ Passed The docs and test updates are directly tied to the deprecated Repeater role change, with no clear unrelated scope creep.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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.

…ater-role-2025

# Conflicts:
#	Meshtastic/Resources/docs/index.json

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
Meshtastic/Resources/docs/index.json (1)

398-429: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Index the repeater migration terms.

The settings entry does not contain repeater, deprecated, router, or role. Since DocBundle.retrievePages scores pages only by keyword matches, queries about the newly documented migration can give this page a score of zero. Regenerate the index from docs/user/settings.md, retaining these terms within the 30-keyword limit.

As per coding guidelines, bundled documentation under Meshtastic/Resources/docs/** must stay in sync with the source markdown under docs/.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Meshtastic/Resources/docs/index.json` around lines 398 - 429, Regenerate the
`settings` entry in the bundled docs index from `docs/user/settings.md` so its
30-keyword list includes `repeater`, `deprecated`, `router`, and `role`.
Preserve the existing index format and ensure the generated bundle remains
synchronized with the source documentation.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@Meshtastic/Resources/docs/index.json`:
- Around line 398-429: Regenerate the `settings` entry in the bundled docs index
from `docs/user/settings.md` so its 30-keyword list includes `repeater`,
`deprecated`, `router`, and `role`. Preserve the existing index format and
ensure the generated bundle remains synchronized with the source documentation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 381216ba-0d5a-4694-87f7-78b605d52180

📥 Commits

Reviewing files that changed from the base of the PR and between 4c88c5b and 079a773.

📒 Files selected for processing (5)
  • Meshtastic/Resources/docs/index.json
  • Meshtastic/Resources/docs/markdown/user/settings.md
  • Meshtastic/Resources/docs/user/settings.html
  • MeshtasticTests/LoraDeviceEnumTests.swift
  • docs/user/settings.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • Meshtastic/Resources/docs/user/settings.html
  • docs/user/settings.md
  • Meshtastic/Resources/docs/markdown/user/settings.md

…ater-role-2025

# Conflicts:
#	Meshtastic/Resources/docs/index.json

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Meshtastic/Resources/docs/index.json`:
- Around line 401-429: Update the Settings entry’s indexed term list to include
repeater, deprecated, and router, while keeping it within the 30-term cap by
removing low-signal terms such as from, only, or later. Preserve the existing
charCount and all other relevant migration terms.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9cce725b-49fb-4786-963b-8e6439f6a79e

📥 Commits

Reviewing files that changed from the base of the PR and between 079a773 and 3306a86.

📒 Files selected for processing (5)
  • Meshtastic/Resources/docs/index.json
  • Meshtastic/Resources/docs/markdown/user/settings.md
  • Meshtastic/Resources/docs/user/settings.html
  • MeshtasticTests/LoraDeviceEnumTests.swift
  • docs/user/settings.md
🚧 Files skipped from review as they are similar to previous changes (4)
  • Meshtastic/Resources/docs/user/settings.html
  • docs/user/settings.md
  • Meshtastic/Resources/docs/markdown/user/settings.md
  • MeshtasticTests/LoraDeviceEnumTests.swift

Comment on lines +401 to +429
"device",
"from",
"firmware",
"device",
"settings",
"tag",
"region",
"position",
"mesh",
"language",
"nodes",
"nfc",
"traffic",
"translation",
"set",
"rate",
"only",
"contact",
"connected",
"configure",
"channel",
"translated",
"set",
"only",
"management",
"later",
"ios",
"hardware",
"enable",
"documentation",
"display",
"default",
"connected",
"unknown",
"setting",
"preset",
"pages",
"packets"
"documentation"
],
"charCount": 9637
"charCount": 11204

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Index the Repeater migration terms.

The updated Settings entry omits repeater, deprecated, and router, despite documenting that migration. Since this index drives in-app doc retrieval and is capped at 30 terms, replace low-signal terms such as from, only, or later so searches for the deprecated role find the migration guidance.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Meshtastic/Resources/docs/index.json` around lines 401 - 429, Update the
Settings entry’s indexed term list to include repeater, deprecated, and router,
while keeping it within the 30-term cap by removing low-signal terms such as
from, only, or later. Preserve the existing charCount and all other relevant
migration terms.

Source: Coding guidelines

…ater-role-2025

# Conflicts:
#	Meshtastic/Resources/docs/index.json
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