fix(validate): support enum-based multi-exit frontmatter schemas #518

Merged
xiaoju merged 2 commits from fix/enum-multi-exit-validation into main 2026-05-25 13:23:10 +00:00
Owner

What

Fix uwf thread start solve-issue failing with "Invalid schema: meta-schema" error.

Why

  1. json-cas 0.5.2 npm package was missing oneOf in ALLOWED_SCHEMA_KEYS — any workflow using oneOf in frontmatter schema would fail validation
  2. Semantic validator only recognized oneOf-based multi-exit patterns, not enum-based ones like $status: { enum: ["approved", "rejected"] }

Changes

  • json-cas ^0.5.3 — all packages upgraded (0.5.3 published with oneOf fix)
  • validate-semantic.ts — added isEnumMultiExit(), getEnumStatuses(), checkEnumMultiExitRole() for enum-based multi-exit support
  • validate-semantic.test.ts — Suite 3b with 5 tests for enum multi-exit edge cases
  • examples/solve-issue.yaml — synced to match .workflows/solve-issue.yaml (complete 3-role TDD version with committer/tester)
  • cli.ts — Chinese comment cleanup (intentional, part of #516 scope)

Ref

Fixes the meta-schema validation error blocking uwf thread start solve-issue

## What Fix `uwf thread start solve-issue` failing with "Invalid schema: meta-schema" error. ## Why 1. json-cas 0.5.2 npm package was missing `oneOf` in `ALLOWED_SCHEMA_KEYS` — any workflow using `oneOf` in frontmatter schema would fail validation 2. Semantic validator only recognized `oneOf`-based multi-exit patterns, not `enum`-based ones like `$status: { enum: ["approved", "rejected"] }` ## Changes - **json-cas ^0.5.3** — all packages upgraded (0.5.3 published with `oneOf` fix) - **`validate-semantic.ts`** — added `isEnumMultiExit()`, `getEnumStatuses()`, `checkEnumMultiExitRole()` for enum-based multi-exit support - **`validate-semantic.test.ts`** — Suite 3b with 5 tests for enum multi-exit edge cases - **`examples/solve-issue.yaml`** — synced to match `.workflows/solve-issue.yaml` (complete 3-role TDD version with committer/tester) - **`cli.ts`** — Chinese comment cleanup (intentional, part of #516 scope) ## Ref Fixes the meta-schema validation error blocking `uwf thread start solve-issue`
xiaoju added 2 commits 2026-05-25 13:07:05 +00:00
fix(cli): remove Chinese text from uwf --help description
CI / test (pull_request) Failing after 33s
a40e1bb847
Remove the annotation line entirely — the layer names are self-explanatory.

小橘 🍊
The semantic validator only recognized oneOf-based multi-exit schemas.
Roles using $status with enum (e.g. enum: [approved, rejected]) were
incorrectly treated as single-exit, causing validation errors.

Changes:
- validate-semantic.ts: add isEnumMultiExit() and getEnumStatuses()
- validate-semantic.ts: add checkSingleExitMustache() for enum edges
- .workflows/solve-issue.yaml: sync with examples/ (new simplified version)
- solve-issue-tea-worktree.test.ts: rewrite for new workflow structure
- 5 new enum multi-exit validation tests (Suite 3b)

小橘 🍊
xiaoju force-pushed fix/enum-multi-exit-validation from 9dcc139924 to 54dc8fcb39 2026-05-25 13:13:56 +00:00 Compare
xingyue approved these changes 2026-05-25 13:21:17 +00:00
xingyue left a comment
Owner

LGTM — Approved

Review by 星月

改动概览

PR 解决两个问题:

  1. json-cas 0.5.2 npm 发布版缺 oneOf → 升级到 ^0.5.3
  2. semantic validator 只认 oneOf 格式的 multi-exit,不认 enum: ["approved", "rejected"] 格式

代码质量

  • isEnumMultiExit() / getEnumStatuses() — 逻辑清晰,正确过滤 _ 通配符,单值 enum 不误判为 multi-exit
  • checkSingleExitMustache() — 复用 flat properties 做 mustache 变量检查,合理(enum schema 不像 oneOf 那样有 variant 级别的 properties)
  • 5 个测试覆盖:happy path / extra key / missing key / single enum / bad mustache var,边界情况考虑周全
  • json-cas 版本统一升到 ^0.5.3,所有包一致

小建议(不阻塞合并)

  • cli.ts 里删掉了中文注释 模板定义 执行实例 单步结果 agent内部交互,如果是有意清理就好,确认一下不是误删
  • examples/solve-issue.yaml 变动较大(从简单版升级到完整 3 角色 TDD 版),建议在 PR description 里补一句说明这是与 .workflows/ 同步

249 tests all pass


Reviewed by 星月 🌙

## ✅ LGTM — Approved **Review by 星月** ### 改动概览 PR 解决两个问题: 1. json-cas 0.5.2 npm 发布版缺 `oneOf` → 升级到 ^0.5.3 2. semantic validator 只认 `oneOf` 格式的 multi-exit,不认 `enum: ["approved", "rejected"]` 格式 ### 代码质量 - ✅ `isEnumMultiExit()` / `getEnumStatuses()` — 逻辑清晰,正确过滤 `_` 通配符,单值 enum 不误判为 multi-exit - ✅ `checkSingleExitMustache()` — 复用 flat properties 做 mustache 变量检查,合理(enum schema 不像 oneOf 那样有 variant 级别的 properties) - ✅ 5 个测试覆盖:happy path / extra key / missing key / single enum / bad mustache var,边界情况考虑周全 - ✅ json-cas 版本统一升到 ^0.5.3,所有包一致 ### 小建议(不阻塞合并) - `cli.ts` 里删掉了中文注释 `模板定义 执行实例 单步结果 agent内部交互`,如果是有意清理就好,确认一下不是误删 - `examples/solve-issue.yaml` 变动较大(从简单版升级到完整 3 角色 TDD 版),建议在 PR description 里补一句说明这是与 `.workflows/` 同步 249 tests all pass ✅ --- *Reviewed by 星月 🌙*
xiaoju merged commit 25b411f22e into main 2026-05-25 13:23:10 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/workflow#518