Studio import returns 500 on its own export when a directory input has a value

Symptom

Importing a workflow that Studio itself exported returns HTTP 500 when an action has a directory input with a value. Studio logs:

File "/data/ryax/studio/infrastructure/packaging/packaging_import.py", line 256, in _build_workflow_action_input
    workflow_action_input.set_static_value(
File "/data/ryax/studio/domain/workflow/entities/workflow_action_input.py", line 93, in set_static_value
    raise NotImplementedException(
ryax.studio.domain.workflow.workflow_exceptions.NotImplementedException: Use WorkflowActionInput.add_input_file for file and dir.

Reproduced on 26.9.0 (Studio master is unchanged).

Root cause (confirmed in the code)

studio/ryax/studio/infrastructure/packaging/packaging_import.py:241 routes only FILE inputs to add_input_file():

if action_input.type == ActionIOType.FILE:
    file = workflow_file_metadata.get(workflow_action_input_value_yaml, None)
    ...
    workflow_action_input.add_input_file(filename, extension, file["path"], file["size"])
else:
    workflow_action_input.set_static_value(workflow_action_input_value_yaml)

A DIRECTORY input falls into the else, and set_static_value() refuses file, dir and table types by design (workflow_action_input.py:88-93). The export does write the directory: its zip is in the archive as <uuid>-<name>.zip, and workflow.yaml references it by that name. Only the import fails to read it back. TABLE takes the same else path, so it probably fails the same way; I haven't tested that.

NotImplementedException is not in the import endpoint's except list (workflow_controller.py:191-199), so it surfaces as a bare 500 rather than a 400.

Reproduction

  1. Create a workflow with an action that has a directory input, e.g. Web hosting for static content (web-hosting-static-dir, input dir).
  2. Upload a zip as the value of dir.
  3. GET /api/studio/workflows/{id}/export
  4. POST /api/studio/workflows/import with the zip Studio just produced → 500.

Exporting before step 2 imports fine, which isolates the directory value as the trigger.

Suggested fix

Treat DIRECTORY (and probably TABLE) like FILE in _build_workflow_action_input: a membership test on the file-like types instead of == FILE. Also check that add_input_file() records the directory type correctly. Add NotImplementedException to the endpoint's 400 mapping so any remaining unsupported case reads as a client error.

A regression test should round-trip an export with a file input and a directory input.

  • #1465 (closed): the same function returns 500 on numeric values. Both break export/import round-trips, so a round-trip test would cover both.
  • #1464 (closed): import drops addons.
  • #308: the 2020 idea "Files and directories are not supported in workflow import". File values have been supported since; directory values are still missing.

Found while testing #1463 (closed) on a local cluster.