fix(model): parse model specs with multiple slashes and colons correctly#930
fix(model): parse model specs with multiple slashes and colons correctly#930decode2 wants to merge 2 commits into
Conversation
The test was hardcoding Unix-style paths (~/.config/gga/config) but gga.ConfigPath() uses %APPDATA%\gga\config on Windows. Use the gga package functions to get platform-correct paths instead of hardcoding. This ensures the test works correctly on all platforms.
The read-path parser in ReadCurrentModelAssignments was splitting on the first colon before checking for slashes. This broke model specs like 'openrouter/qwen/qwen3.6-plus:free' where the provider is before the first slash, not before the colon. Changed the parsing logic to find the first separator (either '/' or ':') instead of preferring colon-first. This aligns with the write-path parser in parseModelSpec (sync.go) which already handles this correctly. Added test coverage for OpenRouter free-model specs with the format 'provider/org/model:variant'. Fixes Gentleman-Programming#802
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughFixes the colon-first separator bug in ChangesSDD model spec first-separator fix
GGA backup test path correction
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Summary
Fixes model spec parsing in \ReadCurrentModelAssignments\ to correctly handle specs with multiple slashes and colons like \openrouter/qwen/qwen3.6-plus:free.
Problem
The read-path parser was splitting on the first colon before checking for slashes. This broke model specs where the provider is before the first slash, not before the colon.
For example, \openrouter/qwen/qwen3.6-plus:free\ was incorrectly parsed as:
When it should be:
Solution
Changed the parsing logic to find the first separator (either /\ or :) instead of preferring colon-first. This aligns with the write-path parser in \parseModelSpec\ (sync.go) which already handles this correctly.
Changes
Testing
All existing tests pass, including:
Fixes #802
Summary by CodeRabbit
Bug Fixes
Tests