Skip to content

Add version diff endpoint implementation#1041

Open
Robinsonchiziterem wants to merge 3 commits into
ANTAPEX:mainfrom
Robinsonchiziterem:feature/version-pagination-diff
Open

Add version diff endpoint implementation#1041
Robinsonchiziterem wants to merge 3 commits into
ANTAPEX:mainfrom
Robinsonchiziterem:feature/version-pagination-diff

Conversation

@Robinsonchiziterem

@Robinsonchiziterem Robinsonchiziterem commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

📝 Summary

This pull request verifies the robust implementation of Unified Contract Search Filters (supporting mixed combinations of network, category, and verification-only filters alongside full-text search) inside the /api/contracts endpoint, ensuring that combining filters does not break pagination or search logic.
The endpoint /api/contracts maps to handlers::list_contracts inside backend/api/src/handlers.rs, which naturally implements all requested filters:

  1. Combined Filters & AND Logic: Integrates networks, categories, verified_only, and query using top-level AND clauses in SQL queries.
  2. Preserved Pagination: Computes pagination sizes and offsets correctly for filtered sets, matching count queries dynamically.
  3. Response Metadata: Automatically parses active filters into SearchFilterMetadata and populates the "filters" property inside PaginatedResponse using .with_filters(filters).
    This pull request completes and verifies the implementation of the Version History Compare & Changelog Diff functionality (Issue Add changelog and version history diff endpoints #955) inside the Soroban Registry. It enables consumers to track semantic version history, explicitly analyze version-to-version metadata differences (such as WASM hashes, source URLs, commit hashes, release notes, and change notes), and ensures reliable backend builds with updated lockfile constraints.

🚀 Changes Made

Area Files Added/Modified Description
Integration Tests backend/api/tests/search_filter_tests.rs [NEW] Adds robust integration tests to cover mixed filter scenarios, empty result sets, response active-filter metadata, and pagination stability.
Component Files Added/Modified Description
----------- ---------------------- -------------
API Routes backend/api/src/routes.rs Exposes the version comparison route: GET /api/contracts/:id/versions/compare mapping to the compare handler.
API Handlers backend/api/src/handlers.rs Refines and exports compare_contract_versions to parse version parameters, query database version records, perform semantic field comparisons, and return a structured difference.
Cargo Build backend/Cargo.lock Restores and updates dependency locking (redox_syscall, telemetry, etc.) to ensure build stability and resolve local/remote mismatch conflicts.

🧪 Integration Test Coverage

🔍 Endpoint Details

We have introduced search_filter_tests.rs to cover:

  • Mixed Filter Combinations: Calls GET /api/contracts?networks=testnet&categories=DeFi&verified_only=true&query=token and asserts that the response schema, pagination boundaries, and "filters" active-filters metadata matches the query.
  • Empty Result Sets: Queries a nonexistent contract string combined with network filters, ensuring a 200 OK empty list with total count 0 is returned instead of errors.

GET /api/contracts/:id/versions/compare?from={version_a}&to={version_b}

Allows clients to retrieve a comprehensive diff between two version tags of a specific contract.
Sample Request:

curl "https://registry.soroban.org/api/contracts/550e8400-e29b-41d4-a716-446655440000/versions/compare?from=1.0.0&to=1.1.0"

Sample Response Schema:

{
  "contract_id": "550e8400-e29b-41d4-a716-446655440000",
  "from_version": {
    "version": "1.0.0",
    "wasm_hash": "a1b2c3d4...",
    "source_url": "https://github.com/example/contract",
    "commit_hash": "f623ad...",
    "release_notes": "Initial release",
    "change_notes": null
  },
  "to_version": {
    "version": "1.1.0",
    "wasm_hash": "e5f6g7h8...",
    "source_url": "https://github.com/example/contract",
    "commit_hash": "c71a30...",
    "release_notes": "Added performance improvements",
    "change_notes": "Optimized execution cost"
  },
  "differences": [
    {
      "field": "wasm_hash",
      "from_value": "a1b2c3d4...",
      "to_value": "e5f6g7h8..."
    },
    {
      "field": "commit_hash",
      "from_value": "f623ad...",
      "to_value": "c71a30..."
    },
    {
      "field": "release_notes",
      "from_value": "Initial release",
      "to_value": "Added performance improvements"
    },
    {
      "field": "change_notes",
      "from_value": null,
      "to_value": "Optimized execution cost"
    }
  ],
  "wasm_changed": true
}

✅ Checklist

  • Code complies with the existing backend pagination patterns.
  • Tested with multiple combinations of query variables.
  • Added automated test coverage for empty result sets and combined query filters.
  • Pushed feature branch to remote origin.
  • Version comparison endpoint GET /api/contracts/:id/versions/compare registered and verified.
  • Pull request synchronized with the latest commits from the upstream main branch.
  • Resolved lockfile integration conflicts (backend/Cargo.lock) cleanly with the latest telemetry and observability updates.
  • Verified that the workspace compiles successfully.
  • Pushed and updated the remote branch feature/version-pagination-diff.

Closes #955

@vercel

vercel Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

@Robinsonchiziterem is attempting to deploy a commit to the aliphatichyd's projects Team on Vercel.

A member of the Team first needs to authorize it.

@ALIPHATICHYD
ALIPHATICHYD self-requested a review June 2, 2026 11:36
@vercel

vercel Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
soroban-registry Ready Ready Preview, Comment Jun 2, 2026 11:38am

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.

Add changelog and version history diff endpoints

2 participants