Skip to content

Commit 4f84375

Browse files
Add request helper transport boundary architecture guard
Co-authored-by: Shri Sukhani <shrisukhani@users.noreply.github.com>
1 parent a17703f commit 4f84375

3 files changed

Lines changed: 27 additions & 0 deletions

File tree

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ This runs lint, format checks, compile checks, tests, and package build.
149149
- `tests/test_pyproject_architecture_marker.py` (pytest marker registration enforcement),
150150
- `tests/test_readme_examples_listing.py` (README example-listing consistency enforcement),
151151
- `tests/test_request_helper_parse_import_boundary.py` (request-helper import boundary enforcement for direct response parsing imports),
152+
- `tests/test_request_helper_transport_boundary.py` (request-helper transport boundary enforcement through shared model request helpers),
152153
- `tests/test_response_parse_usage_boundary.py` (centralized `parse_response_model(...)` usage boundary enforcement),
153154
- `tests/test_schema_injection_helper_usage.py` (shared schema injection helper usage enforcement in payload builders),
154155
- `tests/test_session_operation_metadata_usage.py` (session manager operation-metadata usage enforcement),

tests/test_architecture_marker_usage.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"tests/test_contributing_architecture_guard_listing.py",
5252
"tests/test_readme_examples_listing.py",
5353
"tests/test_request_helper_parse_import_boundary.py",
54+
"tests/test_request_helper_transport_boundary.py",
5455
"tests/test_response_parse_usage_boundary.py",
5556
"tests/test_examples_syntax.py",
5657
"tests/test_docs_python3_commands.py",
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from pathlib import Path
2+
3+
import pytest
4+
5+
pytestmark = pytest.mark.architecture
6+
7+
8+
ALLOWED_REQUEST_HELPER_TRANSPORT_MODULES = {
9+
"hyperbrowser/client/managers/model_request_utils.py",
10+
}
11+
12+
13+
def test_request_helpers_route_transport_calls_through_model_request_utils():
14+
violating_modules: list[str] = []
15+
for module_path in sorted(
16+
Path("hyperbrowser/client/managers").glob("*_request_utils.py")
17+
):
18+
module_text = module_path.read_text(encoding="utf-8")
19+
if "client.transport." not in module_text:
20+
continue
21+
normalized_path = module_path.as_posix()
22+
if normalized_path not in ALLOWED_REQUEST_HELPER_TRANSPORT_MODULES:
23+
violating_modules.append(normalized_path)
24+
25+
assert violating_modules == []

0 commit comments

Comments
 (0)