Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: workflow id and name usage #2685

Closed
wants to merge 4 commits into from

Conversation

vishwamartur
Copy link

Related to #1885

Update workflow parsing to use id as id and name as name, generate different UUID if id is not provided, and add validation for configuration errors.

  • keep/parser/parser.py

    • Update _get_workflow_id to use workflow.get("id") for id and workflow.get("name") for name.
    • Add logic to generate a different UUID if workflow.get("id") is not provided.
    • Update _parse_workflow to use workflow.get("name") for name.
  • keep/api/models/db/workflow.py

    • Add a new field invalid to mark workflows with configuration errors.
    • Update the Workflow class to include the invalid field.
  • keep/api/routes/workflows.py

    • Update create_workflow and create_workflow_from_body to generate a different UUID if workflow.get("id") is not provided.
    • Add validation logic to mark workflows with configuration errors as invalid.
  • tests/test_parser.py

    • Add test cases to verify that a different UUID is generated if workflow.get("id") is not provided.
    • Add test cases to verify that workflows with configuration errors are marked as invalid.

Related to keephq#1885

Update workflow parsing to use `id` as id and `name` as name, generate different UUID if `id` is not provided, and add validation for configuration errors.

* **keep/parser/parser.py**
  - Update `_get_workflow_id` to use `workflow.get("id")` for id and `workflow.get("name")` for name.
  - Add logic to generate a different UUID if `workflow.get("id")` is not provided.
  - Update `_parse_workflow` to use `workflow.get("name")` for name.

* **keep/api/models/db/workflow.py**
  - Add a new field `invalid` to mark workflows with configuration errors.
  - Update the `Workflow` class to include the `invalid` field.

* **keep/api/routes/workflows.py**
  - Update `create_workflow` and `create_workflow_from_body` to generate a different UUID if `workflow.get("id")` is not provided.
  - Add validation logic to mark workflows with configuration errors as `invalid`.

* **tests/test_parser.py**
  - Add test cases to verify that a different UUID is generated if `workflow.get("id")` is not provided.
  - Add test cases to verify that workflows with configuration errors are marked as `invalid`.
Copy link

vercel bot commented Nov 28, 2024

@vishwamartur is attempting to deploy a commit to the KeepHQ Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Nov 28, 2024
@CLAassistant
Copy link

CLAassistant commented Nov 28, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

No linked issues found. Please add the corresponding issues in the pull request description.
Use GitHub automation to close the issue when a PR is merged

@talboren talboren changed the title Fix workflow id and name usage fix: workflow id and name usage Nov 28, 2024
@Matvey-Kuk Matvey-Kuk self-requested a review December 2, 2024 08:16
Copy link

vercel bot commented Dec 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
keep ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 9, 2024 7:53am

keep/api/models/db/workflow.py Show resolved Hide resolved
keep/api/routes/workflows.py Show resolved Hide resolved
@talboren
Copy link
Member

This is open for more than a month. Closing for now, please re-open if it's relevant
cc: @vishwamartur @Matvey-Kuk

@talboren talboren closed this Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants