Skip to content

Repo refresh: cleanup, refactor and bug fixes - #113

Merged
RapierXbox merged 18 commits into
mainfrom
refactor/repo-refresh
Sep 24, 2026
Merged

RapierXbox merged 18 commits into
mainfrom
refactor/repo-refresh

Conversation

@RapierXbox

Copy link
Copy Markdown
Owner

Repo-wide cleanup, refactor and bug-fix pass. Every source area was refactored, then reviewed by a second agent, then audited across the whole app. Split into one commit per area.

What changed

  • Cleanup: long methods split up, duplicate code merged, dead code and unused imports removed, 4 unused resources deleted.
  • Comments: rewritten everywhere in the project style (short, lowercase, no commas or apostrophes, only where needed).
  • Build fix: main did not compile because of a stray c in SettingsFragment.kt. Fixed in ffa8015.
  • Unchanged contracts: MQTT topics and payloads, HA discovery configs, HTTP endpoints and JSON, SharedPreferences keys and defaults, @JavascriptInterface names, JNI names and serial/BLE framing.

Notable bug fixes

  • Bluetooth proxy:
    • A plain CONNECT was read as an unknown request (proto3 zero default).
    • GATT connection slots leaked.
    • Scan start/stop could race.
    • One bad message could drop the whole session.
    • DisconnectResponse was never sent.
    • Late GATT callbacks could complete the wrong operation.
  • MQTT:
    • It reconnected after being disabled.
    • The offline status was never published.
    • Retained discovery configs were not cleared.
    • Night mode and settings saves dropped the connection even when broker settings were unchanged.
    • An exception in periodic publishing could stop it for good.
  • Hardware:
    • Dimmer stayed off after off → on.
    • Swipe toggled a relay that does not exist on relay-less models.
    • UART per-transfer timeouts and read-error handling were wrong.
    • The native input monitor had a use-after-free, missing O_CLOEXEC and a self-join on stop.
  • STES:
    • Normal commands collided with the bootloader during a firmware update.
    • Short responses were treated as success.
    • GET_ID failed when the ACK and ID bytes arrived in one read.
    • Progress was wrong on a final partial page.
  • Voice:
    • The interpreter could be used after being freed.
    • A queued listen loop could pick up a stale session.
    • Native frontend leaked memory.
    • VAD state was not reset after the model changed.
  • App:
    • GET /webview/refresh did nothing.
    • The replacement WebView lost gestures after a renderer crash.
    • Dialogs leaked when the activity closed.
    • The HTTP server reference could become null.
    • A double dashboard load happened after offline recovery.
  • CI and devcontainer: installed SDK 35 while the app builds against 36.

Testing

  • ./gradlew clean assembleDebug testDebugUnitTest passes.
  • Added StreamingModelTest.
  • Still needs on-device testing:
    • BLE proxy with an active connection.
    • STES dimmer and firmware update.
    • Buttons, proximity sensor and switch inputs through the native monitor.
    • Screensaver timing and brightness fade.
    • Wake word.

🤖 Generated with Claude Code

RapierXbox and others added 18 commits September 24, 2026 19:42
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…and session races

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cleanup

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t bugs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
port the deterministic settings tap sequence onto the refactored MainActivity

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- mqtt: read the port tolerantly so a string port from the http api cannot crash startup
- ble: keep no response writes in flight until onCharacteristicWrite so the next op is not rejected as busy
- stes: collect the whole bootloader get id reply in one transfer so bytes cannot fall into a listener gap

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@RapierXbox
RapierXbox merged commit cbec75c into main Sep 24, 2026
1 check passed
@RapierXbox
RapierXbox deleted the refactor/repo-refresh branch October 4, 2026 20:50
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