Skip to content

feat(jdtls): 为 JDT LS 增加国内 CNB 镜像源与双源容灾 - #55

Merged
1lck merged 1 commit into
mainfrom
feat/jdtls-cnb-mirror
Dec 3, 2026
Merged

1lck merged 1 commit into
mainfrom
feat/jdtls-cnb-mirror

Conversation

@1lck

@1lck 1lck commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

背景

Eclipse JDT Language Server (download.eclipse.org/jdtls/milestones/...) 目前没有可用的国内公共开源镜像,国内用户首次打开 Java 文件自动下载 JDTLS 较慢或易超时。

配合 Lithe-IDEA/Lithe-store#127(将 jdt-language-server-1.61.0-202609031315.tar.gz 经 SHA-256 校验后原样镜像至 CNB managed-runtimes Release),本 PR 为 jdtls 的全部六个平台制品补齐国内镜像源。

改动

  • third_party/jdtls/manifest.json:新增 archiveMirrors 固定 CNB 镜像地址(https://cnb.cool/lithe-idea/Lithe-store/-/releases/download/managed-runtimes/jdt-language-server-1.61.0-202609031315.tar.gz),保留上游 download.eclipse.org 作为官方源。
  • io.github.lithe-idea.java-support/plugin.json:为 managedRuntimes.dependencies[id="jdtls"].artifacts 的 6 个平台条目(linux/macos/windows × arm64/x86_64)添加该 mirrors(插件已启用 managedRuntimes: 1,宿主 pluginruntime 会对官方源与 CNB 镜像并行 HEAD 测速并在失败或低于 64 KiB/s 时自动切换,同时强制校验原包 SHA-256 338e7e73…34c64)。
  • backend/tests/repository_pins.rs:校验 jdtls 全部平台制品的非空 HTTPS mirrors 与 third_party/jdtls/manifest.json 的 archiveMirrors 一致。

验证

  • cargo fmt --all --check:通过
  • cargo clippy --workspace --all-targets --locked -- -D warnings:通过
  • cargo test --workspace --locked:通过(含 repository_pins 11/11 与 backend/domain 全部测试)
  • node --test --test-timeout=60000 scripts/package/*.test.mjs:通过(11/11)
  • 未在本机运行 scripts/verify-contract.py(本地 Python 缺少 jsonschema 依赖),交由 CI 校验。

依赖与发版顺序

  • 建议先合入并运行 Lithe-IDEA/Lithe-store#127 的 Mirror to CNB 工作流,确保 CNB Release 资产已就位后再基于本 PR 切新版本;即使 CNB 侧尚未同步,宿主仍会按原官方 url 正常回退下载。

@1lck
1lck marked this pull request as ready for review December 3, 2026 03:12

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

Devin Review

Comment on lines +109 to +111
"mirrors": [
"https://cnb.cool/lithe-idea/Lithe-store/-/releases/download/managed-runtimes/jdt-language-server-1.61.0-202609031315.tar.gz"
],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔴 Missing mirror blocks JDT LS setup

With Eclipse ranked first, downloadArchive cancels a working transfer when its speed check measures below 64 KiB/s. If CNB then returns 404, the host never returns to Eclipse, so first-time JDT LS setup fails.

Learn more

When JDT LS is missing, the runtime preparation flow asks the desktop host to download it. In the pinned desktop host, rankMirrors puts unsuccessful HEAD probes last but retains them. downloadArchive visits each URL once and enables the speed cutoff whenever another URL remains, even when that URL failed its probe. With only the Eclipse URL, the speed cutoff does not apply. The configured CNB URL currently returns HTTP 404 because the release tag does not exist yet.

Example: On a clean installation with a compatible JDK, Eclipse answers HEAD and serves the JDT LS archive at a steady 48 KiB/s. CNB answers HEAD and GET with 404. The host cancels the progressing Eclipse download, tries CNB, and fails setup; without the mirror, it lets Eclipse finish.

Recommended fix: Make the host retry sources canceled only for low throughput without the speed cutoff after all other sources fail, while preserving parent cancellation and SHA-256 verification. Gate the mirror rollout on that behavior and a successful anonymous download of the pinned CNB asset.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@1lck

1lck commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for catching the fallback edge case on slow primary mirrors when a secondary mirror returns 404 before mirror sync completes. Fixed in the host runtime downloader in 1lck/Lithe-IDEA#2647 (commit 0e714193f, desktop/internal/pluginruntime/mirrors.go): mirrors cancelled by the < 64 KiB/s speed guard are now retried without the speed cutoff if all fallback mirrors fail.

@1lck
1lck merged commit 343622b into main Dec 3, 2026
9 of 15 checks passed
@1lck
1lck deleted the feat/jdtls-cnb-mirror branch December 3, 2026 03:49
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