Skip to content

Persist the expert_mode preference the frontend already writes#1480

Closed
bdraco wants to merge 1 commit into
mainfrom
persist-expert-mode-preference
Closed

Persist the expert_mode preference the frontend already writes#1480
bdraco wants to merge 1 commit into
mainfrom
persist-expert-mode-preference

Conversation

@bdraco

@bdraco bdraco commented Jun 15, 2026

Copy link
Copy Markdown
Member

What does this implement/fix?

The frontend's Expert Mode toggle writes expert_mode via config/set_preferences, but the backend UserPreferences model never had the field, so mashumaro dropped it on write and get_preferences never returned it; the toggle reset to off on every reload. Adds expert_mode: bool to the model so the existing get/set path persists it. Backend only; the frontend already reads and writes the field.

Related issue or feature (if applicable):

  • N/A

Types of changes

  • Bugfix (non-breaking change which fixes an issue) — bugfix
  • New feature (non-breaking change which adds functionality) — new-feature
  • Enhancement to an existing feature — enhancement
  • Breaking change (fix or feature that would cause existing functionality to not work as expected) — breaking-change
  • Refactor (no behaviour change) — refactor
  • Documentation only — docs
  • Maintenance / chore — maintenance
  • CI / workflow change — ci
  • Dependencies bump — dependencies

Frontend coordination

  • No frontend change needed
  • Companion frontend PR: esphome/device-builder-frontend#

Checklist

  • The code change is tested and works locally.
  • Pre-commit hooks pass (ruff, codespell, yaml/json/python checks).
  • Tests have been added or updated under tests/ where applicable.
  • components.index.json / definitions/components/*.json have not been hand-edited (regenerate via script/sync_components.py if a sync is needed).
  • Architecture-level changes are reflected in docs/ARCHITECTURE.md and/or docs/API.md.

@github-actions github-actions Bot added the bugfix Bug fix label Jun 15, 2026
@bdraco bdraco force-pushed the persist-expert-mode-preference branch from 14ee8ad to 7f85dd9 Compare June 15, 2026 14:50
@codspeed-hq

codspeed-hq Bot commented Jun 15, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 27 untouched benchmarks


Comparing persist-expert-mode-preference (7f85dd9) with main (d6054e3)

Open in CodSpeed

@codecov

codecov Bot commented Jun 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.50%. Comparing base (d6054e3) to head (7f85dd9).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1480   +/-   ##
=======================================
  Coverage   99.50%   99.50%           
=======================================
  Files         222      222           
  Lines       17253    17254    +1     
=======================================
+ Hits        17168    17169    +1     
  Misses         85       85           
Flag Coverage Δ
py3.12 99.47% <100.00%> (+<0.01%) ⬆️
py3.14 99.50% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
esphome_device_builder/models/preferences.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bdraco bdraco closed this Jun 15, 2026
@bdraco

bdraco commented Jun 15, 2026

Copy link
Copy Markdown
Member Author

folded into #1445

final wire shape to be BEGINNER = “beginner” or EXPERT = “expert” and drop UI = “ui”, / YAML = “yaml”

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant