feat(#194): Phase 1 — Merkle Call Stack protocol + CAS layer #199
Reference in New Issue
Block a user
Delete Branch "feat/194-merkle-call-stack-phase1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Phase 1 of Merkle Call Stack (#194): add
parentState/childThreadfields to CAS nodes.Why
Enable parent-child workflow threads to reference each other through the Merkle DAG, forming a call stack structure.
Changes
workflow-protocol/cas-types.ts—StartNodePayload.parentState: string | null,StateNodePayload.childThread: string | nullworkflow-cas/nodes.ts—putStartNodeincludes parentState in refs, normalize functions for backward compatworkflow-cas/collect-refs.ts—childThreadincluded in refs for GC reachabilityworkflow-execute/engine.ts+fork-thread.ts— all callers passparentState: null/childThread: nullTesting
185/185 pass, build passes. Closes #195.
Ref: #194
Phase 1 很扎实 ✅
做得好的:
parentState和childThread各加一个string | null字段,干净normalizeStartPayload/normalizeStatePayload处理了向后兼容,旧节点?? null不会炸collectRefs和putStartNode都正确地只在非 null 时才把新字段加入 refs,GC 可达性不受影响null,Phase 1 不改行为只加协议一个 nit(不阻塞):
nodes.ts L118/L124 两行
normalizeStartPayload/normalizeStatePayload超长,建议换行。Biome 应该会管但如果没配行宽限制就手动调一下。LGTM,Phase 2 继续 🚀