Skip to content

Conversation

abhisek
Copy link
Member

@abhisek abhisek commented Aug 11, 2025

  • feat: Add support for filter v2
  • Add filter v2 support
  • Add test for filter v2 evaluator
  • fix: CEL v2 query engine

Copy link

codecov bot commented Aug 11, 2025

Codecov Report

❌ Patch coverage is 21.25000% with 441 lines in your changes missing coverage. Please review.
✅ Project coverage is 8.38%. Comparing base (651b09b) to head (80c6eaf).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
pkg/analyzer/cel_filter_suite_v2.go 0.00% 121 Missing ⚠️
pkg/analyzer/cel_filter_v2.go 0.00% 112 Missing ⚠️
pkg/analyzer/filterv2/eval.go 55.18% 82 Missing and 13 partials ⚠️
scan.go 0.00% 50 Missing ⚠️
query.go 0.00% 44 Missing ⚠️
pkg/analyzer/filterv2/result.go 18.18% 9 Missing ⚠️
pkg/analyzer/cel_filter_suite.go 0.00% 6 Missing ⚠️
pkg/analyzer/filterv2/program.go 0.00% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main    #560      +/-   ##
========================================
+ Coverage   8.23%   8.38%   +0.14%     
========================================
  Files        284     290       +6     
  Lines      47501   48103     +602     
========================================
+ Hits        3914    4033     +119     
- Misses     43314   43784     +470     
- Partials     273     286      +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@abhisek abhisek requested a review from Copilot August 12, 2025 15:20
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for filter v2 capabilities by introducing new policy-based filtering with Insights v2 data model while maintaining backward compatibility with existing filters.

  • Adds new --filter-v2, --filter-v2-suite, --policy, and --policy-suite command-line flags
  • Implements policy evaluation system using CEL expressions with Insights v2 data model
  • Creates new analyzer components for v2 filtering with comprehensive test coverage

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
scan.go Adds new CLI flags for filter v2 and policy options with validation
query.go Adds corresponding query command flags and renames variables for consistency
pkg/analyzer/filterv2/result.go Defines filter evaluation result structure
pkg/analyzer/filterv2/program.go Implements filter program wrapper for CEL evaluation
pkg/analyzer/filterv2/eval_test.go Provides test coverage for the filter evaluator
pkg/analyzer/filterv2/eval.go Core CEL evaluator implementation with policy input processing
pkg/analyzer/cel_filter_v2.go Single filter v2 analyzer implementation
pkg/analyzer/cel_filter_suite_v2.go Filter suite v2 analyzer implementation
pkg/analyzer/cel_filter_suite.go Minor formatting improvements to existing filter suite

filterEvalMaxRules = 150
)

var errMaxFilter = errors.New("max filter limit has reached")
Copy link
Preview

Copilot AI Aug 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message should be grammatically correct: "max filter limit has been reached" instead of "max filter limit has reached".

Suggested change
var errMaxFilter = errors.New("max filter limit has reached")
var errMaxFilter = errors.New("max filter limit has been reached")

Copilot uses AI. Check for mistakes.

break
}

if iter.HasNext().Value() == false {
Copy link
Preview

Copilot AI Aug 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Use !iter.HasNext().Value() instead of == false for better readability and Go idioms.

Suggested change
if iter.HasNext().Value() == false {
if !iter.HasNext().Value() {

Copilot uses AI. Check for mistakes.


return ret, nil
}

Copy link
Preview

Copilot AI Aug 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This TODO comment indicates a known inefficiency with JSON serialization round-trip. Consider creating a GitHub issue to track this technical debt or implement the direct Protobuf configuration.

Suggested change
// Protobuf messages are now passed directly to CEL; JSON round-trip removed.

Copilot uses AI. Check for mistakes.

@abhisek abhisek force-pushed the feat/add-filter-v2-support branch from 252a529 to ff01901 Compare August 25, 2025 03:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant