# Debugging and Testing ## Root cause first When encountering a bug, always investigate the root cause. Don't patch symptoms. If you're about to add a try/except, a fallback default, or a defensive check -- ask whether the real fix is upstream. The user will tell you "fix the root cause" if you get this wrong. Don't make them say it twice. ## Isolated testing Prefer running individual test functions or modules over full E2E suites. Only run the full suite when explicitly asked or before pushing. - Single function: `uv run pytest tests/test_foo.py::TestBar::test_baz -v` - Single module: `uv run pytest tests/test_foo.py -v` - Full suite: only when asked, or before `git push` When debugging a specific endpoint or integration, test it directly (e.g., `requests.post()` to a local server) instead of running the entire pipeline end-to-end. ## Subprocess failures When a subprocess fails, always log stdout and stderr. "Exit code 1" with no output is useless. If you see a subprocess failure without output, add logging before moving on.