fix(remediation): create remediation#1190
Open
kanstantsinbuklis-sap wants to merge 2 commits into
Open
Conversation
39c65ef to
0f0e9f6
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts remediation creation to avoid resolving the wrong (or ambiguous) component context, addressing failures like “component id not found” when multiple components match the provided input.
Changes:
- Updated CreateRemediation mutation to resolve issue first, then narrow down to a single component version and component.
- Improved E2E remediation creation setup to use a service/component/issue triple that is known to be linked in seeded data.
- Adjusted DB seeding to better preserve repository/linkage data used by remediation creation.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| internal/api/graphql/graph/resolver/mutation.go | Refines remediation creation lookup flow by resolving issue → component version → component to reduce ambiguous matches. |
| internal/database/mariadb/test/fixture.go | Adds helper to find linked remediation seed data and tweaks seeding to align repository/linkage fields for tests. |
| internal/e2e/remediation_query_test.go | Uses linked seeded service/component/issue data to make remediation creation E2E deterministic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
1052
to
1056
| if err != nil || len(issueResult.Elements) == 0 || len(issueResult.Elements) > 1 { | ||
| return nil, baseResolver.NewResolverError( | ||
| "CreateRemediationMutationResolver", | ||
| "Internal Error - when creating remediation - component id not found", | ||
| "Internal Error - when creating remediation - issue id not found", | ||
| ) |
Comment on lines
+1073
to
+1078
| if err != nil || len(componentVersionResult.Elements) == 0 || len(componentVersionResult.Elements) > 1 { | ||
| return nil, baseResolver.NewResolverError( | ||
| "CreateRemediationMutationResolver", | ||
| "Internal Error - when creating remediation - component version not found", | ||
| ) | ||
| } |
michalkrzyz
reviewed
May 8, 2026
| nil, | ||
| ) | ||
| if err != nil || len(issueResult.Elements) == 0 || len(issueResult.Elements) > 1 { | ||
| if err != nil || len(componentResult.Elements) == 0 || len(componentResult.Elements) > 1 { |
Collaborator
There was a problem hiding this comment.
why not to check != 1 to reduce mc
Collaborator
Author
There was a problem hiding this comment.
Just copy-paste error handling from code above. Fixed this in several parts
Signed-off-by: Kanstantsin Buklis <kanstantsin.buklis@sap.com>
0f0e9f6 to
a586756
Compare
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Kanstantsin Buklis <kanstantsin.buklis@sap.com>
99a1f15 to
db588be
Compare
michalkrzyz
approved these changes
May 12, 2026
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
In this PR I've changed the logic of creating remediation. Previously we could get more components than expected that's why process of creating was failing
What type of PR is this? (check all applicable)
Related Tickets & Documents
fix(remediation): create remediation #1189
Added tests?
Added to documentation?