Skip to content

fix(mrs): use global API endpoints for code change proposals#116

Merged
polaz merged 3 commits intomainfrom
fix/115-apply-suggestion-endpoint
Jan 22, 2026
Merged

fix(mrs): use global API endpoints for code change proposals#116
polaz merged 3 commits intomainfrom
fix/115-apply-suggestion-endpoint

Conversation

@polaz
Copy link
Copy Markdown
Member

@polaz polaz commented Jan 22, 2026

Summary

  • Fix apply_suggestion and apply_suggestions actions in manage_mr_discussion tool returning 404 errors
  • Change from nested project endpoints to global GitLab Suggestions API endpoints

Problem

The handler was using incorrect nested endpoints:

PUT /projects/:id/merge_requests/:iid/suggestions/:sid/apply
PUT /projects/:id/merge_requests/:iid/suggestions/batch_apply

But GitLab Suggestions API uses global endpoints:

PUT /suggestions/:id/apply
PUT /suggestions/batch_apply

Changes

  • src/entities/mrs/registry.ts - Updated endpoints in handler
  • tests/unit/entities/mrs/registry.test.ts - Updated test expectations

Test plan

  • Unit tests pass (2941/2941)
  • Lint passes
  • Build succeeds
  • Manual test with real GitLab instance

Fixes #115

Change endpoints from nested project paths to global paths:
- PUT /suggestions/:id/apply
- PUT /suggestions/batch_apply

Fixes #115
Copilot AI review requested due to automatic review settings January 22, 2026 10:39
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 22, 2026

📊 Test Coverage Report

Overall Coverage: 90.71%

Coverage Details

Metric Percentage
Statements 90.71%
Branches 83.58%
Functions 79.02%
Lines 91.17%

Coverage Report: View detailed coverage report

This report was generated automatically from your PR changes.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_id and merge_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
Copy link
Copy Markdown

codecov bot commented Jan 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@polaz polaz merged commit 891b5b1 into main Jan 22, 2026
11 checks passed
@polaz polaz deleted the fix/115-apply-suggestion-endpoint branch January 22, 2026 10:57
sw-release-bot bot pushed a commit that referenced this pull request Jan 22, 2026
## [6.26.1](v6.26.0...v6.26.1) (2026-01-22)

### Bug Fixes

* **mrs:** use global API endpoints for code change proposals ([#116](#116)) ([891b5b1](891b5b1)), closes [#115](#115)
@sw-release-bot
Copy link
Copy Markdown

🎉 This PR is included in version 6.26.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: apply_suggestion uses wrong API endpoint causing 404 errors

2 participants