Skip to content

fix(mcp): нормализовать root-uri через Absolute.uri#4119

Merged
nixel2007 merged 1 commit into
developfrom
claude/mcp-roots-absolute-uri
Jun 15, 2026
Merged

fix(mcp): нормализовать root-uri через Absolute.uri#4119
nixel2007 merged 1 commit into
developfrom
claude/mcp-roots-absolute-uri

Conversation

@nixel2007

@nixel2007 nixel2007 commented Jun 15, 2026

Copy link
Copy Markdown
Member

McpRootsChangeConsumer.toPath строил Path из URI.create(root.uri()). По соглашению проекта URI всегда нормализуем через Absolute.uri(...) (а не URI.create), чтобы пути из разных источников совпадали. Заменил на Path.of(Absolute.uri(root.uri())), убрал неиспользуемый импорт java.net.URI.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor
    • Updated MCP root URI-to-filesystem path conversion to use a dedicated absolute-path utility, improving correctness and reducing edge-case failures when translating root locations. This results in more consistent path handling across environments and avoids less reliable URI-to-Path conversions. Workspace add/remove behavior stays the same, and no configuration changes are required for users.

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@nixel2007, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 8 minutes and 52 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 287fa688-04d7-4117-aed3-5a4221df06eb

📥 Commits

Reviewing files that changed from the base of the PR and between 44f8047 and a0026d5.

📒 Files selected for processing (1)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/mcp/McpRootsChangeConsumer.java
📝 Walkthrough

Walkthrough

McpRootsChangeConsumer replaces the java.net.URI.create(...) call in its toPath method with Absolute.path(...) from com.github._1c_syntax.utils.Absolute, and removes the now-unused java.net.URI import. No behavioral changes to workspace add/remove logic.

Changes

MCP Root URI Conversion

Layer / File(s) Summary
Replace URI.create with Absolute.path in toPath
src/main/java/com/github/_1c_syntax/bsl/languageserver/mcp/McpRootsChangeConsumer.java
Replaces java.net.URI import with com.github._1c_syntax.utils.Absolute and updates toPath to use Absolute.path(root.uri()) instead of Path.of(URI.create(root.uri())).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐇 A URI path once went astray,
URI.create had its final day.
Absolute.path hops in with flair,
Two lines swapped with the utmost care.
The rabbit nods — a tidy lair! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: normalizing root URIs through the Absolute utility in the MCP module.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/mcp-roots-absolute-uri

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

private static @Nullable Path toPath(Root root) {
try {
return Path.of(URI.create(root.uri()));
return Path.of(Absolute.uri(root.uri()));

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Absolute.path?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Да, так чище — Absolute.path(String) отдаёт нормализованный Path напрямую. Заменил Path.of(Absolute.uri(root.uri()))Absolute.path(root.uri()).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Поправка к ответу выше: чистый Absolute.path(root.uri()) не подошёл — перегрузка path(String) трактует строку как файловый путь, а у нас root.uri() это URI-строка (file://…), плюс она не отбраковывает не-file URI (так ломались 2 теста: unsupportedRootUriIsSkipped, mcpRootsRegisterAndRemoveWorkspaces). Корректная форма через Absolute.path — с URI-перегрузкой: Absolute.path(Absolute.uri(root.uri())) (строка → нормализованный URI → Path). Сборка и MCP-тесты зелёные.

@nixel2007
nixel2007 force-pushed the claude/mcp-roots-absolute-uri branch from 0996ca9 to 44f8047 Compare June 15, 2026 06:58
@nixel2007
nixel2007 force-pushed the claude/mcp-roots-absolute-uri branch from 44f8047 to a0026d5 Compare June 15, 2026 07:04
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

Test Results

 3 414 files  ±0   3 414 suites  ±0   1h 41m 25s ⏱️ + 13m 14s
 3 391 tests ±0   3 373 ✅ ±0   18 💤 ±0  0 ❌ ±0 
20 346 runs  ±0  20 238 ✅ ±0  108 💤 ±0  0 ❌ ±0 

Results for commit a0026d5. ± Comparison against base commit 9dca202.

@nixel2007
nixel2007 merged commit 7b5e8de into develop Jun 15, 2026
39 checks passed
@nixel2007
nixel2007 deleted the claude/mcp-roots-absolute-uri branch June 15, 2026 09:58
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.

1 participant