Repository navigation
fix(gitlab): preserve instance subpath when importing MRs - #1151
Merged
Merged
Conversation
Signed-off-by: ydflow <314143294+ydflow@users.noreply.github.com>
|
No findings confidently identified in the specified PR diff. The PR description provides sufficient testing evidence: build, typecheck, lint, 62 provider tests, and two built-CLI runs against a loopback GitLab fixture covering default and custom API prefixes. This satisfies the real-CLI verification requirement; a live GitLab deployment and full provider × agent matrix are not required. Review was read-only; I did not run, build, or install PR code. |
jeff-r2026
approved these changes
Oct 15, 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.
Summary
With
GITLAB_URL=https://host/gitlab, importinghttps://host/gitlab/g/sub/repo/-/merge_requests/7currently requests/api/v4/projects/gitlab%2Fg%2Fsub%2Frepo/.... The documented deployment prefix is dropped from the API base and incorrectly included in the project id, so MR import fails for a sub-path instance.Keep the configured instance path in the API base and strip that prefix from the project path. Refuse an MR outside the configured instance path before making a request. Preserve nested groups and the custom
GITLAB_API_PREFIX. Update the bilingual provider guide and troubleshooting reference.Type of Change
Test Plan
npm run buildnpx tsc --noEmitnpm run lintnpx vitest run gitlab-provider: 62 passed.git diff --checkAll three new cases fail against the unchanged upstream runtime at
27a026f: the two API-prefix cases show the wrong URLs, and the outside-root case reaches fetch instead of refusing it. The other 59 tests pass on that baseline.Refreshed onto upstream
450be2aabefore submission; build, typecheck, lint, the 62 tests, and both built-CLI cases passed again on head4e5be8da.Real CLI verification after build
Windows, Node 24.19.0; isolated
HOME/USERPROFILE; a loopback HTTP server simulating GitLab; a dummy token; a fakeclaudereturning fixed Markdown. No real credentials, model calls, remote writes, or GitLab account are required.Both runs exit 0 and report
MR data fetched. The server sees exactly the metadata, commits, and changes requests under:The fake AI invocation marker exists after each successful fetch. Unit tests additionally verify the returned commits and diff. The CLI fixture validates request routing through the real command against a local server, not a live GitLab deployment.
Related Issues
Found through source inspection of the documented sub-path deployment support. #450 added custom API prefixes; this fix preserves that feature while handling the separate instance root. No open PR addressing this MR path split was found. #1122 changes import orchestration and does not modify this provider fetcher.
Notes for Reviewers
Reuses the existing
gitlabBaseUrl()configuration resolver, keeping its URL validation and the existing configured-host guard. The MR URL still supplies the request scheme and host after that guard. No clone, authentication, or persisted config format changes. Independent of #1149 and the GitHub HTTP-status fix; the shared guide edits are in separate provider sections.Shares documentation files with #1150, but changes different sections. Both local merge orders were checked on base
450be2aaat headse6fde993and4e5be8da: no conflicts and the same final tree. Neither runtime fix depends on the other.Prepared with assistance from an AI coding agent.