fix(activity): import the permission resolver where it is used

A module-level import of handler.auth.permissions sorted ahead of
handler.database, so importing handler.activity_handler first, as the
e2e seed script and the RQ worker do through endpoints.sockets.scan,
started decorators.database before handler.database and failed on the
cycle between them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PU9EuYhLpqR1DGMtmymr79
This commit is contained in:
Sam Dornan
2026-10-04 17:11:00 +00:00
committed by Claude
parent e6181b7d25
commit 3e6ad705c1

View File

@@ -16,7 +16,6 @@ from typing import Any, TypedDict, cast
from redis.exceptions import WatchError
from endpoints.responses.activity import ActivityClearSchema
from handler.auth.permissions import resolve_permissions
from handler.database import (
db_device_handler,
db_rom_handler,
@@ -285,6 +284,10 @@ def _audience(rom_id: int) -> list[str]:
Sockets join their user's room on connect; one with no user is in none.
"""
# Local import: handler.auth.permissions loads before handler.database
# otherwise, and their decorators cycle when either is imported first.
from handler.auth.permissions import resolve_permissions
rom = db_rom_handler.get_rom(rom_id)
if rom is None:
return []