Repository navigation
refactor(execution): 删除内置运行发现探测器,运行入口只来自插件 buildSystems[].run (#1856) - #77
Merged
Merged
Conversation
Core 不再自己识别可运行入口。生成层只由构建插件声明的 run(providerRuns)组成,
模型何时过期由各插件的 sync.watch 决定。
- 删除 execution 的 detectors/(cargo、compose、go、make、npm、procfile、python、shell)、
指纹输入 inputs.rs、工具链要求 requirements.rs,以及随之失去用途的 regex、serde_yaml_ng、
toml、lithe-diagnostics 依赖。
- runConfig.generate 只把 providerRuns 生成为 build.provider 条目;未提供时等同 []。
生成层只留在内存,不写工作区、不写缓存,也不再读取旧版的 .lithe/run/generated.json;
响应为 { generated, entryCount }。
- runConfig.inspect 只在给了 providerRuns 且快照不同时报告 staleProviderModel;
删除 checkFingerprint、staleFingerprint、incompleteProjectScan 与 cacheDirectory。
- runConfig.resolve 不再匹配工具链版本、不再归一化 npm 条目:删除 toolchainCandidates
和工具链诊断,默认项为项目默认、首个生成的服务、首个非 Current File 的生成条目。
- 重名只按工作目录区分(provider 条目没有 source)。
- workspace_scan 只保留一种有界扫描(6 层、隐藏目录与 Git 忽略、最多 4000 个目录),
供 build.detect 使用;删除不限层数模式、unreadablePaths 与提前停止。
- 契约:rust-core-api.md、application-boundary.md、run-configuration-v2 schema 的
generator 只剩 providerRunFingerprint;删除 toolchain-requirements-v1 schema 与
hybrid-service-web fixture。
- 测试:删除内置探测器测试,新增 provider run 生成的重名与过期快照测试,
Cargo 静态模型测试改为直接断言 run 条目。
26 of 29 tasks
#74 合入的 PreviewResponse.repositories 与 RepositoryPush.state 没有文档注释, Rust Core CI 的 Check comments(rustdoc -D missing-docs)在 PR 覆盖到 lithe-git 时失败。
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.
关联 Issue / Linked issue
#1856 要求把 Core 里剩下的 5 类语言专属默认值移出 Core。本 PR 做最后一项:第 4 项(运行发现的探测器与指纹)。第 5 项 #66、第 2 项 #68、第 3 项 #69、第 1 项 #72 已合入。本 PR 和桌面端接入 PR 合入后,#1856 的 Core 部分就做完了。
PR 类型 / Type
buildSystems[].run)改动说明 / What changes
背景 / Why
runConfig.generate原来会在execution/src/detectors/里跑 8 个写死的探测器,按文件名和文件内容自己生成 Run 配置:cargo.rsCargo.toml的[[bin]]/src/main.rscargo run --bingo.rsgo.mod+package maingo runnpm.rspackage.json的scripts、锁文件选 npm/pnpm/yarn/bunnpm run,外加project-node运行时归一化python.rspyproject.toml、manage.py、main.py等python -m/ 脚本make.rs、shell.rsMakefile目标、justfile、可执行脚本make/just/ 脚本procfile.rsProcfilecompose.rscompose.yaml等docker compose up,类别infrastructure每个探测器还登记了自己的“指纹输入”(
inputs.rs)和“工具链要求”(requirements.rs),用来判断 Run 列表是否过期、工具链版本是否满足。这些全都是 Core 对具体语言和工具的特判,违反“Core 对语言和工具零依赖”。同一件事已经有通用机制:构建插件用buildSystems[].run声明 Run 入口,用sync.watch声明自己的过期输入(API-29)。Go 和 Gradle 插件已经这样做,Core 的go.rs和 Go 插件做的是同一件事。改动 / Changes
生成:只把插件声明的 run 变成 Run 配置
execution/src/detectors/(上表 8 个探测器)、configuration/inputs.rs、configuration/requirements.rs。随之没有用途的依赖regex、serde_yaml_ng(及unsafe-libyaml)、toml、lithe-diagnostics从lithe-execution去掉。runConfig.generate只把providerRuns生成为build.provider条目,然后按工作目录给重名条目加后缀。没给providerRuns时等同[],生成层为空。响应为{ generated, entryCount }。.lithe/run/generated.json。删除cacheDirectory参数和整条缓存读写路径。generator只剩providerRunFingerprint。检查:只认插件模型的快照
runConfig.inspect只在给了providerRuns、已有生成层、且快照指纹不同(或缺失)时报告staleProviderModel。checkFingerprint参数、staleFingerprint和incompleteProjectScan状态:过期输入由各插件的sync.watch负责,Core 不再扫描工作区算指纹。解析:不再匹配工具链
runConfig.resolve删除toolchainCandidates参数和工具链版本、厂商诊断;删除对npm.script条目的project-node运行时归一化。orphanedOverride、disabled、missingWorkingDirectory、missingDefaultConfiguration。.lithe/project.json的团队默认,否则第一个生成的服务,否则第一个不是 Current File 的生成条目。重名
source,重名只按工作目录区分:两个模块都声明serve时变成serve (services/api)、serve (services/worker);工作目录不能把一组全部分开,或其中有工作区根目录时,名字不变。id 不受影响。工作区扫描
workspace_scan现在只给build.detect用,只留一种有界扫描:最多 6 层、不跟随符号链接、跳过默认隐藏目录(Core 自己的目录和已启用插件声明的目录)和 Git 忽略的目录,最多 4,000 个目录。根目录读不了、远程连接中断时报错;更深的目录读不了时跳过。unreadablePaths和提前停止。API 改为scan_workspace(root, max_depth, ignored)和scan_with_reader(root, max_depth, read)。契约与文档
rust-core-api.md:重写runConfig.inspect/generate/resolve的说明,删除 Windows 指纹、checkFingerprint、unreadablePaths、incompleteProjectScan、cacheDirectory、toolchainCandidates和“进程探测器声明运行时绑定”整段;构建系统一节补上共享扫描策略。application-boundary.md:去掉“工具链匹配器”和“由探测器声明运行时”的说法。run-configuration-v2.schema.json:generator只剩providerRunFingerprint。toolchain-requirements-v1.schema.json和 fixturehybrid-service-web.json(已无引用)。测试
tests/detectors.rs和只为内置探测器存在的 9 个run_configuration测试(混合项目、纯 Go、多语言、隐藏目录扫描、v2 遗留运行时等)。provider_run_generation_qualifies_repeated_names_and_reports_stale_snapshots:只用虚构的dev.lithe.test.engine,验证重名后缀、相同快照不报过期、不同快照报staleProviderModel、不给providerRuns时生成 0 条且不创建.lithe。resolve不安全工作目录测试先断言正常路径ok且无诊断,再保留../outside的拒绝。兼容性与发布顺序 / Compatibility and rollout
行为变化:合入并接入桌面端后,Run 列表只显示已启用构建插件声明的 run,加上用户保存的配置和 Current File。这是 #1856 讨论里确认过的取舍:这些探测器本来就应该由插件做。没有对应插件的生态失去自动生成的 Run 条目,用户可以自己保存配置:
runrun(Core 原本没有探测器)runrun之前没有自动条目infrastructure);Docker 插件 0.1.2 没有构建系统run(Core 原本没有探测器)旧客户端:请求结构没有
deny_unknown_fields,旧桌面端继续发送checkFingerprint、cacheDirectory、toolchainCandidates不会报错,只是被忽略;staleFingerprint、incompleteProjectScan不再出现。旧版写下的.lithe/run/generated.json不再读取,也不删除。发布顺序
PINNED_CORE_REVISION的同一个 PR 里去掉这些参数和状态的处理、run.incompleteProjectScan*文案,更新依赖 npm 探测器的测试、功能矩阵和 Agent Note。run、Docker 插件是否提供 Compose 构建系统,由插件维护者在插件仓库决定,不阻塞本 PR。宿主方法:没有新增宿主方法、通知或能力版本。
runConfig.*是宿主调用 Core 的命令。不在本 PR 范围内 / Out of scope
run声明(插件仓库)。infrastructure类别;Compose 一类的基础设施条目只能来自保存的配置。是否给buildSystems[].run加类别字段,等有插件需要时再按 API-29 设计。类型专属:fix
复现与根因
go.rs和 Go 插件各识别一遍。execution/src/detectors/把 8 类生态的识别规则、指纹输入和工具链要求写死在 Core 里。范围检查 / Scope checks
功能矩阵 / Feature matrix
N/A:Core 仓库没有功能矩阵。宿主端的可见行为在桌面端接入 PR 里按矩阵规则更新(
run-discovery)。插件归属 / Plugin ownership
dev.lithe.test.*插件。UI 验证 / UI evidence
N/A:Core 没有界面。Run 列表的可见变化在桌面端接入 PR 里验证。
统一日志系统 / Structured logging
N/A:没有新增或改动日志事件(
generate-log-events.mjs --check通过)。界面文案 / i18n
N/A:没有用户可见文案。桌面端接入 PR 会删掉不再出现的
run.incompleteProjectScan*文案。逻辑归属 / Logic placement
性能与内存 / Performance and memory
runConfig.generate不再扫描工作区、不再读写缓存,只处理宿主交来的providerRuns(最多 10,000 条)。runConfig.inspect不再计算工作区指纹。设置 / Settings
N/A:没有设置项变化。
插件契约 / Plugin contract
PINNED_CORE_REVISION:在桌面端接入 PR 里升级。sdk-e2e.mjs:没有改插件后端协议。发行包与资源 / Bundle and resources
N/A:没有运行时资源;删掉了生成缓存的写入。
无用代码与重构 / Dead code and refactoring
unreadablePaths、提前停止,以及只为它们存在的 4 个依赖、1 个 schema 和 1 个 fixture(共删 3,714 行)。验证 / Verification
cargo fmt --manifest-path rust/Cargo.toml --all -- --checknode scripts/logging/generate-log-events.mjs --checkscripts/rust-core/verify-rust-core-comments.sh core executioncargo clippy --workspace --all-targets --all-features -- -D warningscargo clippy --locked --workspace --all-targets --target x86_64-pc-windows-msvc -- -D warningscargo test --locked --workspace --features lithe-remote/servercargo test --workspace --all-features --no-fail-fastplugin_sdk_build的 2 个测试失败:它们需要shared/plugins/scripts/sdk-e2e.mjs设置的环境变量,和本 PR 无关(SDK 示例不调用runConfig.*)node scripts/rust-core/verify-platform-tests.mjsnode shared/plugins/scripts/verify-docs.mjsnode scripts/rust-core/affected-crates.mjs --base origin/main--workspace --features lithe-remote/server;macOS:lithe-platform、lithe-remote、lithe-platform-tests;Windows:lithe-platform、lithe-platform-tests未能执行的检查和原因: Windows 上没有在本机运行测试,ready 后由 CI 覆盖;本 PR 没有平台相关代码。Run 列表的整机效果要在桌面端接入 PR 里验证。
提交前确认 / Final checks
main(ac8825b)创建;目标分支main