fix(sdk): classify a missing adapter by structured signal only - #257
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Aligns the TypeScript SDK’s Vercel AI provider adapter-import error classification with SPEC §6.5 by relying only on structured signals (error code) when deciding whether an adapter is missing, avoiding misclassification driven by free-text messages.
Changes:
- Removed the free-text
/cannot find (module|package)/imessage fallback from the missing-adapter detector. - Kept classification based on Node-style resolution
codevalues (ERR_MODULE_NOT_FOUND/MODULE_NOT_FOUND) while continuing to walk thecausechain.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Merged
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.
SPEC §6.5: "Classify by structured signals only … Free-text message matching MUST NOT reclassify an error: wording is not a contract, and a misclassification is worse than the catch-all."
The adapter-import classifier added in #254 matched on message text as a fallback:
So an adapter that is installed but throws while loading — with a message that happens to mention a module it could not find, which is exactly what a missing transitive dependency looks like — was reported as
ConfigurationError: install its adapter. That is the misclassification #254 set out to remove, reintroduced one layer down and driven by wording.Fix
Structured signal only: the resolution
code(ERR_MODULE_NOT_FOUND/MODULE_NOT_FOUND), still walked through thecausechain because bundlers and loaders wrap import failures and keep the real error underneath.The message check turns out to have been unnecessary as well as non-conformant — I added it when the test harness threw an uncoded error, before discovering the harness preserves the coded original as
cause. All 42 provider tests pass without it.Validation
typecheck,lint,test:unit(1364),verify:dist(6/6),scripts/check.pynpm packinstall with only@ai-sdk/googlepresent: stillConfigurationError, stillinstanceof DependencyError === false, same messageConfigurationErrorFound by auditing the SDK against
sdks/SPEC.md(PR #162) rather than by a failing test.