live coverage: moderations, OpenAI audio, DashScope legacy, Gemini Live realtime; whole-repo quality round - #38
Merged
Merged
Conversation
…ni Live realtime Four mock-only surfaces go live. OpenAI moderations and TTS/STT get matrix cases (characters and whole seconds land as billed units — the whisper run exercised the vendor-duration path). The DashScope legacy native wire runs against the real intl endpoint. The realtime bridge's Gemini dialect connects for real: the Live socket is one bidi RPC authed by key with the model in the setup frame, its frames are binary, and a turn is admitted on clientContent.turnComplete — the dialect's own generation signal — so the old cannot-gate 501 goes away; usageMetadata settles the turn non-estimated (verified live: prompt 146 / completion 24 audio tokens, transcript through outputAudioTranscription).
…he video reads The whole-repo audit (541 pub items swept, 11 mechanisms adjudicated) returned two cuts: SearchEngine::search_get lost its second caller with the CSE removal and folds back into the Brave arm; the two video read routes shared a verbatim admit+resolve+poll head that now lives whole in admit_video_job. Three audit-flagged coverage gaps get their tests: unpinned video/search models fail config load, a Kling business-error envelope is a 502 on submit and poll, and a delivered sync video reply must not register its task_id as an async job.
…s, estimates Codex round: the wire dialect now keys on the account's preset kind (Account.kind, stamped at providers: expansion) falling back to the raw provider label, so a provider named gemini-prod still speaks the Live socket — the same fix covers the video and search dialects. The bridge rewrites a gemini setup.model to the entitled served model (the socket carries no model, so the setup frame was a billing/entitlement bypass), refuses realtimeInput loudly until audio turns have an admission point, and the abort estimate counts gemini's serverContent parts so a disconnect after delivery bills instead of refunding.
Codex round 2: a clientContent.turnComplete arriving while a turn is pending would relay ungated and bill unreserved once the interrupted turn consumed the reservation; it now answers the same in-band error as realtimeInput. Docs carry the dialect contract.
The wire_kind insertion had orphaned base_url's doc onto the wrong item; the synthesized account's push-time kind was dead (the provider loop stamps every matching account two lines later); the output-delta doc names both dialects; the stale azure→Sora doc claim goes.
…apshot The Live API may send cumulative usageMetadata on any server frame; only reading it off the turnComplete frame degraded a split delivery to the prompt=0 output estimate. Each usage-bearing frame overwrites one snapshot, every boundary consumes it — used only when the boundary itself is bare, so same-frame usage and the estimate/refund fallbacks are unchanged.
A session dropped before turnComplete used to bill the byte estimate with prompt=0 even when a periodic usageMetadata frame had already reported real counts. A leftover snapshot now bills real prompt, audio modality shares, and max(reported, delivered-estimate) completion; the estimate/refund path is unchanged when no snapshot exists. The audio extraction takes the usage object directly (gemini_audio_tokens) instead of wrapping it in a synthetic frame.
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.
What
Live coverage — four mock-only surfaces go live (
de55b64)Protocol::Dashscope) runs against the real intl endpoint.clientContent.turnComplete— the dialect's own generation signal — so the old cannot-gate 501 is gone;usageMetadatasettles non-estimated.loc round (
ca58229) — whole-repo audit: 541 pub items swept (zero dead), 11 mechanisms adjudicated (all earned), two cuts applied (the CSE-orphanedsearch_getinlined; the video read routes' shared head folded intoadmit_video_job), three audit-flagged coverage gaps got tests (unpinned video/search model fails config load; Kling{code,message}envelope → 502 on submit and poll; a delivered sync video reply must not register its task_id as an async job).Codex rounds (
fc89987,729f983) — bidirectional review to convergence:Account.kind, stamped atproviders:expansion) falling back to the raw provider label — a provider namedgemini-prodnow still speaks the Live socket; the same fix covers the video and search dialects.setup.modelto the entitled served model (the setup frame was a billing/entitlement bypass).realtimeInputaudio turns and a secondclientContentduring an active generation answer an in-band error until they have an admission point (no reservation queue — the minimal fix Codex prescribed).serverContentparts, so a disconnect after delivery bills instead of refunding.Net: rust prod +122, tests +20, docs/harness +154.
E2E (live, real keys, billing oracle per row)
Full matrix on the final code: 129/133 effective-green — 125/129 in the main run plus gemini-rt and 3 Ollama cases re-verified green after an environment fix (the Ollama container had been cleaned up mid-run). The remaining 4:
kling-v1-6: 429 Account balance not enough — the trial package was deliberately burned to exhaustion in the PR 36 verification; vendor-side, re-arms on recharge.Performance
A/B bench vs main (
b545e5e), 10 interleaved reps both orders: serial 51.2→51.1 ms/2000 (−0.3 %), p50 25 µs identical, concurrent 202.7k→203.9k rps (+0.6 %), big-payload p50 −0.3 % / p99 −1.4 %. The final commit touches only a gemini-session frame check. No regression.Gates
cargo fmt --check/clippy -D warnings/cargo test --workspace: 544 passed / 0 failed; ruff clean on the harness. Docs updated: providers.md (gemini realtime row, kind-based dialect keys), api.md (realtime dialect contract), development.md (matrix scope).