Repository navigation
feat(logging): 接入 litheLogging 1 结构化诊断 - #5
Merged
Merged
Conversation
- vendor 的 Node SDK 更新为 lithe-plugin-docs 29b245c 加本轮日志改动, sdk.lock.json 分开记录 sdkSource(SDK 来源)与 coreSource(集成测试宿主) - provider 去掉 context.log 的重复错误日志;失败只由 SDK 请求边界记录一次, 错误信息不再拼接 Cargo stderr 或异常原文 - prepare-core 支持 --source/--ref/--working-tree/--target-dir,校验宿主 origin、ref、源码摘要和 litheLogging 目录前提,构建期间源码漂移即拒绝; 不再往宿主检出里复制 example - CI 与 release 改为检出宿主 preview;README 补充诊断日志与 Core 集成来源说明
This was referenced Nov 4, 2026
xiaoyumuxi
marked this pull request as ready for review
November 4, 2026 10:51
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.
概要
Cargo 插件接入结构化日志 v2:vendor 的官方 Node SDK 更新到支持
litheLogging1 的版本,构建模型请求(lithe/build/model)的成功/失败终态由 SDK 自动上报;provider 去掉“记录后再抛出”的重复错误日志,错误信息不再拼接 Cargo 的 stderr 或异常原文。集成测试的 Core 构建脚本改为显式选择宿主来源,并校验宿主具备litheLogging1。依赖:
litheLogging协议与目录事件;集成测试需要它)Provider 行为(
…/backend/provider.mjs)context.log(error)和context.log(result.stderr):失败只由 SDK 在请求边界记录一次operationFailed(ERROR),不再出现两份错误记录。cargo.invalidRoot、cargo.invalidMetadata改为固定的安全提示,不再透传error.message(可能带路径)。cargo.metadataFailed只带退出码,不再拼接最多 2 KB 的 Cargo stderr(可能含项目内容和环境变量)。SDK 来源(
sdk.lock.json、vendor/)29b245c0e1d77c761d9032a3144a301d1818bfc7加 SDK PR #17 的日志改动,新增diagnostics.mjs、host.mjs。sdk.lock.json分开记录两种来源:sdkSource:SDK 源码来源(lithe-plugin-docs 基线 commit、带localChanges的文件);每个文件记source、localChanges、upstreamSha256和当前 SHA-256。coreSource:集成测试使用的宿主(https://github.com/1lck/Lithe-IDEA,refpreview,requiredCapabilities: ["litheLogging:1"])。scripts/verify-sdk.mjs增加对sdkSource的校验。集成测试的 Core 来源
scripts/core-source.mjs:identifyCore校验宿主检出的 origin 等于coreSource.repository,HEAD等于所选 ref;计算rust/与shared/的源码摘要;宿主目录事件中没有plugins.operation.finished时报错 “Selected Core lacks litheLogging:1…”;有未提交改动时必须显式传--working-tree。verifyPreparedCore在每次集成请求前重新校验源码摘要、harness 和二进制 SHA-256,构建后源码有变化即拒绝。scripts/prepare-core.mjs支持--source、--ref、--target-dir、--working-tree:先构建 Core--lib,再用 rustc 链接liblithe_core.rlib编译 harness,把来源身份写进prepared.json。不再往宿主检出里复制 example 文件。sdk.lock.json的coreSource读取宿主仓库和 ref 并检出。测试
test/core-source.test.mjs,覆盖来源校验。test/provider.test.mjs新增两项:log;litheLogging1,工具缺失时恰好一条operationFailed,字段只有code、durationMs、kind、operation、operationId,且不包含工作区路径。test/integration.test.mjs、test/support/core.mjs改为协商litheLogging并用新的 Core 身份校验。验证
node --test单元测试 0 失败(4 项集成测试因本机没有准备好的 Core 而跳过);node scripts/verify-sdk.mjs通过。cargo metadata和工具缺失;打包通过。预期的 CI 状态与合并顺序
preview之前,CI 的 “Verify host prerequisite and build Core bridge” 会报 “Selected Core lacks litheLogging:1”,这是预期结果。contract/v1)→ 本 PR。发布前把sdkSource重新固定到 SDK #17 合并后的 commit,并视需要把coreSource.ref固定到合并后的宿主 SHA。限制
配套 PR: