test: make #57's trigger fire for the person who trips it - #159
Merged
Conversation
#57 proposed a typed ProviderMetadata enum, with an explicit conditional: do it "the moment a second provider needs provider_metadata". An open issue is a poor mechanism for a conditional — whoever adds OpenAI reasoning IDs will not read the tracker first, so the reminder fires for nobody. It sat open since 2026-07-05 doing exactly that. This fails in the diff that trips it, naming the file, the line, and what to do instead. Deliberately not a grep for `provider_metadata: Some`. The Gemini production sites assign a variable, and the Some literals in those files are test fixtures — matching on Some would guard test code and miss the real writes. The invariant that holds today is the stronger one: every provider outside the Gemini family writes the literal None. Two exclusions, both earned by the guard failing on them first. A struct field declaration is not a write (mock.rs declares the field on its fixture type). And mock.rs echoes whatever MockToolCall was given, so it forwards metadata rather than originating any — it cannot be the second family this watches for. Verified against the real trigger: adding `provider_metadata: Some(json!({"reasoning_id": "r-1"}))` to openai_responses.rs fails it with the file, the line and the remedy. The source-reading itself is guarded too — a layout change that made this read nothing fails rather than passing green. 629 passed, clippy clean under -Dwarnings. Closes #57
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.
Closes #57 by moving its conditional somewhere it will actually be noticed.
Why not just leave the issue open
#57 proposed replacing
Content::ToolCall.provider_metadata's untypedOption<serde_json::Value>with a typed, namespaced enum. Its own "when to do this" was a conditional:An open issue is a poor mechanism for a conditional. Whoever adds OpenAI reasoning IDs will not check the tracker first, so the reminder fires for nobody — which is what happened: open since 2026-07-05, doing nothing.
This test fires for exactly that person, at exactly that moment, in the diff that trips it:
The issue's analysis is preserved in the test's module docs, including why now is the last cheap moment: after a second family ships, persisted
SessionJSONL carries the untyped shape and the migration inherits a serde back-compat burden it doesn't need.What it actually checks
Deliberately not a grep for
provider_metadata: Some. The Gemini production sites assign a variable (provider_metadata: metadata), and theSomeliterals in those files are test fixtures — so matching onSomewould guard test code and miss the real writes. The invariant that holds today is the stronger one: every provider outside the Gemini family writes the literalNone.Two exclusions, both earned by the guard failing on them first rather than assumed up front:
mock.rsdeclares the field on its fixture type.mock.rsechoes whateverMockToolCallwas handed, so it forwards metadata rather than originating any. It cannot be the second family this watches for.Verification
openai_responses.rswriting areasoning_id→ fails, naming file, line and remedycargo test --all-features: 629 passed, 0 failed. Clippy clean under-Dwarnings.Test-only — no library change.
🤖 Generated with Claude Code