Skip to content

feat(ui-v2): Add trigger form templates - #10

Open
tomerqodo wants to merge 3 commits into
coderabbit_full_base_featui-v2_add_trigger_form_templates_pr10from
coderabbit_full_head_featui-v2_add_trigger_form_templates_pr10
Open

feat(ui-v2): Add trigger form templates#10
tomerqodo wants to merge 3 commits into
coderabbit_full_base_featui-v2_add_trigger_form_templates_pr10from
coderabbit_full_head_featui-v2_add_trigger_form_templates_pr10

Conversation

@tomerqodo

@tomerqodo tomerqodo commented Jan 30, 2026

Copy link
Copy Markdown

Benchmark PR from agentic-review-benchmarks#10

Summary by CodeRabbit

  • New Features

    • Implemented trigger configuration fields for deployment status, work pool status, work queue status, and custom triggers. Users can now configure posture, expected outcomes, thresholds, and conditional timing parameters instead of placeholder screens.
  • Tests

    • Updated trigger template tests to verify field components render correctly for each trigger type.

✏️ Tip: You can customize this high-level summary in your review settings.

devin-ai-integration Bot and others added 3 commits January 25, 2026 12:10
…ool-status, work-queue-status, and custom triggers

- Create DeploymentStatusTriggerFields component with status select
- Create WorkPoolStatusTriggerFields component with status select
- Create WorkQueueStatusTriggerFields component with status select
- Create CustomTriggerFields component with textarea for expected events
- Update TriggerStep to use new components instead of placeholders
- Export all new components from index.ts

All components follow the same pattern as FlowRunStateTriggerFields with:
- PostureSelect for Reactive/Proactive toggle
- Threshold input field
- Conditional Within field (shown only for Proactive posture)

Co-Authored-By: alex.s@prefect.io <ajstreed1@gmail.com>
…mponents

Update tests to check for actual component rendering instead of placeholder
text now that the trigger form templates are implemented.

Co-Authored-By: alex.s@prefect.io <ajstreed1@gmail.com>
@coderabbitai

coderabbitai Bot commented Jan 30, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR introduces four new React components for automation trigger configuration fields (custom, deployment status, work pool status, work queue status) that replace placeholder text in the trigger wizard. These components are exported via module index, integrated into the trigger-step workflow, tested for visibility, and TypeScript strict mode is disabled in the build configuration.

Changes

Cohort / File(s) Summary
New Trigger Field Components
custom-trigger-fields.tsx, deployment-status-trigger-fields.tsx, work-pool-status-trigger-fields.tsx, work-queue-status-trigger-fields.tsx
Four new React components that render form fields for different automation trigger types. Each component uses react-hook-form to manage PostureSelect, status/expected-value fields, threshold numeric input, and conditionally renders a within-seconds field when posture is "Proactive".
Module Exports and Integration
index.ts, trigger-step.tsx
Added re-exports of the four new trigger field components from index.ts; updated trigger-step.tsx to import and render these components within TriggerTemplateFields instead of placeholder text.
Tests
trigger-step.test.tsx
Updated test assertions to verify visibility of the new trigger field components and relevant form labels (e.g., "select posture", "Threshold", "Expected Events") rather than placeholder text.
Configuration
tsconfig.app.json
Disabled strict TypeScript type-checking by setting the strict compiler option from true to false.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 Four new fields hop into place,
No more "coming soon" in this space,
Posture and thresholds aligned so tight,
Forms take shape with reactive delight,
The trigger-step wizard burns bright! 🌟

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description is minimal and only references a benchmark PR without detailing changes, missing required checklist items and overview. Add an overview of the changes, complete the checklist items (issue reference, tests, docstrings), and provide details about what functionality was added.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding trigger form template components to the UI.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch coderabbit_full_head_featui-v2_add_trigger_form_templates_pr10

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In
`@ui-v2/src/components/automations/automations-wizard/trigger-step/custom-trigger-fields.tsx`:
- Around line 37-40: The onChange handler for the textarea currently does const
lines = e.target.value.split("\n"); and then field.onChange(lines.length > 0 ?
lines : undefined), which treats an empty textarea as [""]; update the handler
to split and then filter out empty/whitespace-only lines (e.g., trim each line
and filter(Boolean) or filter(l => l.trim() !== "")), and call
field.onChange(filteredLines.length ? filteredLines : undefined) so clearing the
textarea sets the field to undefined (or an empty array if you prefer) rather
than [""]; reference the onChange prop, e.target.value, the local variable
lines, and field.onChange to locate the change.

