Skip to content

feat(lora): honor a pinned-preset intent advertised for UNSET - #6711

Merged
jamesarich merged 2 commits into
claude/6704-placeholder-preset-gatefrom
claude/6704-unset-pinned-intent
Aug 15, 2026
Merged

feat(lora): honor a pinned-preset intent advertised for UNSET#6711
jamesarich merged 2 commits into
claude/6704-placeholder-preset-gatefrom
claude/6704-unset-pinned-intent

Conversation

@jamesarich

@jamesarich jamesarich commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Why

Second half of #6704 (stacked on the placeholder-gate PR).

The placeholder heuristic in the previous PR can't tell a vendor build that deliberately pins LONG_FAST from a stock install: both report region UNSET + LONG_FAST. meshtastic/firmware#11507 closes that gap by advertising an UNSET entry in LoRaRegionPresetMap when, and only when, the build pins a preset, stating the pin as the group's sole entry and default.

What changed

🌟 presetForRegionChange() now treats a non-null constraintFor(RegionCode.UNSET) as an explicit statement that the current preset is deliberate: fresh setup keeps it (legality-repaired only), even when it is LONG_FAST. Firmware that sends no UNSET entry (stock builds, and everything shipped today) falls through to the placeholder heuristic unchanged.

Notes for reviewers

  • The UNSET lookup is scoped to the fresh-setup decision only: the picker's constraint lookup now explicitly skips UNSET, so a pinned build's single-entry group never collapses the dropdown while the region is still unset — matching #11507's "intent, not enforcement", and confirmed as the intended reading by the map's author on Fresh-setup preset default overwrites a preset that is still legal in the chosen region #6704. Behavior-neutral on firmware without the entry (constraintFor(UNSET) was null there anyway).
  • Inert on today's firmware: no shipped release emits an UNSET entry, so behavior is identical to the previous PR until firmware#11507 lands.

Testing Performed

  • :core:model:allTests — new tests: a map with an UNSET entry keeps a pinned LONG_FAST at fresh setup; the same pin is still legality-repaired when illegal in the chosen region; maps without an UNSET entry keep the placeholder heuristic.
  • :feature:settings:allTests, spotlessCheck, detekt, kmpSmokeCompile — green.

Summary by CodeRabbit

  • Bug Fixes
    • Preserves deliberately selected radio presets during fresh setup, including LONG_FAST.
    • Repairs presets when they are not valid for the selected region.
    • Keeps preset selection unrestricted while the region remains unset.

@coderabbitai

coderabbitai Bot commented Aug 14, 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 68faf186-a264-4a68-bbc1-ca576f1b654b

📥 Commits

Reviewing files that changed from the base of the PR and between 809af8d and fe46acf.

📒 Files selected for processing (3)
  • core/model/src/commonMain/kotlin/org/meshtastic/core/model/RegionPresetConstraint.kt
  • core/model/src/commonTest/kotlin/org/meshtastic/core/model/LoRaRegionPresetsTest.kt
  • feature/settings/src/commonMain/kotlin/org/meshtastic/feature/settings/radio/component/LoRaConfigItemList.kt

📝 Walkthrough

Walkthrough

The change adds explicit handling for firmware-advertised UNSET preset constraints. Fresh setup preserves deliberate pins, invalid pins are repaired for concrete regions, and the settings picker remains unconstrained while the region is UNSET.

Changes

UNSET preset handling

Layer / File(s) Summary
Model preset preservation and validation
core/model/src/commonMain/kotlin/org/meshtastic/core/model/RegionPresetConstraint.kt, core/model/src/commonTest/kotlin/org/meshtastic/core/model/LoRaRegionPresetsTest.kt
The model preserves a LONG_FAST pin when an explicit UNSET constraint exists. Tests verify that illegal pins are still repaired for UA_433.
Settings picker constraints
feature/settings/src/commonMain/kotlin/org/meshtastic/feature/settings/radio/component/LoRaConfigItemList.kt
The picker skips constraint lookup for UNSET and continues using mapped constraints for concrete regions.

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

Merge Risk: ⚪ Minimal · up to fe46a

The PR narrowly changes fresh-setup preset selection for firmware that explicitly advertises a pinned preset while preserving existing behavior otherwise; no actionable merge-blocking risk remains after normal checks and review.

Possibly related issues

Possibly related PRs

Suggested labels: bugfix

🚥 Pre-merge checks | ✅ 6 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Regression Coverage For Changed Behavior ⚠️ Warning LoRaRegionPresetsTest covers the model helper, but no settings test covers LoRaConfigScreen's UNSET picker branch; a pinned UNSET map could still collapse the dropdown. Add a Compose or extracted-helper test with a 2.8-capable pinned map: at UNSET expose presets outside the UNSET group, then verify a concrete region applies its constraint.
Tests Prove The Path, Not The End State ❓ Inconclusive I need to inspect the full test history and the covered production path before deciding whether the added assertions can pass after a revert. Determine whether each changed test fails against the pre-PR implementation or only checks returned state without distinguishing the intended path.
✅ Passed checks (6 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: honoring pinned-preset intent advertised through an UNSET entry.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Sibling Call Sites And Presence Semantics ✅ Passed The diff only adds UNSET constraint presence handling; all production constraintFor uses are covered by the model helper and picker, with no changed physical-value field or new zero default.
Moved Code Diffed Against Its Original ✅ Passed The region-change block is extracted to presetForRegionChange with one migrated caller; no listed override, validation, default, nullability, annotation, or coroutine-policy change appears in the d...
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

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.

@github-actions github-actions Bot added the enhancement New feature or request label Aug 14, 2026
@jamesarich
jamesarich marked this pull request as ready for review August 15, 2026 01:54
jamesarich and others added 2 commits August 14, 2026 21:07
A build that pins a preset can advertise it as UNSET's entry in
LoRaRegionPresetMap (firmware #11507), stating the preset is deliberate.
Fresh setup then keeps it (legality-repaired only), covering even a
pinned LONG_FAST that the placeholder heuristic cannot distinguish.
Inert for maps without an UNSET entry, which is all shipped firmware.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
UNSET's map entry states pin intent, not a constraint; without this
gate a pinned build's single-preset group would collapse the dropdown
until a region is picked. Confirmed as the intended reading in #6704.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@jamesarich
jamesarich force-pushed the claude/6704-unset-pinned-intent branch from 6df3d1c to fe46acf Compare August 15, 2026 02:11
@jamesarich

Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@jamesarich
jamesarich added this pull request to the merge queue Aug 15, 2026
@jamesarich
jamesarich removed this pull request from the merge queue due to a manual request Aug 15, 2026
@jamesarich
jamesarich added this pull request to the merge queue Aug 15, 2026
@jamesarich
jamesarich removed this pull request from the merge queue due to a manual request Aug 15, 2026
@jamesarich
jamesarich added this pull request to the merge queue Aug 15, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue because a pull request earlier in the stack was removed Aug 15, 2026
@jamesarich
jamesarich added this pull request to the merge queue Aug 15, 2026
Merged via the queue into main with commit 06aee11 Aug 15, 2026
34 of 44 checks passed
@jamesarich
jamesarich deleted the claude/6704-unset-pinned-intent branch August 15, 2026 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant