Skip to content

Conversation

@MarcelGeo
Copy link
Collaborator

@MarcelGeo MarcelGeo commented Dec 12, 2025

When pulling transaction starts in clients, we need to know in which version s client operating to perform successfull project info and finish of pull.

  • to_version key added to response
  • diff.path changed to diff.id in response as this path is abstract and for clients it's not path, just some file somewhere - it could be also name

Other:

  • improve handling of empty delta if since equals to to (or latest project version) -> returns items: [], bacuase clients will ping this endpoint everytime when somebody will try to pull.

…action integrity in clients:

- improve handling of empty delta if since equals to to (or latest project version) -> returns items: []
@MarcelGeo MarcelGeo requested review from Copilot and varmar05 and removed request for Copilot December 12, 2025 11:58
@MarcelGeo MarcelGeo requested a review from harminius December 12, 2025 12:00
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a to_version field to the project delta API response and modifies the validation logic to allow queries where since equals to (previously returned a 400 error). This change enables clients to poll the delta endpoint without errors when no changes have occurred since their last sync.

Key Changes:

  • Added to_version field to delta response schema to indicate the target version
  • Modified validation to allow since == to queries, returning an empty items list instead of an error
  • Updated error messages to be more descriptive and contextually appropriate

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
server/mergin/sync/public_api_v2_controller.py Updated validation logic to allow since == to, refactored error messages, and added to_version to response
server/mergin/sync/files.py Added to_version field to DeltaChangeRespSchema with required=True
server/mergin/sync/public_api_v2.yaml Added to_version property to ProjectDeltaResponse schema and minor formatting fix
server/mergin/tests/test_public_api_v2.py Added test assertions for to_version field, new test for since==to case, removed old test that expected 400 for same versions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coveralls
Copy link

coveralls commented Dec 12, 2025

Pull Request Test Coverage Report for Build 20166872065

Details

  • 35 of 35 (100.0%) changed or added relevant lines in 3 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.009%) to 94.539%

Files with Coverage Reduction New Missed Lines %
server/mergin/sync/public_api_v2_controller.py 1 91.14%
Totals Coverage Status
Change from base Build 19732530660: 0.009%
Covered Lines: 8656
Relevant Lines: 9156

💛 - Coveralls

@MarcelGeo MarcelGeo changed the title Added to_version as latest project version to delta reponse Added to_version as latest project version to delta reponse + another response updates Dec 12, 2025
"""Schema for diff file path in diffs list"""

path = fields.String(required=True)
id = fields.String(required=True)
Copy link
Collaborator

Choose a reason for hiding this comment

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

update also docstring

@MarcelGeo MarcelGeo merged commit ab7aeda into dev-r85-v2-pull Dec 16, 2025
4 checks passed
@MarcelGeo MarcelGeo deleted the provide-to-version branch December 16, 2025 21:40
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.

4 participants