fix(concurrency): remove type:ignore and fix lint issues in thread safety helpers
CI / benchmark-publish (pull_request) Has been skipped
CI / push-validation (pull_request) Successful in 34s
CI / helm (pull_request) Successful in 44s
CI / build (pull_request) Successful in 55s
CI / lint (pull_request) Successful in 1m2s
CI / quality (pull_request) Successful in 1m16s
CI / typecheck (pull_request) Successful in 1m37s
CI / security (pull_request) Successful in 1m43s
CI / integration_tests (pull_request) Successful in 3m35s
CI / e2e_tests (pull_request) Successful in 4m15s
CI / unit_tests (pull_request) Failing after 6m2s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / status-check (pull_request) Failing after 3s
CI / benchmark-regression (pull_request) Failing after 32s
CI / benchmark-publish (pull_request) Has been skipped
CI / push-validation (pull_request) Successful in 34s
CI / helm (pull_request) Successful in 44s
CI / build (pull_request) Successful in 55s
CI / lint (pull_request) Successful in 1m2s
CI / quality (pull_request) Successful in 1m16s
CI / typecheck (pull_request) Successful in 1m37s
CI / security (pull_request) Successful in 1m43s
CI / integration_tests (pull_request) Successful in 3m35s
CI / e2e_tests (pull_request) Successful in 4m15s
CI / unit_tests (pull_request) Failing after 6m2s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / status-check (pull_request) Failing after 3s
CI / benchmark-regression (pull_request) Failing after 32s
This commit is contained in:
@@ -7,7 +7,6 @@ Covers: mixed operations, effective invariants, and shared assertions.
|
||||
from __future__ import annotations
|
||||
|
||||
import threading
|
||||
import time
|
||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||
from typing import Any
|
||||
|
||||
|
||||
@@ -17,7 +17,10 @@ if _SRC not in sys.path:
|
||||
from cleveragents.application.services.invariant_service import ( # noqa: E402
|
||||
InvariantService,
|
||||
)
|
||||
from cleveragents.domain.models.core.invariant import InvariantScope # noqa: E402
|
||||
from cleveragents.domain.models.core.invariant import ( # noqa: E402
|
||||
InvariantEnforcementRecord,
|
||||
InvariantScope,
|
||||
)
|
||||
|
||||
|
||||
def _fresh_service() -> InvariantService:
|
||||
@@ -174,7 +177,7 @@ def concurrent_enforce() -> None:
|
||||
)
|
||||
|
||||
thread_count = 5
|
||||
enforcement_records: list[object] = []
|
||||
enforcement_records: list[InvariantEnforcementRecord] = []
|
||||
errors: list[Exception] = []
|
||||
lock = threading.Lock()
|
||||
invariants = svc.list_invariants()
|
||||
@@ -207,7 +210,7 @@ def concurrent_enforce() -> None:
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
decision_ids = [r.decision_id for r in enforcement_records] # type: ignore[union-attr]
|
||||
decision_ids = [r.decision_id for r in enforcement_records]
|
||||
unique_ids = set(decision_ids)
|
||||
if len(unique_ids) != len(decision_ids):
|
||||
print(
|
||||
|
||||
@@ -10,6 +10,7 @@ import contextlib
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
from collections.abc import Callable
|
||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||
from pathlib import Path
|
||||
|
||||
@@ -373,7 +374,7 @@ def thread_safety_with_invariant_modifications() -> None:
|
||||
print("invariant-advanced-invariant-modifications-ok")
|
||||
|
||||
|
||||
COMMANDS: dict[str, callable] = {
|
||||
COMMANDS: dict[str, Callable[[], None]] = {
|
||||
"high-contention-add": high_contention_add,
|
||||
"lock-contention-stress": lock_contention_stress,
|
||||
"deadlock-prevention": deadlock_prevention,
|
||||
|
||||
Reference in New Issue
Block a user