In `@ui-v2/tsconfig.app.json`:
- Line 19: The tsconfig change turned off TypeScript strict mode by setting the
"strict" compiler flag to false, which weakens type safety; revert "strict" back
to true in the tsconfig and fix the resulting type errors in the new trigger
field components instead of relaxing compiler checks globally—locate uses of the
"strict" flag and the new trigger field components (the recently added
TriggerField* components) and address missing/any types, nullable checks, and
incorrect function signatures (e.g., add precise types, use optional chaining,
tighten return types) so the codebase compiles under strict mode.
🧹 Nitpick comments (3)
ui-v2/src/components/automations/automations-wizard/trigger-step/work-pool-status-trigger-fields.tsx (2)

78-78: Inconsistent number parsing: parseInt vs Number.

This component uses parseInt(e.target.value) for the threshold field, while other components (deployment-status, work-queue-status, custom) use Number(e.target.value). For consistency and to handle edge cases uniformly, consider using Number() here as well.

Proposed fix
-onChange={(e) => field.onChange(parseInt(e.target.value))}
+onChange={(e) => field.onChange(Number(e.target.value))}

26-109: Consider extracting shared logic to reduce duplication.

WorkPoolStatusTriggerFields and WorkQueueStatusTriggerFields are nearly identical, differing only in the status options and event prefixes. While acceptable for the initial implementation, consider extracting a shared StatusTriggerFields component that accepts status options as a prop to reduce future maintenance burden.

ui-v2/src/components/automations/automations-wizard/trigger-step/trigger-step.test.tsx (1)

45-56: Use case-insensitive regex matchers for label assertions to improve test resilience.

These assertions rely on exact string matching for labels. Any capitalization change (e.g., "Select posture" instead of "select posture") will break the tests. React Testing Library supports case-insensitive RegExp matchers, which reduces brittleness and is the recommended pattern for stable assertions. Apply this across all similar template tests in this file:

-		expect(screen.getByLabelText("select posture")).toBeVisible();
-		expect(screen.getByLabelText("Threshold")).toBeVisible();
+		expect(screen.getByLabelText(/select posture/i)).toBeVisible();
+		expect(screen.getByLabelText(/threshold/i)).toBeVisible();

Comment on lines +37 to +40
onChange={(e) => {
const lines = e.target.value.split("\n");
field.onChange(lines.length > 0 ? lines : undefined);
}}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Empty textarea results in [""] instead of empty array or undefined.

"".split("\n") returns [""] (an array with one empty string), so the condition lines.length > 0 is always true. This means clearing the textarea sets the field to [""] rather than undefined or [].

Consider filtering out empty lines:

Proposed fix
 onChange={(e) => {
-	const lines = e.target.value.split("\n");
-	field.onChange(lines.length > 0 ? lines : undefined);
+	const lines = e.target.value.split("\n").filter(line => line.trim());
+	field.onChange(lines.length > 0 ? lines : undefined);
 }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
onChange={(e) => {
const lines = e.target.value.split("\n");
field.onChange(lines.length > 0 ? lines : undefined);
}}
onChange={(e) => {
const lines = e.target.value.split("\n").filter(line => line.trim());
field.onChange(lines.length > 0 ? lines : undefined);
}}
🤖 Prompt for AI Agents
In
`@ui-v2/src/components/automations/automations-wizard/trigger-step/custom-trigger-fields.tsx`
around lines 37 - 40, The onChange handler for the textarea currently does const
lines = e.target.value.split("\n"); and then field.onChange(lines.length > 0 ?
lines : undefined), which treats an empty textarea as [""]; update the handler
to split and then filter out empty/whitespace-only lines (e.g., trim each line
and filter(Boolean) or filter(l => l.trim() !== "")), and call
field.onChange(filteredLines.length ? filteredLines : undefined) so clearing the
textarea sets the field to undefined (or an empty array if you prefer) rather
than [""]; reference the onChange prop, e.target.value, the local variable
lines, and field.onChange to locate the change.

Comment thread ui-v2/tsconfig.app.json
"noEmit": true,
"jsx": "react-jsx",
"strict": true,
"strict": false,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Disabling TypeScript strict mode weakens type safety for the entire application.

Setting "strict": false disables critical type-checking features like noImplicitAny, strictNullChecks, and strictFunctionTypes. This is a significant regression that can mask bugs and reduce code quality across the entire ui-v2 codebase.

The new trigger field components should be written to comply with strict mode rather than relaxing compiler settings globally. Consider keeping "strict": true and addressing any type errors in the new components directly.

🤖 Prompt for AI Agents
In `@ui-v2/tsconfig.app.json` at line 19, The tsconfig change turned off
TypeScript strict mode by setting the "strict" compiler flag to false, which
weakens type safety; revert "strict" back to true in the tsconfig and fix the
resulting type errors in the new trigger field components instead of relaxing
compiler checks globally—locate uses of the "strict" flag and the new trigger
field components (the recently added TriggerField* components) and address
missing/any types, nullable checks, and incorrect function signatures (e.g., add
precise types, use optional chaining, tighten return types) so the codebase
compiles under strict mode.

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.

1 participant