Skip to content

Conversation

@midigofrank
Copy link
Collaborator

@midigofrank midigofrank commented Dec 10, 2025

Description

Changes the version dropdown and read-only logic to use URL parameter presence instead of comparing lock versions. When viewing a run from history, only pins the version if it differs from latest, preventing unnecessary read-only mode when viewing latest version runs.

The version dropdown now shows both "latest" and version numbers as separate options, making it clearer when editing the latest version versus viewing a pinned snapshot.

Closes #4121
Closes #4149

Validation steps

1. Version Dropdown Behavior

  • Open a workflow in the collaborative editor
  • Click the version dropdown in the header
  • Verify it shows "latest" as the first option
  • Verify it also shows individual version numbers (e.g., v19, v18, v17)
  • Click "latest" and verify the URL has no ?v= parameter
  • Click a specific version (e.g., v17) and verify the URL shows ?v=17

2. MiniHistory and Read-Only Mode

  • Open a workflow and make several edits to create multiple versions
  • Open the MiniHistory panel (run history)
  • Click on a run from an older version
  • Verify the URL includes ?v=X parameter
  • Verify the editor shows a read-only warning
  • Verify you cannot edit the workflow

3. Latest Version with Pinned Parameter

  • Get the latest version number from the dropdown (e.g., v19)
  • Manually add ?v=19 to the URL (pinning to latest version)
  • Verify the editor enters read-only mode
  • Verify you cannot edit the workflow
  • Click "latest" in the version dropdown
  • Verify the ?v parameter is removed from the URL
  • Verify the editor becomes editable again

4. Clicking Latest Version Run in MiniHistory

  • Create a new run (this will be at the latest version)
  • Click on this run in the MiniHistory panel
  • Verify the URL does NOT include a ?v= parameter
  • Verify the editor remains editable (no read-only warning)

Additional notes for the reviewer

The key behavioral change is that we now use URL parameter presence (?v=X) to determine read-only state, rather than comparing workflow lock versions. This makes the behavior more predictable and prevents unnecessary read-only mode when viewing runs at the latest version.

AI Usage

Please disclose how you've used AI in this work (it's cool, we just want to know!):

  • Code generation (copilot but not intellisense)
  • Learning or fact checking
  • Strategy / design
  • Optimisation / refactoring
  • Translation / spellchecking / doc gen
  • Other
  • I have not used AI

You can read more details in our Responsible AI Policy

Pre-submission checklist

  • I have performed a self-review of my code.
  • I have implemented and tested all related authorization policies. (e.g., :owner, :admin, :editor, :viewer)
  • I have updated the changelog.
  • I have ticked a box in "AI usage" in this PR

Changes the version dropdown and read-only logic to use URL parameter
presence instead of comparing lock versions. When viewing a run from
history, only pins the version if it differs from latest, preventing
unnecessary read-only mode when viewing latest version runs.

The version dropdown now shows both "latest" and version numbers as
separate options, making it clearer when editing the latest version
versus viewing a pinned snapshot.
@midigofrank midigofrank self-assigned this Dec 10, 2025
@github-project-automation github-project-automation bot moved this to New Issues in v2 Dec 10, 2025
@codecov
Copy link

codecov bot commented Dec 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.05%. Comparing base (2cf8209) to head (f90ca40).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4166      +/-   ##
==========================================
- Coverage   89.05%   89.05%   -0.01%     
==========================================
  Files         425      425              
  Lines       19686    19691       +5     
==========================================
+ Hits        17532    17536       +4     
- Misses       2154     2155       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@midigofrank midigofrank marked this pull request as ready for review December 10, 2025 07:31
@midigofrank midigofrank mentioned this pull request Dec 10, 2025
2 tasks
@midigofrank
Copy link
Collaborator Author

@stuartc @taylordowns2000 while working on this, I learnt that opening the collab editor with ?v=10 where 10 is the latest version would start a different Y.Doc instance from when you opening without the v param. That made me so happy because it means this solution fits right in 👑

@taylordowns2000 I have updated the read-only tooltips to "You are viewing a pinned version of this workflow" instead of "You cannot edit because this an old snapshot.."

@theroinaochieng theroinaochieng requested review from elias-ba and removed request for stuartc December 10, 2025 09:14
midigofrank and others added 2 commits December 10, 2025 15:27
Relocates the version mismatch banner from the top of the canvas to the
bottom of the MiniHistory panel, improving UI organization and making
the warning more contextual to the run being viewed.

