feat: move web-probe to top-level cli (#933)
Co-authored-by: Codex <codex@noreply.local>
This commit is contained in:
@@ -21,15 +21,15 @@ description: UniDesk Web 开发与浏览器验证技能。用户处理 UniDesk/H
|
||||
- Workbench 前端无破坏性投影权:删除 session、清空 active session、清空当前消息页、清空 tabs、把 composer 降成 `session_required`,或把 route session 标记为 not-found/archived/deleted,都是 lifecycle mutation;Web reducer/selectors、route hydrate、GET/list/detail/messages/SSE consumer、fake-server 和测试 helper 都不能由读侧失败、404、空列表、网络瞬断或 late response 触发这些 mutation。只有用户显式 mutation 成功,或后端 canonical lifecycle projection,能改变 session lifecycle。需求真相见 UniDesk OA `PJ2026-010401 Web工作台` 的“破坏性投影权”。
|
||||
- fake-server 不是第二后端:它只按正式 API 契约重放脱敏 fixture 和必要边界变形。未 mock 的 `/auth/*`、`/v1/*`、`/health*` 请求应失败并暴露 path;不得访问 live Cloud API、AgentRun、HWPOD、数据库或 Kubernetes 作为通过条件。
|
||||
- 真实数据优先:fixture seed 优先从目标 node/lane 的受控真实样本采集。合成 fixture 只补真实样本难以稳定覆盖的边界,并标明 `derivedFrom` 与 `syntheticReason`。
|
||||
- 原入口闭环:fake-server Playwright 用例负责可重复红灯和源码回归;线上 `hwlab nodes web-probe` 负责同一 node/lane public origin 的 P4 原入口验收。二者不能互相替代。
|
||||
- 原入口闭环:fake-server Playwright 用例负责可重复红灯和源码回归;线上 `web-probe` 负责同一 node/lane public origin 的 P4 原入口验收。二者不能互相替代。
|
||||
- Master server 禁重型验证:不要在 master server 跑仓库级 check、Web build、Playwright/browser smoke 或镜像构建。HWLAB Web 验证走目标 node/lane workspace、k3s/Tekton、D601 runner 或受控 web-probe。
|
||||
- 禁止裸写 Playwright:UniDesk/HWLAB Web 复现、截图、DOM/API 采样、长程 Workbench 观测和线上 closeout 默认必须走 `hwlab nodes web-probe run|script|observe`;不得直接写 `trans <route> playwright` heredoc、`playwright-cli`、临时 Node Playwright 脚本或本地 browser daemon 作为正式证据入口。确有非 HWLAB 外站截图/PDF 等 web-probe 不覆盖的短生命周期需求时,必须说明例外原因,且可复用动作要回收进 web-probe。
|
||||
- 禁止裸写 Playwright:UniDesk/HWLAB Web 复现、截图、DOM/API 采样、长程 Workbench 观测和线上 closeout 默认必须走 `web-probe run|script|observe`;不得直接写 `trans <route> playwright` heredoc、`playwright-cli`、临时 Node Playwright 脚本或本地 browser daemon 作为正式证据入口。确有非 HWLAB 外站截图/PDF 等 web-probe 不覆盖的短生命周期需求时,必须说明例外原因,且可复用动作要回收进 web-probe。
|
||||
|
||||
## 工作流
|
||||
|
||||
1. 定位目标:确认 repo、node、lane、workspace、public origin 和目标 SPEC。HWLAB D601 v0.3 例子是 `/home/ubuntu/workspace/hwlab-v03` + `https://hwlab.pikapython.com`,但只能在 issue/CLI 指向该目标时使用。
|
||||
2. 读规则:进入目标 workspace 前读取目标 `AGENTS.md`;涉及规格或测试设计时读取 UniDesk OA 对应 SPEC。
|
||||
3. 线上复现:短动作用 `hwlab nodes web-probe run|script`,长程 Workbench/session 观测用 `hwlab nodes web-probe observe start|command|status|stop|analyze`;保存 `scriptSha256`、`runDir`、observer id、stateDir、截图名、截图 SHA、URL、DOM/API 摘要、prompt hash、trace/session/run id。
|
||||
3. 线上复现:短动作用 `web-probe run|script`,长程 Workbench/session 观测用 `web-probe observe start|command|status|stop|analyze`;保存 `scriptSha256`、`runDir`、observer id、stateDir、截图名、截图 SHA、URL、DOM/API 摘要、prompt hash、trace/session/run id。
|
||||
4. 建红灯:修 Workbench/Performance 用户可见 bug 前,在目标 HWLAB workspace 的 `web/hwlab-cloud-web` fake-server Playwright 套件中补确定性用例;fixture 从真实采集样本脱敏产生。
|
||||
5. 修源码:保持状态读写单一路径。状态投影类修复优先收敛 server-state/reducer/projection,不在 UI 组件、trace polling、result polling 或 localStorage 中新增竞争事实。
|
||||
6. 验证:先跑 fake-server Playwright 目标用例,再回到同一 node/lane public origin 用 web-probe 复测;多轮任务必须用同一个 observer/session 采样到终态。截图、report hash 和 analyze finding 作为证据回传,不进入源码仓库。
|
||||
@@ -40,7 +40,7 @@ description: UniDesk Web 开发与浏览器验证技能。用户处理 UniDesk/H
|
||||
线上 Cloud Web DOM 验收优先使用受控入口:
|
||||
|
||||
```bash
|
||||
bun scripts/cli.ts hwlab nodes web-probe run --node D601 --lane v03
|
||||
bun scripts/cli.ts web-probe run --node D601 --lane v03
|
||||
```
|
||||
|
||||
web-probe 入口分三类:
|
||||
@@ -54,7 +54,7 @@ web-probe 入口分三类:
|
||||
需要 Playwright route/intercept、延迟 API、读取 in-flight DOM 或截图时仍使用受控 `web-probe script`,不要裸写 Playwright:
|
||||
|
||||
```bash
|
||||
bun scripts/cli.ts hwlab nodes web-probe script --node D601 --lane v03 <<'JS'
|
||||
bun scripts/cli.ts web-probe script --node D601 --lane v03 <<'JS'
|
||||
export default async ({ gotoStable, screenshot, fetchJson, fetchApiMatrix, recordStep }) => {
|
||||
await gotoStable('/workbench');
|
||||
const sessionsResponse = await fetchJson('/v1/workbench/sessions?limit=5');
|
||||
@@ -82,27 +82,27 @@ JS
|
||||
长程 Workbench 观测使用 `observe` 命令组:
|
||||
|
||||
```bash
|
||||
bun scripts/cli.ts hwlab nodes web-probe observe start --node D601 --lane v03 --target-path /workbench --sample-interval-ms 5000 --screenshot-interval-ms 60000 --command-timeout-seconds 55
|
||||
bun scripts/cli.ts hwlab nodes web-probe observe command webobs-xxxx --type newSession
|
||||
bun scripts/cli.ts hwlab nodes web-probe observe command webobs-xxxx --type selectProvider --provider codex-api
|
||||
bun scripts/cli.ts hwlab nodes web-probe observe command webobs-xxxx --type sendPrompt --text 'ping'
|
||||
bun scripts/cli.ts hwlab nodes web-probe observe command webobs-xxxx --type steer --text '继续观察当前 trace'
|
||||
bun scripts/cli.ts hwlab nodes web-probe observe command webobs-xxxx --type cancel
|
||||
bun scripts/cli.ts hwlab nodes web-probe observe command webobs-xxxx --type sendPrompt --text-stdin <<'EOF'
|
||||
bun scripts/cli.ts web-probe observe start --node D601 --lane v03 --target-path /workbench --sample-interval-ms 5000 --screenshot-interval-ms 60000 --command-timeout-seconds 55
|
||||
bun scripts/cli.ts web-probe observe command webobs-xxxx --type newSession
|
||||
bun scripts/cli.ts web-probe observe command webobs-xxxx --type selectProvider --provider codex-api
|
||||
bun scripts/cli.ts web-probe observe command webobs-xxxx --type sendPrompt --text 'ping'
|
||||
bun scripts/cli.ts web-probe observe command webobs-xxxx --type steer --text '继续观察当前 trace'
|
||||
bun scripts/cli.ts web-probe observe command webobs-xxxx --type cancel
|
||||
bun scripts/cli.ts web-probe observe command webobs-xxxx --type sendPrompt --text-stdin <<'EOF'
|
||||
long prompt
|
||||
EOF
|
||||
bun scripts/cli.ts hwlab nodes web-probe observe status webobs-xxxx --tail-lines 6
|
||||
bun scripts/cli.ts hwlab nodes web-probe observe collect webobs-xxxx --view turn-summary
|
||||
bun scripts/cli.ts hwlab nodes web-probe observe collect webobs-xxxx --view trace-frame --trace-id trc_xxx --sample-seq 42
|
||||
bun scripts/cli.ts hwlab nodes web-probe observe stop webobs-xxxx
|
||||
bun scripts/cli.ts hwlab nodes web-probe observe analyze webobs-xxxx
|
||||
bun scripts/cli.ts hwlab nodes web-probe sentinel plan --node D601 --lane v03 --dry-run
|
||||
bun scripts/cli.ts hwlab nodes web-probe sentinel status --node D601 --lane v03
|
||||
bun scripts/cli.ts hwlab nodes web-probe sentinel image status --node D601 --lane v03
|
||||
bun scripts/cli.ts hwlab nodes web-probe sentinel image build --node D601 --lane v03 --dry-run
|
||||
bun scripts/cli.ts hwlab nodes web-probe sentinel control-plane plan --node D601 --lane v03 --dry-run
|
||||
bun scripts/cli.ts hwlab nodes web-probe sentinel control-plane status --node D601 --lane v03
|
||||
bun scripts/cli.ts hwlab nodes web-probe sentinel control-plane trigger-current --node D601 --lane v03 --dry-run
|
||||
bun scripts/cli.ts web-probe observe status webobs-xxxx --tail-lines 6
|
||||
bun scripts/cli.ts web-probe observe collect webobs-xxxx --view turn-summary
|
||||
bun scripts/cli.ts web-probe observe collect webobs-xxxx --view trace-frame --trace-id trc_xxx --sample-seq 42
|
||||
bun scripts/cli.ts web-probe observe stop webobs-xxxx
|
||||
bun scripts/cli.ts web-probe observe analyze webobs-xxxx
|
||||
bun scripts/cli.ts web-probe sentinel plan --node D601 --lane v03 --dry-run
|
||||
bun scripts/cli.ts web-probe sentinel status --node D601 --lane v03
|
||||
bun scripts/cli.ts web-probe sentinel image status --node D601 --lane v03
|
||||
bun scripts/cli.ts web-probe sentinel image build --node D601 --lane v03 --dry-run
|
||||
bun scripts/cli.ts web-probe sentinel control-plane plan --node D601 --lane v03 --dry-run
|
||||
bun scripts/cli.ts web-probe sentinel control-plane status --node D601 --lane v03
|
||||
bun scripts/cli.ts web-probe sentinel control-plane trigger-current --node D601 --lane v03 --dry-run
|
||||
bun scripts/web-probe-sentinel-service.ts --node D601 --lane v03 --state-root .state/web-probe-sentinel-smoke --scheduler-disabled --once
|
||||
```
|
||||
|
||||
@@ -111,23 +111,23 @@ bun scripts/web-probe-sentinel-service.ts --node D601 --lane v03 --state-root .s
|
||||
项目管理 / MDTODO 页面同样优先使用 `observe`,不要退回一次性 Playwright 脚本。MDTODO 主动编辑验收必须把常见动作沉淀成 `observe command`,同一 observer 串联 source 配置、HWPOD probe/reindex、文件/任务选择、Rxx 树操作、编辑写回和 Workbench launch:
|
||||
|
||||
```bash
|
||||
bun scripts/cli.ts hwlab nodes web-probe observe start --node D601 --lane v03 --target-path /projects/mdtodo --sample-interval-ms 5000 --screenshot-interval-ms 60000 --command-timeout-seconds 55
|
||||
bun scripts/cli.ts hwlab nodes web-probe observe command webobs-xxxx --type gotoProjectMdtodo
|
||||
bun scripts/cli.ts hwlab nodes web-probe observe command webobs-xxxx --type configureMdtodoHwpodSource --hwpod-id d601-f103-v2 --node-id node-d601-f103-v2 --root docs/MDTODO/
|
||||
bun scripts/cli.ts hwlab nodes web-probe observe command webobs-xxxx --type probeMdtodoSource
|
||||
bun scripts/cli.ts hwlab nodes web-probe observe command webobs-xxxx --type reindexMdtodoSource
|
||||
bun scripts/cli.ts hwlab nodes web-probe observe command webobs-xxxx --type selectMdtodoSource --source-id <opaque-source-id>
|
||||
bun scripts/cli.ts hwlab nodes web-probe observe command webobs-xxxx --type selectMdtodoFile --file-ref <opaque-file-ref>
|
||||
bun scripts/cli.ts hwlab nodes web-probe observe command webobs-xxxx --type selectMdtodoTask --task-ref <opaque-task-ref-or-rxx>
|
||||
bun scripts/cli.ts hwlab nodes web-probe observe command webobs-xxxx --type editMdtodoTaskTitle --task <rxx-or-task-ref> --text 'web-probe interactive edit acceptance'
|
||||
bun scripts/cli.ts hwlab nodes web-probe observe command webobs-xxxx --type editMdtodoTaskBody --task <rxx-or-task-ref> --text 'body updated through web-probe command'
|
||||
bun scripts/cli.ts hwlab nodes web-probe observe command webobs-xxxx --type toggleMdtodoTaskStatus --task <rxx-or-task-ref> --status completed
|
||||
bun scripts/cli.ts hwlab nodes web-probe observe command webobs-xxxx --type addMdtodoSubTask --parent <rxx-or-task-ref> --title 'web-probe command subtask'
|
||||
bun scripts/cli.ts hwlab nodes web-probe observe command webobs-xxxx --type continueMdtodoTask --task <rxx-or-task-ref> --title 'web-probe sibling task'
|
||||
bun scripts/cli.ts hwlab nodes web-probe observe command webobs-xxxx --type deleteMdtodoTask --task <rxx-or-task-ref>
|
||||
bun scripts/cli.ts hwlab nodes web-probe observe command webobs-xxxx --type launchWorkbenchFromMdtodo --task <rxx-or-task-ref>
|
||||
bun scripts/cli.ts hwlab nodes web-probe observe collect webobs-xxxx --view project-mdtodo-summary
|
||||
bun scripts/cli.ts hwlab nodes web-probe observe analyze webobs-xxxx
|
||||
bun scripts/cli.ts web-probe observe start --node D601 --lane v03 --target-path /projects/mdtodo --sample-interval-ms 5000 --screenshot-interval-ms 60000 --command-timeout-seconds 55
|
||||
bun scripts/cli.ts web-probe observe command webobs-xxxx --type gotoProjectMdtodo
|
||||
bun scripts/cli.ts web-probe observe command webobs-xxxx --type configureMdtodoHwpodSource --hwpod-id d601-f103-v2 --node-id node-d601-f103-v2 --root docs/MDTODO/
|
||||
bun scripts/cli.ts web-probe observe command webobs-xxxx --type probeMdtodoSource
|
||||
bun scripts/cli.ts web-probe observe command webobs-xxxx --type reindexMdtodoSource
|
||||
bun scripts/cli.ts web-probe observe command webobs-xxxx --type selectMdtodoSource --source-id <opaque-source-id>
|
||||
bun scripts/cli.ts web-probe observe command webobs-xxxx --type selectMdtodoFile --file-ref <opaque-file-ref>
|
||||
bun scripts/cli.ts web-probe observe command webobs-xxxx --type selectMdtodoTask --task-ref <opaque-task-ref-or-rxx>
|
||||
bun scripts/cli.ts web-probe observe command webobs-xxxx --type editMdtodoTaskTitle --task <rxx-or-task-ref> --text 'web-probe interactive edit acceptance'
|
||||
bun scripts/cli.ts web-probe observe command webobs-xxxx --type editMdtodoTaskBody --task <rxx-or-task-ref> --text 'body updated through web-probe command'
|
||||
bun scripts/cli.ts web-probe observe command webobs-xxxx --type toggleMdtodoTaskStatus --task <rxx-or-task-ref> --status completed
|
||||
bun scripts/cli.ts web-probe observe command webobs-xxxx --type addMdtodoSubTask --parent <rxx-or-task-ref> --title 'web-probe command subtask'
|
||||
bun scripts/cli.ts web-probe observe command webobs-xxxx --type continueMdtodoTask --task <rxx-or-task-ref> --title 'web-probe sibling task'
|
||||
bun scripts/cli.ts web-probe observe command webobs-xxxx --type deleteMdtodoTask --task <rxx-or-task-ref>
|
||||
bun scripts/cli.ts web-probe observe command webobs-xxxx --type launchWorkbenchFromMdtodo --task <rxx-or-task-ref>
|
||||
bun scripts/cli.ts web-probe observe collect webobs-xxxx --view project-mdtodo-summary
|
||||
bun scripts/cli.ts web-probe observe analyze webobs-xxxx
|
||||
```
|
||||
|
||||
`observe command --type newSession` 是显式用户/control action:它通过当前 Workbench UI 点击 `#session-create` 创建新 session,等待 active session id 改变和 composer ready,并把前后 snapshot 写入 control log。它只能用于采样开始时建立目标 session,或作为用户明确的新建会话动作;不得在 route/session mismatch 后当作 repair 手段。
|
||||
@@ -253,7 +253,7 @@ UniDesk 主前端交付门禁仍由 `bun scripts/cli.ts e2e run` 承担;本技
|
||||
|
||||
## 受控 web-probe 代替裸 Playwright
|
||||
|
||||
UniDesk/HWLAB Web 工作不再把裸 Playwright 当作默认操作面。需要截图、DOM 断言、API matrix、route/intercept、SSE 降级、长程 session 采样、性能页面复测或 Workbench 多轮任务时,统一选择 `hwlab nodes web-probe run|script|observe`。
|
||||
UniDesk/HWLAB Web 工作不再把裸 Playwright 当作默认操作面。需要截图、DOM 断言、API matrix、route/intercept、SSE 降级、长程 session 采样、性能页面复测或 Workbench 多轮任务时,统一选择 `web-probe run|script|observe`。
|
||||
|
||||
`web-probe observe analyze` 必须把 Workbench session 列表标题纳入默认采样与报告:可见列表中 `Session ses_...` fallback 标题超过一半时输出红灯 finding。修复方向必须让上游 session list projection 直接携带名称;点击详情后的下游补名、reload repair 或多来源仲裁不能作为修复。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user