refactor!: remove backwards-compat shims (aliases, legacy preamble, extractor usage API, persisted-format tolerance, dead model ids) - #2420
Open
gold-silver-copper wants to merge 4 commits into
Conversation
…acro, ToolRegistrySnapshot, CompletionCall event, bedrock historical constant names)
…l, deepseek, moonshot)
System instructions are carried solely by leading Message::System entries in chat_history (what the builder has emitted since 0.33). Providers no longer read the dead field; hand-built requests must put the system prompt in chat_history. Telemetry system_instructions, which was fed only by the dead field, now reports none.
…trict persisted-format serde - extract/extract_with_chat_history now return ExtractionResponse<T> (data + usage); the _with_usage variants are deleted (~120 call sites migrated). - The extractor no longer silently discards unhandled invalid tool calls (legacy extractor-transport semantics); unresolved invalid calls fail the attempt and the retry loop retries. AgentRun::ignore_invalid_tool_call is removed. - CompletionCall.usage is a required object: the pre-monoid "usage": null encoding no longer deserializes (run records, stream items, suspended runs); pinning tests flipped to assert rejection. - json_utils::string_or_vec no longer accepts null; the one field where null is a real wire shape (OpenAI tool-calls-only assistant content) uses the new string_null_or_vec. - Stale "backward compatibility" test labels rewritten; MIGRATING.md documents every break under 0.41 -> next.
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.
A sweep removing every remaining backwards-compatibility shim, per the project's no-backcompat policy. Every break is documented in MIGRATING.md ("Backwards-compat shims removed" under 0.41 → next).
Removed
Rename aliases (pure old-name shims):
rig_candle::ModelFamily→ useConversationProtocol;rig_candle::LlamaModel→ useCandleModel(internal code mass-renamed to the canonical names)rig::tool_macro/rig_agent::tool_macrore-exports ofrig_toolrig_agent::tool::server::ToolRegistrySnapshotalias ofToolCatalogrig_bedrock::embedding's historical constant names (AMAZON_TITAN_EMBED_TEXT_V1etc.) aliasing the canonicalcompletionconstantsCompletionCallEventitself (washook::CompletionCall+ a renaming re-export), ending the collision with the run-recordCompletionCallCompletionRequest::preamble— the legacy field "preserved for backwards compatibility". The builder has funneled the preamble into a leadingMessage::Systemsince 0.33 and always emittedpreamble: None; every provider read of the field was a dead parallel channel for hand-built requests. Providers now derive system instructions solely from leading system messages (they already did).CompletionRequestBuilder::preamble(..)survives as pure build-time sugar. Provider telemetrysystem_instructions, fed only by the dead field, now reports none.Extractor API —
extract_with_usage/extract_with_chat_history_with_usagedeleted;extract/extract_with_chat_historynow returnExtractionResponse<T>({ data, usage }). ~120 call sites migrated.Extractor legacy-transport policy —
ignore_unhandled_invalid_tool_calls(invalid tool calls silently discarded in extractor runs) removed; unresolved invalid calls now fail the attempt and the extractor's retry loop retries.AgentRun::ignore_invalid_tool_call, which existed only for that policy, is removed.Retired provider model constants — all 13
#[deprecated]model ids (Cohere ×6, Mistral ×5, DeepSeek ×2) plus the undeadMOONSHOT_CHAT(moonshot-v1-128k, doc-marked "(legacy)") are deleted rather than left warning; the providers no longer serve these models.Persisted-format tolerances:
CompletionCall.usageis a required object — the pre-monoid"usage": nullencoding no longer loads (run records, stream items, suspendedAgentRunstate). Pinning tests flipped to assert rejection.json_utils::string_or_vecre-tightened:nullis a loud error again. The one field wherenullis a real wire shape (OpenAI assistant content on tool-calls-only messages) uses the newstring_null_or_vec, so provider decoding is unchanged.Considered and deliberately kept
AdditionalParams{}/null→ absent canonicalization — this is the type's core absence doctrine (non-empty-map invariant), not a bolt-on compat path; removing it would break the design, including serialization-skip symmetry.PromptResponse::new(output, usage)/TypedPromptResponse::new— flagged by a test comment as "backward compatibility", butnew+with_*is the intended builder shape; only the stale test labels were rewritten.PromptResponse,CompletionCall,AgentRun), so the re-exports are load-bearing.bootstrap_token_fingerprint: Option<String>— user on-disk auth state, fail-safe (Noneforces refresh), cheap.#[serde(alias)]sites — verified to handle currently-live provider wire dialects (OpenAIdeveloperrole, gatewayrole: "model", Mistral dual spelling, Jina/TEI rerank keys, …), not rig compat.keys_lost_in_round_trip— opt-in migration tooling, correctly outside the load path.Verification
cargo check/clippy --workspace --all-features --all-targets: cleancargo check --target wasm32-unknown-unknownfor rig-core/rig-agent/rig-run: cleancargo nextest run --workspace --all-features): 6239/6239 passed (213 skipped)