refactor: migrate registry from YAML to ocas variable (Phase 4a) #16

Merged
xiaomo merged 1 commits from refactor/registry-to-ocas-variable into main 2026-06-02 14:06:52 +00:00
Owner

What

Migrate workflow registry from workflows.yaml to ocas VariableStore (SQLite).

Why

Phase 4a of issue #11 — first step of data layer migration.

Changes

  • UwfStore gains varStore: VariableStore (SQLite at ~/.ocas/variables.db)
  • loadWorkflowRegistry(varStore) reads @uwf/registry/* variables
  • saveWorkflowRegistry(varStore, name, hash) sets individual variables
  • Auto-migration: workflows.yaml → variables on first createUwfStore(), renames to .migrated
  • Callers updated in workflow.ts and thread.ts
  • Tests updated

Variable schema

@uwf/registry/<workflow-name> → CAS hash

Verification

  • bun run check
  • bun run test (401 CLI tests)

Ref #11

## What Migrate workflow registry from `workflows.yaml` to ocas VariableStore (SQLite). ## Why Phase 4a of issue #11 — first step of data layer migration. ## Changes - `UwfStore` gains `varStore: VariableStore` (SQLite at `~/.ocas/variables.db`) - `loadWorkflowRegistry(varStore)` reads `@uwf/registry/*` variables - `saveWorkflowRegistry(varStore, name, hash)` sets individual variables - Auto-migration: `workflows.yaml` → variables on first `createUwfStore()`, renames to `.migrated` - Callers updated in `workflow.ts` and `thread.ts` - Tests updated ## Variable schema `@uwf/registry/<workflow-name>` → CAS hash ## Verification - `bun run check` ✅ - `bun run test` ✅ (401 CLI tests) Ref #11
xingyue added 1 commit 2026-06-02 13:59:35 +00:00
- UwfStore gains varStore: VariableStore (SQLite at ~/.ocas/variables.db)
- loadWorkflowRegistry reads from @uwf/registry/* variables
- saveWorkflowRegistry writes individual @uwf/registry/<name> variables
- Auto-migration: workflows.yaml → variables on first run, renames to .migrated
- Updated callers in workflow.ts and thread.ts
- Tests updated and passing

Ref #11
xiaomo approved these changes 2026-06-02 14:06:50 +00:00
xiaomo left a comment
Owner

LGTM

Registry → ocas variable 迁移干净:

  • UwfStore 新增 varStore 字段,createUwfStore 统一初始化
  • Variable 命名 @uwf/registry/<name> 清晰
  • loadWorkflowRegistry / saveWorkflowRegistry 从 async YAML 读写变为同步 variable 操作,调用点简化
  • 自动迁移:检测 workflows.yaml → 导入 variables → rename .migrated(可逆可追溯)
  • resolveWorkflowCasRef 去掉了 storageRoot 参数,直接用 uwf.varStore
  • 测试同步更新,覆盖迁移场景
  • 4 个 test helper makeUwfStore 统一改用 createUwfStore,减少重复代码
LGTM ✅ Registry → ocas variable 迁移干净: - `UwfStore` 新增 `varStore` 字段,`createUwfStore` 统一初始化 - Variable 命名 `@uwf/registry/<name>` 清晰 - `loadWorkflowRegistry` / `saveWorkflowRegistry` 从 async YAML 读写变为同步 variable 操作,调用点简化 - 自动迁移:检测 `workflows.yaml` → 导入 variables → rename `.migrated`(可逆可追溯) - `resolveWorkflowCasRef` 去掉了 `storageRoot` 参数,直接用 `uwf.varStore` - 测试同步更新,覆盖迁移场景 - 4 个 test helper `makeUwfStore` 统一改用 `createUwfStore`,减少重复代码
xiaomo merged commit 9326cc430f into main 2026-06-02 14:06:52 +00:00
xiaomo deleted branch refactor/registry-to-ocas-variable 2026-06-02 14:06:52 +00:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shazhou/united-workforce#16