main
md 42 lines 1.89 KB
Rendered Raw
1 # performance.py DOX
2
3 ## Purpose
4
5 - Own the `performance.py` helper module.
6 - This module provides lightweight performance tracing helpers.
7 - Keep this file-level DOX profile synchronized with `performance.py` because this directory is intentionally flat.
8
9 ## Ownership
10
11 - `performance.py` owns the runtime implementation.
12 - `performance.py.dox.md` owns durable notes about responsibilities, contracts, side effects, and verification for that implementation.
13 - Top-level functions:
14 - `trace_performance(show_all=..., color=..., unicode=...)`: Decorator that profiles a function and prints a call tree when it finishes.
15
16 ## Runtime Contracts
17
18 - Helper modules own reusable framework APIs and must preserve public callers unless all callers, tests, and docs are updated together.
19 - Update this file whenever public functions, classes, persistence behavior, path/security assumptions, side effects, or cross-module contracts change.
20 - Imported dependency areas include: `functools`, `inspect`, `pyinstrument`.
21
22 ## Key Concepts
23
24 - Important called helpers/classes observed in the source: `inspect.iscoroutinefunction`, `functools.wraps`, `Profiler`, `profiler.start`, `profiler.stop`, `func`, `profiler.output_text`.
25 - Keep request/response, tool, or helper semantics documented here at the same time as source changes.
26
27 ## Work Guidance
28
29 - Preserve public helper APIs used by core code and plugins unless every caller is updated.
30 - Keep path, auth, secret, persistence, network, and subprocess behavior explicit and bounded.
31 - Prefer adding cohesive helper functions here only when behavior is reused across modules.
32
33 ## Verification
34
35 - Run targeted tests for changed helper behavior; run security regressions for auth, filesystem, WebSocket, tunnel, upload, or secret-handling helpers.
36 - Related tests observed by source search:
37 - `tests/test_extensions_stress.py`
38 - `tests/test_ws_manager.py`
39
40 ## Child DOX Index
41
42 No child DOX files.