Commit Graph

5 Commits

Author SHA1 Message Date
Josh Vera
9248947e39 fix: Resolve o3-pro test isolation issues and convert print to logging
- Fix test isolation by clearing LOCALE env var in o3-pro test
- Add restriction service cleanup in test_model_restrictions.py
- Fix PII sanitizer phone regex to not match timestamps
- Convert all print statements to logging in test files per PR review
- Re-record o3-pro cassette with correct environment

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-13 10:41:43 -06:00
Josh Vera
83e8b67234 test: Enhance o3-pro test to verify model metadata and response parsing
- Add verification that o3-pro model was actually used (not just requested)
- Verify model_used and provider_used metadata fields are populated
- Add graceful handling for error responses in test
- Improve test documentation explaining what's being verified
- Confirm response parsing uses output_text field correctly

This ensures the test properly validates both that:
1. The o3-pro model was selected and used via the /v1/responses endpoint
2. The response metadata correctly identifies the model and provider

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-13 06:09:31 -06:00
Josh Vera
3db49413ff fix: Resolve o3-pro response parsing and test execution issues
- Fix lint errors: trailing whitespace and deprecated typing imports
- Update test mock for o3-pro response format (output.content[] → output_text)
- Implement robust test isolation with monkeypatch fixture
- Clear provider registry cache to prevent test interference
- Ensure o3-pro tests pass in both individual and full suite execution

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-12 20:24:34 -06:00
Josh Vera
8eef4b6722 refactor: Simplify PIISanitizer class by 27%
- Consolidate patterns: GitHub tokens (3→1), phone numbers (2→1)
- Remove duplicate Bearer token patterns (saved 18 lines)
- Simplify sanitize_headers method (30→15 lines)
- Remove unnecessary base64 handling methods
- Clean up unused imports (base64, json, Tuple)
- Reduce total patterns from 24 to 14
- All tests pass, functionality preserved

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-12 19:40:04 -06:00
Josh Vera
7f92085c70 feat: Fix o3-pro response parsing and implement HTTP transport recorder
- Fix o3-pro response parsing to use output_text convenience field
- Replace respx with custom httpx transport solution for better reliability
- Implement comprehensive PII sanitization to prevent secret exposure
- Add HTTP request/response recording with cassette format for testing
- Sanitize all existing cassettes to remove exposed API keys
- Update documentation to reflect new HTTP transport recorder
- Add test suite for PII sanitization and HTTP recording

This change:
1. Fixes timeout issues with o3-pro API calls (was 2+ minutes, now ~15-22 seconds)
2. Properly captures response content without httpx.ResponseNotRead exceptions
3. Preserves original HTTP response format including gzip compression
4. Prevents future secret exposure with automatic PII sanitization
5. Enables reliable replay testing for o3-pro interactions

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-12 18:47:17 -06:00