feat(web-audit): add targeted failOnIssueCodes publish gate#124
feat(web-audit): add targeted failOnIssueCodes publish gate#124PrzemyslawKlys merged 1 commit intomainfrom
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
PR Review: feat(web-audit): add targeted failOnIssueCodes publish gateSummaryThis PR adds a fine-grained quality gate mechanism ( ✅ Strengths1. Well-Motivated FeatureThe PR addresses a real pain point: 2. Consistent Implementation
3. Robust Pattern MatchingThe implementation leverages the existing
This provides excellent flexibility for users. 4. Good Test CoverageTwo focused unit tests cover the critical paths:
5. Documentation
🔍 Code Quality ObservationsArchitectureThe implementation follows the existing audit gate pattern (similar to
Key Implementation DetailsIssue Code Generation ( private static string BuildIssueRuleCode(string category, string? hint)
{
var categoryCode = BuildIssueCategoryCode(category);
var normalizedHint = NormalizeIssueToken(hint);
if (string.IsNullOrWhiteSpace(normalizedHint))
return categoryCode;
return categoryCode + "." + normalizedHint.ToUpperInvariant();
}This creates hierarchical codes like Pattern Matching (
This multi-pronged approach ensures users can match issues in the most intuitive way. 🐛 Potential Issues1. Minor: Inconsistent Exclusion LogicLocation: var issueHits = issues.Count(issue =>
!issue.Category.Equals("gate", StringComparison.OrdinalIgnoreCase) &&
MatchesFailIssuePatterns(issue, failIssuePatterns));Issue: The Impact: Low - "gate" issues shouldn't match user patterns in practice, but the inconsistency is worth noting. Recommendation: Either add the same exclusion to 2. Minor: Test Coverage GapThe tests validate basic matching behavior, but don't cover:
Recommendation: Consider adding a parameterized test covering different pattern types: [Theory]
[InlineData("media-img-dimensions")] // hint match
[InlineData("PFAUDIT.MEDIA.MEDIA-IMG-DIMENSIONS")] // code match
[InlineData("media-*")] // wildcard
[InlineData("re:media.*dim")] // regex
public void Audit_FailOnIssueCodes_SupportsVariousPatterns(string pattern)
{
// ...
}3. Minor: Documentation Could Be Clearer on Pattern PriorityThe XML docs and user documentation mention all pattern types but don't explain the matching order/priority:
Recommendation: Add a note in 🔒 Security Considerations✅ No Issues Detected
⚡ Performance Considerations✅ Acceptable Performance The gate check is O(n*m) where n = issue count and m = pattern count: var issueHits = issues.Count(issue =>
!issue.Category.Equals("gate", StringComparison.OrdinalIgnoreCase) &&
MatchesFailIssuePatterns(issue, failIssuePatterns));For each issue, Typical Scale:
This should complete in milliseconds. Regex timeout protection prevents runaway patterns. Optimization Opportunity (Future): If pattern counts grow large, could pre-compile regex patterns and cache wildcard-to-regex conversions. 📝 Best Practices✅ Follows Codebase Conventions
✅ No Breaking Changes
✅ Reasonable Code Reuse
🧪 Testing RecommendationsCurrent Coverage: Basic happy path + negative case
📋 Minor Nits
✅ Final VerdictRecommendation: APPROVE with minor suggestions This is a solid, well-implemented feature that fills a real need. The code quality is high, follows established patterns, and includes appropriate test coverage. The suggestions above are minor improvements rather than blockers. What I Like Most:
What Could Be Better (non-blocking):
Great work! 🎉 📚 ReferencesKey files reviewed:
|
Summary
FailOnIssueCodesto web audit options for targeted publish blockingweb audit,doctor, and pipeline runner (including aliases)WebAuditIssuewithCodeandHintmetadataWhy
failOnCategoriesis too coarse for CI quality gates. This enables strict blocking on specific regressions (for examplemedia-img-dimensions,heading-order,head-render-blocking) without failing whole categories.Validation
dotnet test .\PowerForge.Tests\PowerForge.Tests.csproj -c Release --filter "FullyQualifiedName~WebSiteAuditOptimizeBuildTests|FullyQualifiedName~WebSiteAuditFileBudgetTests"