[WRONG BRANCH] fix(slug): prefer self-namespaced exact matches in resolveSlugSelection - #344
[WRONG BRANCH] fix(slug): prefer self-namespaced exact matches in resolveSlugSelection#344luvs01 wants to merge 1 commit into
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
✅ Deterministic PR hygiene checks passed. |
⏳ DRAFT
What to do
Its title has been prefixed with |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f056c40a57
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const qualified = ids.includes(selection) || !selection.startsWith(`${provider}/`) | ||
| ? routedSlug(provider, selection) | ||
| : selection; |
There was a problem hiding this comment.
Resolve against each provider's complete model set
When customModels contains both orcarouter/auto and auto, this preference does not reach the production removal flow: handleCustomRemove calls resolveSlugSelection separately with each singleton [model.modelId], so this condition treats the first row as a native exact match and the second row as a routed suffix, causing both indices to match and ocx models remove orcarouter/auto --yes to fail as ambiguous. Resolve once against all IDs for the provider (or preselect the native exact row) and add a focused CLI regression covering the two-row case.
AGENTS.md reference: AGENTS.md:L284-L286
Useful? React with 👍 / 👎.
Motivation
orcarouter/auto) as already routed, which caused self-namespaced native IDs to be ignored or confused with a suffix-only ID.Description
resolveSlugSelectionto materializeknownIdsand prefer a known native exact match before interpreting the input as a provider-prefixed routed slug by adjusting thequalifiedcalculation insrc/providers/slug-codec.ts.idsarray (instead of the original iterable) so the pre-check for an exact known-id is stable and available during matching.tests/slug-codec.test.tsthat assertorcarouter/autoresolves exactly both when it is the only known id and whenautoalso exists.Testing
bun -e 'import { resolveSlugSelection } from "./src/providers/slug-codec.ts"; ...', which confirmed the resolver returns the expected matches.bun run typecheckwhich passed andgit diff --checkwhich reported no issues.bun test tests/slug-codec.test.tsbut the test harness in this environment is blocked by Bun 1.2.14 lacking thenode:zlibzstdDecompressSyncexport, so the new tests are present but could not be executed end-to-end here.Codex Task