fix: change Antigravity field from map to array to match remote models.json format#2
Open
I3eg1nner wants to merge 1 commit into
Open
fix: change Antigravity field from map to array to match remote models.json format#2I3eg1nner wants to merge 1 commit into
I3eg1nner wants to merge 1 commit into
Conversation
…s.json The remote models.json (router-for-me/models) changed antigravity from a map format to an array format (consistent with all other sections like claude, gemini, etc.). However, the Go struct in staticModelsJSON still expected a map, causing the binary to panic on startup with: " json: cannot unmarshal array into Go struct field
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.
Problem
The binary built from
mainpanics on startup with:panic: registry: failed to parse embedded models.json: embed: decode models
catalog: json: cannot unmarshal array into Go struct field
staticModelsJSON.antigravity of type
mapstring*registry.AntigravityModelConfig
Root Cause
The remote
models.json(maintained atrouter-for-me/models) changed theantigravitysection from a map format to an array format — consistent with all other sections (claude,gemini,codex-*, etc.). However,staticModelsJSONininternal/registry/model_definitions.gostill declaredAntigravityasmap[string]*AntigravityModelConfig.This is a runtime contract mismatch — Go compilation succeeds regardless, so CI cannot catch it.
Changes
AntigravityModelEntrystruct with anIDfield to support array-based model entriesstaticModelsJSON.Antigravityfrommap[string]*AntigravityModelConfigto[]*AntigravityModelEntryGetAntigravityModelConfig()to iterate over the arrayLookupStaticModelInfo()to search the array byIDvalidateAntigravitySection()to validate array entries, now with duplicate ID detectionVerification
The commit compiles cleanly and passes all existing tests. The remote
models.jsonathttps://raw.githubusercontent.com/router-for-me/models/refs/heads/main/models.jsonnow parses successfully.