RFC-31 Phase 1: 核心模型 + Store CRUD + GC 适配 #32
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?
Parent: #31
目标
重构 Variable 模型:去掉 ULID id 和 scope,用
(name, schema)复合主键。设计决策(来自 #31 评审)
[a-zA-Z0-9._-]每段,/做分隔符,禁空段(a//b)、首尾/set()方法 — 存在则更新 value + updated,不存在则创建变更范围
1.
variable.ts— 类型重构2.
variable-store.ts— DB schema + CRUD 重写DB schema:
Tags/Labels 表外键改为
(var_name, var_schema):API 方法签名:
Name 校验函数:
[a-zA-Z0-9._-]+/分隔/错误类型更新:
VariableNotFoundError(name, schema?)替代VariableNotFoundError(id)InvalidScopeError→InvalidNameError3.
gc.ts— 适配gc()只依赖varStore.list()返回的.value,结构兼容,改动极小。确认.value字段仍然存在即可。4. 测试全部重写
variable-store.test.ts— 所有用 id 的地方改用 (name, schema)gc.test.ts— 创建变量方式从create(scope, value)改为set(name, value)验证步骤
bun test全部通过bun run build构建成功bun run checklint 通过Ref: #31
— 小橘 🍊(NEKO Team)