Skip to content

Rename automation API schema test to .zod.test.ts convention + update ROADMAP#772

Merged
hotlong merged 2 commits into
mainfrom
copilot/add-schema-test-for-automation-api
Feb 21, 2026
Merged

Rename automation API schema test to .zod.test.ts convention + update ROADMAP#772
hotlong merged 2 commits into
mainfrom
copilot/add-schema-test-for-automation-api

Conversation

Copilot AI commented Feb 21, 2026

Copy link
Copy Markdown
Contributor

The existing automation-api.test.ts (37 tests covering all 9 endpoint schemas, error codes, and contract registry) wasn't matching the filename convention requested in #757's checklist item for "编写 schema 测试".

  • Rename automation-api.test.tsautomation-api.zod.test.ts to align with the automation-api.zod.ts source file
  • ROADMAP.md — Annotate automation API protocol line with (37 schema tests) to reflect coverage
Original prompt

This section details on the original issue you should resolve

<issue_title>补充 Automation API Protocol Schema 单元测试</issue_title>
<issue_description>

关联: #757 Task 1 遗留项
Parent: #753(Spec 优先 Roadmap 2026.02)


📊 背景

#757 的完成验证中发现,Task 1 checklist 要求的"编写 schema 测试"尚未完成。

packages/spec/src/api/automation-api.zod.ts 已完整实现 9 个端点的 Request/Response schemas + AutomationApiContracts 注册表 + AutomationApiErrorCode,但 缺少独立的 Zod schema parse/validate 单元测试文件

目前 schema 的正确性仅被 HTTP dispatcher 测试和 Client SDK 测试间接覆盖,不满足 Issue #757 中明确要求的 "编写 schema 测试" checklist 项。

🎯 目标

新增 packages/spec/src/api/automation-api.zod.test.ts,直接验证每个 schema 的 parse 正确性。

📝 Tasks

  • 创建 packages/spec/src/api/automation-api.zod.test.ts
  • 测试 ListFlowsRequestSchema — 有效输入 parse、默认值(limit=50)、无效 status 拒绝
  • 测试 FlowSummarySchema — 完整字段 parse、可选字段省略
  • 测试 ListFlowsResponseSchema — 含 data.flows 数组验证
  • 测试 GetFlowRequestSchema / GetFlowResponseSchema
  • 测试 CreateFlowRequestSchema / CreateFlowResponseSchema
  • 测试 UpdateFlowRequestSchemadefinition 为 partial FlowSchema
  • 测试 DeleteFlowRequestSchema / DeleteFlowResponseSchema
  • 测试 TriggerFlowRequestSchema / TriggerFlowResponseSchema
  • 测试 ToggleFlowRequestSchema / ToggleFlowResponseSchema
  • 测试 ListRunsRequestSchema / ListRunsResponseSchema — 复用 ExecutionLogSchema
  • 测试 GetRunRequestSchema / GetRunResponseSchema
  • 测试 AutomationApiErrorCode — 9 个错误码枚举值
  • 测试 AutomationApiContracts — 9 个端点注册,method/path 正确性
  • 测试 AutomationFlowPathParamsSchema / AutomationRunPathParamsSchema — 路径参数
  • 运行 pnpm test,确保全部测试通过
  • 更新 ROADMAP.md 中测试计数

📐 工作量估算

Task 估时
编写 schema 测试 0.5d

🔗 关联

  • 来源: automation api #757 Task 1 遗留的 "编写 schema 测试" checklist 项
  • 参考: 现有 API schema 测试模式可参考 packages/spec/src/api/ 目录下其他 .test.ts 文件

备注:开发任务完成后需运行 test,并及时更新 roadmap。</issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

@vercel

vercel Bot commented Feb 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
objectstack-play Ready Ready Preview, Comment Feb 21, 2026 11:00am
spec Ready Ready Preview, Comment Feb 21, 2026 11:00am

Request Review

… ROADMAP test count

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Add unit tests for Automation API Protocol Schema Rename automation API schema test to .zod.test.ts convention + update ROADMAP Feb 21, 2026
Copilot AI requested a review from hotlong February 21, 2026 10:53
@hotlong
hotlong marked this pull request as ready for review February 21, 2026 11:04
Copilot AI review requested due to automatic review settings February 21, 2026 11:04
@hotlong
hotlong merged commit a3036bf into main Feb 21, 2026
4 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR renames the automation API schema test file from automation-api.test.ts to automation-api.zod.test.ts and updates the ROADMAP to reflect the test coverage (37 schema tests). The change was motivated by #767 which required completing the test suite for the Automation API protocol schemas.

Changes:

  • Renamed test file to use .zod.test.ts suffix to explicitly indicate Zod schema testing
  • Updated ROADMAP.md line 157 to annotate the Automation API protocol entry with "(37 schema tests)"

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.

File Description
packages/spec/src/api/automation-api.zod.test.ts Complete test suite covering all 9 API endpoints, path parameters, error codes, and contract registry with 37 test cases
ROADMAP.md Added test count annotation "(37 schema tests)" to Automation API protocol line

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

补充 Automation API Protocol Schema 单元测试

3 participants