Phase 2 Testing: Schema system (JSON Schema + cas_ref + traversal) #4
Reference in New Issue
Block a user
Delete Branch "%!s()"
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?
验证目标
Schema 存在 CAS 里,节点可按 schema 校验,
cas_ref字段可被自动发现用于 DAG 遍历。前置
Phase 1 完成(#3)
测试步骤
Step 1: putSchema + getSchema
注册一个 JSON Schema,取回验证 name 正确
预期: Schema 作为普通节点存入 CAS,可取回
Step 2: validate 通过
合法 payload 通过 schema 校验
预期:
validate(store, node) === trueStep 3: validate 失败
缺 required 字段的 payload 校验失败
预期:
validate(store, node) === falseStep 4: refs() 提取 cas_ref
Schema 中标记
format: "cas_ref"的字段值被自动提取预期:
refs(store, childNode)返回 parent 的 hashStep 5: walk() 遍历 DAG
从任意节点递归遍历所有可达节点
预期: visited 包含整条链上的所有节点
Step 6: bootstrap meta-schema 自指
预期:
metaNode.type === metaHash(自指)验证完成标准
✅ 所有 checkbox 打勾
✅
bun test全过✅ biome check 无报错
Ref: #1