[codex] Add policy decision explanation fields#43
Merged
Conversation
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.
Brief Design Summary
This PR adds additive policy decision explanation fields to
sbom-diff-and-riskJSON policy finding objects.Policy findings now include stable machine-readable metadata for local policy decisions:
decision_reasonpolicy_ruleseverity_sourcematched_thresholdobserved_valueThe implementation extends the existing
PolicyViolationandpolicy_violation_to_dict()path, sopolicy_evaluation.*_violations, top-level policy finding arrays, and provenance policy impact sections stay consistent without introducing a second schema.This is additive and backward-compatible. It does not change exit codes, CLI flags, Markdown output, SARIF output, workflow behavior, network behavior, CVE behavior, or package version.
Files Changed
tools/sbom-diff-and-risk/src/sbom_diff_risk/policy_models.pytools/sbom-diff-and-risk/src/sbom_diff_risk/policy_evaluator.pytools/sbom-diff-and-risk/src/sbom_diff_risk/presentation.pytools/sbom-diff-and-risk/tests/test_policy.pytools/sbom-diff-and-risk/tests/test_reports.pytools/sbom-diff-and-risk/examples/sample-policy-warn-report.jsontools/sbom-diff-and-risk/examples/sample-policy-fail-report.jsontools/sbom-diff-and-risk/examples/sample-provenance-report.jsontools/sbom-diff-and-risk/examples/sample-scorecard-report.jsontools/sbom-diff-and-risk/docs/report-schema.mdTests Added/Updated
Added focused coverage for:
riskssummary.policybehaviorUpdated JSON golden samples for affected policy, provenance, and Scorecard report paths.
Validation
Results:
python -m pytest:157 passedpython -m build: builtsbom_diff_and_risk-0.7.0wheel and sdistpython -m twine check $files: wheel and sdist passedgit diff --check: passed0.7.0.github/workflowsunchangedOut of Scope