Skip to content

feat(drivers): move devices off a driver the release replaces - #1433

Merged
frahlg merged 1 commit into
masterfrom
feat/driver-replaces
Sep 25, 2026
Merged

frahlg merged 1 commit into
masterfrom
feat/driver-replaces

Conversation

@frahlg

@frahlg frahlg commented Sep 25, 2026

Copy link
Copy Markdown
Member

Last piece of the one-id work (#1423).

srcfl/device-drivers#135 folded the catalog entry esphome-dsmr into esphome_dsmr, which now declares replaces = { "esphome-dsmr" } in its DRIVER table. 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

  • The driver catalog reads replaces from a DRIVER table.
  • At start, MigrateReplaced looks 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.
  • An operator's own file of the old name in the user-drivers directory is left alone.
  • The pin moves to device-drivers 92adaf0: esphome_dsmr 1.0.6, and the README release flow.

Evidence

  • TestDeviceOnARetiredDriverMovesToTheReleasesReplacement covers both cases: a device on the retired driver moves, and an operator's own file of the old name stays.
  • go test passes 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 -unsigned accepts the bundled set: 40 drivers.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MuerPFZFG88kgu8sWVHeq7

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
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-25T08:56:42.521342Z 1c376a7 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@frahlg
frahlg merged commit 2184858 into master Sep 25, 2026
15 checks passed

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 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 {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

Comment thread go/cmd/ftw/main.go
Comment on lines +556 to +557
if err := config.SaveStored(st, *configPath, cfg); err != nil {
slog.Warn("could not save devices moved to a replacing driver", "err", err)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@frahlg
frahlg deleted the feat/driver-replaces branch September 25, 2026 08:57
frahlg added a commit that referenced this pull request Sep 25, 2026
…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>
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