Skip to content

Add workflow composer validation and warnings#10

Draft
sezallagwal wants to merge 2 commits into
feature/workflow-composer-normalizationfrom
feature/workflow-composer-validation-warnings
Draft

Add workflow composer validation and warnings#10
sezallagwal wants to merge 2 commits into
feature/workflow-composer-normalizationfrom
feature/workflow-composer-validation-warnings

Conversation

@sezallagwal

Copy link
Copy Markdown
Collaborator

Summary

  • Add validation for workflow composer input
  • Check for duplicate step IDs, missing references, dependency cycles, and invalid step configs
  • Validate template references, data flow between steps, and workflow expressions
  • Add helpful warnings for issues like unused steps, duplicate API calls, and hardcoded IDs
  • Separate blocking errors from non-blocking warnings

Depends on

#9

@dhairyashiil dhairyashiil left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Sezal, could we improve the sampling/data-flow validation in this PR?

A plain text sampling step can currently be used later like it returned JSON, for example {{steps.rank.safe}}. That composes successfully, but if the sampling result is just text at runtime, the field access resolves to an empty value.

Could we make the composer catch this? A few possible options:

  • treat non-JSON sampling output as a string and reject field access on it
  • require RESPONSE_FORMAT json or a response schema before allowing steps.someSampling.field
  • or infer JSON mode when downstream steps clearly access fields

The main thing is: if a later step expects structured data, the composer should make that explicit instead of silently producing empty values.

@dhairyashiil dhairyashiil marked this pull request as draft July 1, 2026 09:04
Sampling results are plain text unless the step is in JSON mode (explicit responseFormat: json or JSON intent in the prompt), where the runtime parses them into an object. Field access is only valid against the object form.

- Add shared detectJsonIntent heuristic (workflow/json-intent.ts) as the single source of truth for JSON-mode detection across compose-time validation and the runtime sampling executor.
- validateDataFlowTypes now resolves sampling output type per-step and rejects field access on plain-text sampling with an actionable error.
- Implement inferSamplingResponseSchemas: infer responseSchema for JSON-mode sampling from downstream field access, warning (SAMPLING_SCHEMA_MISMATCH) when a consumed field is absent from the prompt.
- Add unit tests for data-flow validation, schema inference, and json-intent.

Addresses review feedback on silent empty-value resolution when a text sampling result is used like structured JSON.
@sezallagwal sezallagwal requested a review from dhairyashiil July 7, 2026 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants