From 3e6ad705c12fe8e48c070bb9dbd444cd84b2195a Mon Sep 17 00:00:00 2001 From: Sam Dornan Date: Sun, 4 Oct 2026 17:11:00 +0000 Subject: [PATCH] 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 Claude-Session: https://claude.ai/code/session_01PU9EuYhLpqR1DGMtmymr79 --- backend/handler/activity_handler.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/handler/activity_handler.py b/backend/handler/activity_handler.py index efe3b52a1..a485ffa68 100644 --- a/backend/handler/activity_handler.py +++ b/backend/handler/activity_handler.py @@ -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 []