feat(drivers): move devices off a driver the release replaces - #1433
Conversation
srcfl/device-drivers#135 folded the catalog entry esphome-dsmr into esphome_dsmr, which declares replaces = { "esphome-dsmr" } in its DRIVER table. At start, a configured driver that runs the owner's selection of a replaced driver now names the release's file, the old selection ends, and the settings are saved. An operator's own file of the old name is left alone. The pin moves to device-drivers 92adaf0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MuerPFZFG88kgu8sWVHeq7
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1c376a7646
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| names = append(names, cfg.Drivers[i].Name) | ||
| } | ||
| } | ||
| if err := m.Deactivate(installed.LogicalPath); err != nil { |
There was a problem hiding this comment.
Honor pinned versions before retiring a replaced driver
When an operator deliberately rolled this old driver back to an earlier managed version, Chosen(installed.LogicalPath, installed.Version) records that choice, but this unconditional Deactivate clears it and moves the device to the release version anyway. That can reintroduce the exact hardware problem the rollback avoided; skip or explicitly preserve/translate chosen selections until the owner changes them.
AGENTS.md reference: AGENTS.md:L175-L179
Useful? React with 👍 / 👎.
| if err := config.SaveStored(st, *configPath, cfg); err != nil { | ||
| slog.Warn("could not save devices moved to a replacing driver", "err", err) |
There was a problem hiding this comment.
Preserve migration state when settings persistence fails
If SaveStored fails after MigrateReplaced successfully deactivated the old selection, startup continues using the in-memory replacement while durable settings still name the old path. On the next restart there is no active old install to trigger this migration again, so the configured driver resolves to a missing retired file and may leave the site meter offline; make the save failure fatal or restore the old activation/configuration before continuing.
AGENTS.md reference: AGENTS.md:L20-L25
Useful? React with 👍 / 👎.
…1434) When a release's newer copy overtakes a kept driver selection, the selection stays but does not run. Three places still assumed it ran: - A failed trial restarted the kept selection's file in the effective directory, which no longer exists, so the device stayed stopped. The restart now falls back to the release's copy when no managed file runs at the path. - A failed switch recovered with ActivateInstalled, which pinned the kept older version and ran it over the release's copy. It now uses Rollback, which restores the selection and the choice together. - The Versions list marked the kept selection as selected and hid its "Use this". /versions now names it as superseded_version, and the list offers it like any version on disk. Found by the Codex review of #1422..#1433. Claude-Session: https://claude.ai/code/session_01MuerPFZFG88kgu8sWVHeq7 Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Last piece of the one-id work (#1423).
srcfl/device-drivers#135 folded the catalog entry
esphome-dsmrintoesphome_dsmr, which now declaresreplaces = { "esphome-dsmr" }in itsDRIVERtable. The two were one driver under two ids. Sites installed the old entry from the channel: its artifacts have 38 beta and 11 stable downloads. Those sites keep running it from the signed history but get no updates.Change
replacesfrom aDRIVERtable.MigrateReplacedlooks for configured drivers that run the owner's selection of a replaced driver. Each one is moved to the release's replacing file, the old selection ends, and the settings are saved. This is the same save path the other start-time migrations use.92adaf0: esphome_dsmr 1.0.6, and the README release flow.Evidence
TestDeviceOnARetiredDriverMovesToTheReleasesReplacementcovers both cases: a device on the retired driver moves, and an operator's own file of the old name stays.go testpasses for driverrepo, drivers, config, cmd/ftw and api. The api package failed once when several packages ran in parallel and passed on two reruns, which looks like a timing flake.ftw-driver-repository publish -unsignedaccepts the bundled set: 40 drivers.🤖 Generated with Claude Code
https://claude.ai/code/session_01MuerPFZFG88kgu8sWVHeq7