Skip to content

Interactive workflow simulation and condition testing in the editor (#84) - #89

Merged
EricWittmann merged 4 commits into
mainfrom
issues/gh-84
Sep 4, 2026
Merged

Interactive workflow simulation and condition testing in the editor (#84)#89
EricWittmann merged 4 commits into
mainfrom
issues/gh-84

Conversation

@EricWittmann

Copy link
Copy Markdown
Contributor

Summary

  • Add a Simulate mode to WorkflowEditor that runs a workflow's routing logic against a sample
    start context without deploying a real instance. The canvas lights up the path taken, which edges
    matched, and which conditions evaluated true/false; blocking nodes (action/human-task/
    receive-event) pause for a mock output that is merged into the context, and errors are surfaced
    tied to the offending node/edge.
  • Introduce two dependency-free, React-free modules pinned to the Java engine: elEvaluator.ts
    (a Jakarta-EL-subset evaluator whose tests mirror ConditionEvaluatorTest) and simulate.ts
    (a routing stepper mirroring WorkflowEngine.selectEdge/getOutgoingEdges, priority order,
    isDefault fallback, and MAX_TRANSITIONS).
  • Add an inline Test condition affordance on edges (evaluate a single condition against a pasted
    context), a Simulate switch in the toolbar, an auto-generated sample start context from the start
    node's declared inputs, a blue canvas border while simulating (reserved via a transparent border
    so it never shifts layout), and automatic interactivity lock (with a disabled lock button) during
    simulation. Public simulation/evaluator APIs are exported from index.ts.

Related Issue

Fixes #84

Test Plan

  • cd ui && npx vitest run — full suite (140 tests, includes EL parity + simulation units)
  • cd ui && npx tsc --noEmit — typecheck
  • cd ui && npm run lint
  • cd ui && npm run build
  • cd ui && npm run dev — toggle Simulate, Start/Step/Run through the cveTriage sample,
    supply a mock output at the human task, confirm the path + edge true/false light up, verify a
    bad condition surfaces an error on the right edge, and test a single condition inline

…testing

Replaces the plain textarea JSON fields (sample start context, mock output,
inline condition-tester context) with a lightweight, bundled JsonCodeEditor
built on react-simple-code-editor + Prism, and renders the evolving
simulation context with the same editor in read-only mode.

Refs #84
The blocking-node mock output JSON now seeds each declared output with a
placeholder matching its type (false for boolean, -1 for number, {} for
object, "" for string) instead of an empty string for every field, and
honors an explicit output defaultValue when one is set.

Refs #84
The prismjs package (3.7MB, 700 files) was stalling npm ci in CI, pushing
install from ~15s to ~5 minutes. Drop prismjs and @types/prismjs and highlight
JSON with a small in-repo function fed to react-simple-code-editor's highlight
callback, keeping identical syntax highlighting with zero new dependencies.

Refs #84
@EricWittmann
EricWittmann merged commit 0c51650 into main Sep 4, 2026
2 checks passed
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.

Interactive workflow simulation and condition testing in the editor

1 participant