Skip to content

fix(node): confirm before clearing a node's position track - #6745

Open
jamesarich wants to merge 2 commits into
mainfrom
fix/6741-confirm-clear-position-track
Open

fix(node): confirm before clearing a node's position track#6745
jamesarich wants to merge 2 commits into
mainfrom
fix/6741-confirm-clear-position-track

Conversation

@jamesarich

@jamesarich jamesarich commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator

Fixes #6741

The trash-can button on the Position Log screen deleted a node's entire recorded GPS track immediately, with no confirmation — and it sits directly next to the GPX export button, making accidental taps easy and irreversible.

This change gates the delete behind a confirmation dialog using the existing MeshtasticResourceDialog component: "Clear position track?" with an explicit warning that the deletion is permanent, plus Cancel/Delete actions. viewModel.clearPosition() only runs on explicit confirmation.

  • New ClearPositionTrackButton composable in PositionLogScreens.kt owning the dialog-visible state
  • Two new string resources (clear_position_track_title, clear_position_track_message); scripts/sort-strings.py run

Validated with the full baseline: spotlessApply spotlessCheck detekt assembleDebug test allTests — BUILD SUCCESSFUL.

Summary by CodeRabbit

  • New Features

    • Added a confirmation dialog before permanently deleting a node’s recorded GPS position track.
    • The dialog includes localized title, message, and confirmation text.
  • Bug Fixes

    • Prevented accidental deletion by replacing immediate track removal with an explicit confirmation step.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

No new commits to review since the last review.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: dac18016-b38c-4bd2-a5c9-e586d4758fab

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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: cf41f123-f18d-4542-b639-73bb1aefe0ab

📥 Commits

Reviewing files that changed from the base of the PR and between 07b5a8d and b9612b2.

📒 Files selected for processing (3)
  • .skills/compose-ui/strings-index.txt
  • core/resources/src/commonMain/composeResources/values/strings.xml
  • feature/node/src/commonMain/kotlin/org/meshtastic/feature/node/metrics/PositionLogScreens.kt

Included review availability: Your plan includes up to 4 reviews per rolling hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The position-log screen now shows a localized confirmation dialog before it clears a node’s recorded GPS position track. The deletion callback runs only after confirmation, and the dialog closes after confirmation or cancellation.

Changes

Position track confirmation

Layer / File(s) Summary
Confirmation resource contract
.skills/compose-ui/strings-index.txt, core/resources/.../values/strings.xml
Added indexed and localized strings for the position-track deletion title and message.
Deletion confirmation flow
feature/node/.../metrics/PositionLogScreens.kt
Replaced immediate deletion with a saveable dialog state. The screen clears the position track only after confirmation and dismisses the dialog after either action.

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

Merge Risk: ⚪ Minimal · up to b9612

The change adds an explicit confirmation before permanently clearing a node’s position track, with no actionable merge-blocking risk remaining after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant ClearPositionTrackButton
  participant ResourceDialog
  participant ViewModel
  User->>ClearPositionTrackButton: Tap clear
  ClearPositionTrackButton->>ResourceDialog: Show localized confirmation
  User->>ResourceDialog: Confirm deletion
  ResourceDialog->>ViewModel: Invoke clearPosition()
Loading

Suggested reviewers: jeremiah-k

🚥 Pre-merge checks | ✅ 7 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Regression Coverage For Changed Behavior ⚠️ Warning PositionLogScreen now gates clearPosition() behind ClearPositionTrackButton, but no test covers cancel/no-call, confirm/one-call, or rememberSaveable dialog restoration. Add a feature/node Compose UI test with non-empty positions: tap trash, assert the resource-backed dialog and no clear; test Cancel/back; test Delete invokes once; restore composition and assert the dialog stays open.
✅ Passed checks (7 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes add the requested confirmation dialog, Cancel and Delete actions, and defer track deletion until explicit confirmation [#6741].
Out of Scope Changes check ✅ Passed All changes support the confirmation dialog, including localized strings, indexing, dialog state, and confirmed deletion behavior.
Sibling Call Sites And Presence Semantics ✅ Passed The complete PR diff changes dialog state, resources, and the clearPosition call path; it does not change nullable, zero-guard, presence, or covered field default semantics.
Tests Prove The Path, Not The End State ✅ Passed The PR changes only resources and PositionLogScreens.kt; the diff contains no added or modified test files or test assertions, so this check is not applicable.
Moved Code Diffed Against Its Original ✅ Passed The PR extracts the trash action into a private composable; the sole caller and clearPosition() path remain intact, with no override, validation, default, nullability, annotation, or scope change.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the confirmation added before clearing a node's position track.

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 bugfix PR tag label Aug 16, 2026
…dialog

Use rememberSaveable instead of remember for the dialog visibility
state, matching the codebase's established pattern for destructive-
action confirmation dialogs (Logcat.kt, Debug.kt).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@jamesarich

Copy link
Copy Markdown
Collaborator Author

Follow-up commit b9612b2: the confirmation dialog's visibility state now uses rememberSaveable instead of remember, so an open dialog survives configuration changes (e.g. rotation). This matches the codebase's established pattern for equivalent destructive-action confirmation dialogs (Logcat.kt, Debug.kt).

@jamesarich
jamesarich marked this pull request as ready for review August 17, 2026 13:57
@jamesarich

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@jamesarich

Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Already reviewed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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.

[Feature Request]: Add a confirmation dialog to the "Clear Position Track" button

1 participant