Skip to content

Persist full-list writes to the remote feature cache - #261

Merged
uhl merged 1 commit into
enbility:devfrom
andig:fix/persist-full-write-upstream
Sep 30, 2026
Merged

uhl merged 1 commit into
enbility:devfrom
andig:fix/persist-full-write-upstream

Conversation

@andig

@andig andig commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #253

Problem

Remotes that announce a list function as writeable without partial support receive the complete list on every write. LoadControl.WriteLimitData and DeviceConfiguration.WriteKeyValues build that list by merging the new entries into the locally cached remote data (UpdateData(persist=false)), but the cache itself is only updated once the remote notifies the change, which happens after the result.

A second write built in between, e.g. OPEV obligation limits followed by OSCEV recommendation limits, therefore merges into the stale cache and reverts the entries of the first write. On the Porsche PMCC this leaves the obligation limits inactive after every write; a disable (0.1A obligation) ends with all limits inactive and the EV charging at maximum. See evcc-io/evcc#34004 and evcc-io/evcc#34066 for traces.

Fix

Feature.writeFullList sends the write and persists the merged list as the remote feature's state right away. If the remote rejects the write, the response callback restores the previous state. Partial writes are unchanged.

Test

Test_WriteLimitValues_Persist: after a full write the cache reflects the written limit while other entries are kept, and an error result restores the previous state. Fails on dev without the change.

🤖 Generated with Claude Code

Remotes without partial write support receive the complete list, merged from
the locally cached remote data. The remote replaces its list with what was
written but notifies the change only after the result, so a second write built
in between merged into the stale cache and reverted the first one: writing OPEV
and OSCEV limits back to back left the obligation inactive on the Porsche PMCC.

Persist the written list right away and restore the previous state if the
remote rejects the write.
@andig

andig commented Sep 27, 2026

Copy link
Copy Markdown
Contributor Author

/cc @uhl

@uhl uhl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me.

@uhl
uhl merged commit baa3a07 into enbility:dev Sep 30, 2026
4 checks passed
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.

2 participants