CEL test coverage calculation#1209
Merged
jnthntatum merged 2 commits intogoogle:masterfrom Sep 3, 2025
Merged
Conversation
jnthntatum
reviewed
Aug 26, 2025
Collaborator
jnthntatum
left a comment
There was a problem hiding this comment.
LGTM.
Still not sure on the best way to present the details on missing coverage: it may make sense to just present the high level stats by default and add a flag or other mechanism to opt into dumping the missing coverage snippets, but I'll defer to other reviewers.
7f6c41d to
8632938
Compare
8632938 to
48c49d8
Compare
bypass cel.@block function from branch coverage added nil check on coverage stats stored in the Program object passed to traverseAndCalculateCoverage moved start log statement to printCoverageReport method moved coverage reporting to a separate file to allow simpler copybara import changed key type of set to ref.Val code refactor to log cel block boolean index variables and remove redundant boolean flag
48c49d8 to
feba349
Compare
jnthntatum
previously approved these changes
Aug 29, 2025
l46kok
reviewed
Sep 2, 2025
…e expression with line breaks
jnthntatum
approved these changes
Sep 3, 2025
l46kok
approved these changes
Sep 3, 2025
renevo
pushed a commit
to Blizzard/cel-go
that referenced
this pull request
Sep 12, 2025
* added cel test coverage calculation and tests
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.
This change adds coverage calculation logic for the CEL test runner:
cel_go_testbazel macro accepts a new boolean flagenable_coverage. When set toTruethe coverage statistics for the test suite are logged.For each of the above metrics, an optional set of interesting nodes and branches are logged which can help determine which nodes or logical branches are missed by the tests.
Sample coverage logs for

//policy:restricted_destinations_policy: