Skip to content

Property::clearValue(): retract through the publish queue, and only once - #32

Merged
dcj merged 1 commit into
mainfrom
fix/clear-value-queued
Nov 14, 2026
Merged

dcj merged 1 commit into
mainfrom
fix/clear-value-queued

Conversation

@dcj

@dcj dcj commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Closes #30.

Property::clearValue() now sends its retraction through queue_publish(), so it queues behind any value queued before it and a stale value can no longer land after it.

It is skipped when there is nothing to retract:

  • no value held,
  • nothing queued,
  • and the last message sent was a retraction, or nothing has been sent since boot.

A driver that retracts on every failed read therefore retracts once. A refused retraction is retried on the next call.

A value too long to memo now leaves the memo at -2 rather than -1, so -1 means only "nothing sent since boot", and a retraction after forget_value() on such a value is not skipped.

A port must implement queue_publish(); the POSIX port and the ESP32 firmware do. The ESP32 queue sends a zero-length payload as a zero-length retained message.

Tests:

  • test_property_publish has five new cases: a repeat retraction, nothing to retract, ordering behind a queued value, a value too long to memo, and a refused retraction. The existing retraction test is updated for the queue.
  • All 15 core suites pass.
  • All 8 POSIX end-to-end tests pass against mosquitto, including drive_and_retract.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VUQ6asqTe3tYwnZR7GW2dn

The retraction now goes through queue_publish(), behind any value queued
before it, so a stale value can no longer land after it. It is skipped when
there is nothing to retract: no value held, none queued, and the last
message sent was a retraction or nothing has been sent since boot. A value
too long to memo now leaves the memo at -2, so a retraction after
forget_value() on one is not skipped.

Closes #30

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VUQ6asqTe3tYwnZR7GW2dn
@dcj
dcj force-pushed the fix/clear-value-queued branch from 961704c to e3681df Compare November 14, 2026 17:40
@dcj
dcj merged commit 18337d3 into main Nov 14, 2026
8 checks passed
@dcj
dcj deleted the fix/clear-value-queued branch November 14, 2026 17:41
@dcj dcj mentioned this pull request Nov 14, 2026
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.

Property::clearValue() bypasses the publish queue and republishes when already retracted

1 participant