Skip to content

Conversation

@WashizuRyo
Copy link
Member

@WashizuRyo WashizuRyo commented Oct 17, 2025

User description

Summary

This PR enables editing of callsign and labels after configuring a GitHub trigger, along with refactoring the trigger configuration logic.

Changes

Features

  • Enable reconfiguration of callsign and labels: Added "Change Callsign" and "Change Labels" buttons to the configured GitHub trigger view, allowing users to modify these settings after initial configuration
  • Persistent state during configuration: Callsign and labels are now preserved when navigating between configuration steps, improving user experience during setup
  • Enhanced validation: Added proper validation with clear error messages for callsign and labels inputs (must contain at least one non-space character)
  • Improved reconfiguration flow: When reconfiguring callsign or labels, users can now directly edit these values without going through unnecessary steps

Refactoring

  • Extracted useConfigureTrigger hook (use-configure-trigger.ts): Centralized trigger configuration logic that was previously embedded in the component, making it reusable and testable
  • Created resolveNextStep utility (resolve-next-step.ts): Separated step navigation logic from the component, implementing a clear state machine for the configuration flow
  • Enhanced type safety in trigger-configuration.ts:
    • Added type guards (hasCallsignCondition, hasLabelsCondition, isTriggerRequiringCallsign, isTriggerRequiringLabels)
    • Added utility functions (extractCallsign, extractLabels) for safe access to event conditions
    • Improved type definitions with CallsignRequiredEventId and LabelsRequiredEventId union types
  • Simplified component logic: Reduced github-trigger-properties-panel.tsx from complex embedded logic to cleaner, more maintainable code by extracting business logic

Testing

Manual Testing Steps

  1. Configure a new GitHub trigger with callsign:

    • Create a new trigger with "Issue Comment Created" event
    • Enter a callsign and verify it's saved correctly
    • Verify validation error appears when submitting empty callsign
  2. Configure a new GitHub trigger with labels:

    • Create a new trigger with "Issue Labeled" event
    • Add multiple labels and verify they're saved correctly
    • Verify validation error appears when all labels are empty
  3. Reconfigure callsign:

    • Click "Change Callsign" button on a configured trigger
    • Verify current callsign is pre-filled
    • Change to a new callsign and verify update succeeds
    • Verify "Back" button is hidden during reconfiguration
  4. Reconfigure labels:

    • Click "Change Labels" button on a configured trigger
    • Verify current labels are pre-filled
    • Modify labels and verify update succeeds
    • Verify "Back" button is hidden during reconfiguration
  5. Reconfigure repository:

    • Click "Change Repository" button
    • Verify previously configured callsign/labels are preserved if you navigate back through the flow

Other Information


PR Type

Enhancement


Description

  • Extracted trigger configuration logic into reusable useConfigureTrigger hook and resolveNextStep utility for better maintainability

  • Added reconfiguration support for callsign and labels with "Change Callsign" and "Change Labels" buttons in configured view

  • Implemented persistent state preservation for callsign and labels during configuration flow navigation

  • Enhanced validation with improved error messages for empty callsign and labels inputs

  • Added type guards and utility functions for safe access to event conditions


Diagram Walkthrough

flowchart LR
  A["GitHub Trigger Configuration"] -->|Extract Logic| B["useConfigureTrigger Hook"]
  A -->|Step Navigation| C["resolveNextStep Utility"]
  B -->|Configure/Reconfigure| D["Trigger Event"]
  C -->|State Machine| E["Setup Steps"]
  E -->|Callsign/Labels| F["Reconfiguring View"]
  F -->|Change Callsign| G["Input Callsign Step"]
  F -->|Change Labels| H["Input Labels Step"]
  G -->|Submit| D
  H -->|Submit| D
Loading

File Walkthrough

Relevant files
Enhancement
10 files
resolve-next-step.ts
New step resolution utility for trigger configuration flow
+182/-0 
trigger-configuration.ts
Added type guards and utility functions for conditions     
+109/-13
use-configure-trigger.ts
New hook for executing trigger configuration operations   
+114/-0 
index.ts
Added GitHubFlowTriggerEvent parameter to reconfiguration
+2/-0     
reconfigure-github-trigger.ts
Support optional event parameter for trigger reconfiguration
+3/-1     
router.ts
Added optional event field to reconfiguration request schema
+2/-0     
labels-input-step.tsx
Added initial labels support and improved error handling 
+44/-23 
github-trigger-configured-view.tsx
Added Change Callsign and Change Labels buttons with type guards
+84/-56 
github-trigger-reconfiguring-view.tsx
Enhanced to support mode-specific reconfiguration steps   
+52/-3   
select-repository.tsx
Added initial installation ID support for state preservation
+3/-1     
Refactoring
2 files
use-trigger-configuration.ts
Removed in favor of new useConfigureTrigger hook                 
+0/-93   
github-trigger-properties-panel.tsx
Refactored to use new hooks and utilities with simplified logic
+133/-295

Summary by CodeRabbit

  • New Features
    • Enhanced GitHub trigger configuration with a streamlined multi-step setup flow.
    • Added ability to configure and reconfigure callsign and labels for specific GitHub trigger events.
    • Introduced selective reconfiguration options—users can now change repository, callsign, or labels independently without re-entering all settings.
    • Improved validation and error messaging for required trigger fields.
    • Added loading indicators during trigger configuration.

@WashizuRyo WashizuRyo self-assigned this Oct 17, 2025
@changeset-bot
Copy link

changeset-bot bot commented Oct 17, 2025

⚠️ No Changeset found

Latest commit: 886d9c6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

💥 An error occurred when fetching the changed packages and changesets in this PR
Some errors occurred when validating the changesets config:
The package or glob expression "giselle-sdk" is specified in the `ignore` option but it is not found in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch.

@vercel
Copy link

vercel bot commented Oct 17, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
giselle Ready Ready Preview Comment Oct 17, 2025 6:37am
ui Ready Ready Preview Comment Oct 17, 2025 6:37am

@giselles-ai
Copy link

giselles-ai bot commented Oct 17, 2025

Finished running flow.

Step Status Updated(UTC)
1 Oct 17, 2025 6:35am
2 Oct 17, 2025 6:38am
3 Oct 17, 2025 6:42am
4 Oct 17, 2025 6:42am

@WashizuRyo WashizuRyo changed the title Feat/change callsign feat: Add reconfiguration support for GitHub trigger callsign and labels Oct 17, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 17, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

A GitHub trigger setup flow refactoring that introduces multi-step reconfiguration, replaces per-step submission handlers with unified state machine logic via resolveNextStep, adds support for optional callsign and labels conditions, and extends the engine's reconfiguration API to accept trigger event data.

Changes

Cohort / File(s) Summary
LabelsInputStep component enhancements
internal-packages/workflow-designer-ui/.../labels-input-step.tsx
Added initialLabels, errorMessage, and showBackButton props; supports error display, loading state on submit button, and conditional Back button visibility
GitHub trigger main panel refactor
internal-packages/workflow-designer-ui/.../github-trigger-properties-panel.tsx
Replaced per-step handlers with unified handleSubmit and resolveNextStep flow; added reconfiguration mode tracking; imported utility types and step progression logic; extended child component props with initial/persisted state
Step progression orchestration
internal-packages/workflow-designer-ui/.../resolve-next-step.ts
New utility module defining GitHubTriggerSetupStep union type, RepositoryInfo interface, and resolveNextStep function to determine next step or submission state
Trigger configuration utilities
internal-packages/workflow-designer-ui/.../trigger-configuration.ts
Added type guards (hasCallsignCondition, hasLabelsCondition), extractors (extractCallsign, extractLabels), and exported predicates (isTriggerRequiringCallsign, isTriggerRequiringLabels, generateTriggerOutputs)
Trigger configuration hooks
internal-packages/workflow-designer-ui/.../use-configure-trigger.ts
New hook replacing useTriggerConfiguration; implements configuration vs. reconfiguration logic with configureTrigger function and isPending state
Trigger configuration hook removal
internal-packages/workflow-designer-ui/.../use-trigger-configuration.ts
Removed entire hook implementation (functionality migrated to use-configure-trigger.ts)
Configured trigger view reconfiguration
internal-packages/workflow-designer-ui/.../github-trigger-configured-view.tsx
Exported GitHubTriggerReconfigureMode type; added onStartReconfigure callback prop; introduced Change buttons for repository, callsign, and labels; replaced event-id conditionals with hasCallsignCondition/hasLabelsCondition checks
Reconfiguring trigger view dynamic flow
internal-packages/workflow-designer-ui/.../github-trigger-reconfiguring-view.tsx
Added optional reconfigureMode prop; derives dynamic reconfigStep based on mode and persisted callsign/labels data
Repository selection initialization
internal-packages/workflow-designer-ui/.../select-repository.tsx
Added optional initialInstallationId prop to initialize selected installation state
Engine reconfiguration API extension
packages/giselle/src/engine/index.ts
Imported GitHubFlowTriggerEvent; extended reconfigureGitHubTrigger signature with optional event parameter
Reconfigure trigger implementation
packages/giselle/src/engine/triggers/reconfigure-github-trigger.ts
Added optional event parameter; updated trigger message to use provided event or fall back to existing
HTTP router validation
packages/giselle/src/http/router.ts
Added optional event: GitHubFlowTriggerEvent field to reconfigureGitHubTrigger input schema

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GitHubTriggerPropertiesPanel
    participant resolveNextStep
    participant useConfigureTrigger
    participant GiselleEngine

    User->>GitHubTriggerPropertiesPanel: Submit step (e.g., select repository)
    GitHubTriggerPropertiesPanel->>GitHubTriggerPropertiesPanel: handleSubmit()
    GitHubTriggerPropertiesPanel->>resolveNextStep: resolveNextStep(currentStep, eventId, submissionData, nodeStatus)
    alt More steps required
        resolveNextStep-->>GitHubTriggerPropertiesPanel: { continue: nextStep }
        GitHubTriggerPropertiesPanel->>GitHubTriggerPropertiesPanel: Update UI to show next step
    else Ready to submit
        resolveNextStep-->>GitHubTriggerPropertiesPanel: { submit: { event, repositoryInfo } }
        GitHubTriggerPropertiesPanel->>useConfigureTrigger: configureTrigger(event, repositoryInfo, flowTriggerId?)
        useConfigureTrigger->>GiselleEngine: configureTrigger() or reconfigureGitHubTrigger()
        GiselleEngine-->>useConfigureTrigger: { triggerId }
        useConfigureTrigger->>GitHubTriggerPropertiesPanel: Update node data (status: "configured")
        GitHubTriggerPropertiesPanel->>User: Show configured view
    end
