Skip to content

fix(mavlink): harden twin state management - #2165

Merged
mbuckton merged 1 commit into
developmentfrom
agent/mavlink-twin-management-hardening
Aug 10, 2026
Merged

fix(mavlink): harden twin state management#2165
mbuckton merged 1 commit into
developmentfrom
agent/mavlink-twin-management-hardening

Conversation

@mbuckton

@mbuckton mbuckton commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Scope

Consolidates the MAVLink twin/state fixes reviewed from:

  • agent/mavlink-runtime-hardening
  • feature/mavlink-transport-lifecycle-fixes
  • review/state-mavlink-bootstrap

This branch starts from current development and contains no endpoint/network transport changes.

Required fixes retained

  • decode Gson List<Number> values as MAVLink numeric arrays
  • decode JSON number lists used for MAVLink fixed-width character arrays
  • preserve DetectionEvent.contactId for DETECTED/UPDATED/LOST contact lifecycle
  • return the canonical twin registered by TwinManager
  • make updater/subscriber/observer close idempotent and ignore late updates
  • clean up protocol and observer resources after start, subscribe, unsubscribe, or close failures
  • defer readiness evaluation until listener-driven twin mutations finish
  • prevent recursive readiness observer updates
  • stamp valid battery packet freshness
  • reject invalid coordinates, GPS sentinel values, and unusable battery measurements
  • block stale power from command-ready state
  • reset bootstrap request trackers after missing state recovery

MAVLink JSON arrays

MAVLink contains both numeric arrays (for example BATTERY_STATUS.voltages and voltages_ext) and fixed-width character arrays (for example status text and names). Gson deserializes those JSON arrays as lists, so both numeric and character-list decoding are retained.

Tests

Adds focused coverage for:

  • packet numeric and character JSON lists, including malformed mixed lists
  • contact ID add/lost lifecycle
  • updater battery freshness, ordering, registration, close, and late messages
  • subscriber start/stop failure cleanup and idempotence
  • monitor lifecycle and recursion prevention
  • readiness validity/freshness combinations
  • bootstrap request retry/reset/timeout transitions
  • source registry matching

Deliberately excluded

  • formatting/import-only churn and review documentation
  • broad runtime swallowing in the subscriber message handler; programming faults still propagate after logging
  • all endpoint/network transport changes (separate PR)

Validation note

Focused Maven execution was attempted, but this environment cannot resolve repository.mapsmessaging.io or Maven Central. GitHub Actions is the authoritative test run for this draft.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 430772e8-1a41-45e6-9d94-7abc835b4fab

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

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.

@mbuckton
mbuckton marked this pull request as ready for review August 10, 2026 00:08
@mbuckton
mbuckton merged commit 51fa5a8 into development Aug 10, 2026
3 checks passed
@mbuckton
mbuckton deleted the agent/mavlink-twin-management-hardening branch August 10, 2026 00:08
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.

1 participant