Skip to content

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

Open
jasinner wants to merge 6 commits into
mainfrom
feat/atlas-v3-api
Open

feat(api): migrate default API version from v2 to v3#75
jasinner wants to merge 6 commits into
mainfrom
feat/atlas-v3-api

Conversation

@jasinner

Copy link
Copy Markdown
Collaborator

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

Supersedes #74 (fork branch with unsigned commits).

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

Made with Cursor

sfowl and others added 3 commits August 20, 2026 14:24
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>
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>
@coderabbitai

coderabbitai Bot commented Aug 20, 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: 50820bdb-a089-4fbb-9ae8-9da36114d7c5


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.

jasinner and others added 3 commits August 20, 2026 14:36
Apply ruff check/format fixes so CI lint job passes: modern type
annotations, specific exception handling, import order, and test
style (SIM115/SIM117/ISC004).

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep /api/v2/ as the default API path; honour an explicit path in
TRUSTIFY_URL (e.g. /api/v3/) when set. Remove TRUSTIFY_API_VERSION and
do not add total=true to paginated requests unless the caller passes it.

Co-authored-by: Cursor <cursoragent@cursor.com>
When TRUSTIFY_URL includes a path (e.g. /api/v3/), use it as-is instead of
forcing /api/v2/. Append /api/v2/ only when the URL has no path. Add tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
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