You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
result.ExcludedPackages[pkg] = true // This is wrong!
108
104
}
105
+
106
+
// CORRECT LOGIC should be:
107
+
// if hasIncludedRules || hasExcludedRules {
108
+
// result.IncludedPackages[pkg] = true // Include package, filter rules later
109
+
// }
109
110
}
110
111
```
111
112
113
+
**Note**: The current implementation incorrectly excludes packages that contain only excluded rules. This should be fixed to include such packages, allowing post-evaluation filtering to handle rule-level exclusions.
114
+
115
+
#### Why This Logic Matters
116
+
117
+
The package-level determination affects which packages are loaded for conftest evaluation:
118
+
119
+
1. **Pre-Evaluation**: Only packages in `IncludedPackages` are passed to conftest for evaluation
120
+
2. **Post-Evaluation**: The `UnifiedPostEvaluationFilter` filters individual results based on rule-level decisions
121
+
122
+
**Current Problem**: If a package contains only excluded rules, it's marked as `ExcludedPackages` and never evaluated by conftest. This means:
123
+
- The excluded rules never run, so they can't be filtered out post-evaluation
124
+
- The package is completely skipped, which may not be the intended behavior
125
+
126
+
**Correct Behavior**: Packages with any rules (included or excluded) should be included for evaluation, allowing post-evaluation filtering to handle the rule-level decisions properly.
- Exceptions and skipped results only have metadata added
225
-
- No inclusion/exclusion filtering is applied to these result types
200
+
This method:
201
+
1. **Determines Original Type**: Identifies whether each filtered result was originally a warning, failure, exception, or skipped
202
+
2. **Applies Severity Logic**:
203
+
- Warnings with `severity: failure` metadata are promoted to failures
204
+
- Failures with `severity: warning` metadata or future `effective_on` dates are demoted to warnings
205
+
3. **Preserves Categories**: Exceptions and skipped results maintain their original categorization
226
206
227
207
### 5. Term Extraction and Analysis
228
208
@@ -514,4 +494,18 @@ The current implementation uses a unified filtering system:
514
494
3. **Consistent Logic**: Both use the same PolicyResolver for consistent decision-making
515
495
4. **Backward Compatibility**: Legacy interfaces are still supported
516
496
517
-
This filtering system provides fine-grained control over which policy violations are reported and how they're categorized, allowing for gradual policy rollouts and context-specific rule management with precise term-based filtering capabilities.
497
+
### PolicyResolver Types
498
+
499
+
The system supports two types of PolicyResolver:
500
+
501
+
1. **ECPolicyResolver**:
502
+
- Handles pipeline intention filtering
503
+
- Uses `ruleMatchesPipelineIntention` for rule-level filtering
504
+
- Supports both include/exclude and pipeline intention criteria
505
+
506
+
2. **IncludeExcludePolicyResolver**:
507
+
- Ignores pipeline intention filtering
508
+
- Only uses include/exclude criteria
509
+
- Provides backward compatibility for systems that don't use pipeline intentions
510
+
511
+
This filtering system provides fine-grained control over which policy violations are reported and how they're categorized, allowing for gradual policy rollouts and context-specific rule management with precise term-based filtering capabilities.
0 commit comments