Skip to content

MS-1382 Explicitly throw exception on unsuccessful event up/down sync responses#1613

Merged
luhmirin-s merged 1 commit intorelease/2025.4.2from
hotfix/MS-1382-response-handling
Mar 17, 2026
Merged

MS-1382 Explicitly throw exception on unsuccessful event up/down sync responses#1613
luhmirin-s merged 1 commit intorelease/2025.4.2from
hotfix/MS-1382-response-handling

Conversation

@luhmirin-s
Copy link
Contributor

@luhmirin-s luhmirin-s commented Mar 12, 2026

JIRA ticket
Will be released in: 2025.4.2

Root cause analysis (for bugfixes only)

First known affected version: 2024.1.0

  • When retrofit interface returns Response<T> type, then it will never throw during call execution.

Notable changes

  • If event up and down sync requests return any non 2xx response, we now manually throw HttpException.
  • Sync tasks already expect that data source calls can throw (there are even unit tests for such cases).
  • Other cases of Response<T> are also already covered correctly.

Testing guidance

  • Sync should work as expected.
  • There isn't really a way to reliably reproduce the issue by hand, so we will have to rely on unit tests.

Additional work checklist

  • Effect on other features and security has been considered
  • Design document marked as "In development" (if applicable)
  • External (Gitbook) and internal (Confluence) Documentation is up to date (or ticket created)
  • Test cases in Testiny are up to date (or ticket created)
  • Other teams notified about the changes (if applicable)

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 fixes a sync reliability gap where Retrofit methods returning Response<T> don’t throw on non-2xx HTTP statuses, by explicitly throwing when event up-sync / down-sync requests return unsuccessful responses.

Changes:

  • Throw retrofit2.HttpException when down-sync download (downloadEvents) returns a non-2xx Response.
  • Throw retrofit2.HttpException when up-sync upload (uploadEvents) returns a non-2xx Response.
  • Add unit tests asserting exceptions are thrown for non-2xx responses for both download and upload paths.

Reviewed changes

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

File Description
infra/event-sync/src/main/java/com/simprints/infra/eventsync/event/remote/EventRemoteDataSource.kt Adds explicit non-2xx handling by throwing HttpException for download/upload responses.
infra/event-sync/src/test/java/com/simprints/infra/eventsync/event/remote/EventRemoteDataSourceTest.kt Adds tests validating exceptions are thrown when the Retrofit interface returns non-2xx Response objects.

@luhmirin-s luhmirin-s force-pushed the hotfix/MS-1382-response-handling branch from 524d098 to ab2a2b1 Compare March 12, 2026 15:56
@sonarqubecloud
Copy link

@luhmirin-s luhmirin-s changed the base branch from release/2025.4.1 to release/2025.4.2 March 17, 2026 10:41
@luhmirin-s luhmirin-s requested review from a team, BurningAXE, TristramN, alex-vt, alexandr-simprints, meladRaouf and ybourgery and removed request for a team March 17, 2026 10:42
@luhmirin-s luhmirin-s marked this pull request as ready for review March 17, 2026 10:42
@luhmirin-s luhmirin-s merged commit b6c1e1b into release/2025.4.2 Mar 17, 2026
13 checks passed
@luhmirin-s luhmirin-s deleted the hotfix/MS-1382-response-handling branch March 17, 2026 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants