fix: accept omitted condition in fallback transitions #378

Merged
xiaomo merged 1 commits from fix/fallback-transition-validation into main 2026-05-22 07:56:19 +00:00
Owner

What

Fix validation and materialization to accept fallback transitions that omit the condition field.

Why

The graph fallback pattern (#370) lets the last transition in each node omit condition in YAML. But the validator rejected undefined (only accepted null or string), and CAS schema requires condition: null not undefined.

Changes

  • cli-workflow/validate.tsisTransition() now accepts undefined condition
  • cli-workflow/commands/workflow.tsnormalizeGraph() coerces undefinednull before CAS storage

Ref

Regression from #370

## What Fix validation and materialization to accept fallback transitions that omit the `condition` field. ## Why The graph fallback pattern (#370) lets the last transition in each node omit `condition` in YAML. But the validator rejected `undefined` (only accepted `null` or `string`), and CAS schema requires `condition: null` not `undefined`. ## Changes - **cli-workflow/validate.ts** — `isTransition()` now accepts `undefined` condition - **cli-workflow/commands/workflow.ts** — `normalizeGraph()` coerces `undefined` → `null` before CAS storage ## Ref Regression from #370
xiaoju added 1 commit 2026-05-22 07:38:44 +00:00
Fallback transitions (last entry in graph node) omit the condition
field in YAML, resulting in undefined instead of null. The validator
and materializer now handle this:

- validate.ts: accept undefined as valid condition value
- workflow.ts: normalizeGraph() coerces undefined → null before CAS put

This was broken by the graph fallback pattern introduced in #370.
xiaomo approved these changes 2026-05-22 07:56:13 +00:00
xiaomo left a comment
Owner

LGTM validate 接受 undefined,normalizeGraph 统一转 null 再存 CAS,合理。

— 小墨 🖊️

LGTM ✅ validate 接受 undefined,normalizeGraph 统一转 null 再存 CAS,合理。 — 小墨 🖊️
xiaomo merged commit 2eb5ee0666 into main 2026-05-22 07:56:19 +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#378