-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
Description
Quality Gate Reference
- Checklist Item(s): COD-006 (Error Handling Strategy, score 0.5 — critical severity)
- Current Score: Coding domain 60/100
- Impact: Medium — addresses critical-severity item, improves testability
- Effort: Medium
Description
Python scripts use untyped error dicts ({"error": "message"}) with no custom exception types or error wrapping. The agent reaping issue (now fixed in skill files) exposed that error handling lacks resilience patterns.
Implementation Plan
- Create
scripts/exceptions.pywith hierarchy:RefactorError(base)SubprocessError— wraps failed subprocess.run with command, exit code, stderrUnsupportedLanguageError— raised when language detection failsCoverageParseError— raised when coverage output can't be parsedProjectDetectionError— raised when project root/language can't be determined
- Replace bare dict-based error returns with proper exceptions in
run_tests.py,coverage_report.py,detect_project.py - Add context wrapping: catch low-level errors, re-raise with domain context
- Keep dict-based returns at the API boundary (
__init__.pyexports) for backward compatibility — catch exceptions internally and convert
Cross-Domain Impact
- Makes error paths testable (pytest.raises assertions) — improves TDD scores
- Clean exception hierarchy improves code review quality
Acceptance Criteria
- COD-006 score → ≥0.8
- All error paths have specific exception types
- Tests verify error paths with pytest.raises
- No regression in other domain scores
Generated by Cogitations /cog-discover
Reactions are currently unavailable