Skip to content

Commit 50ec856

Browse files
Enforce agent manager helper boundaries
Co-authored-by: Shri Sukhani <shrisukhani@users.noreply.github.com>
1 parent 33e4668 commit 50ec856

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ This runs lint, format checks, compile checks, tests, and package build.
7777
- Prefer deterministic unit tests over network-dependent tests.
7878
- Preserve architectural guardrails with focused tests. Current guard suites include:
7979
- `tests/test_agent_examples_coverage.py` (agent task example coverage enforcement),
80+
- `tests/test_agent_helper_boundary.py` (agent manager boundary enforcement for shared request/response helpers),
8081
- `tests/test_agent_operation_metadata_usage.py` (shared agent operation-metadata usage enforcement),
8182
- `tests/test_agent_payload_helper_usage.py` (shared agent start-payload helper usage enforcement),
8283
- `tests/test_agent_start_helper_usage.py` (shared agent start-request helper usage enforcement),
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from pathlib import Path
2+
3+
import pytest
4+
5+
pytestmark = pytest.mark.architecture
6+
7+
8+
AGENT_MANAGER_DIRS = (
9+
Path("hyperbrowser/client/managers/sync_manager/agents"),
10+
Path("hyperbrowser/client/managers/async_manager/agents"),
11+
)
12+
13+
14+
def test_agent_managers_use_shared_helper_boundaries():
15+
violating_modules: list[str] = []
16+
for base_dir in AGENT_MANAGER_DIRS:
17+
for module_path in sorted(base_dir.glob("*.py")):
18+
if module_path.name == "__init__.py":
19+
continue
20+
module_text = module_path.read_text(encoding="utf-8")
21+
if (
22+
"_client.transport.get(" in module_text
23+
or "_client.transport.post(" in module_text
24+
or "_client.transport.put(" in module_text
25+
or "parse_response_model(" in module_text
26+
):
27+
violating_modules.append(module_path.as_posix())
28+
29+
assert violating_modules == []

tests/test_architecture_marker_usage.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
ARCHITECTURE_GUARD_MODULES = (
99
"tests/test_agent_examples_coverage.py",
10+
"tests/test_agent_helper_boundary.py",
1011
"tests/test_agent_operation_metadata_usage.py",
1112
"tests/test_agent_payload_helper_usage.py",
1213
"tests/test_agent_start_helper_usage.py",

0 commit comments

Comments
 (0)