Repository navigation
test: keep one owner test per contract in the TypeScript and Python SDKs - #84
Merged
Merged
Conversation
Each package keeps one test per contract at the strongest boundary, which is usually the real provider client with a fake network. The removed tests did the same checks through hand-built events, private helpers, or exact transport retry replays that the otel transport suite already owns. Some kept assertions could not fail. These assertions are repaired. For each repair, a deliberate change to the owner code made the test fail. The ai@7 step-end test now runs through the real generateText dispatcher. Internal exports that only tests used are removed. The public package entries do not change.
Each package keeps one test per contract, through the real provider client with a fake network where one exists. Tests that do the same checks on private helpers are removed. Some kept assertions could not fail. These assertions are repaired. For each repair, a deliberate change to the owner code made the test fail. Private parameters and fallbacks that only tests used are removed from the core metrics module and the OpenAI and Anthropic integrations.
The SDK model keeps the "from" field of a fallback block under the Python name "from_", and it also keeps the wire key "from" as an extra field. The captured output of the unary and the stream paths had the two keys. The unary path now dumps the model by alias. The stream path changes field names to their aliases from the class field table, so that no property runs during the bounded read.
# Conflicts: # packages/ai/tests/integration.test.ts # packages/tanstack-ai/tests/middleware.test.ts
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.
Each contract in the TypeScript packages and the Python SDKs now has one owner test, usually through the real provider client with a fake network. Tests that did the same check again with hand-built events, private helpers, or transport retry replays are removed. The tests have 1,814 fewer lines, and the production code has 62 fewer lines.
Some kept assertions could not fail, and the audit repaired them. For example, the ai@7 step-end test called
onStepEndby hand, so it could not see a second step-end hook. It now runs through the realgenerateTextdispatcher, and a second hook makes a second span. For each assertion that the audit added or repaired, a deliberate error in the owner code made the test fail.Reviewers who did not write the changes compared the deleted coverage with the owner tests. They found contracts with no remaining proof. One example is the restore of a
sendmethod that another wrapper installed beforeinstrumentBedrock(). Each contract is back in its owner test.The audit found one product defect. The Python Anthropic integration recorded a fallback content block with the wire key
fromand also with the Python field namefrom_. The SDK model keeps the field underfrom_and the wire key as an extra field. The unary path now dumps the model by alias, and the stream path changes field names to their aliases. The OpenRouter, LiteLLM, and Google GenAI integrations do not have this defect.The fix is the
fix(sdk-anthropic)commit. Merge this PR with a merge commit, so that release-please sees that commit and proposes atelemetry-dev-anthropicrelease.The production changes remove only private code that tests alone used, such as the
max_attribute_setsparameter ofOutputChunkAggregationand theexpect_message_stopflag of the Anthropic stream state. The public package entries do not change.postOtlpandmaybeGzipstay public exports of@telemetry-dev/otel, although only the package uses them.Related: #83
Telemetry.dev PR: telemetry-dev/telemetry.dev#447