Skip to content

fix(mock-synapse): synapse→hass bridge so TS-written entities surface on the hass mock bus#189

Closed
zoe-codez wants to merge 4 commits into
mainfrom
zoe/agent/ha-testing-suite
Closed

fix(mock-synapse): synapse→hass bridge so TS-written entities surface on the hass mock bus#189
zoe-codez wants to merge 4 commits into
mainfrom
zoe/agent/ha-testing-suite

Conversation

@zoe-codez

Copy link
Copy Markdown
Member

Draft — part of a cross-repo HA testing-suite effort.

The seed bug this fixes

synapse-created entities written from TS did not surface on the hass mock event bus, so cross-module hass listeners never fired in tests.

What this adds (synapse/src/mock/)

  • synapse→hass bridge: on synapse storage.set, routes the new value through the hass socket path (auto-registers the entity, emits one state_changed) so e.g. a synapse switch toggle fires hass-bus listeners.
  • F5 timing: registers each entity into the mock seed store at synapse storage.add; defers pre-connect writes until the socket reports connected.
  • F6 loop guard: bridge-originated emits carry an origin tag; synapse's reactive event.on(unique_id) ignores tagged events — breaks the storage.set → bridge → socket → event.on cycle.
  • Fake-timer fix: bridge onBootstrap setImmediate → microtask (Promise.resolve()); setImmediate was captured by vi.useFakeTimers() and hung forever (the real root cause of the harness hangs).
  • Adds ./mock package export; portal: local-hass linkage with a single @digital-alchemy/core@26.5.30 pin; backbone bug-proof spec.

Gates

  • vitest: 148 pass / 75 skip (pg/mysql live-DB integration specs gated on DB_PG/DB_MYSQL).

Note

Depends on the hass mock_assistant backbone PR (Digital-Alchemy-TS/hass#253) via the local portal pin.

@zoe-codez zoe-codez closed this Jun 18, 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.

1 participant