Skip to content

Conversation

@daryllimyt
Copy link
Contributor

@daryllimyt daryllimyt commented Oct 31, 2025

We were simply doing the equivalent of '\n'.join("{key} : " for key in required_keys) which results in initial values all being null, which can fail validaiton leading to jarring UX. By generating smart defaults (zero value) based on the args schema, we avoid initially setting invalid values.

Summary

Replaces basic YAML field listing with intelligent default value generation for action inputs, improving UX by providing meaningful zero-values that respect field constraints.

Changes

  • Added generate_zero_defaults() utility to generate type-aware defaults for Pydantic models
  • Supports primitives, collections, constraints (min_length, gt, ge), nested models, enums, and datetime types
  • Updated action router to use generated defaults instead of empty field list
  • Added comprehensive unit tests covering 40+ scenarios

Test plan

  • All existing tests pass
  • New unit tests verify correct default generation for various field types and constraints

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@daryllimyt daryllimyt added engine Improvements or additions to the workflow engine enhancement New feature or request tests Changes to unit and integration tests labels Oct 31, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 3 files

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="tracecat/workflow/actions/utils.py">

<violation number="1" location="tracecat/workflow/actions/utils.py:35">
The numeric zero generator ignores lt/le constraints, so fields declared with Field(lt=...) or Field(le=...) receive 0 and immediately fail validation. Please incorporate upper-bound handling to keep generated defaults within the allowed range.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

daryllimyt and others added 7 commits November 2, 2025 11:42
- Add type hints for function parameters (field_info: Any)
- Rename shadowed variables to avoid redefinition (int_lower_bound, int_upper_bound, etc.)
- Add explicit type annotations for local variables to help mypy with type inference
- All 42 unit tests still pass
- All linting checks pass (ruff, mypy, pyright)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@daryllimyt
Copy link
Contributor Author

@cubic-dev-ai rereview

@daryllimyt
Copy link
Contributor Author

@codex rereview

@cubic-dev-ai
Copy link
Contributor

cubic-dev-ai bot commented Nov 3, 2025

@cubic-dev-ai rereview

@daryllimyt I've started the AI code review. It'll take a few minutes to complete.

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Delightful!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 3 files

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="tracecat/workflow/actions/utils.py">

<violation number="1" location="tracecat/workflow/actions/utils.py:469">
The bytes default ignores min_length, so required bytes fields still fail validation when a minimum length is set. Please generate a placeholder of the required length instead of returning an empty string.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

@topher-lo topher-lo marked this pull request as draft November 27, 2025 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

engine Improvements or additions to the workflow engine enhancement New feature or request tests Changes to unit and integration tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant