Skip to content

feat: Workflow History V2 - implement deep-linking to history events #1120

Merged
adhityamamallan merged 7 commits intocadence-workflow:masterfrom
adhityamamallan:history-v2-deeplink
Dec 16, 2025
Merged

feat: Workflow History V2 - implement deep-linking to history events #1120
adhityamamallan merged 7 commits intocadence-workflow:masterfrom
adhityamamallan:history-v2-deeplink

Conversation

@adhityamamallan
Copy link
Member

@adhityamamallan adhityamamallan commented Dec 16, 2025

Summary

  • Add WorkflowHistoryEventLinkButton to allow copying links to events (and group summaries)
  • Add logic to handle the "summary_N" fake event ID in the root component, for scrolling, expansion state and the ungrouped table
  • Pass selected event IDs down to the table components and then to the table rows themselves
  • Animate on enter for selected event IDs, to highlight them
  • Change the initial event alignment from "start" to "center", to be more compatible with the resizable sticky header

Test plan

Added/updated unit tests + ran locally.

Screenshot 2025-12-16 at 15 47 04 Screenshot 2025-12-16 at 15 47 07 Screenshot 2025-12-16 at 15 47 10

Loading into an event in the grouped view

Screen.Recording.2025-12-16.at.15.47.15.mov

Loading into an event in the ungrouped view

Screen.Recording.2025-12-16.at.15.59.19.mov

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>
Signed-off-by: Adhitya Mamallan <adhitya.mamallan@uber.com>
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 implements deep linking functionality for History v2, allowing users to share and navigate directly to specific events in workflow history. The implementation strips the summary_ prefix from event IDs in query parameters and passes the cleaned ID to both grouped and ungrouped history views, enabling proper event highlighting and navigation.

Key Changes

  • Added logic to strip summary_ prefix from historySelectedEventId query parameter
  • Updated event group components to accept selectedEventId instead of boolean selected prop for better precision
  • Implemented WorkflowHistoryEventLinkButton component to generate and copy shareable event links
  • Changed scroll alignment from 'start' to 'center' for better UX when navigating to deep-linked events

Reviewed changes

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

Show a summary per file
File Description
workflow-history-v2.tsx Added selectedEventIdWithinGroup memo to strip summary_ prefix and updated prop passing
workflow-history-ungrouped-table.tsx Removed unused initialStartIndex prop and updated scroll alignment to 'center'
workflow-history-ungrouped-table.types.ts Removed initialStartIndex from types
workflow-history-ungrouped-table.test.tsx Removed initialStartIndex parameter from test setup
workflow-history-ungrouped-event.tsx Added isUngroupedView prop to WorkflowHistoryGroupDetails
workflow-history-grouped-table.tsx Changed selected boolean to selectedEventId string and updated alignment to 'center'
workflow-history-grouped-table.test.tsx Updated tests to verify selectedEventId prop passing
workflow-history-group-details.types.ts Added isUngroupedView optional prop
workflow-history-group-details.tsx Added link button component and memo for selected event tracking
workflow-history-group-details.test.tsx Added tests for link button functionality
workflow-history-event-link-button.types.ts Defined types for new link button component
workflow-history-event-link-button.tsx Implemented link button with copy functionality
workflow-history-event-link-button.test.tsx Added comprehensive tests for link button
workflow-history-event-group.types.ts Reorganized props with comments and changed selected to selectedEventId
workflow-history-event-group.tsx Updated to use selectedEventId for animation trigger and initial event selection
workflow-history-event-group.test.tsx Updated tests to use selectedEventId instead of selected
workflow-history-v2.test.tsx Added tests for summary_ prefix stripping functionality

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

@adhityamamallan adhityamamallan changed the title feat: History v2 deeplink feat: Workflow History V2 - implement deep-linking to history events Dec 16, 2025
@adhityamamallan adhityamamallan marked this pull request as ready for review December 16, 2025 15:31
import { type Props as WorkflowHistoryProps } from '../workflow-history-v2.types';

export type Props = {
// Core data props
Copy link
Member Author

Choose a reason for hiding this comment

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

Just rearranged & grouped the props here 😅

Copy link
Member

Choose a reason for hiding this comment

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

Thx for context :)

defaultItemHeight={36}
rangeChanged={setVisibleRange}
{...(initialStartIndex === undefined
? {}
Copy link
Member Author

Choose a reason for hiding this comment

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

This prop wasn't even being passed/meaningfully used so I just removed it

Signed-off-by: Adhitya Mamallan <adhitya.mamallan@uber.com>
import { type Props as WorkflowHistoryProps } from '../workflow-history-v2.types';

export type Props = {
// Core data props
Copy link
Member

Choose a reason for hiding this comment

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

Thx for context :)

Comment on lines +14 to +19
it('renders correctly', () => {
render(<WorkflowHistoryEventLinkButton historyEventId="123" />);
const button = screen.getByRole('button');
expect(button).toBeInTheDocument();
expect(button).toHaveAccessibleName('Copy link to event');
});
Copy link
Member

Choose a reason for hiding this comment

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

FYI this type of "assert correct rendering" are a great fit for visual snapshots.

Each expect is converted to pixel-level assertions.

Comment on lines +81 to +92
// TODO: this is a bit hacky, see if there is a better way to mock the window location property
const originalWindow = window;
window = Object.create(window);
Object.defineProperty(window, 'location', {
value: {
...window.location,
origin: 'http://localhost',
pathname:
'/domains/test-domain/workflows/test-workflow/test-run/history',
},
writable: true,
});
Copy link
Member

Choose a reason for hiding this comment

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

Good call. I'm ok with it as is.

One improvement:

  1. Type safety.
  2. Auto "reset" the mock (because we sometimes forget or the test fails midway).

This can be achieved with a mock window util.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup, there are quite a few places that windows are mocked. I'll see if we can write a common mock to use in all these places.

@adhityamamallan adhityamamallan merged commit 885aa7b into cadence-workflow:master Dec 16, 2025
4 checks passed
@adhityamamallan adhityamamallan deleted the history-v2-deeplink branch December 16, 2025 21:30
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