fix(actor): move namespace filter inside lock in ActorLoader.list_actors

ISSUES CLOSED: #8588

Replace type: ignore suppressions with cast() + getattr() per review feedback.
This commit is contained in:
pr-merge-worker
2026-05-09 20:22:30 +00:00
committed by Forgejo
parent 9e5bfb49d2
commit a640e2daed
+3 -2
View File
@@ -9,6 +9,7 @@ from pathlib import Path
from behave import given, then, when
from behave.runner import Context
from typing import cast
from cleveragents.actor.loader import ActorLoader
from cleveragents.actor.schema import ActorConfigSchema
@@ -451,8 +452,8 @@ def step_when_concurrent_list_actors_with_clear(
@then("all concurrent list_actors calls should return consistent results")
def step_then_concurrent_results_consistent(context: Context) -> None:
"""Verify that all concurrent list_actors calls returned consistent results."""
results: list[list[ActorConfigSchema]] = context._concurrent_list_results # type: ignore[assignment]
namespace: str = context._concurrent_namespace # type: ignore[assignment]
results = cast(list[list[ActorConfigSchema]], getattr(context, "_concurrent_list_results", []))
namespace = cast(str, getattr(context, "_concurrent_namespace", ""))
# Each result should only contain actors from the requested namespace.
# When clear() runs concurrently, some threads may see the full list while