Repository navigation
Device: announce once, in the caller's first transition - #111
Merged
Merged
Conversation
A Device built without nodes published init, an empty $description and ready at construction, so a caller populating it in its own transition put two cycles on the wire and announced ready before any value (convention.md:279). It now publishes nothing until its first state_transition() or add_node(). A child joins its parent's children, and the parent re-announces, after the child's first ready (:620-629). A child built inside an ancestor's open transition and never populated is announced when that transition closes. refresh_tree(), stop() and delete() skip a device that has not announced itself. A device built with nodes is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0168KMogUF4KfBazQ7ZNaxpT
add() skipped the transition when the spec had nothing to create (all properties internal-only and already in the model, or no specs at all). Now that a Device built without nodes publishes nothing until its first transition, such a device never appeared. add() opens the transition regardless, so it announces empty, as it did before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0168KMogUF4KfBazQ7ZNaxpT
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.
A
Devicebuilt withoutnodes=publishedinit, a$descriptionwith no nodes, andreadyat construction. A caller that then populates it in its ownstate_transition(), as an adapter does, produced two cycles, and announcedreadybefore any value existed (homieiot/convention@7edc221 convention.md:279). On a SPAN panel every child device did this at startup.Now such a device publishes nothing until its first
state_transition()oradd_node(), and that becomes its onlyinit, values,$description,readycycle. Per the add-child order (:620-629), a child joins its parent'schildrenafter its firstready, and the parent'sinit,$description,readyfollows. If the parent is mid-transition, that waits for the parent's own exit.DeviceTreeBuilder.add()always opens a transition, so a spec that creates no node still announces its device, empty.refresh_tree()and the connect republish.stop()sends it nodisconnected, and itsdelete()does not re-announce the parent.nodes=is unchanged.Breaking: code that relied on a bare
Device(...)beingreadymust open astate_transition()on it.Tests:
TestConstructionWithoutNodesand 3 intest_device_tree.py, each pinning the exact publish order with a recording client. Thenodes=case also passes on the old code; the others fail on it.test_description_parent_lists_childnow expects an unannounced child to be left out ofchildren.ruff checkandruff format --checkare clean.🤖 Generated with Claude Code
https://claude.ai/code/session_0168KMogUF4KfBazQ7ZNaxpT