main
md 53 lines 2.74 KB
Rendered Raw
1 # modules.py DOX
2
3 ## Purpose
4
5 - Own the `modules.py` helper module.
6 - This module imports modules and classes dynamically with namespace cache control.
7 - Keep this file-level DOX profile synchronized with `modules.py` because this directory is intentionally flat.
8
9 ## Ownership
10
11 - `modules.py` owns the runtime implementation.
12 - `modules.py.dox.md` owns durable notes about responsibilities, contracts, side effects, and verification for that implementation.
13 - Top-level functions:
14 - `import_module(file_path: str) -> ModuleType`
15 - `load_classes_from_folder(folder: str, name_pattern: str, base_class: Type[T], one_per_file: bool=...) -> list[Type[T]]`
16 - `load_classes_from_file(file: str, base_class: type[T], one_per_file: bool=...) -> list[type[T]]`
17 - `purge_namespace(namespace: str)`
18 - Notable constants/configuration names: `T`.
19
20 ## Runtime Contracts
21
22 - Helper modules own reusable framework APIs and must preserve public callers unless all callers, tests, and docs are updated together.
23 - Update this file whenever public functions, classes, persistence behavior, path/security assumptions, side effects, or cross-module contracts change.
24 - Observed side-effect areas: filesystem reads, filesystem deletion.
25 - Imported dependency areas include: `fnmatch`, `helpers.files`, `importlib`, `importlib.util`, `inspect`, `os`, `re`, `sys`, `types`, `typing`.
26
27 ## Key Concepts
28
29 - Important called helpers/classes observed in the source: `TypeVar`, `get_abs_path`, `os.path.basename.replace`, `importlib.util.spec_from_file_location`, `importlib.util.module_from_spec`, `spec.loader.exec_module`, `import_module`, `inspect.getmembers`, `to_delete.sort`, `importlib.invalidate_caches`, `ImportError`, `os.path.join`, `os.path.basename`, `issubclass`, `os.listdir`, `name.startswith`, `n.count`, `fnmatch`, `file_name.endswith`.
30 - Keep request/response, tool, or helper semantics documented here at the same time as source changes.
31
32 ## Work Guidance
33
34 - Preserve public helper APIs used by core code and plugins unless every caller is updated.
35 - Keep path, auth, secret, persistence, network, and subprocess behavior explicit and bounded.
36 - Prefer adding cohesive helper functions here only when behavior is reused across modules.
37
38 ## Verification
39
40 - Run targeted tests for changed helper behavior; run security regressions for auth, filesystem, WebSocket, tunnel, upload, or secret-handling helpers.
41 - Related tests observed by source search:
42 - `tests/test_a0_connector_prompt_gating.py`
43 - `tests/test_browser_agent_regressions.py`
44 - `tests/test_docker_release_plan.py`
45 - `tests/test_error_retry_plugin.py`
46 - `tests/test_file_tree_visualize.py`
47 - `tests/test_git_version_label.py`
48 - `tests/test_mcp_handler_multimodal.py`
49 - `tests/test_memory_quality.py`
50
51 ## Child DOX Index
52
53 No child DOX files.