Skip to content

feat(plugins): expose connected scale metadata - #844

Draft
MaxRink wants to merge 15 commits into
decentespresso:mainfrom
MaxRink:feature/plugin-scale-info
Draft

feat(plugins): expose connected scale metadata#844
MaxRink wants to merge 15 commits into
decentespresso:mainfrom
MaxRink:feature/plugin-scale-info

Conversation

@MaxRink

@MaxRink MaxRink commented Sep 13, 2026

Copy link
Copy Markdown

Summary

Expose session-scoped opaque firmware and nullable battery metadata for connected plugin scales, with the existing narrow /api/v1/scale/info projection as the public boundary.

  • Add the typed PluginProtocolDevice.connectionId identity used by later guarded actions.
  • Fence metadata publication to the owning connected session and clear it when that session retires.
  • Keep USB provenance, arbitrary extension metadata, and metadata out of device inventory.

Depends on the retained native scale-info boundary in #743.

Linked Issue

Related #852, #713, and #714. Depends on the retained scale-info boundary in #743; consumed by #846.

The new discussion issue is awaiting maintainer triage. This PR remains a draft while maintainers discuss the proposal; opening the issue does not satisfy the accepted-issue gate or imply approval of the proposed contract.

Verification

  • Metadata-focused tests and the refreshed selection regression passed.
  • Parent metadata Linux Flutter 3.44.2 suite: 4,182 successful, 1 skipped, 0 failed.
  • The implementation is based on the retained native scale-info correction and preserves its existing REST projection.
  • Real Skale hardware validation remains pending; opaque firmware and nullable battery behavior are covered by the plugin/fake-device paths.

Impact

Connected plugin scale clients can read firmware and battery values through the existing scale-info contract. Battery 0 and 100 remain valid, unavailable battery remains nullable, and stale sessions cannot update a replacement device. No new inventory field or settings store is introduced; the corresponding API and plugin documentation changes are part of this boundary.

Contributor Responsibility

AI-assisted development is allowed. The submitter remains responsible for the submitted work.

  • I have reviewed and understand all changes in this PR and take responsibility for their correctness, security, behavior, licensing, and provenance, including any AI-assisted or AI-generated work.

MaxRink and others added 15 commits September 13, 2026 13:35
Remove duplicate battery resets, guards, and subscription bookkeeping identified during the ponytail review. Nullable battery reporting and refresh behavior remain unchanged while the implementation has fewer competing state paths.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The top-right Settings page did not link to the existing Devices page, leaving firmware and scale controls hidden behind the launcher navigation. Add a direct Devices row so connected-device metadata and settings are reachable from the expected entry point.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Device Management is now reachable from the regular Settings page as well as the dashboard. Record both entry points so the user-facing navigation documentation matches the new discoverable route.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Expose generic connected-scale metadata through /api/v1/scale/info while keeping device inventory limited to discovery and connection state. Keep metadata refreshes out of the inventory WebSocket and align the API contract.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep scale metadata on the connected-scale endpoint and update affected implementations and tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use the router's parameterized GET form so the connected-scale metadata endpoint is reachable, and align inventory tests with the boundary.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep inventory payloads metadata-free and cover connected scale info responses.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Observed: the device-management text still claimed inventory REST and WebSocket entries carried nested deviceInfo metadata.

Change: Route connected-scale metadata documentation through GET /api/v1/scale/info and apply Dart formatter output.

Constraint: Keep the PR743 batteryLevel support and all implementation behavior unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep the aggregator inventory in its original (Device, StreamSubscription) shape now that each device has one connection-state listener. Apply the same cleanup across related PR copies so stale, replacement, and disposal paths cancel exactly one subscription.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Delete unused DeviceInformation declarations from the REST and WebSocket specifications while preserving the internal Dart metadata model, public ScaleInfo contract, and settings-only manual USB override behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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