Skip to content

fix: Node.delete_property() republishes $description - #41

Merged
dcj merged 1 commit into
mainfrom
fix/delete-property-republishes-description
Aug 7, 2026
Merged

fix: Node.delete_property() republishes $description#41
dcj merged 1 commit into
mainfrom
fix/delete-property-republishes-description

Conversation

@dcj

@dcj dcj commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Closes #35.

Node.add_property() has always called device().publish_description(). Its mirror Node.delete_property() never did: it cleared the property's retained value topic, removed it from the dict, logged, and returned.

The result is a broker holding a device in ready whose $description still names a property that no longer exists, permanently, with nothing to correct it. The two halves of the same API disagreed about whether mutating a node's property set counts as a structural change.

Tests

  • test_delete_property_republishes_description asserts a $description is published and that the deleted property is absent from it while its sibling survives. Fails on main, passes here.
  • test_delete_property_batches_inside_state_transition pins the symmetry under batching: three deletions in one transition produce exactly one consolidated $description, the same guarantee additions already give.

550 passed, ruff clean.

Note on scope

Deliberately fixed rather than documented-as-required. Requiring callers to wrap a single delete_property() in a transition, when the adding counterpart needs no such wrapper, would keep the asymmetry and just move it into the docs.

@dcj
dcj force-pushed the fix/delete-property-republishes-description branch from 4fe7b20 to 607d686 Compare August 7, 2026 14:31
add_property() has always called publish_description(); its mirror never did.
Deleting a property cleared the retained value topic but left the device in
`ready` with a $description that still named the property, and nothing corrected
it afterwards, so the broker held a self-contradicting device indefinitely.

The two halves of the same API disagreed about whether mutating a node's
property set is a structural change. It is. Deletions batch inside
state_transition() exactly as additions do, so N deletions still collapse to one
$description publish.

Closes #35.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@dcj
dcj force-pushed the fix/delete-property-republishes-description branch from 607d686 to eac0bf1 Compare August 7, 2026 14:31
@dcj
dcj merged commit 2e939dc into main Aug 7, 2026
5 checks passed
@dcj
dcj deleted the fix/delete-property-republishes-description branch August 7, 2026 14:32
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.

Node.delete_property() never republishes $description, leaving a ready device describing a property that is gone

1 participant