fix(regex): register provider and fix match/compile parity - #193
Merged
sspaink merged 1 commit intoAug 10, 2026
Merged
Conversation
The BuiltinProvider entry for opa-builtins-regex was commented out in
its META-INF/services file, so ServiceLoader never discovered it and
none of the eight regex builtins were reachable for consumers.
Registering it exposed two parity gaps the fixtures had been skipping:
- regex.match used Matcher.matches(), which requires the pattern to
match the entire input. Go's regexp.MatchString searches instead, so
regex.match("", "x") must be true and an unanchored pattern must
match a substring.
- An invalid pattern let Java's unchecked PatternSyntaxException
escape and abort evaluation. OPA reports this as a builtin error, so
the call is undefined by default and only aborts under
strict-builtin-errors. All six compile sites now go through a helper
that converts it to BuiltinError.
Adds RegexBuiltinsTest, including a ServiceLoader assertion: the module
had no unit tests, and the existing ones elsewhere call impl classes
directly, which is why the registration gap went unnoticed. Eight of the
ten new tests fail against the unfixed code.
Removes the eight regex entries from known-missing-builtins.txt (64 -> 56).
Signed-off-by: Sebastian Spaink <sebastianspaink@gmail.com>
This was referenced Aug 10, 2026
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.
Follow-up to #192. The
BuiltinProviderentry foropa-builtins-regexwas commented out in itsMETA-INF/servicesfile, so none of the eight regex builtins were reachable for consumers.eval --capabilities-currentgoes from 123 to 131.Registering it exposed two parity gaps the compliance fixtures had been skipping:
regex.matchusedMatcher.matches(), which requires the pattern to match the entire input. Go'sregexp.MatchStringsearches instead, soregex.match("", "x")must betrueand an unanchored pattern must match a substring.PatternSyntaxExceptionescape and abort evaluation. OPA reports this as a builtin error, so the call is undefined by default and only aborts under strict-builtin-errors.Adds
RegexBuiltinsTest, including a ServiceLoader assertion. The module had no unit tests, and the ones elsewhere call impl classes directly, which is why an unreachable module still looked healthy. Eight of the ten new tests fail against the unfixed code.Removes the eight regex entries from
known-missing-builtins.txt(64 → 56).