Skip to content

fix: tree discovery gaps and release v1.40.4 - #179

Merged
cursor[bot] merged 6 commits into
masterfrom
dougrathbone/fix-tree-replay-and-release-order-c063
Nov 21, 2026
Merged

cursor[bot] merged 6 commits into
masterfrom
dougrathbone/fix-tree-replay-and-release-order-c063

Conversation

@dougrathbone

Copy link
Copy Markdown
Owner

Summary

Home Assistant discovery could start from a partial C-Bus tree, or attach a tree fragment to the wrong network. This also caps the discovery config cache, locks the failed-command queue contract, and publishes the source GitHub Release before the add-on store is updated. Closes #174 (already fixed in 1.40.2 and 1.40.3; confirmed on 3.9.0).

Patch release 1.40.4. Tag v1.40.4 after merge so the add-on store updates.

Changes

  • Discard a TREEXML that does not fit the pre-discovery buffer, instead of replaying the part that fit.
  • Ignore TreeXML data that arrives with no active session.
  • Cap remembered discovery configs at 20000. Past that, the oldest are dropped and a broker restart re-requests the tree.
  • Test that a failed C-Gate send warns once and the next command is still sent once.
  • Create the source GitHub Release before pushing the add-on store.

Test plan

  • npm test passes locally with no failures
  • New code has unit test coverage (aim for ≥ 60% on changed files)
  • Existing tests were not broken or removed without justification

Checklist

  • Version bumped in package.json and homeassistant-addon/config.yaml (if releasing)
  • CHANGELOG.md updated (if releasing)
  • No sensitive data or credentials included
Open in Web Open in Cursor 

Replaying only the fragments that fit the pending buffer published a
partial tree, and discovery then treated the missing groups as gone.
Drop that tree whole so startup requests a complete one.
A data chunk without a start used to open a fallback session and attach
the XML to the next queued network, or to unknown. Drop the chunk so a
reordered fragment cannot corrupt discovery for the wrong network.
A pool rejection resolves the queue item after one warning. Lock that
contract so a transient failure cannot stall the queue, and so the
failed command is not sent a second time.
The replay map grew with every unique config topic for the life of the
process. Cap it, drop the oldest entries, and request a fresh tree
after a broker restart so those devices are announced again.
The distribution push used to run before changelog extraction and the
source GitHub Release. A failure after that push left Supervisor on
the new version with no source release. Create the source release
first, so a later store-push failure stays on the previous add-on and
the drift check can see the unpublished tag.
@cursor
cursor Bot merged commit 3f419de into master Nov 21, 2026
27 checks passed
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.

Managed C-Gate 3.8.0: config commands hang the session (CGATE_APPDATA not set)

1 participant