Skip to content

fix(canned-messages): stop showing/writing deprecated enabled field (#2021)#2112

Open
bruschill wants to merge 2 commits into
meshtastic:mainfrom
bruschill:fix/canned-messages-drop-deprecated-enabled-2021
Open

fix(canned-messages): stop showing/writing deprecated enabled field (#2021)#2112
bruschill wants to merge 2 commits into
meshtastic:mainfrom
bruschill:fix/canned-messages-drop-deprecated-enabled-2021

Conversation

@bruschill

@bruschill bruschill commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

What changed?

Removed the deprecated CannedMessageConfig.enabled field (enabled = 9) from the Canned Messages module config — it is deprecated upstream with no successor and removed from active use.

  • CannedMessagesConfig.swift: removed the "Enabled" toggle from the Options section, plus its @State, its .onChange, and the setCannedMessagesValues() read. Stopped writing cmc.enabled on save.
  • UpdateSwiftData.swift: stopped persisting config.enabled in both the insert and update branches of the canned-message upsert. Inbound values from older firmware are still tolerated on read (the proto struct still decodes field 9), just never surfaced or stored.
  • CoreDataMigrationService.swift: no longer migrates the legacy enabled value.
  • ConfigModels.swift: retained the CannedMessageConfigEntity.enabled stored property (annotated as deprecated) to avoid a SwiftData schema-version change — the project uses a VersionedSchema + MeshtasticMigrationPlan, so removing the column would require a new migration stage for zero user benefit. The column is now inert (never surfaced, written, or persisted).

Fixes #2021

Why did it change?

enabled = 9 is [deprecated = true] in module_config.proto with no successor. Current firmware no longer gates the canned-message module on this proto field — enablement is driven by whether canned messages are configured (or a cardkb/matrix input is present). The app should therefore no longer show, write, or persist it.

How is this tested?

  • Confirmed the firmware contract: current CannedMessageModule.cpp gates the module on splitConfiguredMessages() / cardkb / matrix input, not proto field 9 (the old compile-time toggle was removed upstream in firmware #9470). Dropping the write does not disable the module on supported firmware.
  • Repo-wide check: no remaining reader/writer/UI site for cannedMessageConfig.enabled after this change (verified absent from AppIntents, CarPlay, watch, export/import, and tests).
  • hasChanges/save-button behavior verified: still driven by the remaining sendBell/rotary1Enabled/updown1Enabled/input-broker .onChange handlers; no dangling enabled reference.
  • SourceKit-LSP: no diagnostics on any changed file.
  • Reviewed with the project's Swift reviewer — approved, no blocking issues (it independently verified the firmware contract and the SwiftData judgment call).

Screenshots/Videos (when applicable)

N/A — the only visible change is the removal of the deprecated "Enabled" toggle from the Canned Messages settings screen.

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/. No doc update is needed — docs/user/settings.md's canned-messages entry is a high-level one-liner that does not document the removed toggle (so nothing becomes inaccurate), and the Meshtastic/Model/ change is a comment only with no schema change. skip-docs-check label applies.
  • I have tested the change to ensure that it works as intended.

Note for reviewers

Sibling of #2022 (which removes the deprecated allow_input_source from the same screen). This PR is scoped to enabled only and intentionally leaves the allowInputSource save block untouched. On truly ancient firmware that honored proto field 9 at runtime, the app can no longer toggle the module on/off — this is the intended behavior of #2021 and such firmware is outside the supported window.

Summary by CodeRabbit

  • Changes
    • Removed the deprecated “Enabled” option from Canned Messages settings.
    • Canned Message configuration updates and migrations no longer save or restore this setting.
    • Existing configuration data remains compatible, while the deprecated option is no longer surfaced or persisted.

…eshtastic#2021)

CannedMessageConfig.enabled (enabled = 9) is deprecated upstream with no
successor and removed from active use. The Apple app still showed an
"Enabled" toggle, wrote it to the device on save, and persisted the
inbound value locally.

- Remove the "Enabled" toggle from the Canned Messages settings screen
  (plus its @State, onChange, and setCannedMessagesValues read).
- Stop writing cmc.enabled when saving CannedMessageConfig.
- Stop persisting config.enabled in UpdateSwiftData (both insert and update
  branches); inbound values from older firmware are still tolerated on read.
- Retain the CannedMessageConfigEntity.enabled property (annotated) to avoid
  a SwiftData schema-version change; it is no longer surfaced or written.
@bruschill bruschill added the skip-docs-check Use this label to skip the automatic docs audit label Jul 18, 2026
@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@bruschill, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 26 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 Plus

Run ID: 3c0c2fd5-da3b-4b2a-94cc-bf2ef3eaf82a

📥 Commits

Reviewing files that changed from the base of the PR and between e6ce496 and 18a83af.

📒 Files selected for processing (7)
  • Meshtastic/Model/ConfigModels.swift
  • Meshtastic/Persistence/CoreDataMigrationService.swift
  • Meshtastic/Persistence/UpdateSwiftData.swift
  • Meshtastic/Resources/docs/developer/swiftdata.html
  • Meshtastic/Resources/docs/index.json
  • Meshtastic/Resources/docs/markdown/developer/swiftdata.md
  • docs/developer/swiftdata.md
📝 Walkthrough

Walkthrough

The deprecated canned-message enabled field is removed from the settings UI and all write and migration paths. The SwiftData entity remains documented for schema compatibility, while reads continue to tolerate the field.

Changes

Canned message enabled retirement

Layer / File(s) Summary
Schema compatibility and migration behavior
Meshtastic/Model/ConfigModels.swift, Meshtastic/Persistence/CoreDataMigrationService.swift
The entity is documented as deprecated, and Core Data migration no longer copies enabled.
Settings UI removal
Meshtastic/Views/Settings/Config/Module/CannedMessagesConfig.swift
The enabled state, toggle, change tracking, initialization, and save assignment are removed.
SwiftData write-path updates
Meshtastic/Persistence/UpdateSwiftData.swift
Create and update upsert branches no longer persist config.enabled.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: garthvh

Poem

I’m a rabbit with a tidy tune,
No enabled toggle under the moon.
The schema stays, the writes now cease,
Old reads hop by in quiet peace.
Canned messages rest, neat and bright.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: removing the deprecated canned-messages enabled field from display and writes.
Description check ✅ Passed The description covers what changed, why, testing, screenshots, and checklist items in the required template.
Linked Issues check ✅ Passed The PR removes the UI toggle, stops writing/persisting enabled, and keeps backward-compatible read behavior as required by #2021.
Out of Scope Changes check ✅ Passed The changes stay focused on the deprecated enabled field and related persistence/UI cleanup, with no unrelated scope added.
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.

@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

Caution

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

⚠️ Outside diff range comments (1)
Meshtastic/Views/Settings/Config/Module/CannedMessagesConfig.swift (1)

43-47: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Update the user-facing settings documentation.

This removes a general settings control, so docs/user/settings.md should remove the Enabled option and describe the field’s retirement.

As per coding guidelines: Meshtastic/Views/Settings/**/*.swift requires updating docs/user/settings.md for general settings changes.

🤖 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/Views/Settings/Config/Module/CannedMessagesConfig.swift` around
lines 43 - 47, Update docs/user/settings.md to remove the documented Enabled
option for the Canned Messages settings and note that the field has been
retired, keeping the documentation aligned with the settings UI change in the
CannedMessagesConfig view.

Source: Coding guidelines

🧹 Nitpick comments (1)
Meshtastic/Views/Settings/Config/Module/CannedMessagesConfig.swift (1)

179-183: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Add a wire-level regression test for field omission.

AccessoryManager+ToRadio.swift sends the entire ModuleConfig.CannedMessageConfig object. This change relies on protobuf serialization omitting enabled when it is not assigned; verify the serialized payload does not contain deprecated field 9, preventing older firmware from receiving an unintended value.

🤖 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/Views/Settings/Config/Module/CannedMessagesConfig.swift` around
lines 179 - 183, Add a wire-level regression test covering the
CannedMessageConfig serialization path used by AccessoryManager+ToRadio.swift.
Construct the configuration without assigning the deprecated enabled property,
serialize the complete ModuleConfig.CannedMessageConfig payload, and assert that
protobuf field 9 is absent while the configured fields remain serialized.
🤖 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/Model/ConfigModels.swift`:
- Around line 50-52: Update the enabled property documentation in the model to
state that it is no longer read or actively written by app code while remaining
stored in the SwiftData schema, preserving existing values. Add the
corresponding compatibility and persistence behavior to
docs/developer/swiftdata.md or docs/developer/architecture.md.

---

Outside diff comments:
In `@Meshtastic/Views/Settings/Config/Module/CannedMessagesConfig.swift`:
- Around line 43-47: Update docs/user/settings.md to remove the documented
Enabled option for the Canned Messages settings and note that the field has been
retired, keeping the documentation aligned with the settings UI change in the
CannedMessagesConfig view.

---

Nitpick comments:
In `@Meshtastic/Views/Settings/Config/Module/CannedMessagesConfig.swift`:
- Around line 179-183: Add a wire-level regression test covering the
CannedMessageConfig serialization path used by AccessoryManager+ToRadio.swift.
Construct the configuration without assigning the deprecated enabled property,
serialize the complete ModuleConfig.CannedMessageConfig payload, and assert that
protobuf field 9 is absent while the configured fields remain serialized.
🪄 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: a42fc637-6557-49ab-838f-c27665401894

📥 Commits

Reviewing files that changed from the base of the PR and between e531f15 and e6ce496.

📒 Files selected for processing (4)
  • Meshtastic/Model/ConfigModels.swift
  • Meshtastic/Persistence/CoreDataMigrationService.swift
  • Meshtastic/Persistence/UpdateSwiftData.swift
  • Meshtastic/Views/Settings/Config/Module/CannedMessagesConfig.swift

Comment thread Meshtastic/Model/ConfigModels.swift Outdated
Address CodeRabbit review on meshtastic#2112:
- Correct the enabled doc comment: it remains a stored SwiftData property
  (schema and existing values preserved) but is no longer surfaced, read, or
  actively written.
- Align the deprecation comments in UpdateSwiftData/CoreDataMigrationService
  to say 'no longer written' rather than 'not persisted'.
- Document the retain-for-compatibility pattern in docs/developer/swiftdata.md
  and regenerate the bundled HTML docs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-docs-check Use this label to skip the automatic docs audit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate off deprecated CannedMessageConfig.enabled (removed field, stop showing/writing)

1 participant