Skip to content

fix(app): block pendant firmware updates on an unknown battery - #24434

Closed
Git-on-my-level wants to merge 6 commits into
mainfrom
fix/firmware-update-battery-gate
Closed

Git-on-my-level wants to merge 6 commits into
mainfrom
fix/firmware-update-battery-gate

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Requested by David

What changed and why

Pendant firmware updates require a current battery reading at or above the 30% threshold approved by David on 2026-11-03, or charging confirmed in the current connection session. Unknown and zero readings cannot bypass the gate. The gate controls update/retry actions, sheet confirmation, and the handoff after downloading.

Disconnect now clears the provider's cached battery to -1 and charging to false immediately, before the disconnect debounce. It also retires the battery/charging session and cancels its listeners; late reads and callbacks cannot restore the old state, even after the same pendant reconnects. A new device or account session also clears the reading. Reconnect waits for a fresh sample. Other battery readers already handle unknown readings or hide disconnected values.

The BLE callback and the provider test seam now share the same throttling implementation. Crossing the firmware threshold in either direction always notifies, including 29%→30% and 30%→29%; a known-to-unknown change also notifies. Unrelated small changes retain the existing throttle. The battery threshold and decision now live together in a small shared utility so the provider and page use one threshold.

Unknown battery shows separate localized wait/reconnect guidance without a percentage. All supported locales were reviewed against the adjacent battery warning: Romanian, Hungarian, and Estonian needed informal singular, and were corrected through python3 scripts/l10n.py set; the others match that warning or use neutral wording. The three changed locales have render evidence. The 30% minimum and adjacent guidance are translated across every locale; the checklist key is now firmwareBatteryRequirement so its name does not encode a percentage. All five comments in the supplied review file were verified and addressed.

Product invariants affected

none

Existing mobile UX primitives, theme tokens, and localization rules remain in use. No product-invariant definition changes. David approved raising the firmware update minimum from 15% to 30% on 2026-11-03; charging still permits any level.

Line-Count-Exception: app/lib/providers/device_provider.dart | 1663 -> 1680 | Keep battery and charging session invalidation with the existing device lifecycle; share production/test throttling and publish safety-threshold crossings. Net growth is 17 lines.

How it was verified

Flutter 3.44.5 from PATH and the requested clang-format directory. Tests and preflights run through /Users/dazheng/workspace/omi/bin/omi-heavy run --. All fixtures are hermetic; no real device, live backend, or GCP tier was used.

The firmware page tests use the real DeviceProvider battery publication logic. The 2026-11-03 threshold follow-up passed 77 focused battery/provider/render tests in 14 seconds, including explicit 15% and 29% rejection, 30% admission, zero while charging, 29%↔30% provider publication, and sheet confirmation at the old minimum. Focused Flutter analysis passed with no issues, and python3 scripts/l10n.py check passed key-set, placeholder and generated-freshness checks. All 49 locales use 30 in the three battery messages, preserving localized numerals; firmwareBatteryAbove15 was replaced by firmwareBatteryRequirement through the repository localization tool and generated output.

All four evidence images were regenerated and are byte-for-byte unchanged because the unknown-battery guidance has no percentage. The English, Romanian, Hungarian and Estonian renders were visually inspected for readable copy and clipping. Existing image filenames and links remain unchanged for repointing after push.

OMI_PR_BODY_FILE=/Volumes/Ephemeral/scratch/cv1-lab/appgate/pr.md make preflight passed all 27 checks in 56.38 seconds (exit 0), through omi-heavy. Preflight retained Failure-Class: none and required no product-invariant citation. Logs use the battery-30- prefix under /Volumes/Ephemeral/scratch/cv1-lab/appgate/. The final scripts/pr-preflight --pr-body-file validation also passed all 27 checks in 75.60 seconds (exit 0). Follow-up commit: 424535183d34d29cf42e31c9a4f004b50b6fed78 (fix(app): require 30% battery for pendant firmware updates), appended after b830acce8b37; no amend or push.

Tests

  • Gate cases: unknown, zero, 15% and 29% block; charging allows unknown/zero/low; 30% and above allow.
  • Provider cases: immediate invalidation on a matching disconnect, another device's disconnect ignored, fresh same-level sample after reconnect, one-point threshold crossings in both directions, known-to-unknown notification, and an old charging read rejected after disconnect/reconnect.
  • Real-page cases: disconnect blocks a stale enabled callback and sheet confirmation; reconnect stays blocked until a fresh reading; both update and failure/retry views refresh at 29%↔30%; rollback, charging exceptions, and pre-DFU recheck remain covered.
  • Focused tests and render capture: cd app && flutter test --no-pub --timeout 90s --dart-define=FIRMWARE_BATTERY_RENDER_OUTPUT="$PWD/../.agent-artifacts/ui-evidence/firmware-battery-gate" test/unit/firmware_update_battery_test.dart test/providers/device_provider_test.dart test/providers/device_provider_fully_charged_alert_test.dart test/providers/device_provider_disconnect_telemetry_test.dart test/providers/device_provider_session_generation_test.dart test/widgets/firmware_update_battery_render_test.dart.
  • Focused Flutter analysis and cd app && python3 scripts/l10n.py check.
  • Locale voice audit: /Volumes/Ephemeral/scratch/cv1-lab/appgate/translation-voice-review.json.

