Repository navigation
refactor(desktop): 应用契约与 fixture 只在 Rust Core,删除 shared/contracts 与 shared/fixtures 副本 - #1861
Merged
Merged
Conversation
…hared/fixtures 副本 (#1853) - 桌面测试改用 contractfixture.CoreFixture 读取所链接 Core 检出的 rust/fixtures, desktop-go.sh 导出 LITHE_CORE_FIXTURE_DIR - 删除 shared/contracts(28 个文件)和 shared/fixtures(295 个文件), i18n 格式样例移到 shared/i18n/fixtures - PINNED_CORE_REVISION 升到 Core main f113e9e(含 #23、#24、#25) - .gitignore 只放行 shared/i18n 和 shared/platform-feature-matrix - 资源复用清单删除 phpunit-fixture,功能矩阵删除无法本地校验的证据路径 - Note、Skill 和文档的引用改指 Core,新增 Note 记录决策
xiaoyumuxi
marked this pull request as ready for review
November 13, 2026 16:43
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
main。lithe-ai,已合入。本 PR 把固定修订升到包含它的main。PR 类型 / Type
改动说明 / What changes
背景 / Why
应用契约和 fixture 在两个仓库各有一份:Core 的
rust/contracts/、rust/fixtures/由 Core 代码和测试读取;本仓库的shared/contracts/、shared/fixtures/由桌面 Go 测试按../../../shared/fixtures/...读取。两份没有同步机制,已经分叉:rust-core-api.md少了命令总表和 AI configuration 章节,本仓库的副本里还在(已由 Core#24 补回)。shared/fixtures/agent/、lsp/java-*.json、maven/、phpunit-project/等没有读者的副本。本 PR 让 Core 成为唯一来源:删除本仓库的副本,桌面测试改读所链接的 Core 检出。
改动 / Changes
测试读取 Core 的 fixture
desktop/internal/contractfixture/contractfixture.go:新增CoreFixtureEnvironmentVariable(LITHE_CORE_FIXTURE_DIR)和CoreFixture(rel)。它和已有的Path共用join,变量没设置时 panic,提示通过desktop-go.sh运行。scripts/desktop/desktop-go.sh:在LITHE_PLUGIN_CONTRACT_DIR之后导出LITHE_CORE_FIXTURE_DIR=<Core 检出>/rust/fixtures,两者来自同一份检出。desktop/internal/{core,pluginservice,pluginsettings,settingswindow,workbench}下 37 个测试文件(加上下一条的ai_generation_test.go共 38 个):os.ReadFile("../../../shared/fixtures/X")和filepath.Join("..", "..", "..", "shared", "fixtures", …)改为contractfixture.CoreFixture("X"),去掉不再使用的path/filepath导入。desktop/internal/core/ai_generation_test.go:readSharedJSON改名为readCoreFixtureJSON,改从 Core 读取。githubapi/transport.go、githubapi/types.go、core/ai_pull_request.go、core/github_checkout.go、core/history.go、core/ai_generation.go、core/github.go、workbench/build.go、workbench/aicommit_http.go,以及core/plugin_diagnostics_test.go、core/gitconsole_test.go里指向shared/(contracts|fixtures)/的注释,都改成Lithe-core-rust rust/(contracts|fixtures)/。每个路径都已核对在 Core 中存在。删除副本
git rm -r shared/contracts shared/fixtures:删除 28 个契约文件和 295 个 fixture 文件(含phpunit-project/)。scripts/i18n/test-i18n.mjs使用,Core 不读取,所以shared/fixtures/i18n/移到shared/i18n/fixtures/。test-i18n.mjs的两处路径和shared/i18n/README.md同步修改。.gitignore:去掉!/shared/contracts/、!/shared/fixtures/,现在只放行shared/i18n/和shared/platform-feature-matrix/。从旧分支切过来时留在磁盘上的副本不会出现在git status里。固定修订
scripts/desktop/build-desktop-core.sh:PINNED_CORE_REVISION从5a8e67d(fix:修复左侧Git提交文件无法全选问题 #23 合入前的分支 head,不在 Coremain上)升到 Coremain的f113e9e。它包含 fix:修复左侧Git提交文件无法全选问题 #23、[Feature] IDE 仅支持白名单的文件后缀打开,需要更广泛的支持 #24、feat: detect text files by content instead of an extension allowlist #25。[Feature] IDE 仅支持白名单的文件后缀打开,需要更广泛的支持 #24 只改文档和测试;feat: detect text files by content instead of an extension allowlist #25 只把 AI 命令移进lithe-ai,命令名、JSON 和错误码不变。注释同步更新。资源复用清单
scripts/resources/worktree-resources.json:删除phpunit-fixture的排除条目(目录已不存在)。docs/ci-builds.md:删除“PHPUnit 测试夹具的shared/fixtures/phpunit-project/vendor也由当前工作树独立安装”这句。功能矩阵
shared/contracts、shared/fixtures的路径。当前证据必须是本仓库里存在的路径,Core 里的文件无法在这里校验。删除后每个条目仍有其他证据。debug-disassembly、debug-state、plugin-debug-adapters、run-java-test的verification文字改成“Core 的rust/(contracts|fixtures)/”。legacy.*证据固定在旧修订,不校验,保持原样。verify-platform-feature-matrix-change.mjs:platformPaths去掉shared/contracts。generate-platform-feature-matrix.mjs规则 4:改成“新的共享行为先在 Rust Core 仓库的rust/contracts/和rust/fixtures/更新契约与 fixture”。Agent Note、Skill 和文档
.agents/notes/implemented/architecture/2026-11-14-core-app-contracts-single-source.md,记录这次决策、备选方案、后果和引用约定。## 适用范围条目和 Markdown 相对链接:改成https://github.com/Lithe-IDEA/Lithe-core-rust/{blob,tree}/main/rust/...;Lithe-core-rust/rust/...;65cf823、feat: add editor tab layout modes and reordering #18 前d797244、[Bug] 左侧Git提交文件无法全选 #19 前16fc903、[Feature] IDE 仅支持白名单的文件后缀打开,需要更广泛的支持 #24/feat: detect text files by content instead of an extension allowlist #25 前78c065d),正文保留原路径作为历史记录;shared/fixtures/i18n/改成shared/i18n/fixtures/;shared/contracts/plugins的历史提及不动;2026-11-08-viva-repository-ownership-and-sharing-boundaries.md:把“Core 命令的共享契约和夹具位于shared/”改成只在 Core 维护,并链接新 Note。2026-11-12-viva-agent-conversation-removed.md、docs/viva-migration.md:补一句,说明剩下的shared/fixtures/agent/、shared/contracts/agent-turn-policy.json随本 PR 删除。develop-litheSkill:contractfixture.CoreFixture;shared/一行改成 i18n 和功能矩阵;rust/fixtures/里补,并升固定修订;lithe-code-review/references/local-review.md、docs/development/{document-encoding,windows-ai-commit,macos-plugin-api-plan,windows-plugin-parity-plan}.md:路径和链接改指 Core。不在本 PR 范围内 / Out of scope
shared/fixtures/lsp/java-*.json等路径。这些 Note 整体由 [Feature] 归档已迁出插件仓库的 Java/Maven/JDT/Spring Agent Note #1787 归档,本 PR 只修了会让校验失败的适用范围和链接。类型专属:fix
复现与根因
shared/fixtures/,链接的却是 Core 的代码。两边已经分叉,例如本仓库还留着 Core 早已删除的 Java/Agent fixture。期望是测试读到和链接代码同一个 commit 的 fixture。shared/contracts、shared/fixtures没有删除,也没有同步机制。检查项
main上运行通过(见验证)。git ls-files shared/contracts shared/fixtures输出为空。git grep搜索全仓库shared/contracts、shared/fixtures和"shared", "fixtures"的引用,覆盖 Go 测试、脚本、资源清单、功能矩阵、Note、Skill 和文档。剩下的只有 archived Note、legacy矩阵证据、插件契约的历史提及,以及已删除文件的历史正文。.agents/notes/implemented/architecture/2026-11-14-core-app-contracts-single-source.md(架构决策,不是 bug-fix 分类)。范围检查 / Scope checks
功能矩阵 / Feature matrix
shared/platform-feature-matrix/features/<id>.json:只删除了无法在本仓库校验的证据路径,并改了 4 处verification文字,实现状态和验证状态都没有变。./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh(validated 223)和node --test scripts/platform-feature-matrix/test-platform-feature-matrix.mjs(5/5)。.artifacts/下生成的矩阵视图统一日志系统 / Structured logging
N/A:没有新增或改动日志事件和失败路径。
界面文案 / i18n
node scripts/i18n/verify-app-language-localization.mjs和node scripts/i18n/generate-i18n.mjs --check,另外跑了node --test scripts/i18n/test-i18n.mjs,确认它读得到移动后的样例。逻辑归属 / Logic placement
性能与内存 / Performance and memory
N/A:只改测试读取路径、文档和仓库结构,不影响运行时。
设置 / Settings
N/A:没有改设置。
插件契约 / Plugin contract
N/A:插件契约本来就只在 Core(
LITHE_PLUGIN_CONTRACT_DIR不变)。本 PR 升级固定修订是为了应用 fixture,不涉及插件契约、能力版本或宿主方法。发行包与资源 / Bundle and resources
./scripts/desktop/verify/verify-runtime-bundle-immutability.sh通过。scripts/resources/worktree-resources.json(删除phpunit-fixture排除条目)和docs/ci-builds.md;node --test scripts/resources/test-reuse-worktree-resources.mjs37/37 通过。删除的是测试夹具,路由脚本里没有它的校验分支。无用代码与重构 / Dead code and refactoring
shared/contracts、shared/fixtures全部副本、phpunit-fixture资源条目、矩阵变更门禁里的shared/contracts路径。验证 / Verification
LITHE_CORE_RUST_DIR=<Core main f113e9e 检出> ./scripts/desktop/check.sh(gofmt、vet、vet -tags dev、go test ./...、buildinfo dev 测试)node scripts/desktop/validate-pins.mjs./scripts/agent-notes/verify-agent-notes.sh./scripts/platform-feature-matrix/verify-platform-feature-matrix.shnode --test scripts/platform-feature-matrix/test-platform-feature-matrix.mjsnode scripts/i18n/verify-app-language-localization.mjsnode scripts/i18n/generate-i18n.mjs --checknode --test --test-timeout=60000 scripts/i18n/test-i18n.mjsnode --test scripts/resources/test-reuse-worktree-resources.mjs./scripts/desktop/verify/verify-runtime-bundle-immutability.shgit ls-files shared/contracts shared/fixtures未能执行的检查和原因: 没有在 Windows 和 Linux 本地运行桌面测试。
desktop-go.sh在 Windows 上用native_path转换LITHE_CORE_FIXTURE_DIR,和已有的LITHE_PLUGIN_CONTRACT_DIR写法相同;需要 ready 后由 CI 的 Windows、Linux 通道确认。提交前确认 / Final checks
preview(36f0dbdb1)创建,目标分支preview