Skip to content

refactor: Use groupType-based filtering for Workflow History Group Category filter#1197

Merged
adhityamamallan merged 6 commits intocadence-workflow:masterfrom
adhityamamallan:fix-filtering-logic
Mar 6, 2026
Merged

refactor: Use groupType-based filtering for Workflow History Group Category filter#1197
adhityamamallan merged 6 commits intocadence-workflow:masterfrom
adhityamamallan:fix-filtering-logic

Conversation

@adhityamamallan
Copy link
Member

@adhityamamallan adhityamamallan commented Feb 27, 2026

Summary

  • Create new config that maps from event group type to category
  • Replace function-based filtering config for Event Group Category, and use the config map instead
  • Move old function-based helper for calculating an event group's category from filtering logic, and reimplement it using the new map
  • Reimplement the category filter to use getEventGroupCategory instead of doing so the other way around
  • Rename "groupType" to "category" in timeline and navigation bar for consistency
  • Rewrite the status filter to use a similar map-based approach instead of hardcoding the logic

Test plan

Added/updated unit tests + ran locally to sanity-check that filters still work as expected.

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 refactors the filtering logic for workflow history v2 by replacing function-based category filtering with a direct constant mapping approach. The change simplifies the code, improves type safety, and eliminates the need for runtime function evaluations when filtering event groups.

Changes:

  • Introduced WORKFLOW_HISTORY_EVENT_GROUP_TYPE_TO_CATEGORY_MAP and WORKFLOW_HISTORY_EVENT_STATUS_TO_GROUP_STATUS_MAP constants for direct type-safe mappings
  • Simplified filter-groups-by-category and filter-groups-by-status functions to use direct map lookups
  • Removed deprecated get-event-group-filtering-type helper function and workflow-history-event-group-category-filters.config file
  • Updated all components to use the new mapping directly instead of calling helper functions
  • Renamed TimelineRow.groupType to TimelineRow.category for consistency
  • Renamed NavigationBarEventsMenuItem.type to NavigationBarEventsMenuItem.category for consistency

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated no comments.

Show a summary per file
File Description
workflow-history-filters-menu.constants.ts Added new type-safe constant mappings for event group types to categories and event statuses to group statuses
filter-groups-by-status.ts Refactored to use direct map lookup instead of manual array reduction
filter-groups-by-category.ts Refactored to use direct map lookup instead of config-based function evaluation
get-event-group-filtering-type.ts Deleted deprecated helper function
workflow-history-event-group-category-filters.config.ts Deleted deprecated config file
workflow-history-ungrouped-event.tsx Updated to use direct map lookup instead of helper function
workflow-history-event-group.tsx Updated to use direct map lookup instead of helper function
workflow-history-timeline.tsx Updated to reference renamed category field
workflow-history-timeline.types.ts Renamed groupType field to category, updated type imports
get-timeline-row-from-event-group.ts Updated to use direct map lookup and return renamed category field
get-navigation-bar-events-menu-items.ts Updated to use direct map lookup
workflow-history-navigation-bar-events-menu.types.ts Renamed type field to category
workflow-history-navigation-bar-events-menu.tsx Updated to reference renamed category field
workflow-history-filters-menu.types.ts Removed deprecated EventGroupCategoryConfig type
workflow-history-event-groups.ts Added mockLocalActivityEventGroup fixture
Various test files Removed mocks for deleted functions, updated test expectations to use category field

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

@adhityamamallan adhityamamallan changed the title fix filtering logic for history v2 refactor: Use groupType-based filtering for Workflow History Group Category filter Feb 27, 2026
@adhityamamallan adhityamamallan marked this pull request as ready for review February 27, 2026 13:52
Signed-off-by: Adhitya Mamallan <adhitya.mamallan@uber.com>
Signed-off-by: Adhitya Mamallan <adhitya.mamallan@uber.com>
Signed-off-by: Adhitya Mamallan <adhitya.mamallan@uber.com>
Signed-off-by: Adhitya Mamallan <adhitya.mamallan@uber.com>
Signed-off-by: Adhitya Mamallan <adhitya.mamallan@uber.com>
@adhityamamallan adhityamamallan merged commit 9d0acc8 into cadence-workflow:master Mar 6, 2026
3 checks passed
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.

3 participants