Failure class

Failure-Class: none

UI evidence

Captured with flutter-render-evidence: real page, product fonts, synthetic data, iOS dark theme, 393 × 852 logical pixels at 3×. Screenshots and sibling evidence.json are tracked in .agent-artifacts/ui-evidence/firmware-battery-gate/.

Unknown battery, English

Unknown battery, Romanian

Unknown battery, Hungarian

Unknown battery, Estonian

@Git-on-my-level Git-on-my-level self-assigned this Nov 2, 2026

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 106 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread app/lib/pages/home/firmware_update.dart Resolved
Comment thread app/lib/pages/home/firmware_update.dart Resolved
Comment thread app/lib/l10n/app_ro.arb Resolved
Comment thread app/lib/l10n/app_hu.arb Resolved
Comment thread app/lib/l10n/app_et.arb Resolved
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

@kodjima33 UI changes involving Git-on-my-level require your approval. Review the current diff, then comment /approve-ui 47f9f0a6350edb5ba419e01cba63584e99bc6ac8. Each new head needs a fresh approval. To withdraw it, comment /reject-ui <full head SHA>. Non-UI work and unrelated access are unaffected.

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

@kodjima33 UI changes involving Git-on-my-level require your approval. Review the current diff, then comment /approve-ui b830acce8b370155cdc0300690d2bffe3e177007. Each new head needs a fresh approval. To withdraw it, comment /reject-ui <full head SHA>. Non-UI work and unrelated access are unaffected.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

@kodjima33 UI changes involving Git-on-my-level require your approval. Review the current diff, then comment /approve-ui 424535183d34d29cf42e31c9a4f004b50b6fed78. Each new head needs a fresh approval. To withdraw it, comment /reject-ui <full head SHA>. Non-UI work and unrelated access are unaffected.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

@kodjima33 UI changes involving Git-on-my-level require your approval. Review the current diff, then comment /approve-ui f22d14668d7988bdcee27a9d9b86795941dd7b45. Each new head needs a fresh approval. To withdraw it, comment /reject-ui <full head SHA>. Non-UI work and unrelated access are unaffected.

Git-on-my-level added a commit that referenced this pull request Nov 3, 2026
)

<!-- claude-projects-attribution: {"github_login":"Git-on-my-level"} -->
_Requested by **David**_

## What changed and why

`plans_sheet_cancel_pending_test.dart` pinned the subscription period
end to 2026-11-03 00:00 UTC. That instant has now passed, so the sheet
no longer shows "Your Plus plan ends …" and `resubscribe uses the
current price and replaces the ends line` fails on every app PR that
runs the full Flutter suite (for example #24434). The test now uses
2099-11-03, so the period never ends during a run. Only the test
changes.

## Product invariants affected

None. Test-only change.

## How it was verified

Ran the file locally with `flutter test
app/test/widgets/plans_sheet_cancel_pending_test.dart`.

## Tests

The existing tests in that file, unchanged except for the date.

## Failure class

Failure-Class: none

## UI evidence

UI-Evidence: none -- test-only change

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/24472?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="View guided diff"
src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>
<a
href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/24472?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F24472&source=description"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img
alt="Turn on auto-fix"
src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

@kodjima33 UI changes involving Git-on-my-level require your approval. Review the current diff, then comment /approve-ui 51df326ea5291283e2009acde47eb56d64ec4908. Each new head needs a fresh approval. To withdraw it, comment /reject-ui <full head SHA>. Non-UI work and unrelated access are unaffected.

@kodjima33

Copy link
Copy Markdown
Collaborator

/approve-ui 51df326

@Git-on-my-level

Copy link
Copy Markdown
Member Author

David signed off this UI in Telegram on 2026-11-04. The CI check still needs kodjima33 to comment /approve-ui 51df326ea5291283e2009acde47eb56d64ec4908 on this head.

@Git-on-my-level

Copy link
Copy Markdown
Member Author

Refreshing the UI approval check. kodjima33 already approved this head.

@Git-on-my-level

Copy link
Copy Markdown
Member Author

Folded into the survivor #24485 (head d6ab3673d9e40b3612856348e40704f7663501d6, branch lane/action-reminders-1103) and closed in its favor — nothing merged to main from here.

What carried over: the whole firmware-battery lane — firmware_update_battery.dart plus the update dialog/mixin/device-provider gating, the four locale screenshot set in .agent-artifacts/ui-evidence/firmware-battery-gate/, the changelog entry, and the app_en + 48-locale string keys (union-merged with #20725's keys in the same files).

One adjustment: the PR's only omi/firmware/omi/src/safe_mode.c delta was the clang-format-23 dialect for the cast-designated-initializer block (CI's Formatting job checks clang-format 18). The survivor restores main's exact blob (046a191890…), verified byte-identical after the fold, so the firmware fix rides along without the formatting churn.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Hey @Git-on-my-level 👋

Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request.

After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our product principles and locked invariants

Before your next PR, please skim:

  • PRODUCT.md — product north star
  • Product invariants — locked rules (shared chat, memory tiers, agent control plane, integrations, brand)

If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing.

Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out.

Thank you for being part of the Omi community!

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