Skip to content

fix: stabilize workspace kind ordering - #1344

Open
thisis-Shitanshu wants to merge 1 commit into
kubeflow:notebooks-v2from
thisis-Shitanshu:fix/stable-workspace-kind-order
Open

fix: stabilize workspace kind ordering#1344
thisis-Shitanshu wants to merge 1 commit into
kubeflow:notebooks-v2from
thisis-Shitanshu:fix/stable-workspace-kind-order

Conversation

@thisis-Shitanshu

Copy link
Copy Markdown

What

Sort WorkspaceKinds by displayName before rendering them in the Create Workspace form, using name as a deterministic tie-breaker.

Why

The WorkspaceKinds API does not guarantee a presentation order, so the order of cards on the Create Workspace page could change between page refreshes.

The frontend owns presentation sorting for WorkspaceKinds, so the selection list should apply a deterministic default order before rendering.

Testing

  • Added unit coverage for ordering WorkspaceKinds by displayName

  • Added coverage for deterministic ordering when display names are equal

  • 454/454 Jest tests pass

  • Create Workspace Cypress suite passes 73/73 tests

  • Manually verified across repeated page refreshes that the UI consistently renders:

    • JupyterLab
    • RStudio
    • VS Code

    even when the WorkspaceKinds API returns the items in different orders

The full mocked Cypress run has one unrelated failure in workspaces/secretsEdit.cy.ts. The same failure is reproducible on a clean origin/notebooks-v2 checkout.

Related

related: #336
related: #1112

#336 documents the decision to keep paging, sorting, and filtering in the frontend.

#1112 separately tracks duplicate WorkspaceKind requests and is not addressed by this change.

@github-project-automation github-project-automation Bot moved this to Needs Triage in Kubeflow Notebooks Aug 21, 2026
@google-oss-prow google-oss-prow Bot added the area/frontend area - related to frontend components label Aug 21, 2026
@google-oss-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign paulovmr for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow Bot added area/v2 area - version - kubeflow notebooks v2 size/M labels Aug 21, 2026
@thisis-Shitanshu

Copy link
Copy Markdown
Author

@christian-heusel @andyatmiami PR is up: #1344. Thanks again for the guidance and for helping me validate the direction before implementation. I kept the change focused on deterministic frontend ordering and added regression coverage for the default sort and tie-breaker. Would appreciate your review when you get a chance!

@christian-heusel christian-heusel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@thisis-Shitanshu great job on your first PR to this repository 🎉

I briefly reviewed your changes, see the comments below 😊

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why did you opt to add the fix add the presentation layer instead of the data layer? 😊 the useWorkspaceKinds() hook is also used in other parts of the code, did you audit them if they suffer from the same issue? Some have other sorting mechanisms, but might be sensible to look at 😊

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Very good point. My initial reason for keeping this in WorkspaceFormKindList came partly from the earlier discussion with @andyatmiami about whether the PatternFly container should own the ordering. We found that Gallery itself doesn't own ordering, and the adjacent Image and PodConfig list components also prepare their ordering before rendering, so I treated this as frontend list/presentation preparation.

After your comment, I audited all production consumers of useWorkspaceKinds():

  • WorkspaceFormKindSelection passes the result into the WorkspaceKind card list, which is the flow affected by this issue.
  • WorkspaceKinds.tsx applies its own sorting based on the active table sort.
  • WorkspaceTable.tsx only uses the result to build the kind/logo lookup.
  • useWorkspaceFormData.ts uses it for lookup, so ordering is irrelevant there.

So currently only the Create Workspace flow depends on this default ordering, while one consumer replaces the ordering and the other two are order-insensitive. There will be a small redundant sort for WorkspaceKinds.tsx if we move this into the hook, but here that cost is negligible.

This still seems consistent with the earlier discussion with Andy because the ordering remains in the frontend data-preparation layer rather than being delegated to PatternFly.

I also noticed the duplicate useWorkspaceKinds() / API requests again while auditing this. That's already tracked separately in #1112, so I'd keep that out of this PR and will look at it independently.

Signed-off-by: Shitanshu Pandey <shitanshu.19p@gmail.com>
@thisis-Shitanshu
thisis-Shitanshu force-pushed the fix/stable-workspace-kind-order branch from 2014112 to 3620a17 Compare August 23, 2026 14:20
@christian-heusel

Copy link
Copy Markdown
Member

/ok-to-test

@thaorell thaorell left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

a minor comment below

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/frontend area - related to frontend components area/v2 area - version - kubeflow notebooks v2 ok-to-test size/M

Projects

Status: Needs Triage

Development

Successfully merging this pull request may close these issues.

3 participants