Skip to content

Use VERSION from PrusaLinkConfigFlow in prusalink#170200

Merged
abmantis merged 2 commits into
home-assistant:devfrom
heikkih:chore/prusalink-cleanup
May 10, 2026
Merged

Use VERSION from PrusaLinkConfigFlow in prusalink#170200
abmantis merged 2 commits into
home-assistant:devfrom
heikkih:chore/prusalink-cleanup

Conversation

@heikkih
Copy link
Copy Markdown
Contributor

@heikkih heikkih commented May 9, 2026

Proposed change

Fixes a latent bug in the migration version check.

__init__.py and test_init.py both did:

from homeassistant.components.prusalink.config_flow import ConfigFlow
...
config_entry.version > ConfigFlow.VERSION

…but ConfigFlow here is homeassistant.config_entries.ConfigFlow (HA's base class, re-exported via our config_flow module), not the integration's actual subclass PrusaLinkConfigFlow. So the comparison reads HA's default VERSION = 1, not ours.

This works today by coincidence because both happen to be 1. The check becomes silently wrong the moment PrusaLinkConfigFlow.VERSION is ever bumped: migration would refuse to load valid config entries created by the new code, and the test_migration_fails_on_future_version test would no longer be testing a "future" version.

While in there, the future-version guard now also covers minor_version — it compares (version, minor_version) as a tuple against the class constants, so a downgraded install can't accidentally accept entries created by a newer minor version. A regression test exercises the new branch.

Note

There's no plan to bump PrusaLinkConfigFlow.VERSION right now — this is just removing a latent footgun before it bites.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (non-breaking change which fixes an issue)
  • Code quality improvements to existing code or addition of tests

Checklist

  • The code change is tested and works locally
  • Local tests pass (9 passed in tests/components/prusalink/test_init.py)
  • Lint (ruff) and mypy pass
  • There is no commented out code in this PR

The migration check in `async_migrate_entry` and the future-version
test in `test_migration_fails_on_future_version` both compared
`config_entry.version` against `ConfigFlow.VERSION` — but `ConfigFlow`
imported via `from .config_flow import ConfigFlow` is HA's base class
(re-exported through our module), not our subclass
`PrusaLinkConfigFlow`. They read HA's default value (1), not ours.

This works today by coincidence because both are 1. The check would
quietly become wrong the moment `PrusaLinkConfigFlow.VERSION` is
bumped — at that point the migration would refuse to load valid
config entries written by the new code.

There is no plan to bump `PrusaLinkConfigFlow.VERSION` right now;
this is just removing the latent footgun before it bites.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a latent migration-version check bug in the prusalink integration by ensuring comparisons use the integration’s actual config flow class (PrusaLinkConfigFlow) rather than Home Assistant’s base ConfigFlow.

Changes:

  • Update the migration “future version” guard in async_migrate_entry to reference PrusaLinkConfigFlow.VERSION.
  • Update the migration regression test to reference PrusaLinkConfigFlow.VERSION so it remains meaningful if the integration’s version is bumped later.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
homeassistant/components/prusalink/__init__.py Use the integration’s config flow VERSION for the migration downgrade guard.
tests/components/prusalink/test_init.py Align the “future version” migration test with the integration’s config flow VERSION.

Comment thread homeassistant/components/prusalink/__init__.py Outdated
Comment thread tests/components/prusalink/test_init.py
Compare (version, minor_version) tuples so a downgraded install can't
accidentally accept entries created by a newer minor version. Adds a
regression test for the current VERSION with a higher MINOR_VERSION.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Copy link
Copy Markdown
Member

@abmantis abmantis left a comment

Choose a reason for hiding this comment

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

Thanks!

@abmantis abmantis changed the title prusalink: read VERSION from PrusaLinkConfigFlow, not the HA base class Use VERSION from PrusaLinkConfigFlow in prusalink May 10, 2026
@abmantis abmantis merged commit 497faeb into home-assistant:dev May 10, 2026
36 of 37 checks passed
bogaczl added a commit to bogaczl/core that referenced this pull request May 11, 2026
Bump aiotankerkoenig to 0.5.3 (home-assistant#170224)

Fix entities refresh for UptimeRobot (home-assistant#170217)

Update easyEnergy exception and icon translations (home-assistant#170218)

Add more Gen1 sensors to indevolt (home-assistant#170191)

Bump letpot to 0.7.0 (home-assistant#169868)

Migrate Thermo Beacon to config entry runtime data (home-assistant#170226)

Migrate Sensirion BLE to config entry runtime data (home-assistant#170227)

Co-authored-by: Josef Zweck <josef@zweck.dev>

Bump imgw-pib to 2.1.2 (home-assistant#170274)

Bump serialx to 1.7.2 (home-assistant#170272)

Bump aioamazondevices to 13.5.0 (home-assistant#170258)

Update upb-lib to 0.7.0 (home-assistant#170051)

Bump qbittorrent-api to 2026.5.1 (home-assistant#170181)

Use VERSION from PrusaLinkConfigFlow in prusalink (home-assistant#170200)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Migrate Duco to python-duco-connectivity and remove temperature sensors (home-assistant#170237)

fix: Do not forget segments from state when a new config arrives (home-assistant#170265)

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Complete icon translations for Indevolt (home-assistant#170292)

Align Indevolt quality scale with documentation (home-assistant#170289)

Apply strict typing to Indevolt integration (home-assistant#170288)

iaqualink: set system specific polling interval (home-assistant#170279)

Use standby for HDMI-CEC turn off (home-assistant#170206)

prusalink: add continue-job button for ATTENTION state (home-assistant#170193)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

data grand lyon: implement diagnostics (home-assistant#170184)

Set serial port description from `description`, not `product` (home-assistant#170160)

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>

Update infrared-protocols to 4.0.0 (home-assistant#170297)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

data grand lyon: use test fixture instead of manual patching (home-assistant#170294)

Handle empty BSB-LAN heating circuits (home-assistant#170249)

Add diagnostics platform to Home Assistant Connect ZBT-2 (home-assistant#170158)

Fix deprecated_class to work with inheritance (home-assistant#170137)

Skip offline devices instead of aborting ViCare diagnostics (home-assistant#170106)

Fix local API incorrectly marking devices as unavailable in Overkiz (home-assistant#170118)

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

Add RepairsFlowResult TypeAlias (home-assistant#170263)

Fix flaky diagnostics test for Novy Cooker Hood (home-assistant#170299)

Fix spelling of RS-232 in Denon RS-232 integration (home-assistant#170298)

data grand lyon: implement reconfiguration flow (home-assistant#170210)

Add shared test mocks for the Infrared integration (home-assistant#170296)

Co-authored-by: Claude <noreply@anthropic.com>

Bump renault-api to 0.5.8 (home-assistant#170309)

Bump indevolt api to 1.7.2 (home-assistant#170310)

Update IQS to platinum for UptimeRobot (home-assistant#170260)

Add player specific sensor to nintendo_parental_controls (home-assistant#155786)

Co-authored-by: Joshua Peisach (ItzSwirlz) <itzswirlz2020@outlook.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Erik Montnemery <erik@montnemery.com>

Fix hassio.backup_partial AttributeError when folders are specified (home-assistant#170312)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Add backoff to forbidden packages (home-assistant#170242)

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Add tuya water timer data points (home-assistant#170314)

Add more entities for Tuya camera (home-assistant#169966)

Co-authored-by: mik-laj <12058428+mik-laj@users.noreply.github.com>
Co-authored-by: Norbert Rittel <norbert@rittel.de>

Add Tuya DLQ fixture (home-assistant#169585)

Update rf-protocols to 3.0.0 (home-assistant#170301)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Add Message Expire Interval option to MQTT publish service (home-assistant#169317)

Co-authored-by: Copilot <copilot@github.com>

Add new CentriConnect component (home-assistant#166933)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

Watts: add HVAC action + preset mode (home-assistant#169546)

Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Joostlek <joostlek@outlook.com>

Add quality scale for airnow integration (home-assistant#169709)

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Fix nobo_hub NoboProfileSelector class-level mutable defaults (home-assistant#170119)

Add cover support to control4 (home-assistant#169417)

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>

Add Mitsubishi brand (home-assistant#169924)

Co-authored-by: Nikolai Rahimi <nikolairahimi@users.noreply.github.com>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Fix coordinator data mutation in YouTube diagnostics (home-assistant#170300)

Co-authored-by: FIls0010 <a1867444@adelaide.edu.au>

Bump aiovodafone to 3.2.0 (home-assistant#170322)

Add countdown number for Tuya sfkzq single-valve timers (home-assistant#170318)

Allow setting hvac_mode in generic_thermostat.set_temperature (home-assistant#168062)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

Z-Wave.me: Allow updating entities (home-assistant#167839)

Fix MQTT device discovery not using shared QoS and encoding options (home-assistant#170195)

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Google assistant temperature setting active thermostat mode (home-assistant#166448)

Co-authored-by: Lucas Sanchez Sagrado <lucas.sansag@educa.jcyl.es>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

Add quality scale to Tesla Fleet integration (home-assistant#160475)

Co-authored-by: Claude <noreply@anthropic.com>

Only use SmartThings switch for light if it should (home-assistant#166424)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

Add quality scale file to Ness Alarm (home-assistant#163425)

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

Fix Shelly media player availability (home-assistant#170319)

Update discovery description wording (home-assistant#170325)

Bump teltasync to 0.3.0, fix discovery for older devices (home-assistant#169660)

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Complete exception translations for Indevolt (home-assistant#170291)

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Add Kiosker switch platform (home-assistant#168858)

Add `ZWaveNodeBaseEntity` for Z-Wave node-level entities (home-assistant#170124)

Add number platform to eurotronic_cometblue (home-assistant#168119)

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
bogaczl added a commit to bogaczl/core that referenced this pull request May 11, 2026
Bump aiotankerkoenig to 0.5.3 (home-assistant#170224)

Fix entities refresh for UptimeRobot (home-assistant#170217)

Update easyEnergy exception and icon translations (home-assistant#170218)

Add more Gen1 sensors to indevolt (home-assistant#170191)

Bump letpot to 0.7.0 (home-assistant#169868)

Migrate Thermo Beacon to config entry runtime data (home-assistant#170226)

Migrate Sensirion BLE to config entry runtime data (home-assistant#170227)

Co-authored-by: Josef Zweck <josef@zweck.dev>

Bump imgw-pib to 2.1.2 (home-assistant#170274)

Bump serialx to 1.7.2 (home-assistant#170272)

Bump aioamazondevices to 13.5.0 (home-assistant#170258)

Update upb-lib to 0.7.0 (home-assistant#170051)

Bump qbittorrent-api to 2026.5.1 (home-assistant#170181)

Use VERSION from PrusaLinkConfigFlow in prusalink (home-assistant#170200)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Migrate Duco to python-duco-connectivity and remove temperature sensors (home-assistant#170237)

fix: Do not forget segments from state when a new config arrives (home-assistant#170265)

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Complete icon translations for Indevolt (home-assistant#170292)

Align Indevolt quality scale with documentation (home-assistant#170289)

Apply strict typing to Indevolt integration (home-assistant#170288)

iaqualink: set system specific polling interval (home-assistant#170279)

Use standby for HDMI-CEC turn off (home-assistant#170206)

prusalink: add continue-job button for ATTENTION state (home-assistant#170193)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

data grand lyon: implement diagnostics (home-assistant#170184)

Set serial port description from `description`, not `product` (home-assistant#170160)

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>

Update infrared-protocols to 4.0.0 (home-assistant#170297)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

data grand lyon: use test fixture instead of manual patching (home-assistant#170294)

Handle empty BSB-LAN heating circuits (home-assistant#170249)

Add diagnostics platform to Home Assistant Connect ZBT-2 (home-assistant#170158)

Fix deprecated_class to work with inheritance (home-assistant#170137)

Skip offline devices instead of aborting ViCare diagnostics (home-assistant#170106)

Fix local API incorrectly marking devices as unavailable in Overkiz (home-assistant#170118)

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

Add RepairsFlowResult TypeAlias (home-assistant#170263)

Fix flaky diagnostics test for Novy Cooker Hood (home-assistant#170299)

Fix spelling of RS-232 in Denon RS-232 integration (home-assistant#170298)

data grand lyon: implement reconfiguration flow (home-assistant#170210)

Add shared test mocks for the Infrared integration (home-assistant#170296)

Co-authored-by: Claude <noreply@anthropic.com>

Bump renault-api to 0.5.8 (home-assistant#170309)

Bump indevolt api to 1.7.2 (home-assistant#170310)

Update IQS to platinum for UptimeRobot (home-assistant#170260)

Add player specific sensor to nintendo_parental_controls (home-assistant#155786)

Co-authored-by: Joshua Peisach (ItzSwirlz) <itzswirlz2020@outlook.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Erik Montnemery <erik@montnemery.com>

Fix hassio.backup_partial AttributeError when folders are specified (home-assistant#170312)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Add backoff to forbidden packages (home-assistant#170242)

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Add tuya water timer data points (home-assistant#170314)

Add more entities for Tuya camera (home-assistant#169966)

Co-authored-by: mik-laj <12058428+mik-laj@users.noreply.github.com>
Co-authored-by: Norbert Rittel <norbert@rittel.de>

Add Tuya DLQ fixture (home-assistant#169585)

Update rf-protocols to 3.0.0 (home-assistant#170301)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Add Message Expire Interval option to MQTT publish service (home-assistant#169317)

Co-authored-by: Copilot <copilot@github.com>

Add new CentriConnect component (home-assistant#166933)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

Watts: add HVAC action + preset mode (home-assistant#169546)

Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Joostlek <joostlek@outlook.com>

Add quality scale for airnow integration (home-assistant#169709)

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Fix nobo_hub NoboProfileSelector class-level mutable defaults (home-assistant#170119)

Add cover support to control4 (home-assistant#169417)

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>

Add Mitsubishi brand (home-assistant#169924)

Co-authored-by: Nikolai Rahimi <nikolairahimi@users.noreply.github.com>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Fix coordinator data mutation in YouTube diagnostics (home-assistant#170300)

Co-authored-by: FIls0010 <a1867444@adelaide.edu.au>

Bump aiovodafone to 3.2.0 (home-assistant#170322)

Add countdown number for Tuya sfkzq single-valve timers (home-assistant#170318)

Allow setting hvac_mode in generic_thermostat.set_temperature (home-assistant#168062)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

Z-Wave.me: Allow updating entities (home-assistant#167839)

Fix MQTT device discovery not using shared QoS and encoding options (home-assistant#170195)

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Google assistant temperature setting active thermostat mode (home-assistant#166448)

Co-authored-by: Lucas Sanchez Sagrado <lucas.sansag@educa.jcyl.es>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

Add quality scale to Tesla Fleet integration (home-assistant#160475)

Co-authored-by: Claude <noreply@anthropic.com>

Only use SmartThings switch for light if it should (home-assistant#166424)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

Add quality scale file to Ness Alarm (home-assistant#163425)

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

Fix Shelly media player availability (home-assistant#170319)

Update discovery description wording (home-assistant#170325)

Bump teltasync to 0.3.0, fix discovery for older devices (home-assistant#169660)

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Complete exception translations for Indevolt (home-assistant#170291)

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Add Kiosker switch platform (home-assistant#168858)

Add `ZWaveNodeBaseEntity` for Z-Wave node-level entities (home-assistant#170124)

Add number platform to eurotronic_cometblue (home-assistant#168119)

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions github-actions Bot locked and limited conversation to collaborators May 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants