fix(mrs): use global API endpoints for code change proposals#116
Merged
Conversation
Change endpoints from nested project paths to global paths: - PUT /suggestions/:id/apply - PUT /suggestions/batch_apply Fixes #115
📊 Test Coverage ReportOverall Coverage: 90.71% Coverage Details
Coverage Report: View detailed coverage report
|
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where the apply_suggestion and apply_suggestions actions in the manage_mr_discussion tool were returning 404 errors due to incorrect API endpoint usage. The fix changes from nested project-specific endpoints to the correct global GitLab Suggestions API endpoints.
Changes:
- Updated API endpoints from nested
/projects/:id/merge_requests/:iid/suggestions/...to global/suggestions/...format - Removed unused parameter destructuring (
project_idandmerge_request_iid) from the handler implementation while keeping them in the schema for context - Updated unit tests to reflect the corrected API endpoints with explanatory comments
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/entities/mrs/registry.ts | Fixed API endpoints for apply_suggestion and apply_suggestions actions to use global GitLab API paths; added comments explaining that project_id and merge_request_iid are kept in schema for context but not used in the API calls |
| tests/unit/entities/mrs/registry.test.ts | Updated test expectations to verify the corrected global API endpoints are called; added explanatory comments for clarity |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
🎉 This PR is included in version 6.26.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Summary
apply_suggestionandapply_suggestionsactions inmanage_mr_discussiontool returning 404 errorsProblem
The handler was using incorrect nested endpoints:
But GitLab Suggestions API uses global endpoints:
Changes
src/entities/mrs/registry.ts- Updated endpoints in handlertests/unit/entities/mrs/registry.test.ts- Updated test expectationsTest plan
Fixes #115