Skip to content

fix(workflow): clicking on 'See runs' shows executions from all workflows#16300

Merged
charlesBochet merged 1 commit intotwentyhq:mainfrom
abk404:workflow_runs_filter_bug
Dec 3, 2025
Merged

fix(workflow): clicking on 'See runs' shows executions from all workflows#16300
charlesBochet merged 1 commit intotwentyhq:mainfrom
abk404:workflow_runs_filter_bug

Conversation

@abk404
Copy link
Copy Markdown
Contributor

@abk404 abk404 commented Dec 3, 2025

Fixes: #16229 and #16286

This PR fixes the bug where click on 'See All Runs' button for a specific workflow was not filtering the runs for that speciific workflow.

Reason : The filter logic in getFilterFilterableFieldMetadataItems was excluding ALL system fields(except field id) from being filterable, which prevented these essential business relations from being used in filters.

Fix : Added a targeted exception to allow specific system relation fields (workflow and workflowVersion) to be filterable, similar to how the id system field is already whitelisted.

Before

Screen.Recording.2025-12-04.at.12.31.36.AM.mov
Screenshot 2025-12-03 at 11 52 50 PM

After

Screen.Recording.2025-12-04.at.12.32.35.AM.mov
Screenshot 2025-12-04 at 12 33 32 AM

Copilot AI review requested due to automatic review settings December 3, 2025 19:15
@abk404 abk404 force-pushed the workflow_runs_filter_bug branch from cf0711a to d74fb56 Compare December 3, 2025 19:19
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Dec 3, 2025

Greptile Overview

Greptile Summary

Fixed workflow runs filtering by allowing specific system relation fields (workflow and workflowVersion) to be filterable. Previously, the filter logic excluded ALL system fields except id, preventing workflow-specific filtering when clicking "See runs".

Changes:

  • Added targeted exception in filter logic to whitelist workflow and workflowVersion relation fields
  • Maintains existing filter behavior for all other system fields
  • Solves the issue where clicking "See runs" showed executions from all workflows instead of the selected one

Note: The fix uses hardcoded field names, which is a pragmatic solution for this specific use case but may require similar updates if other system relation fields need filtering in the future.

Confidence Score: 4/5

  • This PR is safe to merge with minor maintenance considerations
  • The fix correctly addresses the reported bug with a targeted solution. Both workflow and workflowVersion are MANY_TO_ONE relations that should be filterable. The change is minimal and follows the existing pattern (similar to how id is whitelisted). Score is 4 instead of 5 because the hardcoded field names approach could require maintenance if similar issues arise with other system fields, though this is unlikely given the specific nature of workflow filtering.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
packages/twenty-front/src/modules/object-metadata/utils/getFilterFilterableFieldMetadataItems.ts 4/5 Added exception to allow workflow and workflowVersion system relation fields to be filterable, fixing the workflow runs filter bug

Sequence Diagram

sequenceDiagram
    participant User
    participant UI as Workflow UI
    participant Action as SeeRunsWorkflowSingleRecordAction
    participant Filter as availableFieldMetadataItemsForFilterFamilySelector
    participant Utils as getFilterFilterableFieldMetadataItems
    participant Backend as GraphQL API

    User->>UI: Clicks "See runs" button
    UI->>Action: Trigger action with recordId
    Action->>Action: Build filter query with workflow.IS filter
    Action->>UI: Navigate to /objects/workflowRuns with filter params
    
    Note over UI,Filter: Filter Application Phase
    UI->>Filter: Request filterable fields for workflowRuns object
    Filter->>Utils: Call with isJsonFilterEnabled flag
    
    Note over Utils: BEFORE FIX: workflow field excluded (system field)
    Note over Utils: AFTER FIX: workflow field included (whitelisted)
    
    Utils->>Utils: Check field.isSystem
    Utils->>Utils: Check if field is 'id' OR 'workflow' OR 'workflowVersion'
    Utils->>Utils: Verify MANY_TO_ONE relation type
    Utils->>Filter: Return filtered fields (now includes workflow relation)
    
    Filter->>UI: Available filterable fields
    UI->>Backend: Query workflowRuns with workflow filter applied
    Backend->>UI: Return filtered workflow runs
    UI->>User: Display runs only for selected workflow
Loading

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

Copy link
Copy Markdown
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 fixes a bug where clicking "See All Runs" for a specific workflow was displaying executions from all workflows instead of filtering to the selected workflow. The root cause was that system relation fields (workflow and workflowVersion) were being excluded from filterable fields, preventing proper workflow-specific filtering.

  • Added an exception to allow specific system relation fields (workflow and workflowVersion) to be filterable
  • Modified the isFieldFilterable condition to include the new isWorkflowRelationField check alongside existing exceptions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +14 to +16
const isWorkflowRelationField =
field.type === FieldMetadataType.RELATION &&
(field.name === 'workflow' || field.name === 'workflowVersion');
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

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

[nitpick] The hardcoded field names 'workflow' and 'workflowVersion' reduce maintainability. If additional system relation fields need to be filterable in the future, this list will need to be manually updated. Consider extracting these field names into a constant array (e.g., FILTERABLE_SYSTEM_RELATION_FIELDS) to centralize the configuration and make it easier to maintain.

Example:

const FILTERABLE_SYSTEM_RELATION_FIELDS = ['workflow', 'workflowVersion'];

const isWorkflowRelationField =
  field.type === FieldMetadataType.RELATION &&
  FILTERABLE_SYSTEM_RELATION_FIELDS.includes(field.name);

Copilot uses AI. Check for mistakes.
Comment on lines +14 to +16
const isWorkflowRelationField =
field.type === FieldMetadataType.RELATION &&
(field.name === 'workflow' || field.name === 'workflowVersion');
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

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

The new isWorkflowRelationField logic lacks test coverage. Given that other utility functions in this module have tests in the __tests__ directory, consider adding test cases to verify that:

  1. System relation fields named 'workflow' and 'workflowVersion' are correctly identified as filterable
  2. Other system relation fields remain non-filterable
  3. Non-system workflow/workflowVersion fields are properly handled

This will prevent regressions and ensure the bug fix continues to work as intended.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Dec 3, 2025

🚀 Preview Environment Ready!

Your preview environment is available at: http://bore.pub:28306

This environment will automatically shut down when the PR is closed or after 5 hours.

Copy link
Copy Markdown
Member

@charlesBochet charlesBochet left a comment

Choose a reason for hiding this comment

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

ty!

@charlesBochet charlesBochet merged commit 6fe3d58 into twentyhq:main Dec 3, 2025
59 checks passed
@twenty-eng-sync
Copy link
Copy Markdown

Hey @charlesBochet! After you've done the QA of your Pull Request, you can mark it as done here. Thank you!

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Dec 3, 2025

Thanks @abk404 for your contribution!
This marks your 2nd PR on the repo. You're top 15% of all our contributors 🎉
See contributor page - Share on LinkedIn - Share on Twitter

Contributions

NotYen pushed a commit to NotYen/twenty-ym that referenced this pull request Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Workflows] Runs shown from a given workflow are no longer filtered to this workflow

3 participants