Skip to content

Conversation

@The-Best-Codes
Copy link
Contributor

Closes #1556

This upgrades the project to use the latest version of the AI SDK (v5.0.89). It also upgrades provider packages to versions compatible with AI SDK 5.
Note: The ollama-ai-provider package doesn't support AI SDK 5, so I swapped it out for the ollama-ai-provider-v2 package, which is recommended in AI SDK's docs.

The point of these upgrades is to address a security advisory which, though minor, was affecting some users' ability to ship Lingo.dev in production as it failed SOC 2 checks.

@The-Best-Codes
Copy link
Contributor Author

Don't merge yet, please, as I am still manually testing locally. I'll provide an update here if all my manual tests do fine.
cc @maxprilutskiy

Copy link
Contributor Author

@The-Best-Codes The-Best-Codes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ready to merge. Tested locally with Google, Groq, and OpenRouter.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR upgrades the AI SDK from v4 to v5 (specifically v5.0.89) to address a security advisory (GHSA-rwvc-j5jr-mgvh) that was affecting production deployments with SOC 2 compliance requirements.

Key changes:

  • Upgraded core ai package from v4.3.15 to v5.0.89
  • Upgraded all AI SDK provider packages to v2 versions (anthropic, google, groq, mistral, openai, openrouter)
  • Replaced ollama-ai-provider with ollama-ai-provider-v2 as recommended by AI SDK v5 documentation
  • Updated TypeScript types to match AI SDK v5 API (LanguageModelV1LanguageModel, MessageModelMessage)

Reviewed Changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pnpm-lock.yaml Updated dependency versions for AI SDK v5 and all provider packages
packages/cli/package.json Upgraded AI SDK dependencies to v2 and core ai package to v5.0.89
packages/compiler/package.json Upgraded AI SDK dependencies to v2 and core ai package to v5.0.89
packages/cli/src/cli/processor/index.ts Updated import to use ollama-ai-provider-v2
packages/cli/src/cli/processor/basic.ts Updated type from LanguageModelV1 to LanguageModel
packages/cli/src/cli/localizer/explicit.ts Updated import to ollama-ai-provider-v2 and type from Message to ModelMessage
packages/compiler/src/lib/lcp/api/index.ts Updated import to use ollama-ai-provider-v2
.changeset/pink-lemons-buy.md Added changeset documenting the upgrade
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

name: "I18nConfig",
markdownDescription: true,
const schema = toJSONSchema(LATEST_CONFIG_DEFINITION.schema, {
target: "openapi-3.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: Ensure this is the correct way to migrate this

Copy link
Contributor Author

@The-Best-Codes The-Best-Codes Nov 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maxprilutskiy The file this script generates does change quite a bit after the Zod 4 upgrade, but I'm not sure how much that matters... I think the docs script is used internally in some way? Can you give me any details on what the generate-config-docs.ts script does and if it's important for the output schema to stay the same?

Copy link
Contributor Author

@The-Best-Codes The-Best-Codes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still working on migrating to Zod 4, don't merge this!

Signed-off-by: The-Best-Codes <[email protected]>
Signed-off-by: The-Best-Codes <[email protected]>
@The-Best-Codes The-Best-Codes marked this pull request as draft November 15, 2025 20:31
{
text: Z.string(),
targetLocale: Z.string().regex(/^[a-z]{2}(-[A-Z]{2})?$/),
text: Z.string() as any,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to manually test the MCP server

Copy link
Contributor Author

@The-Best-Codes The-Best-Codes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ready for review, I have a couple of things to manually test so don't merge unless you test everything yourself and it works fine 😄

@The-Best-Codes The-Best-Codes marked this pull request as ready for review November 15, 2025 21:38
Copilot finished reviewing on behalf of maxprilutskiy November 17, 2025 12:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 22 out of 23 changed files in this pull request and generated 18 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@maxprilutskiy
Copy link
Contributor

maxprilutskiy commented Nov 17, 2025

@The-Best-Codes have a look - a couple of interesting comments, and some prefault vs default issues that look a bit odd to me (is "prefault" a thing? what does it do?)

@The-Best-Codes
Copy link
Contributor Author

The-Best-Codes commented Nov 17, 2025

@maxprilutskiy Copilot mostly doesn't have a clue what it's talking about. Zod v4 change the .default behavior. The Zod v3 .default behavior is moved to the .prefault function in Zod v4, which they recommend using for backwards compatibility:

https://zod.dev/v4/changelog#default-updates:~:text=To%20replicate%20the%20old%20behavior%2C%20Zod%20implements%20a%20new%20.prefault()%20API.%20This%20is%20short%20for%20%22pre%2Dparse%20default%22

@sumitsaurabh927
Copy link
Contributor

hi @The-Best-Codes please resolve the merge conflicts. Thanks!

@The-Best-Codes
Copy link
Contributor Author

The-Best-Codes commented Nov 19, 2025

Just need maintainer feedback on this:
lingodotdev/lingo.dev/pull/1559/#discussion_r2530204932

Also need to test the MCP server manually. Otherwise, this is read to merge.

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.

Upgrade from AI SDK v4 to v5

3 participants