test(frontend): qualify Goal workspace requests through the shared builder - #5265
Conversation
…tion 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)
APPROVE。没有发现阻塞问题。 本次独立评审针对完整的 5265@d2a75e08e94cfec99130a8db98bba7aea6489326,执行当前 policy 11 的 17 项证据计划;批准范围是恢复并加强创建 Goal 的测试边界。
动机
主干上的 contract smoke 把工作区约束写成了“创建表单源码必须出现某段字符串”。生产参数已经由共享 TypeScript builder 生成,因此旧断言在行为正确时仍失败,阻止 packaged qualification 继续。我在不可变 base cf759d3 复现了这一失败。这是有明确消费者和失败源的维护修复,完成的是本次测试恢复任务;真实 Agent 协作和完整创建/连接体验仍由既有产品交付主线验收。
改动思路
新断言直接调用两个生产入口共用的 goalCreateRequest,分别传入全局和既有 Goal 的会话上下文。上下文可以保留旧 Goal,执行工作区仍应为 current,新 Goal 标识也必须独立。现有 browser scenario 再检查表单预览和直接预览实际发出的请求。fixture 记录并回显请求正文,没有替页面补上正确 workspace,因而这两个层次能相互补充。生产 owner、配置与权限边界均沿用既有实现。
具体改动
关键代码讲解
goalCreateRequest是此次测试调用的既有生产定义。它把context.goal_id与normalizedParameters.goal_id/workspace_ref分开,返回预览请求,自身没有写入副作用。表单与对话草稿均调用此 owner,评审也检查了未改动的调用方。- contract 的上下文循环 替换旧源码正则,同时检查当前工作区、保留会话上下文、新 Goal 的确定标识以及身份不等于旧 Goal。固定 operationId 让预期可重放,而不是从实际输出生成期待值。
goalDraftScenario.run在两条已有预览路径各加入一条 workspace 断言,继续执行修改、取消、重载、重复预览、一次确认以及中英文/移动端检查,没有新增场景脚手架或运行时分支。
完整 diff 是两个测试文件,增加 16 行、删除 1 行。对相同输入,我另外比较了四组生产 builder 的完整输出,以及真实编译页面发出的三条预览请求。base/head 请求一致;只归一化手动表单首次生成的两个 UUID,直接预览及重开的 operation identity 保持逐字比较。
对主干的风险
主要风险是替换源码断言后测试变绿,却失去对错误工作区的检测。我临时把生产 builder 改为发出 wrong-workspace:新 contract 在语义断言处失败,真实打包页面也在新增 workspace 断言处失败。源码按字节恢复、重新构建后,两条路径重新通过。没有保留该测试注入,也没有修改生产代码。
实际执行的验证包括 Node 24.21.0 与最低支持版本 22.22.3 的 contract、原生 TypeScript/Chat build 和 source verification、全部 22 个 packaged browser 场景、Ruff、mypy、CLI 输出预算、DCO、两个文件的公开边界扫描,以及四个 catalog canary 和三项 diff 检查。严格质量回执已核对本次完整 scope,最终 native premerge 通过。首次 premerge 的旧 scope 回执 HOLD 已保留,并在本次重新资格确认后完整重跑。
语义与 CI 对齐
workspace 与 Goal 身份沿用已有类型和词汇,生产默认权限、Heartbeat、取消与确认边界保持不变。对已更新的 main 526f250,相关生产 owner、调用方、fixture、依赖和原生 workflow 的失效检查没有发现变化。大 chunk 提示在 base/head 均存在,恢复后的产物名称和大小一致,没有提高限制。按配置未查询或等待远程 CI。
浏览器使用真实编译页面和生产 HTTP 静态资源 handler,业务 API 是合成 fixture;写入计数不证明真实 Goal 持久化、安装版 App 或 live Agent 执行。此次没有相关生产改动,也不把这些后续产品验收计为通过。
我的整体评价
这项修复有可复现的旧失败、正确的既有 owner 和能拒绝错误行为的新 oracle,范围合适。长期运行语义与用户体验均保持原样,改进发生在持续资格确认路径。未来改动所需的共享 request seam 已存在,本次不需要另加抽象或拆出生产重构。
我也比较了同源修复 #5257:它把源码正则移到 builder 并检查调用关系;本 PR 额外检验请求输出与打包路径。维护者整合时应选择同一失败源的最终修复,避免重复落入两个互相冲突的断言版本。代码评审 APPROVE 不等于合并授权;分支仍需维护者处理当前合并状态。
English verdict: APPROVE for the complete exact head. The immutable baseline reproduces the stale source assertion, while minimum/current Node, production-builder parity, compiled-page request parity, deliberate workspace mutation, all 22 packaged scenarios, repository checks and the final strict native premerge pass. Runtime behavior and authority are unchanged. Browser business routes are synthetic; this does not qualify live Goal persistence, installed-App execution or Agent coordination. Related PR #5257 addresses the same failure and should be reconciled by the maintainer. No merge is performed.
Delivery-frame alignment — exact head
|
Goal And Delivered Outcome
Packaged App CI stopped at a source-text assertion requiring
workspace_ref: "current"inside the creation form. The behavior had moved into the sharedgoalCreateRequestbuilder, so main failed before browser qualification despite retaining the intended workspace boundary.Call that production TypeScript builder from the existing contract test for both global and existing-Goal context. Assert that the new Goal uses the current workspace and keeps its own identity. Extend the existing packaged draft scenario to check requests from both the edit form and direct preview. This restores the qualification path needed for the roadmap’s create/connect acceptance; it adds no new runtime capability or provider.
Scope And Continuation
Two test files only. Production behavior, UI, default permissions and preview/apply boundaries remain unchanged. Reuse the current builder and browser fixture instead of moving the regex to another source file. Full live Agent coordination and installed-App acceptance remain separate work.
Validation
d2a75e08e94cfec99130a8db98bba7aea6489326cqr_151d503efdd8413368a7matches this head.UI impact: none. No presentation or navigation change; existing desktop/mobile and English draft paths are exercised. No installed runtime or active Goal is changed.