refactor(kilo-auto-model): replace string-keyed maps with zod enums#1749
Merged
chrarnoldus merged 2 commits intomainfrom Mar 31, 2026
Merged
refactor(kilo-auto-model): replace string-keyed maps with zod enums#1749chrarnoldus merged 2 commits intomainfrom
chrarnoldus merged 2 commits intomainfrom
Conversation
Contributor
Author
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (1 files)
|
cb5d74f to
21e70e4
Compare
21e70e4 to
399aae4
Compare
markijbema
approved these changes
Mar 31, 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.
Summary
modeSchema(z.enum) for the mode routing keys used inFRONTIER_MODE_TO_MODELandBALANCED_MODE_TO_MODEL, replacingRecord<string, ...>withRecord<Mode, ...>legacyModelIdSchema(z.enum) for legacy model IDs, replacingRecord<string, AutoModel | undefined>with a fully-typedRecord<..., AutoModel>Object.hasOwn(...)guard hacks are eliminated; membership is now checked viaz.enum.safeParse()Verification
pnpm typecheckcould not run in the local environment (tsgonot installed), but the types are straightforwardly correct:Record<Mode, ...>requires all enum members be present (exhaustive), andsafeParsereturns a discriminated union that narrows the key type.Visual Changes
N/A
Reviewer Notes
KILO_AUTO_FREE_MODEL_DEPRECATEDis now typed asz.infer<typeof legacyModelIdSchema>(i.e.'kilo/auto' | 'kilo/auto-free') rather than plainstring, which is strictly more precise. Callers that compare it with===are unaffected.