fix(mobile): 修复源码 xdt-file 字符串误识别 - #5322
Conversation
Signed-off-by: DavidShen <david@xd.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 59b137cb14
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Signed-off-by: DavidShen <david@xd.com>
反馈已处理已处理:
变更:
验证:
备注:
|
反馈已处理已处理:
变更:
验证:
备注:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 210342830b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Signed-off-by: DavidShen <david@xd.com>
反馈已处理已处理:
变更:
验证:
备注:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8519157e0a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Signed-off-by: DavidShen <david@xd.com>
反馈已处理已处理:
变更:
验证:
备注:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3f861efa11
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Signed-off-by: DavidShen <david@xd.com>
反馈已处理已处理:
变更:
验证:
备注:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: af031af2da
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Signed-off-by: DavidShen <david@xd.com>
反馈已处理已处理:
变更:
验证:
备注:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fa5374ccb1
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Signed-off-by: DavidShen <david@xd.com>
反馈已处理已处理:
变更:
验证:
备注:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 07e5e74b40
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Signed-off-by: DavidShen <david@xd.com>
反馈已处理已处理:
变更:
验证:
备注:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d7f942d4da
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
反馈已处理已处理:
变更:
验证:
备注:
|
Signed-off-by: DavidShen <david@xd.com>
反馈已处理已处理:
变更:
验证:
备注:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e466f8d513
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Signed-off-by: DavidShen <david@xd.com>
反馈已处理已处理:
变更:
验证:
备注:
|
Signed-off-by: DavidShen <david@xd.com>
反馈已处理已处理:
变更:
验证:
备注:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: da95e939d8
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Signed-off-by: DavidShen <david@xd.com>
反馈已处理已处理:
变更:
验证:
备注:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: da9b750533
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Signed-off-by: DavidShen <david@xd.com>
反馈已处理已处理:
变更:
验证:
备注:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8357ab482c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Signed-off-by: DavidShen <david@xd.com>
反馈已处理已处理:
变更:
验证:
备注:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 25ddd38992
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Signed-off-by: DavidShen <david@xd.com>
反馈已处理已处理:
变更:
验证:
备注:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2b198022bc
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
反馈已处理已处理:
变更:
验证:
备注:
|
MagicLizi
left a comment
There was a problem hiding this comment.
Review: fix(mobile): 修复源码 xdt-file 字符串误识别 (#5322)
审查 head 2b198022bc516616eac5c506c1aa82b9a8d9ac5b,base 36420c470f275af57103b2da7b03dd5e144333e3(main),diffHash 8e4b0a59…4291。
Findings
没有 P0/P1。
(非阻断备注,不计入结论:散文里被引号包裹、且紧跟 ; 的真实引用——如 Saved "xdt-file:///tmp/report.pdf";——会被 looksLikeQuotedSourceLiteral 的「引号闭合 + 分号」分支当作源码过滤掉。触发面窄、方向保守(宁可少卡片不造伪卡片),属启发式边缘,P2 不阻断。report(1).pdf 类含 ) 的文件名仍被旧 URL 字符集截断,属 #4692 既有字符表行为、本 PR 明确不改,不属本次增量。)
Rule coverage
AGENTS.md/docs/dev-rules/development-workflow.md/ PR 模板:只做一个目的(修 #4692 的源码误识别);描述与 diff、测试一致;无夹带私货;DCO 每个 commit 均有签名;未触碰凭证/更新器/数据库/系统提示词。docs/dev-rules/media-storage-and-protocols.md§Review 清单:不新增媒体副本、目录或生命周期;只改工具结果文本的文件引用提取;定向测试覆盖去重、非法/非绝对 URL、远程投影与失败截断路径。docs/dev-rules/protocol-compatibility.md:不改 wire protocol 字段或协议 package;仅收窄共享解析函数对文本内容的识别,两端(desktop 投影 / mobile 渲染)都走同一@cindy/maker-shared实现,旧端行为退化为旧卡片显示,独立升级兼容。docs/dev-rules/architecture-invariants.md:无依赖方向变化、无动态 import、无布局树改动。docs/dev-rules/remote-and-mobile-adaptation.md:无新增 IPC/push,不触及重试/超时/断链恢复;Description 风险字段给出回滚方式。docs/dev-rules/mobile-development.md冷更边界:只改共享 TypeScript 解析与测试,无 runtime fingerprint 输入,不触发冷更。- 固定问题逐项:共享符号
extractPayloadToolResultFiles的全部 3 个非测试调用方(historyViewProjection.ts、mobileToolProjection.ts、messageNormalize.ts)都经同一函数取文件,过滤逻辑集中生效;错误路径(JSON 解析失败回退纯文本、URL 解析失败丢弃、深层嵌套用显式栈防爆栈)均有测试;无权限/凭证/用户数据落盘;无新增依赖。 - 最终复核:diff 完全落在 PR 描述范围内(JSON 解码扫描 + 绝对路径校验 + 源码字面量过滤 + 三处测试);
signoff.discussionIssue/held为空,无讨论要求待落实;已 resolve 的 bot thread 所列要求(方括号、逗号、撇号、引号、顶层数组、注释、三引号、拼接、前缀字面量等)在最终 diff 与测试中逐条可见。
Verification
本地实跑(worktree pr-5322,pnpm install --prefer-offline 后):
pnpm --filter @cindy/maker-shared exec vitest run src/__tests__/pluginResults.test.ts— 91 项通过。pnpm --filter @cindy/maker-shared exec vitest related src/payloadSummary.ts --run— 6 个文件、174 项通过。pnpm --filter desktop exec vitest run src/main/device-link/__tests__/mobileToolProjection.test.ts— 32 项通过。pnpm --filter mobile exec vitest run src/__tests__/pluginResultRendering.test.ts— 16 项通过。pnpm --filter desktop run --if-present typecheck、pnpm --filter mobile run --if-present typecheck— 通过。pnpm --filter @cindy/maker-shared run build— 失败但与 PR 声明一致:8 处既有类型错误(workRunGrouping / historyView.test / composerPalette.test / brandIdentity.test),payloadSummary.ts0 处命中,本次未新增。- 独立对抗性探针(roundDir
scratch-probe-5322.ts):22 个边缘输入 + 3000 组随机 fuzz 无异常无挂起;140KB 大输入 6ms 完成;散文引号/Markdown 链接/JSON 顶层数组/深层嵌套/Windows 路径/query 形态的真实引用均保留,注释与源码字面量内 URL 均被过滤。 - 未执行:PR 描述所列的模拟器手工验收(Android AVD 页面目检)由作者执行并写明细节,本审查未复跑;不作为阻断项。
Overall
pass — 没有 P0/P1。
这次改了什么
摘要
修复 #4692(2026-09-19 合并,c9fadf524)引入的源码误识别:该 PR 对所有工具输出扫描 xdt-file://,把源码字符串当成产物。小输出在手机生成伪文件卡片;超过 8 KiB 的输出还会在 Desktop 远程投影时优先压缩成文件声明,导致源码正文被替换。桌面本地原文不走这条投影链路。
本 PR 在 JSON 解码后识别源码字面量并校验绝对路径,同时保留原有 URL 字符边界及结构化文件声明。真实产物继续显示,源码不再变成文件卡片。测试覆盖 Desktop 实时/历史投影和 Mobile 正在运行/已完成的渲染模型。
变更类型
fix缺陷修复范围
xdt-file://文本不再生成误导性的文件卡片,真实文件引用继续显示UI 变化
不涉及:仅修改共享结果解析与测试,没有新增或调整 UI。
怎么验证的
自动验证
手工验证
Android AVD cindy-api36(emulator-5554)已打开远程目标任务并查看页面。Metro 从当前 worktree elegant-archimedes 启动,端口 8081;启动日志 source=cindy/elegant-archimedes@d656b0f+e8f6d1769a。已观察到正文中的协议字符串以内联文本显示。验收后 Metro 和模拟器均已关闭。
未执行的验证
本轮未完成专门新增模型调用、原始故障位置逐条对照或合法文件点击打开验收;截图中保留的历史卡片也未逐项核实为真实产物。未另行取得 DEV build label 页面证据,因此不将此次页面观察表述为完整端到端黑盒通过。
pnpm --filter @cindy/maker-shared run build 已执行但未通过,报告 8 个既有类型错误;使用 HEAD 原始文件进行相同检查后,诊断完全一致,本次未新增类型错误。
风险
风险分类
影响与回滚
移动端冷更判断:不触发。仅改共享 TypeScript 解析和测试,未修改原生配置、原生依赖、config plugin 或其他 runtime fingerprint 输入。
影响范围:共享工具结果解析,Desktop 与 Mobile 消费该解析的结果展示。
回滚 / 降级方式:回退本 PR 提交即可恢复原解析逻辑。
提交前检查
git commit -s,见 DCO)