Skip to content

refactor: share the AI provider transport and the core driver scaffolding - #4317

Merged
datlechin merged 2 commits into
mainfrom
refactor/shared-transports-4274
Nov 18, 2026
Merged

datlechin merged 2 commits into
mainfrom
refactor/shared-transports-4274

Conversation

@datlechin

Copy link
Copy Markdown
Member

Summary

AI-12 (macOS, apple/TablePro/Core/AI):

  • AIProviderTransport: one HTTP layer the Claude, OpenAI-compatible, OpenAI Responses and Gemini providers configure (endpoint style, fixed headers, whether 403 means a rejected key). It builds the requests, reads the model list, sorts a connection test's answer and maps HTTP errors.
  • ChatStreamWire: one stream pipeline (error frame, wire parse, empty-reply check, usage) with ToolCallTracker for tool-call ids. Each provider keeps only its wire mapping: AnthropicStreamWire, ChatCompletionsStreamWire, ResponsesStreamWire (also the ChatGPT backend), GeminiStreamWire. ResponsesEventStream is gone.
  • Request bodies, headers, URLs and the events of a well-formed stream are unchanged.
  • Changed on purpose: a Claude, Responses or Gemini stream that ends with no content and no end-of-reply frame now fails like the OpenAI-compatible one already did, instead of showing an empty reply (a Gemini prompt blocked by its safety filter still ends normally); an error event with no message (Claude, Responses) fails the stream instead of being skipped; a repeated start for a tool call that is still open is ignored.
  • Tests updated for the new entry points, same assertions: the parser tests of each provider, OutputLimitSignalTests, ProviderStreamFailureTests, SSEEventStreamTests. The shouldBreak flag the stream never read is gone; its two cases now check that done ends the response.

CD-08 (core, core/crates):

  • tablepro_core::EditorSessionStatus replaces the run claim copied in ClickHouse, MongoDB, Redis and Cassandra; PostgreSQL wraps it with its transaction state. A Cassandra keyspace move that a close interrupts no longer marks the closed session ready.
  • tablepro_core::deadline_elapsed replaces the deadline sleep copied across the drivers and the session's health monitor.
  • tablepro_core::ReadEmitter replaces the export Emitter in the ClickHouse, PostgreSQL, MySQL, SQL Server and Cassandra stream_read.rs, with the same 256-row batches.
  • WriteBatch::precheck holds the read-only and foreign-key refusal five drivers repeated.
  • The 256-row chunk constants point at RowBatch::MAX_ROWS.

Not in this PR: AR-11 (Swift and Rust duplicates of importers, MCP and SSH) and AR-04 (unit tests that need the app host) stay open on the issue for later runs.

Test plan

  • New: every provider's stream fails when it ends with nothing in it and ends normally on its end frame alone; Claude and Responses error events without a message fail; an HTML 200 and an error frame fail the shared stream; tracker order and repeated starts; transport headers, timeouts and the invalid-endpoint error.
  • verify.sh test on the 29 AI provider suites: 285 passed. verify.sh lint and l10n pass.
  • cargo test --lib, clippy -D warnings and fmt --check pass for tablepro-core, tablepro-session and the nine drivers; every test target, the Docker suites included, compiles. The Docker suites run in CI.

Refs #4274

@datlechin
datlechin merged commit 60e1e52 into main Nov 18, 2026
34 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