Skip to content

refactor(translate): expose prepared translation trips - #709

Merged
Menci merged 7 commits into
mainfrom
refactor/translate-public-boundary
Nov 12, 2026
Merged

Menci merged 7 commits into
mainfrom
refactor/translate-public-boundary

Conversation

@Menci

@Menci Menci commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Expose named route functions and ordinary TranslateTrip | TranslateInputError outcomes. Trips provide target, events and error; gateway callers consume input errors locally and encode translated JSON error bodies at the transport boundary.

Translation input failures advance to the next candidate, allowing a different model's target protocol or middleware to serve the request. Terminal Gemini token-counting input failures retain their API-error result and performance attribution through response rendering, so the final failure is recorded once.

Request builders, native event adapters and replay behavior retain main semantics. Existing model and loader inputs remain until #673 replaces the request backend.

Protocol-native Responses request canonicalization and Gemini Part/status facts live in @floway-dev/protocols. Native HTTP/WS callers consume that boundary directly; translation entrypoints adapt protocol input failures to ordinary input-error results. Existing gateway status policies are preserved.

Validation: the prior 31 named files (690 tests), translate/gateway TypeScript projects and scoped lint; the telemetry repair additionally passed five named gateway suites (51 tests), gateway TypeScript and three-file lint. HTTP regressions verify one final failure record with the last candidate's attribution and successful fallback without an intermediate failure record.

Replace fluent protocol subpaths with named root translators returning plain trips or input failures. Keep request builders and event adapters intact while containing expected input exceptions at public operations.

Consume translation failures at gateway attempt and payload boundaries, and encode rewritten JSON errors at the transport boundary. Preserve the current model context and remote-image loader requirements for the pairwise request backend.

Validate named translation and gateway suites, owning TypeScript projects, and changed lint targets.
Preserve the param and code supplied by raw translation input failures in Messages and GenerateContent error envelopes. Omit absent details and keep the rejecting candidate performance context intact.

Keep protocol error results precise and validate both detail envelopes, the named translation boundary suites, and gateway TypeScript checks.
Port the reviewed capture, error telemetry, and Responses attempt explanations to their public-boundary owners. Remove redundant dispatcher and assertion narration and update the dashboard capture reference.
Keep the reviewed Struct Any explanation beside the public-boundary field-preservation matrix.
Move Responses canonicalization and Gemini Part classification into their protocol modules. Protocol errors are ordinary native data, adapted at translation entrypoints. Share HTTP/RPC status facts while preserving gateway status policy.
Keep expected token-counting input failures as gateway API errors so final response rendering records the selected candidate's zero-output error. Preserve fallback across candidates and verify final failure attribution and successful fallback through real HTTP requests and performance records.
…blic-boundary

# Conflicts:
#	packages/translate/__tests__/protocols/openai-chat-completions/as-source/continuous-usage_test.ts
#	packages/translate/__tests__/protocols/round-trip-receive_test.ts
#	packages/translate/__tests__/protocols/routes_test.ts
#	packages/translate/src/protocols/openai-chat-completions/via-openai-responses/content.ts
#	packages/translate/src/protocols/openai-responses/via-anthropic-messages/request.ts
#	packages/translate/src/protocols/openai-responses/via-openai-chat-completions/content.ts
@Menci
Menci marked this pull request as ready for review November 12, 2026 11:43
@Menci
Menci merged commit 981a120 into main Nov 12, 2026
21 checks passed
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.

1 participant