fix(sdd): parse model spec at first separator and consolidate duplicated parsers#374
Open
Basparin wants to merge 3 commits intoGentleman-Programming:mainfrom
Open
Conversation
…ee bug Both extractModelFromAgent and ReadCurrentModelAssignments incorrectly preferred colon over slash when splitting model strings. For OpenRouter free models like openrouter/qwen/qwen3.6-plus:free, this produced openrouter/qwen/qwen3.6-plus/free instead of the correct :free suffix. Fix: find the FIRST occurrence of either / or : (whichever comes first), matching the correct implementation already present in parseModelSpec.
… parsing Consolidates three identical copies of the "split on first '/' or ':'" logic into a shared helper in the model package: - internal/cli/sync.go -> parseModelSpec - internal/components/sdd/profiles.go -> extractModelFromAgent - internal/components/sdd/read_assignments.go -> ReadCurrentModelAssignments No behavior change. Addresses review feedback on Gentleman-Programming#242.
Adds test coverage per review feedback on Gentleman-Programming#242: - Dedicated TestExtractModelFromAgent (previously no coverage) - Regression case for openrouter/qwen/qwen3.6-plus:free in read_assignments_test.go. The combined slash-then-colon format motivating issue Gentleman-Programming#260 must be split at the first separator (the leading '/'), not at ':'.
|
Gracias por la mención, estoy ansioso por revisar esta PR |
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.
🔗 Linked Issue
Closes #260
🔄 Continuation Notice
This PR continues and supersedes #242 by @ACDPDEV, who explicitly handed off the work in #242 (comment) (university commitments prevented him from landing the review suggestions himself).
Full credit for the original fix goes to @ACDPDEV — his commit
28c3378is preserved verbatim with original author metadata intact. This PR applies @Alan-TheGentleman's two review suggestions from #242 on top:SplitProviderModelhelper — consolidates three identical copies of the first-separator logic. This matches @ACDPDEV's final ask in the handoff: "abstraer lo que se repite en una función"./freeformat + dedicated coverage forextractModelFromAgent, which previously had no direct tests.Once this PR lands, #242 can be closed — the full contribution (with review feedback applied) lives here.
🏷️ PR Type
type:bug— Bug fix (non-breaking change that fixes an issue)type:featuretype:docstype:refactortype:choretype:breaking-change📝 Summary
openrouter/qwen/qwen3.6-plus:freewas split at:before the leading/, producing a brokenProviderID=openrouter/qwen/qwen3.6-plus,ModelID=free.SplitProviderModelhelper in themodelpackage.extractModelFromAgent.📂 Changes
internal/model/split.goSplitProviderModel(spec) (provider, model, ok)helperinternal/model/split_test.gointernal/cli/sync.goparseModelSpecnow delegates to the shared helperinternal/components/sdd/profiles.goextractModelFromAgentnow delegates to the shared helperinternal/components/sdd/read_assignments.gointernal/components/sdd/profiles_test.goTestExtractModelFromAgent— no previous coverageinternal/components/sdd/read_assignments_test.goTestReadCurrentModelAssignmentsOpenRouterFreeSuffixregression testNet: +255 / −41, 7 files. No behavior change in the happy path — existing
TestReadCurrentModelAssignments*suite still passes unchanged.🧪 Test Plan
Unit Tests
go test ./internal/model/... ./internal/cli/... ./internal/components/sdd/...E2E Tests (Docker required)
Pre-existing test failures in the Windows sandbox around
unique-names-generator/bun installare unrelated to this PR — they're tracked in a separate PR (#372).cd e2e && ./docker-test.sh)🤖 Automated Checks
Closes #260status:approvedstatus:approvedtype:*Labeltype:bug✅ Contributor Checklist
status:approved(Configure Opencode Models writes invalid model ID prefix (opencode/ instead of openrouter/) #260)type:*label to this PR (pending maintainer — external contributors cannot apply labels)Co-Authored-Bytrailers💬 Notes for Reviewers
28c3378) is @ACDPDEV's verbatim, author metadata intact. GitHub should surface him as a co-contributor via commit history.refactor(model): extract SplitProviderModel helper...andtest(sdd): add OpenRouter free suffix regression coverage.internal/modelbecauseModelAssignmentalready lives there and bothcliandsddpackages import it — zero import-cycle risk.