Skip to content

Commit 0753ab9

Browse files
Enforce manager transport helper boundary
Co-authored-by: Shri Sukhani <shrisukhani@users.noreply.github.com>
1 parent 17a02b5 commit 0753ab9

3 files changed

Lines changed: 32 additions & 0 deletions

File tree

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ This runs lint, format checks, compile checks, tests, and package build.
122122
- `tests/test_job_wait_helper_usage.py` (shared wait-for-job defaults helper usage enforcement),
123123
- `tests/test_makefile_quality_targets.py` (Makefile quality-gate target enforcement),
124124
- `tests/test_manager_model_dump_usage.py` (manager serialization centralization),
125+
- `tests/test_manager_transport_boundary.py` (manager transport boundary enforcement through shared request helpers),
125126
- `tests/test_mapping_keys_access_usage.py` (centralized key-iteration boundaries),
126127
- `tests/test_mapping_reader_usage.py` (shared mapping-read parser usage),
127128
- `tests/test_optional_serialization_helper_usage.py` (optional model serialization helper usage enforcement),

tests/test_architecture_marker_usage.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"tests/test_agent_terminal_status_helper_usage.py",
1717
"tests/test_guardrail_ast_utils.py",
1818
"tests/test_manager_model_dump_usage.py",
19+
"tests/test_manager_transport_boundary.py",
1920
"tests/test_mapping_reader_usage.py",
2021
"tests/test_mapping_keys_access_usage.py",
2122
"tests/test_tool_mapping_reader_usage.py",
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
from pathlib import Path
2+
3+
import pytest
4+
5+
pytestmark = pytest.mark.architecture
6+
7+
8+
MANAGER_DIRECTORIES = (
9+
Path("hyperbrowser/client/managers/sync_manager"),
10+
Path("hyperbrowser/client/managers/async_manager"),
11+
)
12+
13+
14+
def test_managers_route_transport_calls_through_shared_helpers():
15+
violating_modules: list[str] = []
16+
for manager_dir in MANAGER_DIRECTORIES:
17+
for module_path in sorted(manager_dir.glob("*.py")):
18+
module_text = module_path.read_text(encoding="utf-8")
19+
if "_client.transport." in module_text:
20+
violating_modules.append(module_path.as_posix())
21+
22+
for nested_dir in sorted(
23+
path for path in manager_dir.iterdir() if path.is_dir()
24+
):
25+
for module_path in sorted(nested_dir.glob("*.py")):
26+
module_text = module_path.read_text(encoding="utf-8")
27+
if "_client.transport." in module_text:
28+
violating_modules.append(module_path.as_posix())
29+
30+
assert violating_modules == []

0 commit comments

Comments
 (0)