Skip to content

refactor(decopilot): replace ban-types Function with a real call signature - #6672

Merged
pedrofrxncx merged 1 commit into
mainfrom
refactor/studio-provider-ban-types-function
Aug 28, 2026
Merged

refactor(decopilot): replace ban-types Function with a real call signature#6672
pedrofrxncx merged 1 commit into
mainfrom
refactor/studio-provider-ban-types-function

Conversation

@pedrofrxncx

@pedrofrxncx pedrofrxncx commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Source: C-DEBT — a ban-types-violating Function cast in studio-provider.ts (this repo's no-explicit-any/ban-types rules are warn-level, not CI-enforced, so this kind of thing accumulates uncaught). Distinct file from #6671 (which covers built-in-tools/index.ts and run-code.ts) — not a duplicate.

What/why: createLanguageModel's make() helper calls provider.aiSdk.languageModel with a provider-specific second settings argument that isn't part of the declared ProviderV3 interface (which only takes (modelId: string)). It reached for the banned Function type to bypass this, wrapped in a biome-ignore suppression 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 by Function, 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 --noEmit in 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, targeted tsc --noEmit in apps/api, oxlint on the changed file. Full CI validates the rest.


Summary by cubic

Replaces the banned Function cast in studio-provider.ts with 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.

Review in cubic

…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.
@pedrofrxncx
pedrofrxncx merged commit 7dd2b8d into main Aug 28, 2026
33 checks passed
@pedrofrxncx
pedrofrxncx deleted the refactor/studio-provider-ban-types-function branch August 28, 2026 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant