fix: 兼容新版 DSH diff 数据契约,修复卡片静默失效(issue #3 根因) - #4
Open
Fishsb wants to merge 1 commit into
Open
Conversation
DSH 0.1.2-rc.1 重构了 edit/write 工具卡的数据流:旧插件读取的 block.callView/resultView.card === 'diff' 结构已被整体移除,改为组件内 diffCardModel(block) 现算(settled 取 block.meta.diffs,PTC 子调用标记 从 callId ':code:' 改为 parentCallId)。由于槽位 shadowing 优先级选举 正常工作(priority -1 遮蔽内置 0),卡片被本插件接管但提取不到任何 diff 数据,静默降级为无内容摘要卡——表现为接管后红绿 diff 消失 (issue better-er#3)。 extractDiffs 改为三层取数,新旧 DSH 双兼容: 1. settled 且非错误:优先 block.meta.diffs(与内置 appliedDiffs 同构, 含多 hunk 真实应用 diff) 2. PTC 子调用 / running / meta 缺失兜底:从 args 意图构建 (parentCallId 新标记,兼容旧 ':code:';argsRaw/name 防御性双取) 3. 旧版 DSH:保留 callView/resultView.card === 'diff' 回归读取 行级去重与字符级高亮算法不变。新版形状 5 例 + 旧版形状 3 例 + 边界 5 例共 13 项行为测试全过。
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 #3 报告的症状(安装后红绿 diff 消失、只剩折叠摘要卡)根因已定位:DSH 0.1.2-rc.1 重构了 edit/write 工具卡的数据流,插件耦合的内部结构已被整体删除。
根因链
extractDiffs()读取block.callView.card === 'diff'/block.resultView.card === 'diff'—— 这是旧版 DSH 的实现细节。当前版本该字段全运行时零匹配(已被删除)。diffCardModel(block)现算 —— settled 取block.meta.diffs(appliedDiffs,与{path, oldText, newText}同构、含多 hunk),running/子调用从 args 构建;PTC 子调用标记从callId ':code:'改为parentCallId。-1成功遮蔽内置0),于是出现最危险的静默失效形态:卡片接管成功 + 数据提取恒 null —— 无报错、无警告,用户只能靠"效果消失"感知。修复(新旧 DSH 双兼容)
extractDiffs改为三层取数,按优先级回落:block.meta.diffs(真实应用 diff,多 hunk)parentCallId新标记,兼容旧':code:';argsRaw/name 防御性双取)callView/resultView.card === 'diff'读取行为测试 13 项全过(新版形状 5 + 旧版形状 3 + 边界 5:多 hunk 多文件 / write 全新增 / settled 失败不显意图 diff / 非法 JSON 不抛 / meta 异常回落)。
行级去重与字符级下划线高亮算法未动。
附注
diffCardModel对 PTC 子调用直接返回 null(不渲染 diff),本插件现在可以渲染它们。Closes #3 的根因部分(该 issue 实为同一失效)。