Skip to content

feature: pipeline run parameters - dynamic choices (HEXA-1620)#1780

Merged
mrivar merged 25 commits into
mainfrom
HEXA-1620-parameter-dynamic-choices
May 21, 2026
Merged

feature: pipeline run parameters - dynamic choices (HEXA-1620)#1780
mrivar merged 25 commits into
mainfrom
HEXA-1620-parameter-dynamic-choices

Conversation

@mrivar

@mrivar mrivar commented May 1, 2026

Copy link
Copy Markdown
Contributor

Related PRs:

Changes

  • Dynamic choices from file: Pipeline parameters can now declare choices=ChoicesFromFile(path, column?) in the SDK. The app resolves those choices at run time by reading a CSV, JSON, or YAML file from the workspace's file storage and returning a flat list of string values.
  • New GraphQL query pipelineParameterChoices(workspaceSlug, pipelineVersionId, parameterCode): fetches the resolved choices on demand. The run-pipeline and version-config dialogs use it to populate a Select widget when a parameter has choicesFromFile set.
  • Type mismatch warning: When a choices file contains values that cannot be cast to the parameter's declared type (e.g. a string in an int parameter), those options are rendered disabled in the dropdown and a warning lists the invalid values.
  • Config type validation from Backend: Saving a pipeline version config or triggering a run now validates that each supplied value matches the parameter's declared type. Returns INVALID_CONFIG on mismatch instead of silently accepting bad data.
    • Note: It used to be only checked in the frontend and during the actual run.
    • Note 2: It is a simpler validation than the one done during the run, just checking types (such as int doesn't get a str value).

How/what to test

  1. Create a pipeline that uses parameters with choices=ChoicesFromFile(path, column?) and choices=path (see the linked SDK PR for the API). Upload a matching CSV/JSON/YAML file to the workspace.
  2. Open Run pipeline / Set default values — the parameter should show a dropdown populated from the file.
  3. Upload a file whose values don't match the parameter type (e.g. strings for an int param) — invalid options should appear greyed out with a warning message below the select.
  4. In the version config dialog, set a parameter to a value of the wrong type and save — expect an error.
  5. Test error paths: delete the choices file, use a malformed file, or point to a non-existent column — the widget should show an inline error rather than crashing.

Screenshots / screencast

Example with CSV with 2 columns:

  • First param has choices=ChoicesFromFile("choices/choices_2_cols.csv"). Not column chosen so it gives an error.
  • Second param has choices=ChoicesFromFile("choices/choices_2_cols.csv", "two") so it shows the option of column two.
name,two
asd,two1
qwe,two2
zxc,two3
csv,two4
Screenshot from 2026-05-05 16-32-28

Warning when a pipeline parameter has invalid choices (e.g.: int/float with a choices file with strings) the invalid options appear disabled:
image

Error when trying to save an invalid pipeline parameter (e.g.: an int/float pipeline parameter tries to save a string value):
Screenshot from 2026-05-06 16-58-53

Error when everything goes wrong (in theory this state should be unreachable, but it's a fail safe in case everything goes wrong 🤪)
image

Comment thread .gitignore

docker-compose.debug.yaml
docker-compose.dev.yaml
docker-compose.override.yaml

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Using this file to run my local openhexa-sdk-python and test the changes in it:

docker-compose.override.yaml:

services:
  app:
    volumes:
      - ../openhexa-sdk-python:/openhexa-sdk-python
    entrypoint: ["/bin/bash", "-c", "pip install --user -q -e /openhexa-sdk-python && exec /code/docker-entrypoint.sh \"$@\"", "--"]

@mrivar mrivar marked this pull request as ready for review May 7, 2026 13:07

@yolanfery yolanfery left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Solid ! Good to see lot of tests also ☺️

No major concern, just some code quality topics and questions.

Also, we might want to add documentation as part of this PR now that the documentation is in the repo.

Comment thread backend/hexa/pipelines/graphql/schema.graphql Outdated
Comment thread backend/hexa/pipelines/graphql/schema.graphql Outdated
Comment thread backend/hexa/pipelines/schema/queries.py Outdated
Comment thread backend/hexa/pipelines/models.py Outdated
Comment thread backend/hexa/pipelines/choices_from_file.py
Comment thread backend/hexa/pipelines/tests/test_schema/test_pipeline_parameter_choices.py Outdated
code: string;
required?: boolean;
directory?: string;
directory?: string | null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Question] Can you please explain this change and the one below in the same file ?

We already have ? on directory, I don't get why we need to add this union type

@mrivar mrivar May 14, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's introduced because otherwise we get an error when running codegen:
https://github.com/BLSQ/openhexa-app/actions/runs/25879781042/job/76056394291?pr=1780
It's just because null and undefined are not considered the same apparently:

  Types of property 'directory' are incompatible.
    Type 'string | null | undefined' is not assignable to type 'string | undefined'.
      Type 'null' is not assignable to type 'string | undefined'. 

@mrivar mrivar requested a review from yolanfery May 14, 2026 19:17

@yolanfery yolanfery left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great, thanks for the changes, just missing some documentation 🙂

mrivar added 2 commits May 20, 2026 12:48
 Conflicts:
	frontend/src/workspaces/graphql/queries.generated.tsx
@mrivar mrivar requested a review from yolanfery May 20, 2026 11:07
@mrivar

mrivar commented May 20, 2026

Copy link
Copy Markdown
Contributor Author

Great, thanks for the changes, just missing some documentation 🙂

Right! I forgot about that, thanks for reminding me

@mrivar mrivar merged commit 91b3912 into main May 21, 2026
11 checks passed
@mrivar mrivar deleted the HEXA-1620-parameter-dynamic-choices branch May 21, 2026 07:46
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