Skip to content

feat(engine): add commit-level evaluation primitives with ordered multi-commit support#6388

Closed
sachin9058 wants to merge 0 commit into
mindersec:mainfrom
sachin9058:feat/commit-evaluation-primitives
Closed

feat(engine): add commit-level evaluation primitives with ordered multi-commit support#6388
sachin9058 wants to merge 0 commit into
mindersec:mainfrom
sachin9058:feat/commit-evaluation-primitives

Conversation

@sachin9058
Copy link
Copy Markdown
Contributor

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:

  • Added CommitPolicy interface for defining commit-level checks
  • Implemented CommitEvaluator for evaluating commits against one or more policies
  • Added EvaluateAll to evaluate all commits in a PR while preserving order
  • Introduced CommitResult to capture structured per-commit evaluation results
  • Added HasPolicyFailures helper for basic aggregation of results
  • Retained HasFailures as a deprecated alias for backward compatibility
  • Added ConventionalCommitPolicy as an example policy for commit message validation

This PR focuses on providing reusable evaluation primitives rather than enforcing specific policies. It enables building policies such as:

  • Checking intermediate commit contents
  • Enforcing commit message formats
  • Validating commit metadata (e.g., signatures)

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 EvaluateAll

  • Preservation of commit order in results

  • Aggregation behavior using HasPolicyFailures

  • Edge cases such as empty commit lists

  • Validation of commit message formats using ConventionalCommitPolicy, including:

    • Valid conventional commits
    • Scopes with slashes (e.g., api/v1)
    • Uppercase scopes
    • Invalid commit messages

All tests were run using the existing Go test suite:

go test ./...

No additional configuration is required.

@sachin9058 sachin9058 requested a review from a team as a code owner April 21, 2026 16:31
@coveralls
Copy link
Copy Markdown

coveralls commented Apr 21, 2026

Coverage Status

coverage: 60.391% (+0.05%) from 60.337% — sachin9058:feat/commit-evaluation-primitives into mindersec:main

@sachin9058
Copy link
Copy Markdown
Contributor Author

Hi all, just a quick follow-up happy to adjust the design or structure if needed.

In particular, I’d appreciate feedback on:

  • Whether the CommitPolicy abstraction fits well with the existing engine
  • How you’d like this integrated into the PR evaluation flow

Thanks!

@evankanderson

@sachin9058 sachin9058 force-pushed the feat/commit-evaluation-primitives branch from c80084f to 58a56c3 Compare April 22, 2026 21:31
@sachin9058 sachin9058 closed this Apr 22, 2026
@sachin9058 sachin9058 force-pushed the feat/commit-evaluation-primitives branch from 58a56c3 to d547963 Compare April 22, 2026 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Not all commits being added to main are checked during PR

2 participants