Skip to content

Feat/workflow execution dialog#22

Merged
ThHanke merged 25 commits into
mainfrom
feat/workflow-execution-dialog
Jun 23, 2026
Merged

Feat/workflow execution dialog#22
ThHanke merged 25 commits into
mainfrom
feat/workflow-execution-dialog

Conversation

@ThHanke

@ThHanke ThHanke commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Summary

End-to-end interactive execution of Python workflow steps inside the canvas, with live progress, log streaming, user input prompts, and automatic navigation to results.

What's new

  • Execution dialog — modal overlay shows real-time progress, stdout/stderr, and error annotations while Pyodide runs Python workflow scripts
  • Interactive input prompts — scripts can request user input via request_input() (select dropdowns, text, number); dialog surfaces these as inline form controls using SharedArrayBuffer for synchronous blocking
  • Runtime input discovery — workflow steps discover their inputs by querying the RDF graph at runtime instead of requiring pre-connected placeholder entities. The instantiator no longer creates input placeholders
  • Multi-step chaining — pressing play on a step automatically chains through successor steps (resolved via P-Plan variable linkage), each opening in the same dialog
  • Navigate on close — closing the dialog after a successful run zooms the canvas to the output entities of the last executed step
  • Annotation surfacing — OA error/result annotations from Python scripts appear as log messages in the dialog
  • JSON-LD context pre-resolution — remote @context URLs are fetched on the main thread before passing to the worker parser, fixing Firefox CORS/redirect failures
  • Auto-discover ontologies — JSON-LD @context URLs are treated as ontology import candidates
  • Shared library auto-loadingspw_input.py is fetched from the same base URL as the script and pre-loaded into Pyodide's filesystem
  • Blank node ABox classification — untyped blank nodes (common in JSON-LD) now display on the ABox canvas
  • Flows sidebar button — quick access to workflow catalog from the collapsed rail

Key fixes

  • executeActivity no longer wires intermediate data entities as prov:used on the next activity — this caused find_candidates() to exclude the very collections/values it should discover
  • request_input() is injected into Python builtins (not just __main__), so shared libraries like spw_input.py can call it
  • Stopped tracking generated mcp.json build artifact

Thomas Hanke added 25 commits June 22, 2026 11:42
Add stdout/stderr/input_request/init_buffers event types to worker
protocol. Create workflowExecutionStore for dialog state management
with 100ms log batching and reopen-during-execution support.
… blocking

Worker captures Python stdout/stderr via custom writer objects and emits
events. Allocates SharedArrayBuffer for synchronous input blocking with
Atomics.wait/notify — 30s timeout, cancellation support, 8KB text buffer.
…sponse

Worker client handles stdout/stderr/input_request/init_buffers events.
respondToInput() writes directly to SharedArrayBuffer + Atomics.notify
(no postMessage — worker is blocked on Atomics.wait).
Real-time dialog showing progress bar, stdout/stderr log, input prompts,
and errors. Auto-scrolling log with user-scroll detection. Mobile-friendly
with dvh units and 44px touch targets.
executeActivity subscribes to worker events (stdout/stderr/progress/
input_request) and logs to workflowExecutionStore. ProvActivityTemplate
owns dialog lifecycle — open before while loop, close after.
Dialog mounted in canvas container alongside other overlays.
Sparkles icon with tooltip, conditionally rendered when
workflowCatalogEnabled. Expands sidebar and opens workflows accordion.
…ivity

prov:atLocation, rdf:type, and rdfs:label are now searched in both
workflows and data graphs. Fixes execution of standalone example TTL
files where resources may be in either graph. Improved error message
when code URL not found (lists used resources, suggests catalog load).
validateWorkflowExecution() checks activity exists, has code resources
with reachable URLs, and template step present. Exposed on
window.__vgTestWorkflow for dev console access.
Workflow (branching nodes) icon better represents workflows than
Sparkles. Updated in both collapsed rail button and expanded accordion.
Extend request_input protocol to support label/value option pairs,
increase input timeout to 300s, add dialog-side cancel on close with
backdrop/Escape guards, and add integration test fixture and tests
for the end-to-end input resolution flow.
Derive base URL from codeUrl, fetch shared libraries (spw_input.py) to
Pyodide FS at /tmp, cache across executions. Ensures /tmp is in sys.path
so scripts can use standard import. Graceful 404 fallback.
…ate canvas vars

Remove CSVWMetadataURI and CSVWColumnName input variables from the catalog
template — the Python script discovers available CSVW entities at runtime
and prompts the user to select. Deduplicate template variable IRIs when
placing on canvas to fix React duplicate-key warning for shared variables
(e.g. LoadedColumnData used as both step output and input).
All workflows discover inputs at runtime via graph queries and user
prompts. Input variables remain in the catalog as documentation but
the instantiator no longer creates run-level placeholder entities or
places them on the canvas. Also deduplicates template variable IRIs
to fix React duplicate-key warning for shared variables.
…ibility

Firefox blocks CORS on HTTP→HTTPS 301 redirects for JSON-LD @context URLs.
Resolve remote contexts on the main thread before passing to the worker,
upgrading http:// to https:// and inlining the fetched context objects.
Also add application/ld+json to the Accept header for rdfUrl loads.
Add try/catch around respondToInput to prevent unhandled errors.
Fix TextEncoder.encodeInto replaced with encode+subarray to handle
large response values that exceed the SharedArrayBuffer view.
When loading JSON-LD via rdfUrl, extract remote @context URLs during
context resolution and pass them as candidates to discoverReferencedOntologies.
This puts JSON-LD context vocabularies through the same discovery/loading
pipeline as owl:imports, so referenced vocabularies (e.g. CSVW) appear
in the ontology widget. Context URL load failures are non-fatal.
…des display

Blank nodes whose parent subjects had no recognized rdf:type (e.g. csvw:Table
nodes without explicit @type) were never propagated into bNodeViewMap. The
fallback defaulted to TBox, hiding tableSchema blank nodes and their column
connections from the ABox canvas view.
Output oa:Annotation entities from Python workflow scripts were only
visible as canvas nodes. Now executeActivity extracts rdfs:label from
annotations in the output Turtle and appends them as stderr log entries
in the WorkflowExecutionDialog, so error/result messages are immediately
visible to the user.
…t activity

Scripts discover inputs at runtime via find_candidates(), which excludes
entities that are prov:used by the activity AND have p-plan:correspondsToVariable.
The old wiring caused step 2's collection to be excluded — making calculate_average
report "No prov:Collection found" even though load_csvw_column produced one.
…ain__

request_input was defined via pyodide.runPython() which puts it in
__main__.__dict__. After extracting spw_input.py as a shared module,
the call site moved to a separate module that can't see __main__'s
globals. Injecting into builtins makes it available to all modules.
After a successful workflow run, closing the dialog zooms the canvas
to the first output entity of the last executed step. Uses the existing
navigateToIri mechanism which handles element lookup and view switching.
…s CRLF

Generate mcp.json before drift check since it is now gitignored. Refactor
WorkflowExecutionDialog to satisfy react-hooks/refs and set-state-in-effect
rules using render-time state derivation. Normalize CRLF in fixture test
and add .gitattributes enforcing LF for cross-platform consistency.
The prebuild script and drift check both need the file on disk.
Reverting the gitignore exclusion so the generated file is tracked.
@ThHanke
ThHanke merged commit f47c098 into main Jun 23, 2026
6 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.

1 participant