Skip to content

internal: rework studio handshake to allow better caching #31599

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

Merged
merged 62 commits into from
Apr 30, 2025

Conversation

ryanthemanuel
Copy link
Collaborator

@ryanthemanuel ryanthemanuel commented Apr 29, 2025

Additional details

Add a "handshake" mechanism to the studio workflow to get exact studio/protocol URLs up front. This allows for better caching.

Steps to test

How has the user experience changed?

PR Tasks

Copy link

cypress bot commented Apr 29, 2025

cypress    Run #62075

Run Properties:  status check passed Passed #62075  •  git commit 4e326ff34f: PR comment
Project cypress
Branch Review ryanm/fix/make-caching-possible
Run status status check passed Passed #62075
Run duration 14m 31s
Commit git commit 4e326ff34f: PR comment
Committer Ryan Manuel
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 10
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 589
View all changes introduced in this branch ↗︎
UI Coverage  0%
  Untested elements 4  
  Tested elements 0  
Accessibility  97.09%
  Failed rules  0 critical   1 serious   0 moderate   0 minor
  Failed elements 6  

Base automatically changed from 10501-studio-telemetry to develop April 29, 2025 13:37
@ryanthemanuel ryanthemanuel self-assigned this Apr 29, 2025
@ryanthemanuel ryanthemanuel changed the title fix: rework studio handshake to allow better caching internal: rework studio handshake to allow better caching Apr 29, 2025
Copy link
Contributor

@Copilot 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 reworks the studio handshake mechanism to allow better caching by introducing a dedicated studio session endpoint and refactoring studio manager initialization.

  • Introduces a postStudioSession API to retrieve studio/protocol URLs before downloading the studio bundle.
  • Adapts tests and project-base logic to integrate the new handshake flow.
  • Updates studio manager creation and studio-app types to support the new caching mechanism.

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
scripts/gulp/tasks/gulpCloudDeliveredTypes.ts Updated studio bundle download to use studioSession URL from postStudioSession.
packages/server/test/unit/project_spec.js Modified test stubs and asynchronous callbacks for protocol management.
packages/server/test/unit/cloud/api/studio/post_studio_session_spec.ts Added tests for the new postStudioSession API.
packages/server/test/unit/cloud/api/studio/get_and_initialize_studio_manager_spec.ts Updated tests to supply studioUrl to the studio manager initializer.
packages/server/test/unit/StudioLifecycleManager_spec.ts Adjusted studio lifecycle tests to use the postStudioSession stub.
packages/server/lib/project-base.ts Refactored studio destruction logic for improved flow.
packages/server/lib/cloud/routes.ts Updated API endpoints to include a studioSession route.
packages/server/lib/cloud/api/studio/post_studio_session.ts Introduced a new API that posts to the studio session endpoint with retry logic.
packages/server/lib/cloud/api/studio/get_and_initialize_studio_manager.ts Modified API to accept studioUrl and download the appropriate studio bundle.
packages/server/lib/StudioLifecycleManager.ts Refactored studio manager creation logic to use the new postStudioSession and establish protocol setup.
packages/app/src/studio/studio-app-types.ts Updated studio types to mark certain callbacks as optional and add new hooks.
Comments suppressed due to low confidence (2)

packages/app/src/studio/studio-app-types.ts:3

  • [nitpick] Since onStudioPanelClose has been changed to optional and new hooks have been added, consider updating the documentation or inline comments to clarify how consumers should handle the absence of these properties.
export interface StudioPanelProps {

packages/server/test/unit/project_spec.js:885

  • [nitpick] The updated async handling using a promise to capture the onStudioDestroy callback improves clarity. Ensure that this pattern is applied consistently across similar asynchronous test scenarios to avoid potential race conditions.
this.project.server.startWebsockets.callsFake(async (automation, config, callbacks) => {

@ryanthemanuel ryanthemanuel requested a review from mabela416 April 29, 2025 20:18
Comment on lines 479 to 481
await studio?.destroy()

if (studio?.protocolManager) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems odd to destroy studio and then check if there is a protocolManager.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah good point. I think this is less confusing: 4e326ff (#31599)

Copy link
Contributor

@astone123 astone123 left a comment

Choose a reason for hiding this comment

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

Looks good 👍🏻

@ryanthemanuel ryanthemanuel merged commit d435dda into develop Apr 30, 2025
91 checks passed
@ryanthemanuel ryanthemanuel deleted the ryanm/fix/make-caching-possible branch April 30, 2025 18:33
@cypress-bot
Copy link
Contributor

cypress-bot bot commented May 6, 2025

Released in 14.3.3.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v14.3.3, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators May 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants