feat(engine): add commit-level evaluation primitives with ordered multi-commit support#6402
feat(engine): add commit-level evaluation primitives with ordered multi-commit support#6402sachin9058 wants to merge 3 commits intomindersec:mainfrom
Conversation
evankanderson
left a comment
There was a problem hiding this comment.
I think we want to focus on extensible policies for per-commit evaluation, rather than policies which are hard-coded into the Minder engine. (e.g. the osv, frizbee, trusty evaluators are probably an anti-pattern that are artifacts of early implementation before we fully understood the problem)
|
The intention with this PR is to provide generic commit-level evaluation primitives (e.g., The example I agree that keeping the system extensible and avoiding hard-coded evaluators in the engine is the right direction. Happy to adjust the structure further if you’d prefer moving example policies out or changing how they’re exposed. |
… keep evaluator generic
|
@evankanderson Thanks, that makes a lot of sense. I’ve updated the PR to keep the engine focused on the evaluation primitives and removed the concrete policy from it. The evaluator now just works with the The idea is to keep this layer generic and let actual policies live outside the engine so they can evolve independently. Happy to adjust further if you think something should be structured differently. |
|
See my suggestion in #2176 (comment) -- I think you want to write out an example I don't know which is better, but writing down an example or three of using each API will give you a good idea about the limitations (expressiveness, repetition, control, etc) of each API. |
Summary
This PR introduces commit-level evaluation primitives for pull request analysis, enabling evaluation of individual commits rather than only the final state (HEAD).
Currently, Minder evaluates only the resulting state of a PR, which can allow intermediate commits containing issues (e.g., vulnerable dependencies or invalid metadata) to be introduced into the repository history. This change provides a flexible foundation to support evaluation across all commits in a PR.
Key changes include:
CommitPolicyinterface for defining commit-level checksCommitEvaluatorfor evaluating commits against one or more policiesEvaluateAllto evaluate all commits in a PR while preserving orderCommitResultto capture structured per-commit evaluation resultsHasPolicyFailureshelper for aggregation of resultsHasFailuresas a deprecated alias for backward compatibilityConventionalCommitPolicyas an example policy for commit message validationThis PR focuses on providing reusable evaluation primitives rather than enforcing specific policies. It enables building policies such as:
This builds on previous work:
Fixes #2176
Testing
The changes were tested using unit tests covering:
Evaluation with no policies configured
Evaluation with single and multiple policies
Multi-commit evaluation using
EvaluateAllPreservation of commit order in results
Aggregation behavior using
HasPolicyFailuresEdge cases such as empty commit lists
Validation of commit message formats using
ConventionalCommitPolicy, including:api/v1)All tests were run using:
No additional configuration is required.
Note
This PR is a recreation of the previous one after the branch was accidentally reset during cleanup. The implementation itself remains unchanged.