[SDTEST-3768] Async API wrappers for the test-optimization backend#251
Merged
Conversation
…backend Replace the four synchronous service classes (Settings, KnownTests, TestManagement, ITR) with a typed-throwing async API layer under Sources/EventsExporter/API/. The new TestOptimizationApiService composes SettingsApi/KnownTestsApi/GitUploadApi/TestImpactAnalysisApi/ TestManagementApi/SpansApi/LogsApi; EventsExporter drives them synchronously through waitForAsync, which moves from DatadogSDKTesting into EventsExporter/Utils/Async.swift so it can be shared. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
calvinbayer
approved these changes
May 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Sources/EventsExporter/API/(SettingsApi,KnownTestsApi,GitUploadApi,TestImpactAnalysisApi,TestManagementApi,SpansApi,LogsApi) composed byTestOptimizationApiService. All methods useasync throws(APICallError)(orHTTPClient.RequestErrorat the transport boundary).SettingsService,KnownTestsService,TestManagementService,ITRService) and the legacy*Format.swiftpayload types.EventsExporternow owns a singleTestOptimizationApiServiceand drives it from its synchronous public surface viawaitForAsync.waitForAsyncfromDatadogSDKTestingintoEventsExporter/Utils/Async.swiftso the exporter can call it directly, removing the cross-module dependency for the bridge.HTTPClient,HTTPHeader,Endpoint,MultipartFormURLRequest) into theAPI/group alongside their consumers.HTTPClient.RequestError.httpnow carries response headers;APICallError.encodingcarries the offendingany Encodable;APICallError.decodingcarries the raw body soLibraryConfigurationCommunicationError.responseDecodingFailed(body:error:)can preserve the response payload end-to-end.TracerSettings(withEFD.TimeTable),SkipTests/SkipTestPublicFormat,KnownTestsResult/KnownTestsPageInfo/KnownTestsMap,TestManagementTestsInfo,ITRTestLevel,LibraryConfigurationCommunicationError. Pagination for known tests is preserved.Test plan
xcodebuild testforEventsExporteron macOS arm64 — 95/95 passingxcodebuild testforDatadogSDKTestingon macOS arm64 — 360/360 passingLibraryConfigurationServiceThrowTeststo driveEventsExporterdirectly; the success-path test uses a new request-id-echoing mock server to satisfy the restoredisIdValidcheck🤖 Generated with Claude Code