Phase A Testing: Merkle 节点格式 + Content → CAS #41

Closed
opened 2026-05-07 13:02:28 +00:00 by xiaoju · 0 comments
Owner

验证目标

engine 写 step 时,content 存入 global CAS 作为 Merkle 节点({ type, payload, children } YAML),jsonl 里存 contentHash 替代 content。

前置

cd ~/repos/uncaged-workflow && git checkout main && git pull

测试步骤

  • Step 1: Merkle 节点类型定义存在

    bun run build
    

    预期: packages/workflow/src/merkle.ts 导出 MerkleNode 类型({ type: "content" | "step" | "thread", payload: string | Record<string, unknown>, children: string[] })和 serializeMerkleNode / parseMerkleNode 函数。Build 通过。

  • Step 2: CAS 存储 Merkle 节点

    bun test --filter "merkle"
    

    预期: 测试验证 serializeMerkleNode 输出 YAML,parseMerkleNode 能正确解析。content 类型节点 payload 是 string,step 类型 payload 是 { role, meta } 对象。round-trip 测试通过。

  • Step 3: engine 写 step 时 content 存 CAS

    bun test --filter "engine"
    

    预期: executeThread 写出的 .data.jsonl 中 role step 行有 contentHash 字段,无 content 字段。contentHash 指向 global CAS 中的 Merkle content 节点。

  • Step 4: create-workflow content 节点生成

    bun test --filter "create-workflow"
    

    预期: workflow generator yield 的 RoleOutput 中 content 经过 CAS 存储,返回的 contentHash 可以通过 cas get 读回原始 content。

  • Step 5: parseThreadDataJsonl 适配

    bun test --filter "thread-jsonl"
    

    预期: parseThreadDataJsonl 解析新格式(contentHash 替代 content),返回的 step 对象有 contentHash 字段。

  • Step 6: fork 逻辑适配

    bun test --filter "fork"
    

    预期: fork 时 prefilledDiskSteps 使用 contentHash,不复制 content 内容。

  • Step 7: 全量测试通过

    bun test
    bun run build
    bun run check
    

    预期: 全部通过,无 lint/type error。

验证完成标准

所有 checkbox 打勾
.data.jsonl 不再包含 content 字段
CAS 中存储的是 YAML 格式 Merkle 节点
bun test / build / check 全绿

Refs #40

## 验证目标 engine 写 step 时,content 存入 global CAS 作为 Merkle 节点(`{ type, payload, children }` YAML),jsonl 里存 contentHash 替代 content。 ## 前置 ```bash cd ~/repos/uncaged-workflow && git checkout main && git pull ``` ## 测试步骤 - [ ] **Step 1: Merkle 节点类型定义存在** ```bash bun run build ``` **预期:** `packages/workflow/src/merkle.ts` 导出 `MerkleNode` 类型(`{ type: "content" | "step" | "thread", payload: string | Record<string, unknown>, children: string[] }`)和 `serializeMerkleNode` / `parseMerkleNode` 函数。Build 通过。 - [ ] **Step 2: CAS 存储 Merkle 节点** ```bash bun test --filter "merkle" ``` **预期:** 测试验证 `serializeMerkleNode` 输出 YAML,`parseMerkleNode` 能正确解析。content 类型节点 payload 是 string,step 类型 payload 是 `{ role, meta }` 对象。round-trip 测试通过。 - [ ] **Step 3: engine 写 step 时 content 存 CAS** ```bash bun test --filter "engine" ``` **预期:** `executeThread` 写出的 `.data.jsonl` 中 role step 行有 `contentHash` 字段,无 `content` 字段。contentHash 指向 global CAS 中的 Merkle content 节点。 - [ ] **Step 4: create-workflow content 节点生成** ```bash bun test --filter "create-workflow" ``` **预期:** workflow generator yield 的 `RoleOutput` 中 content 经过 CAS 存储,返回的 contentHash 可以通过 `cas get` 读回原始 content。 - [ ] **Step 5: parseThreadDataJsonl 适配** ```bash bun test --filter "thread-jsonl" ``` **预期:** `parseThreadDataJsonl` 解析新格式(contentHash 替代 content),返回的 step 对象有 contentHash 字段。 - [ ] **Step 6: fork 逻辑适配** ```bash bun test --filter "fork" ``` **预期:** fork 时 prefilledDiskSteps 使用 contentHash,不复制 content 内容。 - [ ] **Step 7: 全量测试通过** ```bash bun test bun run build bun run check ``` **预期:** 全部通过,无 lint/type error。 ## 验证完成标准 ✅ 所有 checkbox 打勾 ✅ `.data.jsonl` 不再包含 content 字段 ✅ CAS 中存储的是 YAML 格式 Merkle 节点 ✅ bun test / build / check 全绿 Refs #40
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/workflow#41