refactor: Convert WebSearchSource enum to const object with Zod schema#12866
Merged
kangfenmao merged 1 commit intomainfrom Feb 12, 2026
Merged
refactor: Convert WebSearchSource enum to const object with Zod schema#12866kangfenmao merged 1 commit intomainfrom
kangfenmao merged 1 commit intomainfrom
Conversation
kangfenmao
approved these changes
Feb 12, 2026
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.
What this PR does
Before this PR:
WebSearchSourcewas defined as a TypeScriptenum.After this PR:
WebSearchSourceis converted to anas constobject (WEB_SEARCH_SOURCE) with a Zod schema (WebSearchSourceSchema) and a derived type (WebSearchSource).Part of #12846 — split out as a separate PR to reduce the number of files to review in the final refactor PR.
Why we need it and why it was done in this way
This aligns
WebSearchSourcewith the project's existing convention of usingas constobjects instead of enums (e.g.,EFFORT_RATIO,FILE_TYPE). The Zod schema integration also enables runtime validation.The following tradeoffs were made:
WEB_SEARCH_SOURCE(UPPER_SNAKE_CASE) to follow the const object convention, while the type nameWebSearchSourceis preserved for backward compatibility.The following alternatives were considered:
Breaking changes
None. All runtime string values remain identical. This is a purely internal refactor.
Special notes for your reviewer
pnpm build:checkpasses (lint + 3026 tests + typecheck).AiSdkToChunkAdapter.ts:35still references the oldWebSearchSourcename — can be cleaned up separately.Checklist
Release note