Loading
sequenceDiagram
    participant User
    participant GitHubTriggerConfiguredView
    participant GitHubTriggerReconfiguringView
    participant GitHubTriggerPropertiesPanel

    User->>GitHubTriggerConfiguredView: Click "Change Labels"
    GitHubTriggerConfiguredView->>GitHubTriggerConfiguredView: beginReconfigure("labels")
    GitHubTriggerConfiguredView->>GitHubTriggerPropertiesPanel: onStartReconfigure("labels")
    GitHubTriggerPropertiesPanel->>GitHubTriggerPropertiesPanel: Set reconfigureModeRef = "labels"
    GitHubTriggerPropertiesPanel->>GitHubTriggerReconfiguringView: Pass reconfigureMode="labels"
    GitHubTriggerReconfiguringView->>GitHubTriggerReconfiguringView: Derive reconfigStep for input-labels
    GitHubTriggerReconfiguringView->>User: Show labels input with persisted data
    User->>User: Submit new labels
    GitHubTriggerReconfiguringView->>GitHubTriggerPropertiesPanel: handleSubmit()
    GitHubTriggerPropertiesPanel->>GitHubTriggerPropertiesPanel: reconfigureGitHubTrigger(flowTriggerId, repositoryInfo, newLabelsEvent)
    GitHubTriggerPropertiesPanel->>User: Return to configured view
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Rationale: The PR introduces a substantial refactor of the GitHub trigger setup flow with a new state machine driven by resolveNextStep, replaces per-step submission handlers with unified logic, adds reconfiguration modes, and extends the engine API. While individual files contain clear changes, the interdependencies across components, hooks, and backend logic, combined with new step progression patterns and reconfiguration flow, require careful verification of state transitions and data threading through multiple layers.

Possibly related PRs

Suggested labels

codex, Review effort 4/5

Suggested reviewers

  • shige
  • toyamarinyon

Poem

🐰 Hops through steps with graceful care,
Labels, callsigns float through air,
Reconfiguring as we go,
State machines steal the show!
Flow so smooth, refactored bright,
Workflow triggers, pure delight!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title "feat: Add reconfiguration support for GitHub trigger callsign and labels" clearly and concisely summarizes the primary feature being introduced. It directly aligns with the main changes, which enable users to reconfigure (change) callsign and labels after a GitHub trigger has been configured. The title is specific enough that a teammate scanning the commit history would immediately understand the feature being added, and it avoids vague language or misleading descriptions.
Description Check ✅ Passed The pull request description is comprehensive and mostly complete according to the template. It includes a clear Summary explaining the purpose, detailed Changes organized into Features and Refactoring sections with multiple bullet points, thorough Manual Testing Steps covering various scenarios, and substantial Other Information with PR type, description, and diagrams. The description provides significant value for reviewers and context for the changeset. The Related Issue section is not filled out, but it is marked as optional ("if applicable") in the template, and all critical sections are well-documented.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ 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 feat/change-callsign

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.

@WashizuRyo
Copy link
Member Author

@codex review

@WashizuRyo WashizuRyo marked this pull request as ready for review October 17, 2025 06:40
@WashizuRyo WashizuRyo requested a review from shige as a code owner October 17, 2025 06:40
Copilot AI review requested due to automatic review settings October 17, 2025 06:40
@giselles-ai
Copy link

giselles-ai bot commented Oct 17, 2025

Finished running flow.

Step Status Updated(UTC)
1 Oct 17, 2025 6:40am
2 Oct 17, 2025 6:44am
3 Oct 17, 2025 6:47am
4 Oct 17, 2025 6:47am

@qodo-merge-for-open-source
Copy link

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
- [ ] Create ticket/issue <!-- /create_ticket --create_ticket=true -->

</details></td></tr>
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
No custom compliance provided

Follow the guide to enable custom compliance check.

Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds the ability to reconfigure callsign and labels for GitHub triggers after initial setup, alongside significant refactoring to improve code organization and maintainability. The changes centralize configuration logic, introduce type-safe utilities for event condition handling, and enhance the user experience with better state persistence and validation.

Key Changes

  • Added "Change Callsign" and "Change Labels" buttons to the configured view, enabling direct editing of these settings
  • Refactored trigger configuration logic into reusable hooks and utilities with enhanced type safety
  • Improved state persistence across configuration steps for a smoother user experience

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/giselle/src/http/router.ts Added optional event parameter to reconfiguration endpoint
packages/giselle/src/engine/triggers/reconfigure-github-trigger.ts Updated to support event reconfiguration
packages/giselle/src/engine/index.ts Added optional event parameter to engine reconfiguration method
internal-packages/workflow-designer-ui/src/editor/properties-panel/ui/select-repository.tsx Added initial installation ID support for pre-selecting organization
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/reconfiguring-views/github-trigger-reconfiguring-view.tsx Implemented reconfiguration mode routing with persisted values
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/configured-views/github-trigger-configured-view.tsx Added Change Callsign and Change Labels buttons with reconfiguration handlers
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/use-trigger-configuration.ts Removed deprecated hook (replaced by use-configure-trigger.ts)
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/use-configure-trigger.ts New centralized hook for both initial configuration and reconfiguration
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/trigger-configuration.ts Added type guards, extractors, and helper utilities for event conditions
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/resolve-next-step.ts New state machine for managing configuration step navigation
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx Simplified component by extracting business logic to utilities and hooks
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/components/labels-input-step.tsx Enhanced with initial values support and improved error handling

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

label: getGitHubDisplayLabel({ eventId, accessor: key }),
accessor: key,
});
} satisfies Output);
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

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

[nitpick] The satisfies Output annotation is redundant here. The object already conforms to the Output type from the function signature, and this doesn't add type safety or clarity. Consider removing it for cleaner code.

Suggested change
} satisfies Output);
});

Copilot uses AI. Check for mistakes.
: "border border-white-400 focus:border-border",
"text-[14px] bg-transparent",
)}
required={true}
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

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

The required={true} attribute is unnecessary since true is the default value when the attribute is present. Use required instead for cleaner JSX.

Suggested change
required={true}
required

Copilot uses AI. Check for mistakes.
"text-[14px] bg-transparent",
)}
defaultValue={step.callsign ?? ""}
required={true}
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

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

The required={true} attribute is unnecessary since true is the default value when the attribute is present. Use required instead for cleaner JSX.

Suggested change
required={true}
required

Copilot uses AI. Check for mistakes.
@WashizuRyo WashizuRyo marked this pull request as draft October 17, 2025 06:41
: "border border-white-400 focus:border-border",
"text-[14px] bg-transparent",
)}
required={true}
Copy link

Choose a reason for hiding this comment

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

Bug: HTML5 Validation Conflicts with Custom Logic

The required={true} attribute on label inputs conflicts with the custom validation. The browser's HTML5 validation prevents form submission if any label input is empty, even though the custom logic allows this as long as one label has a value. This blocks users from submitting valid forms.

Fix in Cursor Fix in Web

@qodo-merge-for-open-source
Copy link

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Fix reconfiguration starting step logic

Fix the logic for determining the initial reconfiguration step by removing the
checks for persistedCallsign and persistedLabels. This ensures the UI navigates
to the correct input step based on reconfigureMode, even if a value was not
previously set.

internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/reconfiguring-views/github-trigger-reconfiguring-view.tsx [51-83]

 	const reconfigStep: GitHubTriggerSetupStep = (() => {
-		if (
-			reconfigureMode === "callsign" &&
-			isTriggerRequiringCallsign(event.id) &&
-			persistedCallsign
-		) {
+		if (reconfigureMode === "callsign" && isTriggerRequiringCallsign(event.id)) {
 			return {
 				state: "input-callsign",
 				eventId: event.id,
 				...repositoryInfo,
 				callsign: persistedCallsign,
 			};
 		}
-		if (
-			reconfigureMode === "labels" &&
-			isTriggerRequiringLabels(event.id) &&
-			persistedLabels
-		) {
+		if (reconfigureMode === "labels" && isTriggerRequiringLabels(event.id)) {
 			return {
 				state: "input-labels",
 				eventId: event.id,
 				...repositoryInfo,
 				labels: persistedLabels,
 			};
 		}
 		return {
 			state: "select-repository",
 			eventId: event.id,
 			callsign: persistedCallsign,
 			labels: persistedLabels,
 			installationId: repositoryInfo.installationId,
 		};
 	})();

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies a logic flaw where the reconfiguration flow would not start at the correct step if a value for callsign or labels was not already persisted. Removing the checks for persistedCallsign and persistedLabels fixes this bug and ensures the UI behaves as intended.

Medium
Remove unnecessary required attribute

Remove the required={true} attribute from the label input field. This prevents a
conflict with custom validation logic that should allow submitting the form with
some empty label inputs, as long as at least one is valid.

internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/components/labels-input-step.tsx [88-96]

 								className={clsx(
 									"flex-1 rounded-[8px] py-[8px] px-[12px] outline-none focus:outline-none text-[14px] bg-transparent",
 									errorMessage !== undefined
 										? "border border-[#FF3D71] focus:border-[#FF3D71]"
 										: "border border-white-400 focus:border-border",
 								)}
-								required={true}
 								placeholder="bug"
 							/>
  • Apply / Chat
Suggestion importance[1-10]: 6

__

Why: The suggestion correctly identifies that the required attribute on the label input conflicts with the custom validation logic, which allows for empty label fields as long as at least one valid label is provided. Removing it fixes this UI behavior bug.

Low
High-level
Refactor state machine for better separation

Refactor the resolveNextStep function by separating its responsibilities. Create
one function for handling UI step transitions and another for creating the final
submission payload.

Examples:

internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/resolve-next-step.ts [90-182]
export function resolveNextStep({
	currentStep,
	eventId,
	submissionData,
	nodeStatus,
}: resolveNextStepProps): StepAction {
	switch (currentStep.state) {
		case "confirm-repository": {
			const repositoryInfo = {
				installationId: currentStep.installationId,

 ... (clipped 83 lines)
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx [121-145]
	const handleSubmit = useCallback(
		(data?: { callsign?: string; labels?: string[] }) => {
			try {
				const action = resolveNextStep({
					currentStep: step,
					eventId,
					submissionData: data ?? {},
					nodeStatus: node.content.state.status,
				});


 ... (clipped 15 lines)

Solution Walkthrough:

Before:

// resolve-next-step.ts
function resolveNextStep(props): StepAction {
  switch (currentStep.state) {
    case "confirm-repository":
      if (requiresMoreSteps) {
        return { type: "continue", nextStep: ... };
      }
      return {
        type: "submit",
        event: createTriggerEvent(...), // Creates payload
        repositoryInfo: ...
      };
    case "input-callsign":
      return {
        type: "submit",
        event: createTriggerEvent(...), // Creates payload
        repositoryInfo: ...
      };
    // ...
  }
}

After:

// resolve-next-step.ts
function getNextStep(props): NextStep | 'submit' {
  switch (currentStep.state) {
    case "confirm-repository":
      if (requiresMoreSteps) {
        return { state: "input-callsign", ... };
      }
      return 'submit';
    // ...
  }
}

// trigger-configuration.ts
function createSubmissionPayload(props): { event, repositoryInfo } {
  // Logic to build the final event and repository info
  // based on the current wizard state.
  return { event: ..., repositoryInfo: ... };
}
Suggestion importance[1-10]: 6

__

Why: The suggestion correctly identifies that the new resolveNextStep function has dual responsibilities, and proposing a split would align well with the PR's goal of improving code structure and separation of concerns.

Low
Learned
best practice
Replace noisy console error

Remove console.error and provide a minimal user-visible fallback (tooltip state)
while optionally using a debug logger if available.

internal-packages/workflow-designer-ui/src/ui/clipboard-button.tsx [23-31]

 const handleClick = useCallback(async () => {
 	try {
 		await navigator.clipboard.writeText(text);
 		setIsCopied(true);
-		setTimeout(() => setIsCopied(false), 2000); // Reset after 2 seconds
-	} catch (err) {
-		console.error("Failed to copy text: ", err);
+		setTimeout(() => setIsCopied(false), 2000);
+	} catch (_err) {
+		// Silently fail but inform user via tooltip state
+		setIsCopied(false);
 	}
 }, [text]);

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 5

__

Why:
Relevant best practice - Pattern 5: Avoid noisy logs; prefer structured, user-facing errors and avoid console.error in UI components.

Low
  • More

@giselles-ai
Copy link

giselles-ai bot commented Oct 17, 2025

## 🔍 QA Testing Assistant by Giselle

### 📋 Manual QA Checklist

Based on the changes in this PR, here are the key areas to test manually:

  • Configure a trigger requiring a Callsign:

    1. Create a new GitHub Trigger node.
    2. Select the "Issue Comment Created" event.
    3. Select a repository and confirm it.
    4. On the "Input callsign" step, enter a valid callsign (e.g., /deploy).
    5. Click "Set Up".
    6. Verify: The trigger is successfully configured and the "Configured" view displays the correct event, repository, and callsign (e.g., /deploy).
  • Configure a trigger requiring Labels:

    1. Create a new GitHub Trigger node.
    2. Select the "Issue Labeled" event.
    3. Select a repository and confirm it.
    4. On the "Input labels" step, add at least two valid labels (e.g., bug, priority-high).
    5. Click "Set Up".
    6. Verify: The trigger is successfully configured and the "Configured" view displays the correct event, repository, and all entered labels.
  • State Persistence during setup:

    1. Create a new GitHub Trigger node and select the "Issue Labeled" event.
    2. Select a repository and confirm it. You should now be on the "Input labels" step.
    3. Enter a label (e.g., test-label) but do not submit.
    4. Click the "Back" button to return to the "Confirm Repository" step.
    5. Click the "Next" button again to go back to the "Input labels" step.
    6. Verify: The label you entered (test-label) is still present in the input field.
  • Change an existing Callsign:

    1. Using the trigger configured in the first test ("Issue Comment Created"), locate the "Call sign" section.
    2. Click the "Change Callsign" button.
    3. Verify: You are taken directly to the callsign input screen.
    4. Verify: The input field is pre-filled with the existing callsign (/deploy).
    5. Verify: The "Back" button is not visible on this screen.
    6. Change the callsign to something new (e.g., /run-checks) and click "Set Up".
    7. Verify: The panel returns to the "Configured" view and now displays the new callsign (/run-checks).
  • Change existing Labels:

    1. Using the trigger configured with labels ("Issue Labeled"), locate the "Labels" section.
    2. Click the "Change Labels" button.
    3. Verify: You are taken directly to the labels input screen.
    4. Verify: The input fields are pre-filled with the existing labels (bug, priority-high).
    5. Verify: The "Back" button is not visible on this screen.
    6. Modify the labels: edit one, remove one, and add a new one (e.g., change bug to defect, remove priority-high, add needs-review).
    7. Click "Set Up".
    8. Verify: The panel returns to the "Configured" view and displays the updated set of labels.
  • Regression: Change Repository with existing Callsign:

    1. Start with a configured "Issue Comment Created" trigger (which has a callsign).
    2. Click the "Change Repository" button.
    3. You are now in the reconfiguration flow starting at repository selection. Click "Back" to go to the "Event selection" step.
    4. Change nothing, and proceed forward again by selecting the same event and repository.
    5. You should land on the "Input callsign" step.
    6. Verify: The callsign input field is pre-filled with the original callsign, demonstrating that state was preserved throughout the repository change flow.
  • Invalid Callsign on Setup:

    1. In the "Input callsign" step during a new trigger setup:
    2. Attempt to click "Set Up" with the callsign field empty.
    3. Verify: An error message "Enter a callsign using at least one non-space character." appears, and the setup is blocked.
    4. Enter only spaces into the field and click "Set Up".
    5. Verify: The same error message appears, and the setup is blocked.
  • Invalid Labels on Setup:

    1. In the "Input labels" step during a new trigger setup:
    2. Attempt to click "Set Up" with the default empty label field.
    3. Verify: An error message "Add at least one label using non-space characters." appears, and the setup is blocked.
    4. Add a second label field, leave both empty, and click "Set Up".
    5. Verify: The same error message appears.
    6. Enter only spaces into one label field and leave the other empty, then click "Set Up".
    7. Verify: The same error message appears.
  • Invalid Labels on Reconfiguration:

    1. On a configured "Issue Labeled" trigger, click "Change Labels".
    2. Delete all existing labels from the input fields.
    3. Click "Set Up".
    4. Verify: An error message "Add at least one label using non-space characters." appears, and the change is blocked.

### ✨ Prompt for AI Agents

Use the following prompts with Cursor or Claude Code to automate E2E testing:

📝 E2E Test Generation Prompt
## Prompt for AI Agent: Generate Playwright E2E Tests for GitHub Trigger Reconfiguration

You are an expert QA engineer specializing in automated E2E testing with Playwright. Your task is to generate a comprehensive suite of E2E tests for a new feature that allows users to reconfigure a GitHub trigger's callsign and labels after its initial setup.

Use the provided context, test scenarios, and implementation details to write robust, maintainable, and CI-ready test code using Playwright.

### 1. Context Summary

*   **PR Functionality:** This PR introduces the ability for users to edit the "callsign" and "labels" of an already configured GitHub workflow trigger. It also refactors the entire trigger configuration logic into a more robust state machine and a dedicated `useConfigureTrigger` hook.
*   **Key User Flows Affected:**
    1.  **Initial Configuration:** The multi-step wizard for setting up a new GitHub trigger. State (callsign/labels) is now preserved when navigating between steps.
    2.  **Post-Configuration (New Flow):** A user can now view a configured trigger and click a "Change Callsign" or "Change Labels" button to modify these specific properties.
*   **Critical Paths to Test:**
    *   The complete end-to-end flow of configuring a new trigger that requires a callsign (e.g., "Issue Comment Created").
    *   The complete end-to-end flow of configuring a new trigger that requires labels (e.g., "Issue Labeled").
    *   The new reconfiguration flow for changing an existing callsign.
    *   The new reconfiguration flow for changing existing labels.
    *   Regression testing the repository change flow to ensure it preserves other settings.

### 2. Test Scenarios

Create E2E tests covering the following scenarios. Group them logically using `test.describe()`.

#### `describe('GitHub Trigger: Initial Configuration')`

*   **Test 1: Happy Path - Configure a trigger with a callsign.**
    1.  Start with an unconfigured GitHub trigger node.
    2.  Select the "Issue Comment Created" event.
    3.  Select a repository.
    4.  On the "Confirm Repository" step, click "Next".
    5.  On the "Input Callsign" step, enter a valid callsign (e.g., `/deploy`).
    6.  Click "Set Up".
    7.  **Assert:** The trigger properties panel now shows the configured view with the correct event, repository, and the callsign `"/deploy"`.

*   **Test 2: Happy Path - Configure a trigger with labels.**
    1.  Start with an unconfigured GitHub trigger node.
    2.  Select the "Issue Labeled" event.
    3.  Select a repository.
    4.  On the "Confirm Repository" step, click "Next".
    5.  On the "Input Labels" step, add two valid labels (e.g., "bug", "p0").
    6.  Click "Set Up".
    7.  **Assert:** The trigger properties panel shows the configured view with the labels "bug" and "p0" displayed.

*   **Test 3: Validation - Empty callsign submission.**
    1.  Follow steps 1-4 from Test 1.
    2.  On the "Input Callsign" step, leave the input blank and click "Set Up".
    3.  **Assert:** An error message is displayed (e.g., "Enter a callsign using at least one non-space character.").
    4.  **Assert:** The view remains on the callsign input step.
    5.  Enter a callsign with only spaces and click "Set Up".
    6.  **Assert:** The same error message is displayed.

*   **Test 4: Validation - Empty labels submission.**
    1.  Follow steps 1-4 from Test 2.
    2.  On the "Input Labels" step, leave the default input blank and click "Set Up".
    3.  **Assert:** An error message is displayed (e.g., "Add at least one label using non-space characters.").
    4.  **Assert:** The view remains on the labels input step.

*   **Test 5: UX - State is preserved when navigating back.**
    1.  Start configuring a trigger with the "Issue Comment Created" event.
    2.  Select a repository and proceed to the callsign input step.
    3.  Enter a callsign (e.g., `/test-state`).
    4.  Click the "Back" button to return to the repository confirmation step.
    5.  Click the "Next" button again to go back to the callsign input step.
    6.  **Assert:** The callsign input field is pre-filled with `/test-state`.

#### `describe('GitHub Trigger: Reconfiguration')`

*(For these tests, you must set up a `beforeEach` hook to mock the API and render a pre-configured trigger node.)*

*   **Test 6: Happy Path - Change an existing callsign.**
    1.  Start with a trigger configured with the "Issue Comment Created" event and a callsign of `"/review"`.
    2.  **Assert:** The configured view shows the callsign `"/review"`.
    3.  Click the "Change Callsign" button.
    4.  **Assert:** The view switches to the callsign input form.
    5.  **Assert:** The input field is pre-filled with `review`.
    6.  **Assert:** The "Back" button is **not** visible.
    7.  Change the callsign to `"/re-review"`.
    8.  Click "Set Up".
    9.  **Assert:** The view returns to the configured state, now showing the callsign `"/re-review"`.

*   **Test 7: Happy Path - Change existing labels (add, remove, edit).**
    1.  Start with a trigger configured with the "Issue Labeled" event and labels ["bug", "critical"].
    2.  Click the "Change Labels" button.
    3.  **Assert:** The view switches to the labels input form with two inputs pre-filled with "bug" and "critical".
    4.  **Assert:** The "Back" button is **not** visible.
    5.  Modify the "critical" label to "p0-urgent".
    6.  Click "Add another label" and add a new label "backend".
    7.  Remove the "bug" label by clicking its "X" button.
    8.  Click "Set Up".
    9.  **Assert:** The view returns to the configured state, now showing the labels "p0-urgent" and "backend".

*   **Test 8: Regression - Change repository preserves other settings.**
    1.  Start with a trigger configured for "Issue Comment Created", a specific repository, and a callsign of `"/test-callsign"`.
    2.  Click the "Change Repository" button.
    3.  Select a *different* repository.
    4.  Click "Next".
    5.  **Assert:** The UI does **not** ask for a callsign again (it should be preserved in the state and submitted directly).
    6.  **Assert:** The trigger is successfully reconfigured with the new repository.
    7.  **Assert:** The configured view shows the new repository and the *original* callsign `"/test-callsign"`.

### 3. Playwright Implementation Instructions

*   **Setup:** Use `test.beforeEach` to navigate to the workflow editor page and select the trigger node to open its properties panel. For reconfiguration tests, mock the necessary API calls (`useGitHubTrigger`, `useGiselleEngine`) to render the node in an already "configured" state.

*   **Selectors:** Use robust, user-facing selectors.
    *   **Buttons:** `page.getByRole('button', { name: 'Set Up' })`, `page.getByRole('button', { name: 'Change Callsign' })`, `page.getByRole('button', { name: 'Add another label' })`
    *   **Inputs:**
        *   Callsign: `page.getByPlaceholder('code-review')`
        *   Labels: `page.getByPlaceholder('bug')`
    *   **Configured Data:**
        *   Callsign text: `page.getByText('/review', { exact: true })`
        *   Label pills: `page.getByText('bug', { exact: true })` inside a specific container.
    *   **Error Messages:** `page.getByRole('alert')` or `page.getByText('Enter a callsign...')`
    *   **Event Selection:** `page.getByText('Issue Comment Created')` to select an event type.
    *   **Repository Selection:** Use text or role selectors to find and click repository names in the list.

*   **User Interactions:**
    *   `await selector.click();` for all button clicks and selections.
    *   `await selector.fill('new-value');` for text inputs.
    *   `await selector.clear();` before filling if needed.

*   **Assertions:**
    *   **Visibility:** `await expect(selector).toBeVisible();`, `await expect(selector).not.toBeVisible();`
    *   **Text Content:** `await expect(selector).toHaveText('...');`, `await expect(selector).toContainText('...');`
    *   **Input Value:** `await expect(selector).toHaveValue('pre-filled-value');`
    *   **Mocking:** Use Playwright's [network mocking](https://playwright.dev/docs/mock) capabilities to intercept `fetch` requests and provide stubbed data for the trigger's initial state. This is critical for testing the "reconfiguration" flows reliably.

    ```typescript
    // Example: Mocking the initial state for a reconfiguration test
    await page.route('**/api/get-github-trigger-details/**', async route => {
      const json = {
        // ... a complete mock of the API response for a configured trigger
        trigger: {
          configuration: {
            event: { id: 'github.issue_comment.created', conditions: { callsign: 'review' } },
            // ... other properties
          }
        },
        // ...
      };
      await route.fulfill({ json });
    });
    ```

### 4. MCP Integration Guidelines (Optional)

*   **Command Structure:** Structure commands to run specific test files or tests with specific tags.
    ```bash
    # Run all tests in the new file
    mcp playwright:test -- --spec 'tests/github-trigger-reconfiguration.spec.ts'

    # Run tests with a specific tag (if you add them)
    mcp playwright:test -- --grep @reconfiguration
    ```
*   **Environment:** Ensure the `.env` file for Playwright is configured with the base URL of the application. No other special environment configuration should be needed if API mocking is used correctly.

### 5. CI-Ready Code Requirements

*   **Test Organization:**
    *   Create a new test file: `tests/e2e/github-trigger-configuration.spec.ts`.
    *   Use `test.describe('Group Name', () => { ... })` to group related tests as specified in the "Test Scenarios" section.
    *   Use `test.beforeEach` and `test.afterEach` for setup and teardown to ensure tests are isolated and independent.
*   **Naming Conventions:**
    *   Test names should be descriptive and reflect the user action being tested (e.g., `test('should display an error when submitting an empty callsign', ...)`)
*   **Error Handling:** Use clear and specific `expect` assertions. Playwright will handle test failures and reporting. Add comments to explain complex assertions or setup steps.
*   **Parallelization:** Write tests to be fully independent. Do not rely on the state from a previous test. This allows Playwright to run them in parallel, speeding up CI execution. API mocking within `beforeEach` is the key to achieving this.


@giselles-ai
Copy link

giselles-ai bot commented Oct 17, 2025

## 🔍 QA Testing Assistant by Giselle

### 📋 Manual QA Checklist

Based on the changes in this PR, here are the key areas to test manually:

  • UI/UX - Callsign Reconfiguration: After configuring a GitHub trigger that requires a callsign (e.g., "Issue Comment Created"), verify that the "Change Callsign" button is present and that clicking it leads directly to the callsign input screen with the existing callsign pre-filled. Ensure the "Back" button is not visible on this screen.
  • UI/UX - Labels Reconfiguration: After configuring a GitHub trigger that requires labels (e.g., "Issue Labeled"), verify that the "Change Labels" button is present and that clicking it leads directly to the labels input screen with the existing labels pre-filled. Ensure the "Back" button is not visible on this screen.
  • Functionality - Repository Reconfiguration: Configure a trigger with a callsign, then click "Change Repository". Select a different repository and complete the setup. Verify that the trigger now points to the new repository but retains the original callsign.
  • UI/UX - State Preservation (Callsign): Begin configuring a new trigger for "Issue Comment Created", enter a callsign, navigate back to a previous step, and then forward again to the callsign input step. Verify that the previously entered callsign is still present in the input field.
  • UI/UX - State Preservation (Labels): Begin configuring a new trigger for "Issue Labeled", add some labels, navigate back to a previous step, and then forward again to the labels input step. Verify that the previously entered labels are still present in the input fields.
  • Validation - Callsign Empty: On the callsign input screen (new or reconfigure), attempt to submit with an empty field or only spaces. Verify that an appropriate error message is displayed and submission is prevented.
  • Validation - Labels Empty: On the labels input screen (new or reconfigure), attempt to submit with no labels entered or only spaces in the label fields. Verify that an appropriate error message is displayed and submission is prevented.

### ✨ Prompt for AI Agents

Use the following prompts with Cursor or Claude Code to automate E2E testing:

📝 E2E Test Generation Prompt
You are an expert QA engineer specializing in automated E2E testing with Playwright. Your task is to generate a comprehensive suite of E2E tests for the new functionality introduced in a Pull Request.

The PR enables users to reconfigure the `callsign` and `labels` of an already configured GitHub trigger. It also refactors the entire trigger configuration flow to be more robust and maintainable.

Please generate Playwright test code in TypeScript based on the following detailed instructions.

---

### **1. Context Summary**

*   **PR Goal:** To allow users to edit the `callsign` and `labels` for a GitHub trigger after its initial setup and to refactor the configuration UI logic.
*   **Key User Flows Affected:**
    1.  **Initial Configuration:** Setting up a new GitHub trigger from scratch (for events requiring callsigns, labels, or neither).
    2.  **Callsign Reconfiguration:** Editing the callsign for an existing trigger (e.g., for "Issue Comment Created").
    3.  **Labels Reconfiguration:** Editing the labels for an existing trigger (e.g., for "Issue Labeled").
    4.  **Repository Reconfiguration:** Changing the repository for an existing trigger.
*   **Critical Paths to Test:**
    *   The complete end-to-end flow for creating a new trigger with a callsign.
    *   The complete end-to-end flow for creating a new trigger with labels.
    *   The direct reconfiguration flow for callsigns (verifying pre-filled data and successful update).
    *   The direct reconfiguration flow for labels (verifying pre-filled data and successful update).
    *   The preservation of settings (like callsign/labels) when navigating back and forth during the multi-step configuration process.

---

### **2. Test Scenarios**

Create tests for the following scenarios. Group them logically using `test.describe()`.

#### **`test.describe('GitHub Trigger - New Configuration')`**

1.  **Happy Path: Configure a new 'Issue Comment Created' trigger with a callsign.**
    *   **Steps:**
        1.  Create a new GitHub trigger node.
        2.  Select the "Issue Comment Created" event.
        3.  Select a repository.
        4.  On the "Input callsign" step, enter a valid callsign (e.g., `/run-test`).
        5.  Click "Set Up".
    *   **Expected:**
        *   The properties panel updates to the "Configured" view.
        *   The configured callsign (`/run-test`) is displayed correctly.
        *   A "Change Callsign" button is visible.

2.  **Happy Path: Configure a new 'Issue Labeled' trigger with multiple labels.**
    *   **Steps:**
        1.  Create a new GitHub trigger node.
        2.  Select the "Issue Labeled" event.
        3.  Select a repository.
        4.  On the "Input labels" step, enter multiple valid labels (e.g., "bug", "p0").
        5.  Click "Set Up".
    *   **Expected:**
        *   The properties panel updates to the "Configured" view.
        *   The configured labels ("bug", "p0") are displayed as tags.
        *   A "Change Labels" button is visible.

3.  **Validation: Show error for empty callsign.**
    *   **Steps:**
        1.  Navigate to the "Input callsign" step for a new trigger.
        2.  Leave the input empty (or enter only spaces) and click "Set Up".
    *   **Expected:**
        *   An error message with text `Enter a callsign using at least one non-space character.` is displayed.
        *   The view does not proceed.

4.  **Validation: Show error for empty labels.**
    *   **Steps:**
        1.  Navigate to the "Input labels" step for a new trigger.
        2.  Do not enter any labels (or enter only spaces) and click "Set Up".
    *   **Expected:**
        *   An error message with text `Add at least one label using non-space characters.` is displayed.
        *   The view does not proceed.

5.  **State Preservation: Ensure callsign/label data is kept when navigating back.**
    *   **Steps:**
        1.  Start configuring a new "Issue Comment Created" trigger.
        2.  Select event and repository.
        3.  Proceed to the "confirm-repository" step.
        4.  Now, change the event to "Issue Labeled".
        5.  Proceed to the "Input labels" step and enter "test-label".
        6.  Click the "Back" button to return to the "confirm-repository" step.
        7.  Now, change the event back to "Issue Comment Created".
        8.  Proceed to the "Input callsign" step. Enter "/test-callsign".
        9.  Click the "Back" button.
        10. Change the event *back again* to "Issue Labeled".
    *   **Expected:**
        *   When you return to the "Input labels" step, the input should still contain "test-label".

#### **`test.describe('GitHub Trigger - Reconfiguration')`**

**Setup:** For each test in this suite, use a `test.beforeEach` to create and configure a trigger. For example, for callsign tests, first configure an "Issue Comment Created" trigger with the callsign `/initial-callsign`.

1.  **Happy Path: Reconfigure an existing callsign.**
    *   **Given:** A configured "Issue Comment Created" trigger with callsign `/initial-callsign`.
    *   **Steps:**
        1.  Click the "Change Callsign" button.
        2.  Verify the input is pre-filled with `initial-callsign`.
        3.  Verify the "Back" button is **not** visible.
        4.  Change the value to `/new-callsign`.
        5.  Click "Set Up".
    *   **Expected:**
        *   The view returns to the "Configured" state.
        *   The new callsign `/new-callsign` is displayed.

2.  **Happy Path: Reconfigure existing labels.**
    *   **Given:** A configured "Issue Labeled" trigger with labels "bug" and "urgent".
    *   **Steps:**
        1.  Click the "Change Labels" button.
        2.  Verify the inputs are pre-filled with "bug" and "urgent".
        3.  Verify the "Back" button is **not** visible.
        4.  Change the labels to "feature" and delete the "urgent" label.
        5.  Click "Set Up".
    *   **Expected:**
        *   The view returns to the "Configured" state.
        *   The new label "feature" is displayed, and "urgent" is gone.

3.  **Validation: Show error for empty callsign during reconfiguration.**
    *   **Given:** A configured "Issue Comment Created" trigger.
    *   **Steps:**
        1.  Click "Change Callsign".
        2.  Clear the input and click "Set Up".
    *   **Expected:**
        *   An error message with text `Enter a callsign using at least one non-space character.` is displayed.
        *   The view remains on the input step.

---

### **3. Playwright Implementation Instructions**

*   **Initial Setup:**
    *   In a `beforeEach` hook, navigate to the workflow designer page and create a new, unconfigured GitHub trigger node. Mock any necessary API calls for installations and repositories if they are not available in the test environment.

*   **Selectors to Target:**
    *   **Event Selection:** Use `page.getByText('Issue Comment Created')` to select an event.
    *   **Repository Selection:** Interact with the dropdowns and repository list items. Target by text.
    *   **Configured View Buttons:**
        *   `page.getByRole('button', { name: 'Change Callsign' })`
        *   `page.getByRole('button', { name: 'Change Labels' })`
        *   `page.getByRole('button', { name: 'Change Repository' })`
    *   **Input Fields:**
        *   Callsign: `page.getByRole('textbox', { name: 'callsign' })` or `page.locator('input[name="callsign"]')`
        *   Labels: `page.getByPlaceholder('bug')`
    *   **Form Actions:**
        *   `page.getByRole('button', { name: 'Next' })`
        *   `page.getByRole('button', { name: 'Set Up' })`
        *   `page.getByRole('button', { name: 'Back' })`
        *   `page.getByRole('button', { name: 'Add another label' })`
    *   **Validation Message:** `page.getByRole('alert')` or `page.locator('p.text-\\[#FF3D71\\]')`

*   **User Interactions to Simulate:**
    *   Use `page.click()` for buttons and selections.
    *   Use `page.fill()` or `page.type()` for text inputs.
    *   Chain actions using `await`.

*   **Assertions to Verify Behavior:**
    *   **Visibility:** `await expect(selector).toBeVisible();`
    *   **Absence:** `await expect(selector).toBeHidden();` or `await expect(selector).not.toBeVisible();`
    *   **Text Content:** `await expect(selector).toContainText('Expected error message');`
    *   **Input Value (for pre-filling):** `await expect(page.getByRole('textbox', { name: 'callsign' })).toHaveValue('initial-callsign');`
    *   **Final State:** After configuration, assert that the configured view shows the correct data: `await expect(page.getByText('/new-callsign')).toBeVisible();`

*   **Code Example for a Test:**

    ```typescript
    import { test, expect, type Page } from '@playwright/test';

    // Helper to create a trigger before each test
    async function createGitHubTrigger(page: Page) {
      // Logic to navigate and add a trigger node to the canvas
      await page.goto('/workflow-designer/new');
      // ... click add node, select trigger, etc.
      await page.locator('.trigger-node').click(); // Example selector
    }

    test.describe('GitHub Trigger - Reconfiguration', () => {
      test.beforeEach(async ({ page }) => {
        await createGitHubTrigger(page);

        // Configure an initial trigger with a callsign
        await page.getByText('Issue Comment Created').click();
        await page.getByRole('button', { name: 'Next' }).click();
        // ... select repository logic ...
        await page.getByRole('button', { name: 'Next' }).click();
        await page.getByRole('textbox', { name: 'callsign' }).fill('initial-callsign');
        await page.getByRole('button', { name: 'Set Up' }).click();
        
        // Assert initial configuration is successful
        await expect(page.getByText('/initial-callsign')).toBeVisible();
      });

      test('should allow reconfiguring the callsign', async ({ page }) => {
        await page.getByRole('button', { name: 'Change Callsign' }).click();

        // Assert pre-filled value and no back button
        await expect(page.getByRole('textbox', { name: 'callsign' })).toHaveValue('initial-callsign');
        await expect(page.getByRole('button', { name: 'Back' })).toBeHidden();

        // Update the callsign
        await page.getByRole('textbox', { name: 'callsign' }).fill('new-callsign');
        await page.getByRole('button', { name: 'Set Up' }).click();

        // Assert the update was successful
        await expect(page.getByText('/new-callsign')).toBeVisible();
        await expect(page.getByText('/initial-callsign')).not.toBeVisible();
      });
    });
    ```

---

### **4. MCP Integration Guidelines (Optional)**

*   **Structure:** No specific changes are needed for MCP. The standard Playwright test runner command will work.
*   **Execution Command:** You can run these specific tests using a grep pattern:
    ```bash
    npx playwright test --grep "GitHub Trigger"
    ```

---

### **5. CI-Ready Code Requirements**

*   **Test Organization:** Use `test.describe()` to group tests for "New Configuration" and "Reconfiguration". Use `test.beforeEach()` hooks to ensure a clean state for each test, making them independent and runnable in parallel.
*   **Naming Conventions:** Use clear, descriptive test names, e.g., `test('should display a validation error for an empty callsign during reconfiguration')`.
*   **Error Handling:** Playwright's `expect` assertions handle most test failures. Ensure tests are atomic and don't depend on the success of a previous test.
*   **Parallelization:** By making each `test()` self-contained (via `beforeEach`), the tests will be ready for parallel execution by Playwright, speeding up the CI pipeline. Avoid creating inter-test dependencies.

---

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (7)
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/trigger-configuration.ts (2)

122-131: Labels are never forwarded/validated in trigger configuration (breaks labeled events).

createTriggerConfiguration only handles callsign; label‑required events will throw in createTriggerEvent. Add labels into options, validate when required, and pass through.

Apply this diff:

 interface TriggerConfigOptions {
   nodeId: string;
   workspaceId?: string;
   eventId: GitHubTriggerEventId;
   repositoryNodeId: string;
   installationId: number;
   callsign?: string;
+  labels?: string[];
   useExperimentalStorage?: boolean;
 }

 // ...

 // Validate callsign if required
 if (
   isTriggerRequiringCallsign(eventId) &&
-  (!callsign || callsign.length === 0)
+  (!callsign || callsign.trim().length === 0)
 ) {
   throw new Error(`Callsign is required for trigger type: ${eventId}`);
 }

+// Validate labels if required
+if (isTriggerRequiringLabels(eventId)) {
+  const normalized = (options.labels ?? []).map((l) => l.trim()).filter(Boolean);
+  if (normalized.length === 0) {
+    throw new Error(`At least one non-empty label is required for: ${eventId}`);
+  }
+}

-const event = createTriggerEvent({ eventId, callsign });
+const event = createTriggerEvent({
+  eventId,
+  callsign,
+  labels: options.labels?.map((l) => l.trim()).filter(Boolean),
+});

Also applies to: 225-235, 233-235


149-179: Tighten input validation: disallow whitespace-only callsign and empty/blank labels.

Current checks accept " " as callsign and labels like ["", " "]. Normalize and enforce non‑blank values.

Apply this diff:

 case "github.issue_comment.created":
 case "github.pull_request_comment.created":
 case "github.pull_request_review_comment.created":
-  if (!args.callsign || args.callsign.length === 0) {
+  if (!args.callsign || args.callsign.trim().length === 0) {
     throw new Error("Callsign is required for this trigger type");
   }
   return {
     id: args.eventId,
     conditions: {
-      callsign: args.callsign,
+      callsign: args.callsign.trim(),
     },
   };
 case "github.issue.labeled":
 case "github.pull_request.labeled":
-  if (!args.labels || args.labels.length === 0) {
+  if (!args.labels || args.labels.map((l) => l.trim()).filter(Boolean).length === 0) {
     throw new Error("Labels are required for this trigger type");
   }
   return {
     id: args.eventId,
-    conditions: { labels: args.labels },
+    conditions: {
+      labels: args.labels.map((l) => l.trim()).filter(Boolean),
+    },
   };
packages/giselle/src/engine/triggers/reconfigure-github-trigger.ts (1)

58-66: Guard against event type changes during reconfigure.

Changing event.id here can desync node outputs/name since they aren’t regenerated. Reject id changes; allow condition updates only.

Apply this diff:

 const updatedTrigger = {
   ...currentTrigger,
   configuration: {
     provider: "github",
     repositoryNodeId: newRepositoryNodeId,
     installationId: args.installationId,
-    event: args.event ?? currentTrigger.configuration.event,
+    event: (() => {
+      if (args.event) {
+        if (args.event.id !== currentTrigger.configuration.event.id) {
+          throw new Error("Reconfigure does not allow changing the event type (id).");
+        }
+        return args.event;
+      }
+      return currentTrigger.configuration.event;
+    })(),
   },
 } satisfies FlowTrigger;
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/components/labels-input-step.tsx (3)

76-97: Don't mark every label input as required; it blocks valid submissions with optional extra rows.

Spec requires “at least one non-space label,” not “all rows non-empty.” Browser validation on each input prevents submission if any added row is empty. Remove required from each input and rely on the existing step-level validation; wire a11y via aria-invalid/aria-describedby.

-              <input
+              <input
                 type="text"
                 value={label.value}
                 onChange={(e) =>
                   setLabels((prev) =>
                     prev.map((l) =>
                       l.id === label.id ? { ...l, value: e.target.value } : l,
                     ),
                   )
                 }
                 className={clsx(
                   "flex-1 rounded-[8px] py-[8px] px-[12px] outline-none focus:outline-none text-[14px] bg-transparent",
-                  errorMessage !== undefined
+                  errorMessage !== undefined
                     ? "border border-[#FF3D71] focus:border-[#FF3D71]"
                     : "border border-white-400 focus:border-border",
                 )}
-                required={true}
+                aria-invalid={errorMessage !== undefined}
+                aria-describedby={errorMessage ? "labels-error" : undefined}
                 placeholder="bug"
               />

Also give the error container a stable id:

-          {errorMessage !== undefined && (
-            <p className="text-[12px] text-[#FF3D71] pl-2" role="alert">
+          {errorMessage !== undefined && (
+            <p id="labels-error" className="text-[12px] text-[#FF3D71] pl-2" role="alert">
               {errorMessage}
             </p>
           )}

70-73: Add an accessible label for the info button.

Screen readers won’t announce the icon-only button purpose. Add aria-label.

-          <button type="button">
+          <button type="button" aria-label="Labels help">
             <InfoIcon className="size-[16px]" />
           </button>

147-156: “Setting up…” text is hidden when pending.

The span gets opacity-0 while also switching text to “Setting up…”, making it invisible. Keep the label static and rely on the spinner.

-          <span className={isPending ? "opacity-0" : ""}>
-            {isPending ? "Setting up..." : "Set Up"}
-          </span>
+          <span className={isPending ? "opacity-0" : ""}>Set Up</span>
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx (1)

332-351: Add an accessible label and wire a11y on the callsign input.

  • Provide aria-label for the info button.
  • Connect error to the input and mark invalid when present.
-        <button type="button">
+        <button type="button" aria-label="Callsign help">
           <InfoIcon className="size-[16px]" />
         </button>
-        <input
+        <input
           type="text"
           name="callsign"
           className={clsx(
             "group w-full flex justify-between items-center rounded-[8px] py-[8px] pl-[28px] pr-[4px] outline-none focus:outline-none text-[14px] bg-transparent",
             callsignError !== undefined
               ? "border border-[#FF3D71] focus:border-[#FF3D71]"
               : "border border-white-400 focus:border-border",
           )}
           defaultValue={step.callsign ?? ""}
-          required={true}
+          required
+          aria-invalid={callsignError !== undefined}
+          aria-describedby={callsignError ? "callsign-error" : undefined}
           placeholder="code-review"
         />
-      {callsignError !== undefined && (
-        <p className="text-[12px] text-[#FF3D71] pl-2" role="alert">
+      {callsignError !== undefined && (
+        <p id="callsign-error" className="text-[12px] text-[#FF3D71] pl-2" role="alert">
           {callsignError}
         </p>
       )}
♻️ Duplicate comments (3)
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/trigger-configuration.ts (1)

200-200: Redundant satisfies Output here is a stylistic nit only.

This was already noted; leaving as-is is fine, or remove for brevity.

internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx (2)

396-398: “Setting up…” text is hidden when pending.

Same pattern as labels step; keep it static.

-  <span className={isPending ? "opacity-0" : ""}>
-    {isPending ? "Setting up..." : "Set Up"}
-  </span>
+  <span className={isPending ? "opacity-0" : ""}>Set Up</span>

351-351: Nit: prefer required over required={true}.

Cleaner JSX and aligns with prior comment.

-          required={true}
+          required
🧹 Nitpick comments (2)
internal-packages/workflow-designer-ui/src/editor/properties-panel/ui/select-repository.tsx (1)

13-18: Avoid interface/function name shadowing for clarity.

Having both interface SelectRepository and function SelectRepository is confusing in TSX. Consider renaming the interface to SelectedRepository.

Also applies to: 24-30

internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/resolve-next-step.ts (1)

83-96: Avoid passing eventId separately; derive from currentStep to prevent drift.

eventId is carried in every step type; a separate parameter risks mismatch and bugs.

-interface resolveNextStepProps {
-  currentStep: GitHubTriggerSetupStep;
-  eventId: GitHubTriggerEventId;
-  submissionData: StepSubmissionData;
-  nodeStatus: TriggerNode["content"]["state"]["status"];
-}
+interface resolveNextStepProps {
+  currentStep: GitHubTriggerSetupStep;
+  submissionData: StepSubmissionData;
+  nodeStatus: TriggerNode["content"]["state"]["status"];
+}
 
-export function resolveNextStep({ currentStep, eventId, submissionData, nodeStatus }: resolveNextStepProps): StepAction {
+export function resolveNextStep({ currentStep, submissionData, nodeStatus }: resolveNextStepProps): StepAction {
   switch (currentStep.state) {
     case "confirm-repository": {
+      const eventId = currentStep.eventId;
       ...

Update call sites accordingly (they already have step.eventId).

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 53f96ab and 886d9c6.

📒 Files selected for processing (12)
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/components/labels-input-step.tsx (4 hunks)
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx (12 hunks)
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/resolve-next-step.ts (1 hunks)
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/trigger-configuration.ts (3 hunks)
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/use-configure-trigger.ts (1 hunks)
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/use-trigger-configuration.ts (0 hunks)
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/configured-views/github-trigger-configured-view.tsx (4 hunks)
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/reconfiguring-views/github-trigger-reconfiguring-view.tsx (2 hunks)
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/ui/select-repository.tsx (1 hunks)
  • packages/giselle/src/engine/index.ts (2 hunks)
  • packages/giselle/src/engine/triggers/reconfigure-github-trigger.ts (3 hunks)
  • packages/giselle/src/http/router.ts (2 hunks)
💤 Files with no reviewable changes (1)
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/use-trigger-configuration.ts
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development-guide.mdc)

**/*.{ts,tsx}: Use Biome for formatting with tab indentation and double quotes
Follow organized imports pattern (enabled in biome.json)
Use TypeScript for type safety; avoid any types
Use Next.js patterns for web applications
Use async/await for asynchronous code rather than promises
Error handling: use try/catch blocks and propagate errors appropriately
Use kebab-case for all filenames (e.g., user-profile.ts)
Use camelCase for variables, functions, and methods (e.g., userEmail)
Use prefixes like is, has, can, should for boolean variables and functions for clarity
Use verbs or verb phrases that clearly indicate purpose for function naming (e.g., calculateTotalPrice(), not process())

If breaking changes are introduced in new AI SDK versions, update code to accommodate those changes

**/*.{ts,tsx}: Avoid using the any type in TypeScript
Use async/await for asynchronous code and include proper error handling
Variables and functions should be camelCase
Boolean variables and functions should use is/has/can/should prefixes where appropriate
Function names should clearly indicate their purpose

Files:

  • packages/giselle/src/engine/triggers/reconfigure-github-trigger.ts
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/reconfiguring-views/github-trigger-reconfiguring-view.tsx
  • packages/giselle/src/engine/index.ts
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/ui/select-repository.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/configured-views/github-trigger-configured-view.tsx
  • packages/giselle/src/http/router.ts
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/components/labels-input-step.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/resolve-next-step.ts
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/trigger-configuration.ts
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/use-configure-trigger.ts
**/*

📄 CodeRabbit inference engine (.cursor/rules/naming-guide.mdc)

All filenames should use kebab-case (lowercase with hyphens)

Files:

  • packages/giselle/src/engine/triggers/reconfigure-github-trigger.ts
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/reconfiguring-views/github-trigger-reconfiguring-view.tsx
  • packages/giselle/src/engine/index.ts
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/ui/select-repository.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/configured-views/github-trigger-configured-view.tsx
  • packages/giselle/src/http/router.ts
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/components/labels-input-step.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/resolve-next-step.ts
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/trigger-configuration.ts
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/use-configure-trigger.ts
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/naming-guide.mdc)

**/*.{js,jsx,ts,tsx}: React components and classes should use PascalCase
Variables, functions, and methods should use camelCase
Use verbs or verb phrases for function names; names should clearly indicate what the function does; avoid ambiguous names that could lead to misuse
Use nouns or noun phrases for variable names; names should describe what the variable represents; avoid single-letter variables except in very short scopes
Use prefixes like 'is', 'has', 'can', 'should' for both variables and functions returning boolean values; make the true/false meaning clear

Files:

  • packages/giselle/src/engine/triggers/reconfigure-github-trigger.ts
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/reconfiguring-views/github-trigger-reconfiguring-view.tsx
  • packages/giselle/src/engine/index.ts
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/ui/select-repository.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/configured-views/github-trigger-configured-view.tsx
  • packages/giselle/src/http/router.ts
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/components/labels-input-step.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/resolve-next-step.ts
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/trigger-configuration.ts
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/use-configure-trigger.ts
**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/development-guide.mdc)

**/*.tsx: Use functional components with React hooks
Use PascalCase for React components and classes (e.g., UserProfile)

**/*.tsx: React components should use React hooks and Next.js patterns
Component identifiers (names) should be PascalCase

Files:

  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/reconfiguring-views/github-trigger-reconfiguring-view.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/ui/select-repository.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/configured-views/github-trigger-configured-view.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/components/labels-input-step.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx

📄 CodeRabbit inference engine (internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/AGENTS.md)

internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx: GitHubTriggerPropertiesPanel must render GitHubTriggerConfiguredView when node state is configured; otherwise branch UI by integration github.status: {unauthorized, not-installed, installed → start setup wizard, invalid-credential, error, unset}
Installed component must host the setup wizard with steps select-event → select-repository → confirm-repository → input-callsign (only for callsign events) → configured, including Back transitions as shown
isTriggerRequiringCallsign must return true only for events: github.issue_comment.created, github.pull_request_comment.created, github.pull_request_review_comment.created
Callsign input step must require a non-empty callsign before allowing Set Up
After successful configureTrigger, update node data: mark configured, set name to On ${trigger.event.label}, and attach generated outputs

Files:

  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/{github-trigger-properties-panel.tsx,utils/trigger-configuration.@(ts|tsx)}

📄 CodeRabbit inference engine (internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/AGENTS.md)

On Set Up: build a GitHubFlowTriggerEvent (using createTriggerEvent or local createCallsignEvent), derive outputs from githubTriggers[eventId].event.payloads.keyof().options, and call client.configureTrigger with enable: false and configuration { provider: 'github', repositoryNodeId, installationId, event }

Files:

  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/trigger-configuration.ts
🧠 Learnings (15)
📓 Common learnings
Learnt from: CR
PR: giselles-ai/giselle#0
File: internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/AGENTS.md:0-0
Timestamp: 2025-09-01T00:43:51.193Z
Learning: Applies to internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx : Installed component must host the setup wizard with steps select-event → select-repository → confirm-repository → input-callsign (only for callsign events) → configured, including Back transitions as shown
Learnt from: CR
PR: giselles-ai/giselle#0
File: internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/AGENTS.md:0-0
Timestamp: 2025-09-01T00:43:51.193Z
Learning: Applies to internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/{github-trigger-properties-panel.tsx,utils/trigger-configuration.@(ts|tsx)} : On Set Up: build a GitHubFlowTriggerEvent (using createTriggerEvent or local createCallsignEvent), derive outputs from githubTriggers[eventId].event.payloads.keyof().options, and call client.configureTrigger with enable: false and configuration { provider: 'github', repositoryNodeId, installationId, event }
📚 Learning: 2025-09-01T00:43:51.193Z
Learnt from: CR
PR: giselles-ai/giselle#0
File: internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/AGENTS.md:0-0
Timestamp: 2025-09-01T00:43:51.193Z
Learning: Applies to internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/{github-trigger-properties-panel.tsx,utils/trigger-configuration.@(ts|tsx)} : On Set Up: build a GitHubFlowTriggerEvent (using createTriggerEvent or local createCallsignEvent), derive outputs from githubTriggers[eventId].event.payloads.keyof().options, and call client.configureTrigger with enable: false and configuration { provider: 'github', repositoryNodeId, installationId, event }

Applied to files:

  • packages/giselle/src/engine/triggers/reconfigure-github-trigger.ts
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/reconfiguring-views/github-trigger-reconfiguring-view.tsx
  • packages/giselle/src/engine/index.ts
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/configured-views/github-trigger-configured-view.tsx
  • packages/giselle/src/http/router.ts
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/resolve-next-step.ts
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/trigger-configuration.ts
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/use-configure-trigger.ts
📚 Learning: 2025-09-01T00:43:51.193Z
Learnt from: CR
PR: giselles-ai/giselle#0
File: internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/AGENTS.md:0-0
Timestamp: 2025-09-01T00:43:51.193Z
Learning: useGitHubTrigger(flowTriggerId) must fetch trigger and repository fullname, and expose enableFlowTrigger/disableFlowTrigger that optimistically patch the enable flag

Applied to files:

  • packages/giselle/src/engine/triggers/reconfigure-github-trigger.ts
📚 Learning: 2025-09-01T00:43:51.193Z
Learnt from: CR
PR: giselles-ai/giselle#0
File: internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/AGENTS.md:0-0
Timestamp: 2025-09-01T00:43:51.193Z
Learning: Applies to internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx : isTriggerRequiringCallsign must return true only for events: github.issue_comment.created, github.pull_request_comment.created, github.pull_request_review_comment.created

Applied to files:

  • packages/giselle/src/engine/triggers/reconfigure-github-trigger.ts
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/reconfiguring-views/github-trigger-reconfiguring-view.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/configured-views/github-trigger-configured-view.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/trigger-configuration.ts
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/use-configure-trigger.ts
📚 Learning: 2025-09-01T00:43:51.193Z
Learnt from: CR
PR: giselles-ai/giselle#0
File: internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/AGENTS.md:0-0
Timestamp: 2025-09-01T00:43:51.193Z
Learning: Applies to internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx : GitHubTriggerPropertiesPanel must render GitHubTriggerConfiguredView when node state is configured; otherwise branch UI by integration github.status: {unauthorized, not-installed, installed → start setup wizard, invalid-credential, error, unset}

Applied to files:

  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/reconfiguring-views/github-trigger-reconfiguring-view.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/configured-views/github-trigger-configured-view.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/resolve-next-step.ts
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/use-configure-trigger.ts
📚 Learning: 2025-09-01T00:43:51.193Z
Learnt from: CR
PR: giselles-ai/giselle#0
File: internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/AGENTS.md:0-0
Timestamp: 2025-09-01T00:43:51.193Z
Learning: Applies to internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx : After successful configureTrigger, update node data: mark configured, set name to `On ${trigger.event.label}`, and attach generated outputs

Applied to files:

  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/reconfiguring-views/github-trigger-reconfiguring-view.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/configured-views/github-trigger-configured-view.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/components/labels-input-step.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/resolve-next-step.ts
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/trigger-configuration.ts
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/use-configure-trigger.ts
📚 Learning: 2025-10-08T03:26:11.329Z
Learnt from: WashizuRyo
PR: giselles-ai/giselle#1903
File: internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx:436-439
Timestamp: 2025-10-08T03:26:11.329Z
Learning: In the GitHub trigger properties panel (internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx), when node.content.state.status === "reconfiguring", the flow only allows changing the repository, not the event type. Therefore, node.name should be preserved during reconfiguration to maintain user-customized names and avoid unnecessary label updates when only switching repositories.

Applied to files:

  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/reconfiguring-views/github-trigger-reconfiguring-view.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/configured-views/github-trigger-configured-view.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx
📚 Learning: 2025-09-01T00:43:51.193Z
Learnt from: CR
PR: giselles-ai/giselle#0
File: internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/AGENTS.md:0-0
Timestamp: 2025-09-01T00:43:51.193Z
Learning: Applies to internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx : Installed component must host the setup wizard with steps select-event → select-repository → confirm-repository → input-callsign (only for callsign events) → configured, including Back transitions as shown

Applied to files:

  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/reconfiguring-views/github-trigger-reconfiguring-view.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/configured-views/github-trigger-configured-view.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/components/labels-input-step.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/resolve-next-step.ts
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/trigger-configuration.ts
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/use-configure-trigger.ts
📚 Learning: 2025-09-01T00:43:51.193Z
Learnt from: CR
PR: giselles-ai/giselle#0
File: internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/AGENTS.md:0-0
Timestamp: 2025-09-01T00:43:51.193Z
Learning: Applies to internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/components/event-type-display.tsx : Confirm-repository step must support Back to repository selection and proceed based on isTriggerRequiringCallsign(eventId): to input-callsign if true, or finish setup if false

Applied to files:

  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/reconfiguring-views/github-trigger-reconfiguring-view.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/configured-views/github-trigger-configured-view.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/resolve-next-step.ts
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/trigger-configuration.ts
📚 Learning: 2025-09-01T00:43:51.193Z
Learnt from: CR
PR: giselles-ai/giselle#0
File: internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/AGENTS.md:0-0
Timestamp: 2025-09-01T00:43:51.193Z
Learning: Applies to internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/components/repository-display.tsx : Repository selection step must invoke onSelectRepository(owner/repo/installationId) to advance to confirmation

Applied to files:

  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/reconfiguring-views/github-trigger-reconfiguring-view.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/ui/select-repository.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/resolve-next-step.ts
📚 Learning: 2025-09-01T00:43:51.193Z
Learnt from: CR
PR: giselles-ai/giselle#0
File: internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/AGENTS.md:0-0
Timestamp: 2025-09-01T00:43:51.193Z
Learning: Applies to internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/node/ui/github-trigger/status-badge.tsx : Status badge must reflect enable/disable changes via useGitHubTrigger without full reload (optimistic UI)

Applied to files:

  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/reconfiguring-views/github-trigger-reconfiguring-view.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/configured-views/github-trigger-configured-view.tsx
📚 Learning: 2025-09-01T00:43:51.193Z
Learnt from: CR
PR: giselles-ai/giselle#0
File: internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/AGENTS.md:0-0
Timestamp: 2025-09-01T00:43:51.193Z
Learning: Applies to internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx : Callsign input step must require a non-empty callsign before allowing Set Up

Applied to files:

  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/reconfiguring-views/github-trigger-reconfiguring-view.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/components/labels-input-step.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/trigger-configuration.ts
📚 Learning: 2025-09-01T00:43:51.193Z
Learnt from: CR
PR: giselles-ai/giselle#0
File: internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/AGENTS.md:0-0
Timestamp: 2025-09-01T00:43:51.193Z
Learning: Applies to internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/components/install-application.tsx : NotInstalled UI must open the GitHub app install flow and listen for window.postMessage({ type: 'github-app-installed' }) to call useIntegration().refresh()

Applied to files:

  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/reconfiguring-views/github-trigger-reconfiguring-view.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx
📚 Learning: 2025-09-01T00:43:51.193Z
Learnt from: CR
PR: giselles-ai/giselle#0
File: internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/AGENTS.md:0-0
Timestamp: 2025-09-01T00:43:51.193Z
Learning: Applies to internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/components/unauthorized.tsx : Unauthorized UI must open the GitHub app flow and listen for window.postMessage({ type: 'github-app-installed' }) to call useIntegration().refresh()

Applied to files:

  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/reconfiguring-views/github-trigger-reconfiguring-view.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx
📚 Learning: 2025-09-01T00:43:51.193Z
Learnt from: CR
PR: giselles-ai/giselle#0
File: internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/AGENTS.md:0-0
Timestamp: 2025-09-01T00:43:51.193Z
Learning: Applies to internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/components/event-selection-step.tsx : Event selection step must invoke onSelectEvent(eventId) to advance to repository selection

Applied to files:

  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx
  • internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/resolve-next-step.ts
🧬 Code graph analysis (8)
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/reconfiguring-views/github-trigger-reconfiguring-view.tsx (3)
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/configured-views/github-trigger-configured-view.tsx (1)
  • GitHubTriggerReconfigureMode (64-64)
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/trigger-configuration.ts (4)
  • extractCallsign (102-107)
  • extractLabels (112-117)
  • isTriggerRequiringCallsign (88-90)
  • isTriggerRequiringLabels (95-97)
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/resolve-next-step.ts (1)
  • GitHubTriggerSetupStep (53-58)
packages/giselle/src/engine/index.ts (1)
packages/data-type/src/flow/trigger/github.ts (2)
  • GitHubFlowTriggerEvent (59-70)
  • GitHubFlowTriggerEvent (71-71)
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/configured-views/github-trigger-configured-view.tsx (1)
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/trigger-configuration.ts (2)
  • hasCallsignCondition (70-74)
  • hasLabelsCondition (79-83)
packages/giselle/src/http/router.ts (2)
packages/data-type/src/flow/trigger/github.ts (2)
  • GitHubFlowTriggerEvent (59-70)
  • GitHubFlowTriggerEvent (71-71)
packages/data-type/src/flow/trigger/index.ts (1)
  • GitHubFlowTriggerEvent (4-4)
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx (3)
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/configured-views/github-trigger-configured-view.tsx (1)
  • GitHubTriggerReconfigureMode (64-64)
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/resolve-next-step.ts (2)
  • GitHubTriggerSetupStep (53-58)
  • resolveNextStep (90-182)
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/use-configure-trigger.ts (1)
  • useConfigureTrigger (33-114)
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/resolve-next-step.ts (1)
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/trigger-configuration.ts (3)
  • isTriggerRequiringCallsign (88-90)
  • isTriggerRequiringLabels (95-97)
  • createTriggerEvent (144-184)
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/trigger-configuration.ts (1)
packages/data-type/src/flow/trigger/github.ts (2)
  • GitHubFlowTriggerEvent (59-70)
  • GitHubFlowTriggerEvent (71-71)
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/use-configure-trigger.ts (6)
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/resolve-next-step.ts (1)
  • RepositoryInfo (60-65)
packages/giselle/src/react/feature-flags/context.ts (1)
  • useFeatureFlag (17-25)
packages/giselle/src/react/flow/hooks/use-workflow-designer.ts (1)
  • useWorkflowDesigner (5-13)
packages/giselle/src/react/use-giselle-engine.ts (1)
  • useGiselleEngine (86-168)
packages/giselle/src/engine/triggers/configure-trigger.ts (1)
  • configureTrigger (16-72)
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/trigger-configuration.ts (1)
  • generateTriggerOutputs (189-204)
🔇 Additional comments (8)
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/trigger-configuration.ts (1)

17-21: Event requirement predicates look correct and align with supported IDs.

Lists and guards for callsign/labels match the documented events. Keep these in sync with @giselle-sdk/flow if new events are added.

Based on learnings

Also applies to: 26-30, 70-83, 88-97

packages/giselle/src/http/router.ts (1)

6-6: Router now accepts optional GitHub event on reconfigure — good alignment.

Value import of the Zod schema and .optional() usage is correct; matches engine API.

Ensure the engine handler preserves outputs/name when event.id is unchanged and only conditions change.

Also applies to: 299-306

internal-packages/workflow-designer-ui/src/editor/properties-panel/ui/select-repository.tsx (1)

23-34: Seeding selected installation from initialInstallationId is correct.

Initializer function avoids extra renders and preserves prior context in reconfigure.

packages/giselle/src/engine/index.ts (1)

6-6: Engine API threads optional event through to reconfigure — looks good.

Type‑only import and forwarding to trigger handler are consistent.

Also applies to: 324-326

internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/use-configure-trigger.ts (1)

100-104: Preserving node.name during reconfiguration is correct.

Name is kept when status is “reconfiguring”, matching prior guidance to avoid user-label churn. Good.

Based on learnings

internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/resolve-next-step.ts (1)

121-146: Confirm reconfig repository path handles missing persisted fields.

When reconfiguring repository-only, this submits immediately using persisted callsign/labels. If legacy triggers lack these fields, createTriggerEvent will throw. Ensure reconfiguring view always seeds step.callsign/labels (e.g., via extractCallsign/extractLabels) or route to the input steps when absent.

Based on learnings

internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/configured-views/github-trigger-configured-view.tsx (1)

88-99: Reconfiguration entry correctly sets reconfiguring state and preserves trigger id.

This aligns with the new reconfigure flow. Nice.

Based on learnings

internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/github-trigger-properties-panel.tsx (1)

121-145: Good state-machine integration.

Centralizing progression through resolveNextStep and delegating configure via the hook simplifies the flow.

Comment on lines +88 to +107
updateNodeData(node, {
content: {
...node.content,
state: {
status: "configured",
flowTriggerId: triggerId,
},
},
outputs:
node.outputs.length > 0
? node.outputs
: generateTriggerOutputs(event.id),
name:
node.content.state.status === "reconfiguring"
? node.name
: `On ${trigger.event.label}`,
});
} catch (_error) {
// Error is handled by the UI state
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

🧩 Analysis chain

Surface configuration errors to callers.

The hook catches and drops errors, giving no way for UIs to show failures beyond optimistic states. Expose errors via a callback or return a Promise that rejects so callers can render feedback.

Option A: add optional onError to configureTrigger’s args:

configureTrigger({ event, repositoryInfo, flowTriggerId, onError }?: { ...; onError?: (e: unknown) => void })

and call onError(error) in catch.

Option B: keep startTransition but also set an internal error state and return it from the hook as lastError for consumers.

To verify backend shape (that event is accepted by reconfigure), run:


🏁 Script executed:

#!/bin/bash
rg -nP 'reconfigureGitHubTrigger' packages/giselle/src
rg -nP '(interface|type)\s+Reconfigure.+\{[^}]*event' -C2 packages/giselle/src || true
rg -nP 'export\s+async\s+function\s+reconfigureGitHubTrigger' -n -C3 packages/giselle/src

Length of output: 1350


I need to see the complete function signatures and the full implementation of the hook to properly verify the concerns. Let me gather more details:


---

🏁 Script executed:

```shell
#!/bin/bash
# Get full reconfigureGitHubTrigger function signature
cat packages/giselle/src/engine/triggers/reconfigure-github-trigger.ts | head -40

# Get full use-configure-trigger.ts file content  
cat internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/use-configure-trigger.ts

Length of output: 4316


Surface configuration errors to callers.

The hook catches and drops errors, giving no way for UIs to show failures beyond optimistic states. Expose errors via a callback or return a Promise that rejects so callers can render feedback.

Option A: add optional onError to configureTrigger's args:

configureTrigger({ event, repositoryInfo, flowTriggerId, onError }?: { ...; onError?: (e: unknown) => void })

and call onError(error) in catch.

Option B: keep startTransition but also set an internal error state and return it from the hook as lastError for consumers.

Lines 88–107 in internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/providers/github-trigger/utils/use-configure-trigger.ts require refactoring to propagate errors appropriately per coding guidelines.

Comment on lines 229 to 236
type="button"
className="bg-primary-900 hover:bg-primary-800 text-inverse font-medium px-4 py-2 rounded-md text-[14px] transition-colors"
onClick={() => {
updateNodeData(node, {
content: {
...node.content,
state: {
status: "reconfiguring",
flowTriggerId,
},
},
});
beginReconfigure("repository");
}}
>
Change Repository
</button>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Disable “Change Repository” while another action is in progress.

Prevent overlapping mutations with enable/disable actions.

-  <button
+  <button
     type="button"
     className="bg-primary-900 hover:bg-primary-800 text-inverse font-medium px-4 py-2 rounded-md text-[14px] transition-colors"
-    onClick={() => {
+    onClick={() => {
       beginReconfigure("repository");
-    }}
+    }}
+    disabled={actionInProgress}
   >

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/configured-views/github-trigger-configured-view.tsx
around lines 229-236, the "Change Repository" button must be disabled while
another async action/mutation is in progress to prevent overlapping operations;
add a boolean flag (e.g. isMutating, isReconfiguring or
repositoryActionInProgress) from the surrounding component or hook, set the
button's disabled attribute when that flag is true, update the className to
include disabled styles (and remove hover styles) when disabled, and guard the
onClick handler so beginReconfigure("repository") only runs when the flag is
false (also add aria-busy or aria-disabled for accessibility).

Comment on lines +262 to 271
<button
type="button"
className="bg-primary-900 hover:bg-primary-800 text-inverse font-medium px-4 py-2 rounded-md text-[14px] transition-colors"
onClick={() => {
beginReconfigure("callsign");
}}
>
Change Callsign
</button>
</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Also disable “Change Callsign/Labels” while busy.

Same rationale as above.

-  <button
+  <button
     type="button"
     className="bg-primary-900 hover:bg-primary-800 text-inverse font-medium px-4 py-2 rounded-md text-[14px] transition-colors"
-    onClick={() => {
+    onClick={() => {
       beginReconfigure("callsign");
-    }}
+    }}
+    disabled={actionInProgress}
   >
-  <button
+  <button
     type="button"
     className="bg-primary-900 hover:bg-primary-800 text-inverse font-medium px-4 py-2 rounded-md text-[14px] transition-colors"
-    onClick={() => {
+    onClick={() => {
       beginReconfigure("labels");
-    }}
+    }}
+    disabled={actionInProgress}
   >

Also applies to: 298-306

🤖 Prompt for AI Agents
In
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/configured-views/github-trigger-configured-view.tsx
around lines 262-271 (and also apply to 298-306), the "Change Callsign/Labels"
buttons are not disabled while the component is busy; update each button to use
the busy state to set the disabled attribute and appropriate disabled styling
(e.g., muted background/hover suppression and cursor-not-allowed) and guard the
onClick so it no-ops when busy (or early-return in the handler) to prevent
actions during busy state.

Comment on lines +41 to +83
const event = data.trigger.configuration.event;
const repositoryInfo = {
installationId: data.trigger.configuration.installationId,
repoNodeId: data.trigger.configuration.repositoryNodeId,
owner: data.githubRepositoryFullname.owner,
repo: data.githubRepositoryFullname.repo,
};
const persistedCallsign = extractCallsign(event);
const persistedLabels = extractLabels(event);

const reconfigStep: GitHubTriggerSetupStep = (() => {
if (
reconfigureMode === "callsign" &&
isTriggerRequiringCallsign(event.id) &&
persistedCallsign
) {
return {
state: "input-callsign",
eventId: event.id,
...repositoryInfo,
callsign: persistedCallsign,
};
}
if (
reconfigureMode === "labels" &&
isTriggerRequiringLabels(event.id) &&
persistedLabels
) {
return {
state: "input-labels",
eventId: event.id,
...repositoryInfo,
labels: persistedLabels,
};
}
return {
state: "select-repository",
eventId: event.id,
callsign: persistedCallsign,
labels: persistedLabels,
installationId: repositoryInfo.installationId,
};
})();
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Fix truthiness check for labels; empty array currently passes.

Use length checks to avoid entering input‑labels step with no labels.

Apply this diff:

-  if (
-    reconfigureMode === "labels" &&
-    isTriggerRequiringLabels(event.id) &&
-    persistedLabels
-  ) {
+  if (
+    reconfigureMode === "labels" &&
+    isTriggerRequiringLabels(event.id) &&
+    Array.isArray(persistedLabels) &&
+    persistedLabels.length > 0
+  ) {
     return {
       state: "input-labels",
       eventId: event.id,
       ...repositoryInfo,
       labels: persistedLabels,
     };
   }
🤖 Prompt for AI Agents
internal-packages/workflow-designer-ui/src/editor/properties-panel/trigger-node-properties-panel/ui/reconfiguring-views/github-trigger-reconfiguring-view.tsx
around lines 41 to 83: the current truthiness check for persistedLabels allows
an empty array to pass and enter the "input-labels" step; change the condition
to explicitly check length (e.g., persistedLabels && persistedLabels.length > 0)
so the branch only runs when there are actual labels, and update any similar
label checks in this block to use the same length-based guard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants