Repository navigation
fix(engine): anchor the text after the last * at the end of a model name - #33
Merged
Merged
Conversation
… name `glob_match` looked for each literal segment from left to right and stopped at its first occurrence. The segment after the last `*` therefore only matched when its first occurrence happened to end the name: `*-mini` did not match `gpt-4o-mini-2024-mini`, and `a*b` did not match `abab`. The same matcher decides a routing rule's `when.model`, which models a key's `allow` list shows, and an upstream's `models_only`. A pattern written this way silently left out models it names, and the desktop app mirrors the matcher to show the enabled scope, so both sides were wrong the same way. The first and last segments are now anchored to the start and the end and may not overlap; the segments in between are found left to right in what remains, which is enough when `*` is the only wildcard. A test compares the matcher with a backtracking one on every pattern of up to five characters over `a`, `b` and `*` against every string of up to six characters. Bumps the workspace to 0.2.2 so the desktop app can pin the fix. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Thanks for the PR. One thing before review: this targets
No need to close and reopen: click Edit next to the PR title and change the base branch to See CONTRIBUTING.md and CONTRIBUTING.md for the branch contract. |
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.
What was wrong
glob_matchlooked for each literal segment from left to right and stopped at its first occurrence, so the segment after the last*only matched when that first occurrence happened to end the name.*-minigpt-4o-mini-2024-minigpt-*-minigpt-4o-mini-realtime-minia*bababab*baabaThe same matcher decides a routing rule's
when.model, which models a key'sallowlist shows, and an upstream'smodels_only. A pattern like the ones above silently left out models it names.The fix
The first and last segments are anchored to the start and the end and may not overlap. The segments in between are found left to right in what remains, which is enough when
*is the only wildcard.Tests
the_part_after_the_last_star_anchors_at_the_endcovers the cases in the table.agrees_with_a_backtracking_matcher_on_every_short_inputcompares the matcher with a character-by-character backtracking matcher on every pattern of up to five characters overa,b,*against every string of up to six characters. The old implementation fails it.cargo fmt --check,cargo clippy --workspace --all-targets -D warnings,cargo test --workspaceandscripts/smoke.shpass locally.Bumps the workspace to 0.2.2 so the desktop app can pin the fix; it mirrors this matcher to show an upstream's enabled scope.
🤖 Generated with Claude Code