fix(orchestrator/tests): attribute access on TopologySummary, not dict

emailgen/scheduler.py: topology.email_personas/.language_default
test_heartbeat_topology_resync.py: row.needs_resync (5 occurrences)
This commit is contained in:
2026-05-10 07:11:14 -04:00
parent 4c8ef2f104
commit 6fecf45dcd
2 changed files with 12 additions and 12 deletions

View File

@@ -131,13 +131,13 @@ async def _resolve_personas(
topology = await repo.get_topology(topology_id)
if not topology:
return [], source
return (
parse_personas(
topology.get("email_personas"),
language_default=topology.get("language_default") or "en",
),
source,
)
if isinstance(topology, dict):
raw = topology.get("email_personas")
lang = topology.get("language_default") or "en"
else:
raw = topology.email_personas
lang = topology.language_default or "en"
return parse_personas(raw, language_default=lang), source
# Fleet / shard / anything else → global pool.
return global_pool.load(), source

View File

@@ -115,7 +115,7 @@ async def test_heartbeat_matching_hash_does_not_flag(
)
assert resp.status_code == 204, resp.text
row = await repo.get_topology(tid)
assert row["needs_resync"] is False
assert row.needs_resync is False
@pytest.mark.anyio
@@ -140,7 +140,7 @@ async def test_heartbeat_hash_mismatch_flags_resync(
)
assert resp.status_code == 204, resp.text
row = await repo.get_topology(tid)
assert row["needs_resync"] is True
assert row.needs_resync is True
@pytest.mark.anyio
@@ -167,7 +167,7 @@ async def test_heartbeat_agent_reports_no_topology_flags_resync(
)
assert resp.status_code == 204, resp.text
row = await repo.get_topology(tid)
assert row["needs_resync"] is True
assert row.needs_resync is True
@pytest.mark.anyio
@@ -190,7 +190,7 @@ async def test_heartbeat_without_topology_block_is_noop_for_resync(
row = await repo.get_topology(tid)
# Absence of the topology block means agent hasn't reported anything
# → treat like no topology reported → flag.
assert row["needs_resync"] is True
assert row.needs_resync is True
@pytest.mark.anyio
@@ -221,4 +221,4 @@ async def test_heartbeat_other_host_topology_unaffected(
)
assert resp.status_code == 204, resp.text
row = await repo.get_topology(tid_a)
assert row["needs_resync"] is False
assert row.needs_resync is False