Skip to content

fix: correct LocalCommsStatus field semantics and add missing proto fields#18

Merged
eman merged 3 commits into
mainfrom
bugfix/protobuf-localcomms-audit
Jul 4, 2026
Merged

fix: correct LocalCommsStatus field semantics and add missing proto fields#18
eman merged 3 commits into
mainfrom
bugfix/protobuf-localcomms-audit

Conversation

@eman

@eman eman commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Summary

Cross-checked the library against the Android app (com.quilt.android 1.0.29, versionCode 242) by decompiling with jadx and decoding the compiled protobuf newMessageInfo metadata for exact field numbers. All enum values and control-write field numbers were verified correct; this PR fixes the semantic errors and missing fields that verification surfaced.

Fixes

LocalCommsStatus fields were mislabeled (guessed from limited captures). The compiled message (class l62) proves:

Field Was Is
2 health status
3 link_state (int32) visible_devices_count (int32)
4 version (int32) expected_devices_count (int32)
5 health_changed_ts last_session_change_ts
6 connection_state (int32) reason (LocalCommsHealthReason enum)

The "HEALTHY=9/DEGRADED=8" and "always 9" observations were device counts; the "connection_state" int was actually a diagnostic reason enum (HEALTHY=1, DEGRADED=5=PARTIAL_VISIBILITY). Decoding still worked by field number, but the model exposed wrong names/semantics and discarded the reason diagnostics.

Also:

  • Add LocalCommsHealthReason enum (12 APK-confirmed values). ZENOH_SESSION_DOWN identifies the local mesh transport as Eclipse Zenoh, not NATS (port 7447 is Zenoh's default).
  • Add IndoorUnitConditions.compressor_minimum_run_time (proto field 13, APK-confirmed 1.0.29).
  • Mark SpaceSettings.safety_heating=9 APK-confirmed (was "unconfirmed").
  • Regenerate proto stubs; update QSM/Controller models (local_comms_visible_devices, local_comms_expected_devices, local_comms_reason, local_comms_last_session_change), docstrings, and tests.

Validation

  • ruff check + format: clean
  • mypy: clean (43 files)
  • pytest: 234 passed

eman and others added 2 commits July 2, 2026 17:21
…oller

- WifiInfo (QSM) and Controller now surface bssid and frequency_mhz from
  the shared WifiState wire message (both fields already present on the
  wire for QSMs, not just Controllers) via parse_wifi_state(). Adds a
  WifiInfo.band property mirroring Controller.wifi_band.
- QuiltSmartModule and Controller now expose raw local_comms_link_state,
  local_comms_connection_state, and local_comms_version alongside the
  existing local_comms_health enum, for richer local-mesh diagnostics.

Found while investigating why an over-the-air 2.4 GHz packet capture
showed zero local-mesh traffic: every device with a healthy local-comms
link is actually associated on 5 GHz. Having bssid/frequency in the
model would have surfaced this without a packet capture.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ields

Verified the library against the Android app (com.quilt.android 1.0.29) by
decoding the compiled protobuf newMessageInfo metadata. LocalCommsStatus
fields 3/4/6 were mislabeled from limited capture guesses:

- f3 link_state       -> visible_devices_count (mesh peers visible)
- f4 version          -> expected_devices_count (mesh peers expected)
- f6 connection_state -> reason (LocalCommsHealthReason enum, APK-confirmed)
- f5 health_changed_ts -> last_session_change_ts
- f2 health           -> status (proto field name)

Also:
- Add LocalCommsHealthReason enum (12 diagnostic values; the local mesh is
  Eclipse Zenoh-based, not NATS).
- Add IndoorUnitConditions.compressor_minimum_run_time (proto field 13,
  APK-confirmed 1.0.29).
- Mark SpaceSettings.safety_heating=9 as APK-confirmed (was "unconfirmed").
- Regenerate proto stubs; update QSM/Controller models, docstrings, and tests.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Updates the client’s protobuf and model layer to match APK-confirmed field numbers/semantics for local communications health, and exposes the newly verified diagnostics and missing proto fields in the public Python models.

Changes:

  • Correct LocalCommsStatus subfield names/semantics and add the new LocalCommsHealthReason enum end-to-end (proto → generated stubs → models → tests).
  • Expose LocalComms mesh diagnostics on QuiltSmartModule and Controller (visible/expected device counts, diagnostic reason, last session change timestamp).
  • Add the missing IndoorUnitConditions.compressor_minimum_run_time field and update tests/stubs accordingly.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/test_models_from_proto.py Updates proto stubs and assertions for corrected LocalComms fields + new compressor condition field.
src/quilt_hp/models/qsm.py Adds local comms diagnostic fields and augments WiFi parsing to include BSSID/frequency.
src/quilt_hp/models/controller.py Adds local comms diagnostic fields and surfaces WiFi BSSID/frequency from WifiState.
src/quilt_hp/models/indoor_unit.py Adds compressor_minimum_run_time to conditions model and activation checks.
src/quilt_hp/models/_helpers.py Adds local_comms_last_session_change() and expands parse_wifi_state() return shape.
src/quilt_hp/models/enums.py Introduces LocalCommsHealthReason enum.
src/quilt_hp/models/init.py Exports LocalCommsHealthReason from the models package.
proto/cleaned/quilt_hds.proto Adds LocalCommsHealthReason; corrects LocalCommsStatus field definitions; confirms SafetyHeatingMode f9; adds compressor runtime condition.
src/quilt_hp/_proto/quilt_hds_pb2.pyi Regenerated typing stubs reflecting proto changes.
src/quilt_hp/_proto/quilt_hds_pb2.py Regenerated protobuf module reflecting proto changes.

…comms-audit

# Conflicts:
#	src/quilt_hp/models/_helpers.py
#	src/quilt_hp/models/controller.py
#	src/quilt_hp/models/qsm.py
@eman
eman merged commit f7720b5 into main Jul 4, 2026
5 checks passed
@eman
eman deleted the bugfix/protobuf-localcomms-audit branch July 4, 2026 15:18
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.

2 participants