[F031] identity: role_for_slug_or_none so defensive skip-guards don't crash the dispatcher tick on stale slugs

This commit is contained in:
Renn F
2026-06-28 10:53:25 +02:00
parent 945bb5b6ac
commit 5bb13c8453
3 changed files with 34 additions and 5 deletions
+12
View File
@@ -229,3 +229,15 @@ def test_team_for_slug() -> None:
assert identity.team_for_slug("be-dev-1") == identity.Team.BACKEND
assert identity.team_for_slug("ceo") == identity.Team.BOARD
assert identity.team_for_slug("head-marketing") == identity.Team.BOARD
def test_role_for_slug_or_none_unknown_returns_none() -> None:
"""F019/F031: a safe variant for defensive skip-guards — an unknown/stale
slug returns None instead of raising KeyError, so a stale assignee or
notification-target slug can't crash the whole dispatcher tick."""
assert identity.role_for_slug_or_none("nonexistent-slug") is None
def test_role_for_slug_or_none_known_returns_role() -> None:
assert identity.role_for_slug_or_none("be-pm") == identity.Role.CELL_PM
assert identity.role_for_slug_or_none("ceo") == identity.Role.CEO