Skip to content

feat(dart): add TransformationOptions for ingestion transporter configuration#6321

Open
MarioAlexandruDan wants to merge 22 commits into
mainfrom
feat/dart-transformation-options
Open

feat(dart): add TransformationOptions for ingestion transporter configuration#6321
MarioAlexandruDan wants to merge 22 commits into
mainfrom
feat/dart-transformation-options

Conversation

@MarioAlexandruDan
Copy link
Copy Markdown
Contributor

@MarioAlexandruDan MarioAlexandruDan commented Apr 30, 2026

🧭 What and Why

Part of the effort to standardize transformationOptions across all 11 language SDKs. Depends on the JS + Foundation ticket for CTS infrastructure.

🎟 JIRA Ticket API-379:

Changes included:

  • TransformationOptions.ingestionClientOptions: ClientOptions?: Reuses Dart's existing general-purpose ClientOptions instead of duplicating 8 fields like other languages had to.
  • ClientOptions.transformationOptions: Stored on config so the client constructs in one shot, consistent with how all other Dart client options work.
  • Spec timeouts via RequestOptions in every execute() call: Constructor defaults get silently overridden by callers passing their own ClientOptions, request-level always wins.
  • import 'dart:io' as io: The ingestion spec generates a Platform model that shadows dart:io.Platform at import time.
  • lib/src/extension.dart placeholder in client_ingestion: lib.mustache unconditionally exports this file in every package barrel, missing it breaks the build.
  • DartCTSManager snake_case → camelCase: Ingestion spec uses snake_case; CTS generator passed raw names producing uncompilable Dart constructor calls.
  • param_object.mustache aggregates additionalProperties: Old template generated one entry per extra field; Dart forbids duplicate named args in a single call.
  • runCts.ts dart in both mock validators: replaceAllObjectsWithTransformation calls chunkedPush internally, hitting the pushMock server indirectly.

🧪 Test

- Add TransformationOptions to client_core
- Add transformationOptions field to ClientOptions
- Generate algolia_client_ingestion Dart package
- Add ingestion transporter wiring to SearchClient template
- Implement chunkedPush, saveObjectsWithTransformation,
  partialUpdateObjectsWithTransformation, and
  replaceAllObjectsWithTransformation extensions
- Update pubspec_overrides across docs/tests/playground
@MarioAlexandruDan MarioAlexandruDan self-assigned this Apr 30, 2026
@algolia-bot
Copy link
Copy Markdown
Collaborator

algolia-bot commented Apr 30, 2026

✔️ Code generated!

Name Link
🪓 Triggered by 16d8b39344310decd4d49c3cf803cf799f64b79c
🍃 Generated commit c9a3a1de0973d75b30ed6b974e7fd89b7b4f9caa
🌲 Generated branch generated/feat/dart-transformation-options
📊 Benchmark results

Benchmarks performed on the method using a mock server, the results might not reflect the real-world performance.

Language Req/s
javascript 2298
go 2257
php 1819
java 1454
csharp 1453
python 1364
ruby 1030
swift 757
scala 23

@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented Apr 30, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

TIP This summary will be updated as you push new changes.

@MarioAlexandruDan MarioAlexandruDan force-pushed the feat/dart-transformation-options branch from b15c29b to 44910b3 Compare May 12, 2026 13:04
@MarioAlexandruDan MarioAlexandruDan force-pushed the feat/dart-transformation-options branch from a7ec108 to ee6ec15 Compare May 12, 2026 13:51
@MarioAlexandruDan MarioAlexandruDan force-pushed the feat/dart-transformation-options branch from d1bdb33 to 026e618 Compare May 12, 2026 14:15
@MarioAlexandruDan MarioAlexandruDan marked this pull request as ready for review May 13, 2026 13:07
@MarioAlexandruDan MarioAlexandruDan requested a review from a team as a code owner May 13, 2026 13:07
@MarioAlexandruDan MarioAlexandruDan requested a review from Fluf22 May 13, 2026 13:07
Copy link
Copy Markdown
Collaborator

@Fluf22 Fluf22 left a comment

Choose a reason for hiding this comment

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

I don't understand the changes you made around server timeouts, I might be missing something

Comment on lines +213 to +227
for (var retries = 0; retries < 50; retries++) {
try {
await transporter.getEvent(
runID: runID,
eventID: eventID,
requestOptions: requestOptions,
);
return;
} on AlgoliaApiException catch (e) {
if (e.statusCode != 404) rethrow;
}
await Future<void>.delayed(
Duration(milliseconds: (retries * 1500).clamp(0, 5000)),
);
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Silently returns after 50 retries
Add a throw exception at the end

required String eventID,
RequestOptions? requestOptions,
}) async {
for (var retries = 0; retries < 50; retries++) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The default is 100 now, and we want to pass maxRetries from the calling method I believe (check Dart jira ticket for maxRetries update)

Comment on lines +116 to +118
connectTimeout: ingestionOpts?.connectTimeout ?? const Duration(seconds: 25),
readTimeout: ingestionOpts?.readTimeout ?? const Duration(seconds: 25),
writeTimeout: ingestionOpts?.writeTimeout ?? const Duration(seconds: 25),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Shouldn't we let the ingestion code default the right duration?
Because if we change in the future, we would have two places to change instead of one

Comment on lines +224 to +227
) + {{/vendorExtensions.x-timeouts}}{{^vendorExtensions.x-timeouts}}RequestOptions(
writeTimeout: Duration(milliseconds: {{{serverWriteTimeout}}}),
readTimeout: Duration(milliseconds: {{{serverReadTimeout}}}),
connectTimeout: Duration(milliseconds: {{{serverConnectTimeout}}}),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not sure to understand why you added that

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.

3 participants