test(dashboard): follow answer formatter ownership in workspace contract - #5047
Conversation
Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>
huangruiteng
left a comment
There was a problem hiding this comment.
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机
当前 main 的个人工作区契约测试还在 Dashboard 页面源码中寻找已经迁到 answer-text.ts 的回答格式化函数,因而在“隐藏内部协议标记”断言处失败,并把无关 PR 的构建一并染红。这个提交只修复测试的观察对象,恢复可信的 CI 信号;它没有改变管家路由或用户界面的运行行为。独立复现中,基线相同命令退出 1,当前提交退出 0。
改动思路
沿用已有的 source(name) 读取器和三条原断言,把其输入指向真正拥有 visibleAgentMessage 的 answer-text.ts。断言仍检查内部标记不外露,以及证据和下一步标签可读;其他检查继续读取原来的 Dashboard 源码。完整浏览器 smoke 同时验证实际页面路径,弥补单纯源码扫描不能证明运行时导入正确的局限。没有新增状态、路由规则、权限或兼容分支。
具体改动
唯一改动位于个人工作区契约测试:增加一次 answerText 源码读取,并把三处与回答格式化有关的匹配对象从 dashboard 改为 answerText。新增 4 行、删除 3 行,没有改动产品代码或生成资源。现有测试的调用入口仍是 Dashboard 的 smoke:personal-workspace,失败仍由 Node 断言清楚报告。
关键代码讲解
source(name)(测试文件第 4 行)仍按相对路径读取源码;新增的answerText绑定只复用它,没有第二套读取逻辑。visibleAgentMessage(value)(answer-text.ts第 4 行)是实际回答展示的格式化所有者;三条断言现在检查该函数所在文件,同时保留原有GOAL_STATUS/GOAL_PROGRESS、GOAL_EVIDENCE和NEXT_ACTION语义。
对主干的风险
主要风险是源码型断言仍可能随将来文件移动再次失效,且源码匹配自身不足以证明页面运行。这里没有弱化匹配表达式;基线以相同命令出现预期失败,当前提交通过。npm run smoke:personal-workspace 的全部 15 个浏览器场景通过,包含回答展示;目标文件的公开边界检查为零错误,精确提交的质量收据和风险分级 premerge 均通过。没有本地跳过项。CI 的远端合并状态仍由仓库门槛单独判断;本审查不把本地通过冒充远端完成。
我的整体评价
我在精确提交 fa6eb7d683bef346040b52ae27003bcd6c675083 上给出 APPROVE:这是一处成因明确、范围很小的测试修复,恢复长期集成信号并保持用户体验不变。最小方案已复用原契约和所有者,未引入新的产品机制;剩余的静态测试脆弱性由真实浏览器 smoke 提供补充验证。合并仍以仓库的精确提交 readiness 和现有检查为准。
English verdict: APPROVE - Head fa6eb7d; retargeted three contract assertions to the existing answer formatter. Baseline fails at the stale assertion, while the exact head and all 15 browser scenarios pass; no production behavior changed.
|
Post-merge validation found a separate dashboard acceptance failure in the saved-answer browser scenario. The static contract assertion fixed here passes, but after reloading the standalone answer page the smoke checked the table before the async saved-session read had rendered it. The existing assertion then reported possible content loss or Turn replay without distinguishing the loading state. I isolated the follow-up on the new |
The personal-workspace CI contract check still searches
dashboard-page.tsxfor the answer formatter and its user-facing protocol-marker mappings. That formatter moved toanswer-text.ts, so the same assertion fails on currentmainand blocks unrelated PRs.This updates the three assertions to read the formatter's current source. Product behavior is unchanged; the check still guards hidden internal markers and readable evidence/next-action headings.
Validation:
npm run smoke:personal-workspace(including all browser scenarios),loopx checkon the changed file, change-quality receiptcqr_50c71684dd13beb5dbca, andloopx canary premerge --from-git-diff --goal-id loopx-metapassed. No skipped local checks. The bounded related refactor is the sharedanswerTextsource binding; no production code changes are needed.