Changes the banner from dismissible to actionable - replaces the X button
with a "Go to vN" button that navigates to the correct version. This makes
it easier for users to resolve the mismatch rather than just hide it.

The banner now supports two display modes:
- Collapsed panel: constrained width (150px) wraps text to 3 lines
- Expanded panel: full width keeps text and button on 1 line

Updates tests to match new behavior and adds coverage for compact mode.
Copy link
Member

@taylordowns2000 taylordowns2000 left a comment

Choose a reason for hiding this comment

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

awesome. thank you @midigofrank

@lmac-1
Copy link
Collaborator

lmac-1 commented Dec 11, 2025

I really love how this has been simplified! The logic using URL parameters makes so much more sense. Great work, @midigofrank ☺️

One thing for future consideration (definitely not for this PR and I may have missed context from earlier conversations): the dropdown UX where both "latest" and "v19" appear when v19 is the latest version. Since they represent the same content but have different behaviours (editable vs read-only), it might be a bit confusing to users.

Maybe "latest" could be a separate button outside of version dropdown, or the dropdown could use visual indicators to show which options are editable vs read-only (although that might be a bit cluttered). Not sure what the best solution would be yet... one to discuss and flag for a rainy day perhaps @taylordowns2000 @theroinaochieng .

@taylordowns2000 taylordowns2000 requested review from lmac-1 and removed request for elias-ba December 11, 2025 13:31
Copy link
Collaborator

@lmac-1 lmac-1 left a comment

Choose a reason for hiding this comment

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

Love this work - it's so much cleaner! And the version mismatch banner is so much nicer now.

Some feedback:

  1. I think the tooltip message should be updated from "You are viewing a pinned version of this workflow" to "You are viewing an older version of this workflow". I think "pinned version" is a bit confusing. I didn't really understand what it meant until I dove more into the code and could see what was happening. It's not always an older version. Keep as is for now.
  2. I fixed a small typo for variable name.
  3. I tested your 4th step in Validation steps and didn't get the behaviour you described. It sorts itself out when you click around, but it would be better if it was on latest (see Loom) - please confirm if this is expected behaviour or not. If it's expected I think we can merge.

Nice to have (shouldn't block merging):

  1. We should handle what happens when the user enters an invalid v= number in the URL (e.g. v=99999). At the moment it gets stuck in "Loading workflow" (See Loom). If it's a quick win, we could include it in this PR.

Loom: https://www.loom.com/share/6b48692121904c6aa8d989204e211394

Also noting for future consideration, my comment here from before.

@github-project-automation github-project-automation bot moved this from New Issues to In review in v2 Dec 11, 2025
@lmac-1
Copy link
Collaborator

lmac-1 commented Dec 11, 2025

@midigofrank I also noticed this, but I think this should be a follow up issue https://www.loom.com/share/09bbafb4587d4aa386f9d13d766c2a51

There's some fishy behaviour after refreshing if two runs within the same workorder have different versions. It doesn't seem to be showing the correct version number. Stu was noting some observations about this on this issue

@lmac-1
Copy link
Collaborator

lmac-1 commented Dec 11, 2025

So to be clear, I think we only need action on the stuff mentioned in "Some feedback" before merging:

  1. Updating the tooltip message
  2. Confirming expected behaviour for when you do a run and come back to the canvas with latest and fixing if necessary

Follow up issues:

  1. Handling invalid version number in url like v=9999 (low priority, won't happen often)
  2. Handling multiple runs in the same work order with different versions correctly (higher priority but I do think it should be separate from this PR)

cc @theroinaochieng @taylordowns2000

@taylordowns2000
Copy link
Member

@lmac-1 , confirmed that theres one missing link - the run detail page

image

Only include version param when snapshot differs from current workflow
version. This prevents unnecessary read-only mode when viewing runs
executed on the latest version.
@lmac-1 lmac-1 self-requested a review December 11, 2025 15:12
Tests verify that the version param is:
- Excluded when run snapshot matches current workflow version
- Included when run snapshot differs from current workflow version
@lmac-1 lmac-1 merged commit bc30573 into main Dec 11, 2025
8 checks passed
@lmac-1 lmac-1 deleted the 4121-pin-version branch December 11, 2025 15:33
@github-project-automation github-project-automation bot moved this from In review to Done in v2 Dec 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Unable to go to latest Regression: Version dropdown gets stuck

4 participants