Skip to content

Populate entityInfo for all entity types in ListEvaluationResults#6361

Open
krrish175-byte wants to merge 1 commit into
mindersec:mainfrom
krrish175-byte:fix/issue-3116-list-evaluation-results-entity-info
Open

Populate entityInfo for all entity types in ListEvaluationResults#6361
krrish175-byte wants to merge 1 commit into
mindersec:mainfrom
krrish175-byte:fix/issue-3116-list-evaluation-results-entity-info

Conversation

@krrish175-byte
Copy link
Copy Markdown
Contributor

Summary

This PR addresses an issue where the ListEvaluationResults RPC only populated entityInfo for repository entities, leaving it empty for other entity types such as Pull Requests and Artifacts.

To fix this, the getRuleEvalEntityInfo helper function (previously scoped to handlers_profile.go) was moved to handlers_evalstatus.go. The mapping logic in buildRuleEvaluationStatusFromDBEvaluation was then updated to utilize this shared helper, ensuring consistent population of entityInfo attributes (e.g., artifact_name, artifact_type, etc.) across all supported entity types without duplicating code. Unused imports in handlers_profile.go were also cleaned up.

Fixes #3116

Testing

  • Added TestListEvaluationResultsEntityInfo to specifically verify that entityInfo fields are correctly populated when formatting the evaluation results for both Artifact and PullRequest entities.
  • Ran all existing test suites in the internal/controlplane package (go test -v ./internal/controlplane/...) to ensure no regressions were introduced. All tests passed successfully.

@krrish175-byte krrish175-byte requested a review from a team as a code owner April 13, 2026 19:23
This addresses issue mindersec#3116 by reusing the getRuleEvalEntityInfo helper
across ListEvaluationResults so that entityInfo (like artifact_name,
artifact_type, etc.) is correctly populated for non-repository entities
such as Artifacts and Pull Requests.

Signed-off-by: krrish175-byte <krrishbiswas175@gmail.com>
@krrish175-byte krrish175-byte force-pushed the fix/issue-3116-list-evaluation-results-entity-info branch from 5bd69ad to b81f8b7 Compare April 13, 2026 19:24
@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 59.464% (+0.07%) from 59.39% — krrish175-byte:fix/issue-3116-list-evaluation-results-entity-info into mindersec:main

@krrish175-byte
Copy link
Copy Markdown
Contributor Author

@evankanderson PTAL

Copy link
Copy Markdown
Member

@evankanderson evankanderson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to appease the linter; otherwise, it looks good.

return era
}

func getRuleEvalEntityInfo(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a straight move from handlers_profile.go (fine, but this adds a "type 2 - refactoring" change to a "type 3 - behavior" change, which makes it a little bit harder to review).

Comment on lines +885 to +890
minderEntityType := minderv1.Entity_ENTITY_REPOSITORIES
if tt.entityType == db.EntitiesArtifact {
minderEntityType = minderv1.Entity_ENTITY_ARTIFACTS
} else if tt.entityType == db.EntitiesPullRequest {
minderEntityType = minderv1.Entity_ENTITY_PULL_REQUESTS
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint wants you to use a tagged switch here. If you disagree, you'll need to add an appropriately scoped nolint directive, e.g. //nolint:staticcheck // tagged switch is ...

Suggested change
minderEntityType := minderv1.Entity_ENTITY_REPOSITORIES
if tt.entityType == db.EntitiesArtifact {
minderEntityType = minderv1.Entity_ENTITY_ARTIFACTS
} else if tt.entityType == db.EntitiesPullRequest {
minderEntityType = minderv1.Entity_ENTITY_PULL_REQUESTS
}
minderEntityType := minderv1.Entity_ENTITY_REPOSITORIES
switch tt.EntityType {
case db.EntitiesArtifact:
minderEntityType = minderv1.Entity_ENTITY_ARTIFACTS
case db.EntitiesPullRequest:
minderEntityType = minderv1.Entity_ENTITY_PULL_REQUESTS
}

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.

Entity info is missing in ListEvaluationResults for pull requests and artifacts

3 participants