Skip to content

feat: task arg validation#5543

Merged
ruben-arts merged 4 commits intoprefix-dev:mainfrom
Hofer-Julian:task-arg-validation
Feb 25, 2026
Merged

feat: task arg validation#5543
ruben-arts merged 4 commits intoprefix-dev:mainfrom
Hofer-Julian:task-arg-validation

Conversation

@Hofer-Julian
Copy link
Contributor

Description

  • beac404 adds the actual implementation
  • 89a22e8 cleans up the surrounding tests

Fixes #3535

How Has This Been Tested?

Local installation

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.

Tools: Claude

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added sufficient tests to cover my changes.
  • I have verified that changes that would impact the JSON schema have been made in schema/model.py.

Add an optional 'choices' field to TaskArg that restricts the allowed
values for a task argument. When a value is provided that is not in the
choices list, a clear error message is shown. The default value, if
specified, is validated against choices at parse time.

Closes prefix-dev#3535
Copy link
Collaborator

@lucascolley lucascolley left a comment

Choose a reason for hiding this comment

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

seems to work as advertised, nice!

Co-authored-by: Lucas Colley <lucas.colley8@gmail.com>
Copy link
Contributor

@ruben-arts ruben-arts left a comment

Choose a reason for hiding this comment

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

I like the idea, it could get some more UX improvements.

I think this picture summarizes it:

Image

I would like the original no value to already present me with the choices and missing args.

I would like the second one to be more friendly. e.g.
Error: got x for 'args', choose from: ["hoi", "hi", "Hello World!"]
Some coloring would also help too.

In the future I would love this to be a interactive dialog where the selection comes up like the env selection does.

@Hofer-Julian
Copy link
Contributor Author

I would like the original no value to already present me with the choices and missing args.

I would like the second one to be more friendly. e.g.
Error: got x for 'args', choose from: ["hoi", "hi", "Hello World!"]
Some coloring would also help too.

This makes sense to me, will check it out

@Hofer-Julian
Copy link
Contributor Author

@ruben-arts the current state should reflect your expectations (minus the interactivity)

Copy link
Contributor

@ruben-arts ruben-arts left a comment

Choose a reason for hiding this comment

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

Thanks this looks good now

@ruben-arts ruben-arts merged commit 35ade25 into prefix-dev:main Feb 25, 2026
41 checks passed
@ruben-arts ruben-arts deleted the task-arg-validation branch February 25, 2026 08:39
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.

Validate task args

3 participants