Skip to content

test(web): 修复性能 fixture 的 Session 路径身份,恢复性能测量入口 #840

Closed

Description

@tt-a1i

总跟踪:#841。

scripts/web-performance.mjs 在当前审计版本上运行时,11 个用例全部停在连接或重连页面,未进入性能测量阶段。共同原因是合成 snapshot 更新了 currentSessionId,却继续沿用真实 Host 的 currentSessionPath。

固定版本与问题位置

  • OpenPI 源码:f98d6a4737461ba8d8ee100f113b5a7c3a0001a0;锁文件中的 Pi 为 1.2.0。
  • 本次执行环境:macOS arm64、Node 26.8.1、Playwright 1.62.1、Chromium 151.0.7922.34。
  • projectedSnapshot 展开 base 后覆盖 currentSessionId、sessions 和 selectedSession,遗漏 currentSessionPath。
  • Session 身份检查 要求 id 和 path 一致;store 拒绝不一致的投影并尝试 canonical retry。

复现与观察

在固定版本、依赖及测试 Chromium 已准备好的独立 checkout 中运行:

audit_tmp=$(mktemp -d)
TMPDIR="$audit_tmp" node scripts/web-performance.mjs

检查各用例的 Playwright trace。本次 11 个 trace 都有 9 次 snapshot 响应,均为 HTTP 200;其中一次是真实基础 snapshot,其余 8 次合成 snapshot 均出现 currentSessionId === selectedSession.id、currentSessionPath !== selectedSession.path。因此不能把超时归为 HTTP 连接失败,也不能把 11 个失败用作产品性能退化数据。

在仓库外的临时副本只补齐这一身份字段后:

return {
  ...base,
  currentSessionId: sessionId,
  currentSessionPath: fixturePath,
  // existing synthetic fields
};

hundred synthetic transcript at 1280px 单例通过。生产 web/dist/app.js SHA-256 在验证前后均为 740861b18e2b5f74d1161845638e133d48809fce8ff78ffd9802c8fe466af3e0。

这只证明共同首个阻塞原因与该单例修复有效;另外 10 个修正后的用例尚未执行。本次没有模型请求,也没有把合成数据作为正式 Benchmark。

期望与验收

  • fixture 的 currentSessionId/currentSessionPath、sessions 和 selectedSession 组成同一完整 Session 身份。
  • 修正全部相关 fixture,执行完整 11 个性能用例;继续保留生产 bundle 前后哈希校验。
  • 身份构造错误直接给出可理解的测试失败,避免误记成性能采样或连接超时。
  • 确认断流恢复用例仍针对同一个合成会话,且不触发真实 prompt admission。
  • 原始结果保留环境、样本和测量边界;功能通过不能代替性能预算通过。

本 Issue 只修复测量入口,不调整产品的 Session 身份校验。后续代码修改执行专项测试、bun run check 和 bun run test。

Activity

  1. 6iKUN6 commented on Oct 15, 2026

    @6iKUN6
    Contributor

    这个我来认领,会从最新的 main 开一个独立分支修 fixture 的 Session 身份,修完把 11 个性能用例完整跑一遍,结果贴在 PR 里。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions