-
Notifications
You must be signed in to change notification settings - Fork 61
Fix History Panel bugs and add version mismatch warning in collaborative editor #3941
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3941 +/- ##
==========================================
+ Coverage 88.64% 88.66% +0.02%
==========================================
Files 422 422
Lines 18913 18913
==========================================
+ Hits 16766 16770 +4
+ Misses 2147 2143 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This one is ready for review @stuartc @taylordowns2000 @theroinaochieng |
|
@stuartc I decided to put the version mismatch stuff in a hook to not overcomplicate components. There's also a test to test the logic of the hook. |
taylordowns2000
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the history navigation link works perfectly, but I'm seeing two bugs in the version matching stuff:
- when going to an old run, it should take you to that version—not keep you on
latestand show the mismatch banner. (play around with this feature on the legacy canvas to see how it should work.) - i'm seeing all the nodes collapse into the middle.
Both of these show up in the video here: https://www.loom.com/share/5fd45ef0e7bf4911a56bf511c03729c4
elias-ba
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @lmac-1 this is looking great to me from a code point of view. I alkso clicked tested and it looks great. I will leave the UI approvals to Taylor. @taylordowns2000 just wanna flag that the nodes collapsing issue might be out of scope of this work. It has became rare now but it's still happening from time to time in the app on main. I think we may need to have a proper issue for it and do deep diagnostic for it. I do think that it's deeply related to nodes positionning and layout algorithm.
5a92ab4 to
899f337
Compare
|
Hey @taylordowns2000 thanks for the Loom, yes that makes sense, will take a look! I didn't realise that the version should update at the top. And for the nodes collapsing, I have also been seeing it a bit in other bits of dev work that I'm working on in other branches / main, but not sure what are the exact steps to replicate. Seems to be a bit random. As @elias-ba suggested, it might be worth diving deeper into that in a separate issue. Will try to keep an eye out for it though to see what is causing it. |
|
I think I've fixed the node position bug... but would appreciate some help in understanding how 😅 I was able to consistently reproduce the collapsing nodes issue across multiple branches using these steps:
I looked into this with Claude, and it suggested the fix I implemented here in this branch in adc80d9. The fix works, but I don't fully understand why: The change suppresses the "could not auto-calculate position" warnings when the positions cache is empty on initial render (which is expected before layout runs). But removing these @taylordowns2000 can you retest where you saw the error? It should happen when you have a run selected with a non-successful status and then refresh the page. |
|
Okay @taylordowns2000, I think I have fixed everything you mentioned:
I also improved the warning logic so it appears whenever you're viewing a different version than the run's version, not just when viewing "latest". For example:
This gives you flexibility to compare runs against any workflow version while staying aware of mismatches. |
taylordowns2000
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic! Thanks, @lmac-1 !
Display warning banner when viewing latest workflow version but selected
run was executed on an older version. This prevents user confusion when
workflow structure has changed since the run executed (jobs added,
removed, or modified).
Features:
- VersionMismatchBanner component using bg-yellow-100 styling to match
other warning elements (VersionDropdown, credential badges)
- useVersionMismatch hook encapsulating detection logic
- Full-width banner at top of canvas, consistent with LiveView alerts
- 8 passing tests covering all edge cases and null safety
The banner shows when:
- A run is selected from history
- Viewing "latest" workflow (not a specific snapshot)
- Run's version differs from current workflow version
Fix history page 500 error and workflow filtering
Fixes two related bugs that prevented the history page from loading when
navigating from the collaborative editor:
1. Backend: Fix MatchError crash in humanize_workflow
- Handle nil case when Enum.find doesn't find the workflow
- Previously crashed with "no match of right hand side value: nil"
- Now returns empty string when workflow not found
2. Frontend: Fix workflow ID extraction in MiniHistory
- Extract workflow ID from position [1] instead of last element
- Previously took "collaborate" instead of the actual workflow UUID
- Now works for both /w/:id and /w/:id/collaborate URLs
The bug occurred when clicking "View History" from the collaborative
editor because the frontend was sending workflow_id="collaborate" which
the backend couldn't find, causing a 500 error.
Add test coverage for missing workflow in humanize_search_params
Adds test case to cover the nil branch when a workflow_id filter
references a workflow that doesn't exist in the workflows list.
Fix node position warnings and layout jumps on initial render
When viewing workflow runs (especially failed runs), nodes would trigger
"could not auto-calculate position" warnings during initial render and
briefly appear at incorrect positions before jumping to their correct layout.
This happened after page refresh when the positions cache starts empty before
the layout system runs, which is expected behavior.
Changes:
- Only log warning if positions map has data but parent still not found
- Silently default to {x: 0, y: 0} when positions cache is empty on first render
- Eliminates console spam and improves render performance for failed run views
Auto-switch workflow version when selecting run from history
When clicking a run in the MiniHistory panel, automatically switch the
workflow view to display the version that was used when that run executed.
This matches the LiveView editor behavior and eliminates confusion about
viewing mismatched versions.
Changes:
- Auto-detect run's workflow version and switch to it on selection
- Show version mismatch warning for ANY version mismatch, not just when
viewing latest (fixes issue where warning didn't appear when manually
switching between historical versions)
- URL now includes both run and version parameters (?run=<id>&v=<version>)
Fixes the issue where IDE header would show "latest" while viewing a run
from an older version, causing unnecessary version mismatch warnings.
Update CHANGELOG for PR #3941
Replace brittle URL parsing with clean navigation utilities that get IDs from state instead of parsing window.location. Uses URLSearchParams for proper query string encoding and provides reusable functions for navigating to history and run pages. - Extract navigation logic to dedicated utility module - Get project/workflow IDs from hooks instead of URL parsing - Add comprehensive test coverage for navigation utilities - Update MiniHistory tests to mock new dependencies
ead8c72 to
a06f02d
Compare
Display warning banner when viewing latest workflow version but selected
run was executed on an older version. This prevents user confusion when
workflow structure has changed since the run executed (jobs added,
removed, or modified).
Features:
- VersionMismatchBanner component using bg-yellow-100 styling to match
other warning elements (VersionDropdown, credential badges)
- useVersionMismatch hook encapsulating detection logic
- Full-width banner at top of canvas, consistent with LiveView alerts
- 8 passing tests covering all edge cases and null safety
The banner shows when:
- A run is selected from history
- Viewing "latest" workflow (not a specific snapshot)
- Run's version differs from current workflow version
Fix history page 500 error and workflow filtering
Fixes two related bugs that prevented the history page from loading when
navigating from the collaborative editor:
1. Backend: Fix MatchError crash in humanize_workflow
- Handle nil case when Enum.find doesn't find the workflow
- Previously crashed with "no match of right hand side value: nil"
- Now returns empty string when workflow not found
2. Frontend: Fix workflow ID extraction in MiniHistory
- Extract workflow ID from position [1] instead of last element
- Previously took "collaborate" instead of the actual workflow UUID
- Now works for both /w/:id and /w/:id/collaborate URLs
The bug occurred when clicking "View History" from the collaborative
editor because the frontend was sending workflow_id="collaborate" which
the backend couldn't find, causing a 500 error.
Add test coverage for missing workflow in humanize_search_params
Adds test case to cover the nil branch when a workflow_id filter
references a workflow that doesn't exist in the workflows list.
Fix node position warnings and layout jumps on initial render
When viewing workflow runs (especially failed runs), nodes would trigger
"could not auto-calculate position" warnings during initial render and
briefly appear at incorrect positions before jumping to their correct layout.
This happened after page refresh when the positions cache starts empty before
the layout system runs, which is expected behavior.
Changes:
- Only log warning if positions map has data but parent still not found
- Silently default to {x: 0, y: 0} when positions cache is empty on first render
- Eliminates console spam and improves render performance for failed run views
Auto-switch workflow version when selecting run from history
When clicking a run in the MiniHistory panel, automatically switch the
workflow view to display the version that was used when that run executed.
This matches the LiveView editor behavior and eliminates confusion about
viewing mismatched versions.
Changes:
- Auto-detect run's workflow version and switch to it on selection
- Show version mismatch warning for ANY version mismatch, not just when
viewing latest (fixes issue where warning didn't appear when manually
switching between historical versions)
- URL now includes both run and version parameters (?run=<id>&v=<version>)
Fixes the issue where IDE header would show "latest" while viewing a run
from an older version, causing unnecessary version mismatch warnings.
Update CHANGELOG for PR #3941
Description
This PR improves the history panel experience in the collaborative editor by fixing critical bugs that prevented navigation to the "view all history" page and adding a version mismatch warning to prevent user confusion.
Closes #3814 and point 1 of #3940
History page 500 error when navigating from collaborative editor
Feature: Version mismatch warning banner
Shows a warning when viewing latest workflow but selected run was executed on an older version. Prevents confusion when workflow structure has changed since the run executed. Appears when:
Example message:
Testing
Validation steps
Version mismatch warning:
You have two choices
Once you have a workflow where the latest version is different to previous version:
Bug fix:
Additional notes for the reviewer
I tried to make the banner look similar to existing banner in LiveView using Tailwind colours.
AI Usage
Please disclose how you've used AI in this work (it's cool, we just want to know!):
You can read more details in our Responsible AI Policy
Pre-submission checklist
:owner,:admin,:editor,:viewer)