Skip to content

Conversation

@vdavez
Copy link
Contributor

@vdavez vdavez commented Jan 26, 2026

This PR adds comprehensive support for Vehicles and IDV endpoints, including implementation, integration tests, production smoke tests, and development tooling.

Core Features

Vehicles and IDV Endpoints

  • Added list_vehicles() and get_vehicle() methods for Vehicles endpoints
  • Added list_idvs(), get_idv(), and get_idv_summary() methods for IDV endpoints
  • All endpoints support shape parameters, pagination, filtering, and search
  • Updated ShapeConfig with default shapes for IDVs and vehicles
  • Added comprehensive schemas in tango/shapes/explicit_schemas.py

Integration Tests

  • Added tests/integration/test_vehicles_idvs_integration.py with full test coverage
  • Includes 10 VCR.py cassettes for reliable, offline testing
  • Tests cover default shapes, custom shapes, search, pagination, and data parsing
  • All tests use VCR cassettes by default, with option to use live API

Production Smoke Tests

  • Added tests/production/ directory with production API smoke tests
  • Added production_client fixture and error handling decorators
  • Added smoke tests for IDV and vehicle endpoints
  • Tests gracefully handle authentication and rate limit errors

Development Tooling

  • Added scripts/pr_review.py - PR validation script with multiple modes:
    • smoke: Production API smoke tests only
    • quick: Linting + type checking (no tests)
    • full: All checks (linting + type checking + all tests)
    • production: Production API smoke tests + linting + type checking
  • Auto-detects PR context from GitHub Actions, GitHub CLI, or git branch
  • Supports checking only changed files for faster feedback

Code Quality Improvements

  • Fixed unused variable in detect_pr_from_branch()
  • Added explicit return statements after pytest.skip() in decorators
  • Added diagnostic logging to empty except clauses
  • Added comprehensive type annotations to production test fixtures and decorators

Documentation

  • Updated docs/API_REFERENCE.md with Vehicles and IDV endpoint documentation
  • Updated scripts/README.md with PR review script usage
  • Updated CHANGELOG.md with new features

Testing

  • All new endpoints have comprehensive integration tests with VCR cassettes
  • Production smoke tests validate endpoints against live API
  • Unit tests moved from test_client.py to integration test suite
  • All tests follow existing patterns and validation strategies

Related to PR #7 (Vehicles endpoints).

- Add production test suite with smoke tests against live API
- Add test_production.py script for running production smoke tests
- Add pr_review.py script for PR validation (smoke, quick, full, production modes)
- Add production test marker to pytest configuration
- Update integration tests with cursor pagination support
- Add VCR cassettes for production and integration tests
- Update scripts README with documentation for new scripts
- Update .gitignore to exclude .cursor directory
- Minor improvements to client and models for test compatibility
- Add production_client fixture and error handling decorators to conftest.py
- Add test_list_idvs_basic and test_get_idv for IDV endpoints
- Add test_list_vehicles_basic and test_get_vehicle for vehicle endpoints
- All tests follow existing smoke test patterns with proper validation
@vdavez vdavez changed the base branch from main to issue-1328/vehicles-idvs January 26, 2026 21:40
check=False,
)
if result.returncode == 0:
current_branch = result.stdout.strip()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed: Removed unused current_branch variable assignment. The function now directly calls get_pr_info_from_gh_cli(None) without storing the branch name.

"""

@wraps(func)
def wrapper(*args, **kwargs):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed: Added explicit return statement after pytest.skip() in handle_auth_error wrapper to make control flow explicit. Also added proper type annotations.

"""

@wraps(func)
def wrapper(*args, **kwargs):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed: Added explicit return statement after pytest.skip() in handle_rate_limit wrapper to make control flow explicit. Also added proper type annotations.

url=pr.get("html_url"),
state=pr.get("state"),
)
except Exception:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed: Added diagnostic logging to the empty except clause. Now prints a warning to stderr when reading/parsing the GitHub event file fails, while maintaining the same fallback behavior.

)
except (json.JSONDecodeError, KeyError):
pass
except FileNotFoundError:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed: Added comment explaining that FileNotFoundError is expected when gh CLI is not available. This is intentional fallback behavior.

pass
except FileNotFoundError:
pass
except Exception:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed: Added diagnostic logging to the empty except clause. Now prints a warning to stderr when getting PR info from gh CLI fails, while maintaining the same fallback behavior.

current_branch = result.stdout.strip()
# Try to get PR info for this branch
return get_pr_info_from_gh_cli(None)
except Exception:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed: Added diagnostic logging to the empty except clause. Now prints a warning to stderr when detecting PR from branch fails, while maintaining the same fallback behavior.

- Remove unused current_branch variable in detect_pr_from_branch
- Add explicit return statements after pytest.skip() in decorators
- Add diagnostic logging to empty except clauses
- Add type annotations to production test fixtures and decorators
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants