feat(features/client): gate writes on remote Write() support#251
Open
andig wants to merge 1 commit into
Open
Conversation
Consistently apply the write-capability gate introduced for the HVAC/ Setpoint helpers in enbility#247: the client write helpers now return api.ErrNotSupported unless the remote server feature advertises operation.Write(). Affected helpers: - loadcontrol.WriteLimitData - deviceconfiguration.WriteKeyValues - timeseries.WriteData - smartenergymanagementps.WriteData Previously these fetched Operations()[fn] only to decide WritePartial() and never checked Write(), so a write to a read-only remote was sent and rejected remotely instead of failing fast locally. This is a minor breaking change: callers writing to remotes that do not advertise write support now get ErrNotSupported. Tests: add a read-only negative case per helper (new readOnly toggle in the client test helper); update usecase test setups (eg/lpc, eg/lpp, cem/cevc, cem/ohpcf, internal) to advertise Write() on remote features as real devices do. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Consistently applies the write-capability gate introduced for the HVAC/Setpoint helpers in #247 to the pre-existing client write helpers:
loadcontrol.WriteLimitDatadeviceconfiguration.WriteKeyValuestimeseries.WriteDatasmartenergymanagementps.WriteDataEach now returns
api.ErrNotSupportedunless the remote server feature advertisesoperation.Write().Why
Follow-up to the consistency discussion in #247 (comment). Previously these helpers fetched
Operations()[fn]only to decideWritePartial()and never gated onWrite(), so a write to a read-only remote was serialized and sent, then rejected remotely, instead of failing fast locally.Breaking
Minor breaking (as flagged in the PR-247 discussion): callers writing to a remote that does not advertise write support now receive
ErrNotSupportedinstead of the write being attempted.Tests
readOnlytoggle in the client test helper) assertingErrNotSupported.eg/lpc,eg/lpp,cem/cevc,cem/ohpcf,usecases/internal) now advertiseWrite()on remote features, matching real devices. Without this the gate caused those write tests to fail — and madeinternal.Test_WriteLoadControlLimitshang awaiting a response that no longer came.Full
./usecases/... ./features/... ./api/... ./service/...suite passes (26 packages, exit 0).🤖 Generated with Claude Code