refactor(decopilot): replace ban-types Function with a real call signature - #6672
Merged
Merged
Conversation
…ature studio-provider.ts cast provider.aiSdk.languageModel to the banned Function type (behind a biome-ignore suppression) to call it with a provider-specific second settings argument outside ProviderV3's declared single-arg signature. Cast to the real (id, settings) => LanguageModelV3 signature instead, so a signature drift is a compile error again and the suppression comment goes away.
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.
Source: C-DEBT — a
ban-types-violatingFunctioncast instudio-provider.ts(this repo'sno-explicit-any/ban-typesrules arewarn-level, not CI-enforced, so this kind of thing accumulates uncaught). Distinct file from #6671 (which coversbuilt-in-tools/index.tsandrun-code.ts) — not a duplicate.What/why:
createLanguageModel'smake()helper callsprovider.aiSdk.languageModelwith a provider-specific secondsettingsargument that isn't part of the declaredProviderV3interface (which only takes(modelId: string)). It reached for the bannedFunctiontype to bypass this, wrapped in abiome-ignoresuppression comment. Replaced the cast with the real call signature(id: string, settings: Record<string, unknown>) => LanguageModelV3— same runtime behavior, but now a signature drift on the underlying provider is a compile-time error instead of silently swallowed byFunction, and the suppression comment is gone.Confirms behavior is unchanged: pure type-level change — the call site and its two branches (with/without settings) are untouched, only the cast's declared type changed.
bunx tsc --noEmitin apps/api is green on the file, no runtime logic touched.Reviewer check:
cd apps/api && bunx tsc --noEmit(green),bunx oxlint apps/api/src/harnesses/lib/decopilot/studio-provider.ts(0 warnings/errors).Locally verified:
bun run fmt, targetedtsc --noEmitin apps/api,oxlinton the changed file. Full CI validates the rest.Summary by cubic
Replaces the banned
Functioncast instudio-provider.tswith the real call signature(id: string, settings: Record<string, unknown>) => LanguageModelV3, so provider signature drift is caught at compile time instead of being silently swallowed.This is a pure type-level refactor—the call site and runtime behavior are unchanged.
Written for commit 5f5cbde. Summary will update on new commits.