Skip to content

feat(logging): 接入 litheLogging 1 结构化诊断 - #2

Merged
xiaoyumuxi merged 1 commit into
mainfrom
codex/plugin-logging-v2
Nov 4, 2026
Merged

xiaoyumuxi merged 1 commit into
mainfrom
codex/plugin-logging-v2

Conversation

@xiaoyumuxi

@xiaoyumuxi xiaoyumuxi commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

概要

SVN 插件接入结构化日志 v2:vendor 的官方 Node SDK 更新到支持 litheLogging 1 的版本,VCS 请求的成功/失败终态由 SDK 自动上报;后台高频的 status 和 baseContent 成功不再产生 INFO;批注读取提交说明失败时改为一条降级事实。集成测试的 Core 构建脚本改为显式选择宿主来源,并校验宿主具备 litheLogging 1。

依赖:

Provider 行为(…/provider/svn-provider.mjs)

  • createBackend(...) 链式调用 .suppressSuccessDiagnostics('lithe/vcs/status').suppressSuccessDiagnostics('lithe/vcs/baseContent'):这两个后台请求的成功保持静默,失败照常 ERROR。

  • annotate 读取 svn log 补充提交说明时,如果失败、输出被截断或无法解析,批注仍正常返回(只是没有提交说明),并上报一次 degraded('lithe/vcs/annotate', code):

    • 非零退出 → svn.annotation.historyUnavailable
    • 输出被截断 → svn.annotation.historyTruncated
    • 无法解析 → svn.annotation.historyInvalid

    事实不带 svn 输出。

SDK 来源与集成测试的 Core 来源

和 Cargo 插件采用同一套方案:

  • vendor 的 Node SDK 更新为 lithe-plugin-docs 29b245c0e1d77c761d9032a3144a301d1818bfc7 加 SDK PR #17 的日志改动,新增 diagnostics.mjs、host.mjs;sdk.lock.json 分开记录 sdkSource(SDK 来源,逐文件 source、localChanges、upstreamSha256)和 coreSource(https://github.com/1lck/Lithe-IDEA,ref preview,要求 litheLogging:1);scripts/verify-sdk.mjs 校验 sdkSource。
  • 新增 scripts/core-source.mjs(identifyCore / verifyPreparedCore:校验 origin、ref、源码摘要、plugins.operation.finished 目录事件,构建后源码漂移即拒绝);scripts/prepare-core.mjs 支持 --source、--ref、--target-dir、--working-tree,用 rustc 链接 liblithe_core.rlib 编译 harness,不再往宿主检出里复制 example。
  • CI 与 release 从 coreSource 读取宿主仓库和 ref 并检出。
  • README 新增诊断日志和 Core 集成来源说明;NOTICE 同步来源说明。

测试

  • 新增 test/core-source.test.mjs。
  • test/scenario.test.mjs 新增断言:svn 不可用时,Core 中有一条 plugins.operation.failed(ERROR,operation 为 lithe/vcs/status,code 为 vcs.tool.unavailable),通道为 plugins/io.github.lithe-idea.svn-support/host,op 与宿主请求关联,且不包含临时目录路径。
  • test/support/core.mjs 注册 VCS 会话时带上 role: 'vcs'、logSubject: 'svn',并改用新的 Core 身份校验。

验证

  • 本地:node --test 单元测试 0 失败(1 项集成测试因本机没有准备好的 Core 而跳过);node scripts/verify-sdk.mjs 通过。
  • 此前在 Codex 工作区用本地宿主分支准备 Core 后:25/25 通过(包括真实新 Core 的 working copy 场景,无跳过),覆盖真实 svnadmin 和 provider;打包通过。

预期的 CI 状态与合并顺序

  • 宿主 #1699 合并进 preview 之前,CI 的 “Verify host prerequisite and build Core bridge” 会报 “Selected Core lacks litheLogging:1”,这是预期结果。
  • 合并顺序:宿主 #1699 → SDK #17(先同步 contract/v1)→ 本 PR。发布前把 sdkSource 重新固定到 SDK #17 合并后的 commit。
  • 本 PR 没有改插件版本号。

限制

  • 只覆盖 macOS 宿主;Windows 仍是 v1 writer。
  • 未在 Lithe 整机日志窗口里做端到端验收。

配套 PR:

- vendor 的 Node SDK 更新为 lithe-plugin-docs 29b245c 加本轮日志改动,
  sdk.lock.json 分开记录 sdkSource(SDK 来源)与 coreSource(集成测试宿主)
- 后台 lithe/vcs/status 与 lithe/vcs/baseContent 的成功不再记 INFO,失败照常 ERROR
- annotate 读取提交说明失败、截断或无法解析时记一次 WARN degraded,
  批注仍正常返回,不带 svn 输出
- prepare-core 支持 --source/--ref/--working-tree/--target-dir,校验宿主
  origin、ref、源码摘要和 litheLogging 目录前提
- CI 与 release 改为检出宿主 preview;README 补充诊断日志与 Core 集成来源说明
@xiaoyumuxi
xiaoyumuxi marked this pull request as ready for review November 4, 2026 10:53
@xiaoyumuxi
xiaoyumuxi merged commit 8699cdd into main Nov 4, 2026
1 of 2 checks passed
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