Skip to content

Commit 7c56b60

Browse files
committed
debug(backup): 5s settle + INFO log on entity-not-yet-indexed
Two diagnostics for the persistent WS-backed-domain capture failures across e2e (helper, label, category, zone, area, group, dashboard_resource): 1. Bump test create→edit settle to 5 s. 2 s wasn't enough on CI under load — every WS-list capture was returning None silently and the 1288 full-loop tests timed out at 15 s waiting for a snapshot that never came. 2. Add an INFO log when ``maybe_snapshot``'s fetch returns None so the "entity not yet in WS-list" case is visible in test logs. Previously silent — the only WARN paths were transient errors or write failures, neither of which fired here. Marked for downgrade to DEBUG once the full-loop e2e is stable; surfacing it at INFO short-term so the diagnostic crumb is in CI for the next iteration. If 5 s settle still produces "fetch returned None" logs, the issue isn't propagation latency — it's that the create's response shape differs from the list shape (id mismatch). The INFO line will tell.
1 parent 402295f commit 7c56b60

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

src/ha_mcp/backup_manager.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,14 @@ async def maybe_snapshot(
278278
if config is None:
279279
# Entity didn't exist at fetch time (create operation, or
280280
# already-deleted at remove time before our pre-fetch).
281+
# Logged at INFO so e2e diagnostics surface the
282+
# "entity-not-yet-indexed" case without polluting prod
283+
# WARNING streams; downgrade to DEBUG later once #1288
284+
# full-loop e2e coverage is stable.
285+
logger.info(
286+
"Auto-backup: fetch returned None for %s — skipping snapshot",
287+
key,
288+
)
281289
return None
282290
try:
283291
path = await asyncio.to_thread(

tests/src/e2e/workflows/auto_backup/test_capture_and_restore.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,10 @@ def _backups_for(
5555
# fetch fires. The decorator is best-effort: if fetch returns None
5656
# (entity not in the registry list yet), the snapshot is silently
5757
# skipped — and polling the backup file afterwards can't recover that.
58-
# 2 s is the empirically-stable mark on HAOS testcontainer runners;
59-
# automation's REST upsert path settles faster and doesn't need this,
60-
# but every WS-backed domain (label, category, zone, area, helper,
61-
# dashboard_resource) does.
62-
_HA_PROPAGATION_SETTLE_SECONDS = 2.0
58+
# 5 s is conservative on CI runners under load; automation's REST
59+
# upsert path settles faster and doesn't need this, but every WS-backed
60+
# domain (label, category, zone, area, helper, dashboard_resource) does.
61+
_HA_PROPAGATION_SETTLE_SECONDS = 5.0
6362

6463

6564
async def _wait_for_backup(

0 commit comments

Comments
 (0)