Skip to content

feat(api): migrate default API version from v2 to v3 - #74

Open
sfowl wants to merge 3 commits into
RedHatProductSecurity:mainfrom
sfowl:atlas-v3
Open

feat(api): migrate default API version from v2 to v3#74
sfowl wants to merge 3 commits into
RedHatProductSecurity:mainfrom
sfowl:atlas-v3

Conversation

@sfowl

@sfowl sfowl commented Aug 18, 2026

Copy link
Copy Markdown

Summary

Migrate TrustShell's default Trustify API path from /api/v2/ to /api/v3/ to match current Atlas/RHTPA deployments.

  • Add TRUSTIFY_API_VERSION env var (default v3; set v2 for legacy deployments)
  • Request total=true on v3 paginated queries so Atlas returns item counts when available
  • Handle v3 responses where total is still null by fetching pages until a short/empty page
  • Add unit tests covering v2 numeric-total pagination, v3 null-total pagination, and empty results
  • Document TRUSTIFY_API_VERSION in README

Backward compatibility

Set TRUSTIFY_API_VERSION=v2 to keep using legacy v2 endpoints. Pagination behaviour is unchanged when the API returns a numeric total.

Test plan

  • uv run pytest tests/test_pagination.py -v
  • uv run pytest tests/ -q (79 passed)
  • uv run --group lint mypy src/
  • Manual smoke test against Atlas stage: trust-purl openssl, trust-products pkg:rpm/redhat/openssl

The Atlas v3 API adds /analysis/latest/component and other new endpoints.
The v3 response schemas are backwards compatible with all fields the
codebase currently reads. API version remains overridable via
TRUSTIFY_API_VERSION env var.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 75780386-089a-49ac-a452-6d0f2dcb7288


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

sfowl and others added 2 commits August 18, 2026 13:42
The v3 API returns "total": null in paginated responses. When total is
unknown, pagination now continues fetching until a page returns fewer
items than the limit, ensuring all results are retrieved.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Request total=true on v3 paginated queries so Atlas returns a count when
available, while keeping the null-total fallback. Add unit tests for v2
and v3 pagination paths and document the API version env var in README.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jasinner
jasinner marked this pull request as ready for review August 20, 2026 01:41
@jasinner

Copy link
Copy Markdown
Collaborator

Superseded by #75 — branch feat/atlas-v3-api on upstream with GPG-signed commits and GitHub Actions CI.

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