Repository navigation
Key globs with many stars take seconds to match - #1283
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes: Reviewed the matcher replacement and all affected filtering paths.
- Glob matching: Replaces backtracking regexes with a loop that retries only the most recent star.
- Consumers: Updates shared item filters and
@auditIgnoreKeysto use the new matcher. - Regression coverage: Adds matching and performance tests; 182 focused tests passed, and 1,331,946 short pattern/key comparisons agreed with the previous implementation.
gpt-6.1-sol | 𝕏
A key glob compiled to a regex like ^.*A.*A.*A$, which backtracks polynomially in the number of stars: 7 stars against one 50-character key took 2 seconds, 8 stars about a minute. The matcher is now a loop that goes back to the most recent star only.
theoephraim
force-pushed
the
fix-glob-backtracking
branch
from
November 13, 2026 00:47
e722e4d to
d027ee3
Compare
varlock
@varlock/astro-integration
@varlock/cloudflare-integration
@varlock/nextjs-integration
@varlock/nuxt-integration
@varlock/vite-integration
@varlock/1password-plugin
@varlock/aws-secrets-plugin
@varlock/azure-key-vault-plugin
@varlock/bitwarden-plugin
@varlock/keepass-plugin
@varlock/pass-plugin
@varlock/proton-pass-plugin
commit: |
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.

one more star and ten more A's is about a minute on main.
cause:
globToRegExpturns the glob into/^.*A.*A.*A.*A.*A.*A.*A.*B$/. when it doesn't match, the regex tries every way to split the key between the stars.fix: match with a loop that only ever goes back to the last star (
compileGlob). it gives the same answers as the regex: i compared the two on 300k random pattern/key pairs.the same function is behind
--filter,@setValuesBulkpick/omit and@auditIgnoreKeys.context: found by feeding generated and deliberately hostile schemas to a language server prototype (#469). nobody writes eight stars by accident, so this is a stretch for normal use. it matters to anything that loads a schema it didn't write, like an editor opening a cloned repo.
test:
glob.test.ts. the 7-star case has to finish in under 100 ms.