fix(scripts): fix ComplianceScore always reporting 0% or 100%#931
Closed
WilliamBerryiii wants to merge 2 commits intomainfrom
Closed
fix(scripts): fix ComplianceScore always reporting 0% or 100%#931WilliamBerryiii wants to merge 2 commits intomainfrom
WilliamBerryiii wants to merge 2 commits intomainfrom
Conversation
- return hashtables with TotalCount and Violations from all scanner functions - add ValidateSet on DependencyViolation.Severity to enforce valid values - use TotalDependencies parameter for accurate compliance percentage - update 114 Pester tests to consume new hashtable return shape 🐛 - Generated by Copilot
…ion tests - add 2 partial-compliance unit tests exercising 60% and 90% intermediate scores - add ParameterFilter assertion verifying TotalDependencies at call boundary - add multi-file accumulation test confirming TotalDependencies sums across files 🧪 - Generated by Copilot
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #931 +/- ##
==========================================
+ Coverage 85.95% 85.97% +0.01%
==========================================
Files 27 27
Lines 5185 5192 +7
==========================================
+ Hits 4457 4464 +7
Misses 728 728
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
Description
Fixed
ComplianceScorein the dependency-pinning security scanner always reporting either 0% or 100%, never partial values.Root Cause: Scanner functions returned flat arrays of violations without tracking total dependencies scanned. The orchestrator only knew violation count, so compliance was binary — 0 violations → 100%, any violations → 0% (of an unknown total).
Changes:
TotalCountandViolationskeys.$totalDependencyCountacross all scanners.Get-ComplianceReportDataaccepts a mandatory-TotalDependenciesparameter for accurate percentage calculation.[ValidateSet('High', 'Medium', 'Low', 'Info')]on theSeverityproperty ofDependencyViolation.Related Issue(s)
Fixes #929
Type of Change
Code & Documentation
Infrastructure & Configuration
AI Artifacts
prompt-builderreview and attested to quality.instructions.md).prompt.md).agent.md)SKILL.md)Other
Sample Prompts
Testing
Automated Validation
npm run test:ps— 118/118 Pester tests pass (4 new tests added)Security Analysis
ValidateSetonSeverityconstrains input to known values, preventing invalid severity injection.Diff-Based Assessment
@{ TotalCount; Violations }).Manual Testing
Not performed — validated through Pester test suite covering 0%, partial (60%, 90%), and 100% compliance scenarios.
Checklist
Required Checks
AI Artifact Contributions
prompt-analyzeon the changed artifactprompt-analyzeRequired Automated Checks
npm run lint:mdnpm run spell-checknpm run lint:frontmatternpm run validate:skillsnpm run lint:md-linksnpm run lint:ps— PSScriptAnalyzer cleannpm run plugin:generateSecurity Considerations
Additional Notes
fix(scripts):andtest(scripts):).