-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stateful attribute for properties #108
Conversation
Stateful attribute for properties Signed-off: David Graeff <[email protected]>
Is there a reason this property wasn't called Retained? Stateful has many meanings, one of which may be a retained behavior, yet it looks like you're using Stateful to mean retained. Retained is an MQTT verb, and I recommend keeping terminology consistent. In your example, the state of the doorbell indeed does change - even though that state may not be remembered (retained in the MQTT broker). Stateful doesn't seem to represent the true meaning of this new attribute. |
@lorenwest True point. This PR is based on the discussion in #70 though. I didn't want to bring yet another word into the game. I'm not with you regarding the doorbell example. A (doorbell) button (in contrast to a switch) can be seen as stateless. I'm talking about the event "PRESSED". I guess you are thinking about button "states" DOWN and UP. |
MQTT uses the word Retained for this, so if the motivation is to encourage non-MQTT usage of Homie, introducing a different term is beneficial. I've never considered the applicability of Homie outside of MQTT. |
Introduce the "retained" flag for properties to express "event"-like, stateless properties. Closes homieiot#70.
I have adapted the PR to use "retained". |
<tr> | ||
<td>$retained</td> | ||
<td>Device → Controller</td> | ||
<td>Specifies whether the property is retained (<code>true</code>) or non-retained (<code>false</code>). Publishing to a non-retained property topic MUST always happen with the MQTT 'retain' flag off.</td> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the last sentence be "Publishing to a non-retained property topic MUST always happen with the MQTT 'retain' flag 'false'."? IMHO, the 'off' word could be confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"with the MQTT 'retain' flag off" means without the retain
flag, not with the flag set to 'off', so I'd say it's fine.
Also, shouldn't we update the Homie version number? As far as I know, we are now in the 3.0.0 version, so perhaps the new version should be 3.1. |
There is a rather long discussion on how to increase version numbers. I thing the status quo is not to increase the version number for non breaking changes. |
LGTM! 👍 |
Hey @davidgraeff 👋 the PR looks good to me. From a logical point of view "stateful/stateless" seemed easier to grasp but retained is an established and clearly understood word in MQTT terminology - hence 👍 In the comparison of the four combinations you could stress the difference between "state" and "event" even more. Regarding version numbers: #46 every PR (commit to master) is supposed to increment the version number! It depends on the level of change which version number part has to be increased. We discussed this here #96 but did not yet reach a decision. The PR introduces a new attribute that changes the nature of the property slightly. |
@ThomDietrich The current document contains the 3.x.x version tag, which stays I guess. So the version number increase would not be done in this PR but instead by tagging the commit? |
Correct. At the point of changing it to "3.x.x" I thought that changing this line of the README every time a PR is proposed will create unneeded chaos. (Still do) |
Any remark @timpur? Is the PR ready to be merged? 👍 |
Guys, if a PR simple like this takes 2 weeks there is something seriously going wrong with the maintainership. |
I agree. After my feedback last week I expected @marvinroger or @timpur to do the next step. Not everyone is always online. Let's give them till Saturday. @davidgraeff if you'd be interested and @marvinroger agrees it might be an option to give you repository contributor permissions. |
A structured way on how this convention should be evolved would help. Like:
I propose the following:
|
My opinion on this:
|
@ThomDietrich This will over time fill the Issues/Pull-Requests with open Issues/PRs. As soon as there are so many that they not fit on one page, people will start to forget about them and no discussion will ever happen on those. If you are worried about people only looking at open Issues/PRs before posting another feature request -> Those exact people are the ones that will not scroll through all pages of open issues to find a match. Everybody should use the search function first for open/closed issues before raising another one. |
Hi guys, I created an issue for the maintainership problem: #109 |
LGTM for me 👍 As this is a property addition, it should be minor-bumped instead, don't you think? |
@marvinroger I would say this is a patch version update only. Because an optional attribute with a default equal to the status quo is added. |
It's not clear to me what the value in publishing the "retained" message is. Can you clarify? |
@jamesmyatt It is a "boolean" type, so it accepts "true" and "false" with a default implicit value of "true" |
@davidgraeff, sorry if the question wasn't clear. I meant why is it published? What value does that add? In what situation would a subscriber use that information? I think that the clarification that about combinations of settable/non-settable and retained/non-retained is very valuable, though. |
Everything in Homie is per default a retained topic. It is impossible to publish an event-like value (push button pressed). With the ability to set the retained flag to off (former name was "stateful" / "stateless"), you can publish events in accordance to the Homie specification. |
Hi @jamesmyatt! This comment from @ThomDietrich describes perfectly the four different combinations with settable/non-settables and retained/non-retained options: #70 (comment). As david has told you, the $retained flag allows controllers to know if the property is stateful or stateless 😉 |
Makes sense. Thanks! |
@davidgraeff - Small input: Any change to the API should be a minor version bump. Making this change as a patch would put it on the same level as fixing typos, and it's much more than that. As an implementer of the API, I'd like to say I'm API version Major.Minor compatible. I don't need to update the implementation for typos, but I would want to update it for minors. |
I agree with the clarifications. I also agree that it should be a minor version bump (i.e. v3.1) as it's a new feature. I just don't know when a subscriber would use the "retained" topic, i.e. what automated logic would react to it? I understand how values were previously retained by default, but MQTT things should be designed such that retained vs non-retained is invisible to the subscriber: if a subscriber needs a value that they didn't observe and never subscribed to to work correctly, then it should be retained, otherwise it can be retained or QoS 1+. You don't need a "retained" topic to allow values to be published non-retained. |
@lorenwest, @jamesmyatt: This is not an API change, a revision increment is sufficient. I'll explain: For a current controller implementation nothing changes: The implicit default of "retained" is true, as it was before. A controller that does claim to support "3.0.1" can additionally handle non-retained topics different if it wants too. For a current device implementation nothing changes as well. |
@davidgraeff - According to the semver spec:
You've made the argument that this API addition is backwards compatible, placing it in the MINOR position. If this were a bug-fix (typo for an API), it would be suited for the PATCH position. Sorry to be a stickler on this minor issue, but as the maintainer of a package that has thousands of dependents and millions of downloads a month, if I got this wrong in node-config I'd be slaughtered... |
@lorenwest I agree, that according to semver you might understand this as a minor update. Except if you change your perspective a little. If you make something explicitly settable (like the retained flag), that was implicit before, you could argue, that this is a "bug fix". Why is it important to not increment version numbers fast: We want implementers to adopt this specification / convention. Not everybody knows about semver, and a minor version looks like a huge change for a lot of people (mostly because big projects handle minor versions different like the linux kernel, libre office, and so on). If we convey the impression that this specification is evolving too fast and people can't keep up with their homie projects, we shoot ourself in the foot. Because this is a community project, I'd say we have a small vote here.
I'll have a look at the results on the 02. Nov. |
Can I both like your post, and vote thumbs down at the same time? :) You make compelling arguments from the perspective of someone that hasn't experienced the value of semver, which as you point out, may be the majority of our audience. Soliciting votes is a great way to gather data on this dynamic. To be fair, fudging on MINOR/PATCH isn't a terrible thing, and you outline some fair advantages. Getting MAJOR/MINOR wrong, however, can have lasting negative effects. |
Anyone who cares about version numbers knows about and uses semver. It's a settled problem; semver has won. OK, I'm exaggerating, but not much. |
If it is specified that we use semver for versioning, then it is not something new (it is quite common), nor is it difficult to read about if you didn't know about it. I'm implementing all my things under the idea that semver is respected. If you introduce a breaking change but didn't feel like it was good for branding to increment the major version, then I might not be able to apply a patch for that specific version (and I shouldn't, we're using semver after all). I'm OK if we switch from semver to something else, but please make it really clear how changes are introduced. After all, |
I clarify my point of view: This is NOT a breaking change at all. It does NOT influence how controllers work with the topic data and a device IS NOT required to send or interpret this new attribute :) It is a "Bux fix" from the perspective of semver. |
I can understand the argument to use semver or not using semver, but if we say we adhere to semver we lose our ability to make our own rules, and I must emphatically object to masquerading a non-breaking API addition as a bugfix. This is absolutely a change to the API, as an implementer I understand this well. This is absolutely not a bug fix or patch, because what bug is it fixing? To be clear, the only discussion here is about either adopting semver or not. I believe arguments have been made to adopt our own versioning, with our own page along with reasons behind this argument. We can't say we're semver compatible without being semver compatible. It's our community responsibility. |
I'd like to bring this document as reference: https://tools.ietf.org/id/draft-claise-semver-00.html In IETF terms, this versioning scheme provides functionality analogous to several parts of the traditional IETF process. * MAJOR is analogous to an “obsoletes” relation between RFCs * MINOR is analogous to an “updates” relation between RFCs * PATCH is analogous to use of the RFC errata process Personally I would say the change is equivalent to an RFC errate. This is semver for documents/specifications, not for software. There is not much expertise outside on how to handle those situations. That is the reason for the poll and this very interesting conversation. |
How can an API addition (the ability to express retention along with a new If we're semver compatible, there's exactly one place to express non-breaking features. If not semver, we can put it anywhere. One of the major values of semver is it takes versioning out of the hands of the marketing department. Considerations of how this looks is a marketing concern. I'm not saying it's an invalid concern, but it doesn't belong in the conversation if we're semver compatible. |
I agree with @lorenwest. Even though this is an addition making something that was implicit explicit, it is still an addition. Plus, being able to express stateless properties is a feature. So I'm for the minor bump, too. |
Vivid conversation, I like it! I want to quote my comment from earlier:
I believe we all have to consider that the convention is not easily comparable to an API - for which semver is primarily designed and described. For every change to the conversation we need to evaluate the impact of the change on the expected behavior of the receiving partner. Let me give this example: Imagine a 3.0.1 client announcing/sending a non-retained property to a 3.0.0 controller. The controller does not know the added feature but is able to handle the property flawlessly, except for it's statelessness. Following the illustrated example this PR very much qualify as a PATCH version bump. |
@davidgraeff @bodiroga @marvinroger @ThomDietrich @lorenwest , I apologies for my absence, ive been overwhelmed with work lately, but starting to get back in the balance of work / social time. I will be actively catching up on what i missed and will try to respond asap. Sorry for any annoyance of my MIA. |
Stateful attribute for properties
Signed-off: David Graeff [email protected]