docs(styleguide): fix audit_optional_returns.py — script does not exist
python.md §17.8 and §17.10 listed audit_optional_returns.py as the
✅ implemented successor to audit_optional_in_3_files.py. Verified
via py_find_usages: audit_optional_returns does not exist in scripts/.
The live script is audit_optional_in_3_files.py (covers 4 baseline
files). Corrected the enforcement table + pre-commit workflow blocks.
This commit is contained in:
@@ -356,7 +356,7 @@ The ONLY place these patterns are allowed is at the literal wire boundary — th
|
||||
### 17.8 Enforcement
|
||||
|
||||
- `scripts/audit_weak_types.py --strict` — flags `dict[str, Any]`, `Any`, anonymous tuple returns
|
||||
- `scripts/audit_optional_returns.py --strict` — flags `Optional[T]` return types in ALL `src/*.py` (post-2026-06-27; was `audit_optional_in_3_files.py` covering 4 baseline files only — old script retained for code_path_audit_20260607 cross-reference contract)
|
||||
- `scripts/audit_optional_in_3_files.py --strict` — flags `Optional[T]` return types in the baseline 4 files (`src/mcp_client.py`, `src/ai_client.py`, `src/rag_engine.py`, plus one more). An all-`src/*.py` successor (`audit_optional_returns.py`) is referenced in older planning docs but is NOT yet built — the live script today is `audit_optional_in_3_files.py`.
|
||||
- `scripts/audit_imports.py --strict` — flags local imports (§17.9a) + `_PREFIX` aliasing (§17.9b) in all `src/*.py`; reads `scripts/audit_imports_whitelist.toml` for warmed-imports/hot-reload exceptions (use `--no-whitelist` to audit all files; `--show-whitelist` to inspect current whitelist)
|
||||
- The new `boundary_layer` audit (planned in `conductor/tracks/cruft_elimination_20260627/spec.md`) — documents every `Metadata` usage with justification
|
||||
- Pre-commit: every commit MUST pass all four audits above
|
||||
@@ -449,7 +449,7 @@ The CORRECT pattern (preferred): promote the type at the boundary. After `cruft_
|
||||
| Banned pattern | Audit script | Status |
|
||||
|---|---|---|
|
||||
| `dict[str, Any]`, `Any`, anonymous tuple returns | `scripts/audit_weak_types.py --strict` | ✅ implemented |
|
||||
| `Optional[T]` return types in `src/*.py` | `scripts/audit_optional_returns.py --strict` (successor to `audit_optional_in_3_files.py` 2026-06-27; now scans all `src/*.py`) | ✅ implemented |
|
||||
| `Optional[T]` return types in `src/*.py` | `scripts/audit_optional_in_3_files.py --strict` (live; covers the 4 baseline refactored files only — an all-src successor `audit_optional_returns.py` is referenced in older planning docs but is NOT yet built) | ✅ implemented (baseline files only) |
|
||||
| Silent swallow (`try/except: pass` or log-only) | `scripts/audit_exception_handling.py --strict` | ✅ implemented |
|
||||
| `Metadata` used as `dict[str, Any]` escape hatch | (planned per `conductor/tracks/cruft_elimination_20260627/spec.md` boundary-layer audit) | ⚠️ not yet built |
|
||||
| Local imports inside function bodies (outside `try/except ImportError`) | `scripts/audit_imports.py` | ⚠️ not yet built (planned per §17.9a) |
|
||||
@@ -461,12 +461,12 @@ The CORRECT pattern (preferred): promote the type at the boundary. After `cruft_
|
||||
```bash
|
||||
# Run before claiming "done"
|
||||
uv run python scripts/audit_weak_types.py
|
||||
uv run python scripts/audit_optional_returns.py
|
||||
uv run python scripts/audit_optional_in_3_files.py
|
||||
uv run python scripts/audit_exception_handling.py
|
||||
|
||||
# In CI / pre-commit hook (exit 1 on any violation)
|
||||
uv run python scripts/audit_weak_types.py --strict
|
||||
uv run python scripts/audit_optional_returns.py --strict
|
||||
uv run python scripts/audit_optional_in_3_files.py --strict
|
||||
uv run python scripts/audit_exception_handling.py --strict
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user