// workflow step: validate — check the post has a title + enough body. // Output { ok, word_count, issues } → gates the rest of the DAG via `when`. let b = ctx.request.body; let post = docs::collection("posts").get(b.post_id); if post == () { return #{ ok: false, issues: ["post not found"], word_count: 0 }; } let d = post.data; let issues = []; if d.title == () || d.title == "" { issues.push("missing title"); } let body = if d.body_md == () { "" } else { d.body_md }; let words = if body == "" { 0 } else { body.split(" ").len() }; if words < 3 { issues.push("body too short"); } #{ ok: issues.len() == 0, word_count: words, issues: issues }