Phase 1 Testing: collectCasRefs 收集器 #286

Closed
opened 2026-05-16 10:31:11 +00:00 by xiaoju · 1 comment
Owner

验证目标

collectCasRefs(schema, meta) 能从带 casRef meta 标注的 Zod schema 中,正确提取 meta 对象里对应字段的值。

关联

Ref #285 Phase 1

测试步骤

  • Step 1: flat field — z.object({ hash: z.string().meta({ casRef: true }) }),meta = { hash: "abc" } => ["abc"]
  • Step 2: 无标注 — 没有 casRef 标注的 schema => []
  • Step 3: nested array — z.object({ items: z.array(z.object({ ref: z.string().meta({ casRef: true }) })) }),meta = { items: [{ ref: "a" }, { ref: "b" }] } => ["a", "b"]
  • Step 4: discriminatedUnion — planner 场景,status=planned 时收集 phases[].hash,status=failed 时返回 []
  • Step 5: null 值 — casRef 字段值为 null 时跳过,不崩溃
  • Step 6: 混合字段 — 多个 casRef 字段 + 非 casRef 字段混合,只收集标注的
  • Step 7: bun test 通过 — 所有测试用例 pass

验证完成标准

所有 checkbox 打勾
bun test 通过

## 验证目标 collectCasRefs(schema, meta) 能从带 casRef meta 标注的 Zod schema 中,正确提取 meta 对象里对应字段的值。 ## 关联 Ref #285 Phase 1 ## 测试步骤 - [ ] **Step 1: flat field** — z.object({ hash: z.string().meta({ casRef: true }) }),meta = { hash: "abc" } => ["abc"] - [ ] **Step 2: 无标注** — 没有 casRef 标注的 schema => [] - [ ] **Step 3: nested array** — z.object({ items: z.array(z.object({ ref: z.string().meta({ casRef: true }) })) }),meta = { items: [{ ref: "a" }, { ref: "b" }] } => ["a", "b"] - [ ] **Step 4: discriminatedUnion** — planner 场景,status=planned 时收集 phases[].hash,status=failed 时返回 [] - [ ] **Step 5: null 值** — casRef 字段值为 null 时跳过,不崩溃 - [ ] **Step 6: 混合字段** — 多个 casRef 字段 + 非 casRef 字段混合,只收集标注的 - [ ] **Step 7: bun test 通过** — 所有测试用例 pass ## 验证完成标准 ✅ 所有 checkbox 打勾 ✅ bun test 通过
Author
Owner

Closing: collectCasRefs superseded by json-cas cas_ref format

— 小橘 🍊(NEKO Team)

Closing: collectCasRefs superseded by json-cas cas_ref format — 小橘 🍊(NEKO Team)
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/workflow#286