[Feature] 将 Viva 插件 scheme 与函数 ID 校验下沉 Rust Core

Open
#1,892 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
18/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Active
Tech stack
go, rust

Research direction

Start with desktop/internal/pluginservice/hostcontent.go, where validScheme, validFunctionID and reservedSchemes define the rules, then check their callers in hostcommands.go, hostcodelens.go, hostactions.go, hostproviders.go and toolwindows.go. Moving the rules into the Rust Core needs boundary-value contract fixtures and a Go bridge, and it must leave session ownership and callback checks in the host. Done means the same inputs are accepted and rejected as before across all callers.

Written by the indexing model from the issue text.

Description

area:extensions enhancement P2 platform:cross-platform refactor review: high
Problem to solve / 要解决的问题

Viva 的通用插件输入校验仍由 Go 层持有:desktop/internal/pluginservice/hostcontent.go 的 validScheme、validFunctionID、reservedSchemes 定义 URI scheme 字符集、长度、保留名单以及函数 ID 字符集和长度。这些不依赖平台 I/O,应按当前架构由 Rust Core 提供唯一规则。

以 preview 修订 607f00967d70a7017d49805183d0d2e6ffdf1c0d 为基线,对 desktop、scripts、.github 检索这些符号,函数 ID 校验还用于 hostcommands.go、hostcodelens.go、hostactions.go、hostproviders.go、toolwindows.go;不是无调用代码。保留代价是契约规则由宿主自行维护,其他宿主或 SDK 演进时容易出现不同的接受范围。当前没有证据表明这些字符集已造成错误拒绝。

Proposed solution / 建议方案

把上述确定性校验迁入 Core,补充契约 fixture 后由 Go 桥接调用。保留当前合法/非法输入、长度和保留 scheme 行为;会话所有权、已注册回调查验与资源释放仍由宿主执行。应先覆盖边界值,再检查所有调用方,避免迁移改变授权行为。

Target platform / 目标平台

Cross-platform / 跨平台

Area / 模块

Extensions / 扩展

Priority / 优先级

P2 / 后续考虑:目前不着急,可安排到后续版本

Alternatives considered / 已考虑的替代方案

继续在每个宿主维护校验会扩大契约漂移风险;本次 Java 预发布核验不顺手改这些规则,以免混入无关兼容性变化。

Additional context / 补充信息

静态归属检查;不是 .class 跳转失败的根因。已查重 contentProvider、虚拟文档 Core、validFunctionID,并阅读 #1662:该旧双端清单没有覆盖当前 Viva hostcontent 的这组规则。本报告不包含用户源码、路径、诊断包或业务类。

Checklist / 提交前检查
  • I searched existing issues for duplicates. / 我已搜索现有 Issue,确认没有重复建议。
Dominant language
TypeScript
Stars
1.8k
Forks
151
Avg merge
3h 48m
Merged PRs (30d)
571

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from 1lck/Lithe-IDEA

All issues in 1lck/Lithe-IDEA

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.