-
Notifications
You must be signed in to change notification settings - Fork 17
Add native rule implementation for the standard protovalidate rules #469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jonbodner-buf
wants to merge
31
commits into
main
Choose a base branch
from
jbodner/native-rules-port
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
d9138ec
Add benchmarks mirroring protovalidate-go for native-rules port baseline
jonbodner-buf 40dc0ad
Add native-rules dispatcher infrastructure behind opt-in flag
jonbodner-buf 00a4c21
Add native evaluator for bool.const
jonbodner-buf 88a804c
Add native evaluator for the standard numeric rules
jonbodner-buf cd49558
Add native evaluator for enum const/in/not_in
jonbodner-buf d7662e6
Add native evaluator for the standard bytes rules
jonbodner-buf 7e6dbfe
Add native evaluator for the standard string rules
jonbodner-buf a4e0568
Add native evaluators for repeated and map list/map-level rules
jonbodner-buf aa2840a
Add native-rules parity test and document the opt-in flag
jonbodner-buf a2bbd00
Add native wrapper unwrap for google.protobuf.{Bool,Int32,...}Value
jonbodner-buf d141626
Invert flag polarity from disableNativeRules to enableNativeRules
jonbodner-buf d865f59
Run conformance suite in both modes on every PR
jonbodner-buf 3a7e5d4
Fix float comparator and formatter for ±0
jonbodner-buf 58049a3
Address code-review action items in native rule evaluators
jonbodner-buf e1b394c
Pull violation-list helpers onto RuleBase, drop per-evaluator wrappers
jonbodner-buf 0a6faec
Add unit tests for native rule coverage gaps
jonbodner-buf ad669ef
Add benchmarks for previously uncovered native rules
jonbodner-buf ea107a4
fix formatting and comments. Remove unused field. Add private constru…
jonbodner-buf b7fdc0f
default to native rules enabled. There are now two Builder methods, s…
jonbodner-buf 9e45d6d
update the conformance workflow and the makefile to validate cel and …
jonbodner-buf ec8d659
fix validation message for string.not_contains
jonbodner-buf 6374e26
remove the rules package, just put all the code in the protovalidate …
jonbodner-buf 11c77c1
remove setDisableNativeRules and use a boolean flag on setEnableNativ…
jonbodner-buf a554ada
remove unneeded uses of Violation interface when RuleViolation will s…
jonbodner-buf 7d7e3d9
minor code review issues addressed
jonbodner-buf e4f3463
fix numeric formatting and NaN comparisons. Native is now more correc…
jonbodner-buf 5539a1a
fixed README
jonbodner-buf 33f6c22
revert public API changes
jonbodner-buf da71616
address PR comments
jonbodner-buf 819a9ce
update conformance workflow
jonbodner-buf 2c66ede
fix header name regex
jonbodner-buf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # this script builds a comparison between runs that used the CEL interpreter for | ||
| # protovalidate rule evaluation vs runs that used native Java code for protovalidate | ||
| # rule evaluation. The differentiator is the value of the "native" field (true for | ||
| # native, false for CEL) and this script groups rows that have the same benchmark | ||
| # and metric name, but different values for native. | ||
| def pct(a; b): | ||
|
pkwarren marked this conversation as resolved.
|
||
| if a == null or b == null or b == 0 then "~" | ||
| else (((a - b) / b * 100) * 10 | round / 10) as $d | ||
| | if $d > 0 then "+\($d)%" elif $d == 0 then "~" else "\($d)%" end | ||
| end; | ||
| def num(x): | ||
| if x == null then "-" | ||
| else (x * 100 | round / 100 | tostring) | ||
| end; | ||
|
|
||
| def row: { | ||
| key: (.benchmark | split(".") | last), | ||
| native: .params.enableNativeRules, | ||
| time: .primaryMetric.score, | ||
| unit: .primaryMetric.scoreUnit, | ||
| alloc: (.secondaryMetrics["·gc.alloc.rate.norm"].score // null) | ||
| }; | ||
|
|
||
| map(row) | ||
| | group_by(.key) | ||
| | (["benchmark", "metric", "cel", "native", "delta"] | @tsv), | ||
| (.[] | ||
| | (map(select(.native == "false"))[0]) as $b | ||
| | (map(select(.native == "true"))[0]) as $a | ||
| | select($b and $a) | ||
| | ([$b.key, "time", "\(num($b.time)) \($b.unit)", "\(num($a.time)) \($a.unit)", pct($a.time; $b.time)] | @tsv), | ||
| ([$b.key, "alloc", "\(num($b.alloc)) B/op", "\(num($a.alloc)) B/op", pct($a.alloc; $b.alloc)] | @tsv)) | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.