cfdf8988fb
GREEN phase for Phase 0. Mirrors scripts/audit_weak_types.py design with
3 additions specific to the any-type componentization track:
1. PROMOTED_SITE_MODULES allowlist: the 3 new src/ modules
(mcp_tool_specs.py, openai_schemas.py, provider_state.py) are exempt
from Any-counting (their new dataclasses intentionally have raw_response: Any
and SDK holder fields that stay as Any per Pattern 3).
2. INLINE_PROMOTED_SITE_MODULES: log_registry.py + api_hooks.py get their
dataclasses added inline in Phase 4 + 5 (not new modules); same exemption.
3. Combined counter: counts both Any AND weak-struct patterns
(dict_str_any, list_of_dict, optional_dict, etc.).
Modes:
- default: informational (exits 0; prints human report)
- --json: machine-readable with by_file, by_category, total_weak
- --strict: CI gate (exits 1 when current > baseline)
- --baseline: path to baseline file (default: scripts/audit_dataclass_coverage.baseline.json)
Baseline: scripts/audit_dataclass_coverage.baseline.json = 207 weak sites
(captured pre-Phase-1; expected to drop to ~118 after 89 sites promoted).
Verification:
uv run python scripts/audit_dataclass_coverage.py --strict
STRICT OK: 207 weak sites <= baseline 207
uv run pytest tests/test_audit_dataclass_coverage.py --timeout=30
7 passed in 5.15s
9 lines
116 B
JSON
9 lines
116 B
JSON
{
|
|
"total_weak": 207,
|
|
"files_with_findings": 35,
|
|
"by_category": {
|
|
"any": 188,
|
|
"dict_str_any": 19
|
|
}
|
|
}
|