Skip to content

fix(drivers): keep the owner's driver choice and meet both id spellings - #1426

Merged
frahlg merged 2 commits into
masterfrom
fix/driver-choices
Sep 25, 2026
Merged

frahlg merged 2 commits into
masterfrom
fix/driver-choices

Conversation

@frahlg

@frahlg frahlg commented Sep 25, 2026

Copy link
Copy Markdown
Member

Follow-up to #1422, part of #1423. The owner set the rule: an owner picks which signed driver version runs, and nothing changes without that choice. The release carries a tested baseline set, and Settings lets the owner fetch and run another signed version of one driver.

Changes

  • A chosen older version stays. A version installed although the release bundles a newer one at the same path stays across Core updates until the owner changes it. A newer version installed early still ends when a release catches up, as in fix(drivers): drivers follow the Core release #1422.
    • The choice is recorded after every activation (install, beta install, activate, rollback) under driver_repository/pinned/<logical path> in the config key-value store.
    • Going back to the release's copy forgets it.
  • Both id spellings count as one driver. The bundled sources spell ids their own way (easee-cloud for the channel's easee_cloud, sungrow-shx for sungrow). On the home box, "Use bundled" failed with no bundled file declares driver easee_cloud, and a first install only took effect after a Core restart.
    • bundledDriverFor and sameDriverFile accept the file at the path the signed manifest names when its id passes the publisher's identity rule (driverrepo.IdentifiesSameDriver, ported from device-drivers _identifies_same_driver).
    • An equal id still counts anywhere. A different id at that path does not, so the existing test for a mismatching id still passes.
    • The rule alone would be too loose (ctek-chargestorm-hybrid contains ctek), so it is always paired with the file path.
  • Release version beside an override. The driver catalog reports release_version for managed and local entries, and ftw status prints it: Override: easee 1.3.2 from the driver channel; the release has 1.3.3.
  • Beta channel off switch. ChannelCatalog and InstallChannel honour device_repository.enabled: false, as Refresh already did.
  • Update Center. beta_available compared versions with !==, so an older beta counted as a waiting update. It now compares SemVer.
  • drivers/BUNDLED_SOURCE.json. The note no longer claims every channel artifact is write-inert: control: true entries keep their control path.
  • Docs. AGENTS.md, device repository, self-update and ADR 0007 describe the kept choice.

Checked, not changed

A managed public artifact that is missing from the signed manifest fails closed. The device-drivers build carries every previous entry into history (tools/ftw_repository.py), so that needs a channel reset.

Evidence

  • New tests, each of which fails on the old code:
    • TestChosenOlderVersionStaysUntilTheOwnerChangesIt;
    • TestUsingTheBundledCopyForgetsTheChoice;
    • TestBetaChannelRespectsTheOffSwitch;
    • TestIdentifiesSameDriverFollowsThePublishersRule;
    • TestChannelAndBundledSpellingsOfOneDriverMeet. On the old API code it fails with restarted_drivers:[] runtime_verified:false.
    • The badge test runs isNewerVersion over release and prerelease cases.
  • make test: 69 packages ok.
  • npm test: 630 pass, 1 fail. The failure is in update-dialog.test.mjs: "8,192 records processed" under an en_SE locale. It fails the same way on master and passes with LC_ALL=C.UTF-8, so it is unrelated.
  • The only web change is the version comparison in update-badge.js. Nothing renders differently, apart from an older beta no longer being offered.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MuerPFZFG88kgu8sWVHeq7

Follow-up to #1422 after the owner set the rule: an owner picks which
signed driver version runs, and nothing changes without that choice.

- A version installed although the release bundles a newer one is a
  choice and stays across Core updates until the owner changes it. A
  newer version installed early still ends when a release catches up.
  The choice is kept per logical path in the config key-value store and
  forgotten when the owner goes back to the release's copy.
- The bundled sources spell ids their own way (easee-cloud for the
  channel's easee_cloud). "Use bundled" answered "no bundled file
  declares driver easee_cloud" on the home box, and a first install did
  not reach the running instance until Core restarted. Both now accept
  the file the signed manifest names when its id passes the publisher's
  identity rule (device-drivers _identifies_same_driver); an equal id
  still counts anywhere, and a different id at that path does not.
- The driver catalog reports release_version beside an override, and
  `ftw status` prints it.
- The built-in beta channel honours device_repository.enabled: false.
- Update Center counted any beta whose version differed as an update,
  an older one included; it now compares SemVer.
- The note in drivers/BUNDLED_SOURCE.json no longer claims every channel
  artifact is write-inert.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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-25T06:12:06.716708Z c8e8779 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.

@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: c8e8779829

ℹ️ 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".

Comment on lines +942 to +944
if err := m.store.SaveConfig(pinKey(installed.LogicalPath), pinned); err != nil {
slog.Warn("driver repository: record chosen version", "path", installed.LogicalPath, "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 Fail activation when pin persistence fails

If SQLite rejects this write—for example because the disk is full—the activation still returns success and the UI reports the older driver as selected, but no pin was stored. On a later Core release, RetireSupersededByBundled can therefore silently deactivate the owner's chosen version; propagate this failure or commit the activation and pin atomically rather than only logging it.

AGENTS.md reference: AGENTS.md:L22-L23

Useful? React with 👍 / 👎.

@frahlg
frahlg merged commit a04a4d7 into master Sep 25, 2026
16 checks passed
@frahlg
frahlg deleted the fix/driver-choices branch September 25, 2026 06:15
frahlg added a commit that referenced this pull request Sep 25, 2026
Independent review of #1422 and #1426:

- RetireSupersededByBundled deactivated the managed selection when a
  release bundled a version at least as new. A failed update trial that
  fell back, or `ftw rollback`, then ran the older release's older copy
  and lost the version the owner had installed early.
- A choice counted only when it was older than the bundled copy at that
  moment, so going back from an early 1.3.3 to 1.3.2 under a release
  with 1.3.0 was not kept, and the next release ran the rejected 1.3.3.

The selection is no longer changed at start. driver-repository/active
records what the owner selected; driver-repository/effective, which
paths now resolve through (config, catalog, API, driver inventory), is
derived from it and the release's drivers at every start and after
every change. A selection runs while it is at least as new as the
release's copy, or when the owner went back to it from a newer version
that was running. A rollback of an activation restores the choice it
replaced, so recovering from a failed install leaves no mark. The
release marker is gone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MuerPFZFG88kgu8sWVHeq7
frahlg added a commit that referenced this pull request Sep 25, 2026
Independent review of #1422 and #1426:

- RetireSupersededByBundled deactivated the managed selection when a
  release bundled a version at least as new. A failed update trial that
  fell back, or `ftw rollback`, then ran the older release's older copy
  and lost the version the owner had installed early.
- A choice counted only when it was older than the bundled copy at that
  moment, so going back from an early 1.3.3 to 1.3.2 under a release
  with 1.3.0 was not kept, and the next release ran the rejected 1.3.3.

The selection is no longer changed at start. driver-repository/active
records what the owner selected; driver-repository/effective, which
paths now resolve through (config, catalog, API, driver inventory), is
derived from it and the release's drivers at every start and after
every change. A selection runs while it is at least as new as the
release's copy, or when the owner went back to it from a newer version
that was running. A rollback of an activation restores the choice it
replaced, so recovering from a failed install leaves no mark. The
release marker is gone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MuerPFZFG88kgu8sWVHeq7
frahlg added a commit that referenced this pull request Sep 25, 2026
* fix(drivers): retry failed retirements and credit only the file that runs

Codex review of #1422 found two defects:

- RetireSupersededByBundled recorded the release as reconciled even
  when a Deactivate failed, so a retirement blocked once (for example by
  an unwritable active directory) was never tried again on that
  release. The release marker is now saved only when every retirement
  succeeded.
- The catalog's used_by matched configured drivers by file name. An
  operator's own file elsewhere with the same name was credited to the
  catalog entry, and `ftw status` reported a version that was not
  running. It now compares the configured resolved path with the
  entry's file in its source directory.

Both new tests fail on the previous code.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MuerPFZFG88kgu8sWVHeq7

* fix(drivers): never lose a driver selection to a Core update

Independent review of #1422 and #1426:

- RetireSupersededByBundled deactivated the managed selection when a
  release bundled a version at least as new. A failed update trial that
  fell back, or `ftw rollback`, then ran the older release's older copy
  and lost the version the owner had installed early.
- A choice counted only when it was older than the bundled copy at that
  moment, so going back from an early 1.3.3 to 1.3.2 under a release
  with 1.3.0 was not kept, and the next release ran the rejected 1.3.3.

The selection is no longer changed at start. driver-repository/active
records what the owner selected; driver-repository/effective, which
paths now resolve through (config, catalog, API, driver inventory), is
derived from it and the release's drivers at every start and after
every change. A selection runs while it is at least as new as the
release's copy, or when the owner went back to it from a newer version
that was running. A rollback of an activation restores the choice it
replaced, so recovering from a failed install leaves no mark. The
release marker is gone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MuerPFZFG88kgu8sWVHeq7

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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