Skip to content

internal: (studio) initialize cloud studio asynchronously #31469

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 53 commits into from
Apr 29, 2025

Conversation

astone123
Copy link
Contributor

@astone123 astone123 commented Apr 8, 2025

Additional details

We'd like to know how many people are using Cypress Studio today. This PR does a few things:

  • Always load cloud bundle for Studio (so that init event is captured)
  • Make Studio loading async so that it doesn't block project opening
  • Create StudioLifecycleManager to handle accessing Studio

Steps to test

Ensure that studio still loads correctly - the cloud studio panel should still load when you pass the correct environment variables, and it should not when these variables are not provided.

Check the tests that I added that verify that the cloud code to collect telemetry is always called when Studio loads even if AI is not enabled.

How has the user experience changed?

Users shouldn't notice any changes to how Studio works today - the external user experience should remain unchanged.

PR Tasks

@astone123 astone123 self-assigned this Apr 8, 2025
@astone123 astone123 changed the title feat: (studio) capture telemetry for studio initialization chore: (studio) capture telemetry for studio initialization Apr 8, 2025
@astone123 astone123 changed the title chore: (studio) capture telemetry for studio initialization chore: (studio) capture anonymous telemetry for studio initialization Apr 9, 2025
Copy link

cypress bot commented Apr 9, 2025

cypress    Run #62037

Run Properties:  status check passed Passed #62037  •  git commit 06b12e60fb: Update packages/server/lib/StudioLifecycleManager.ts
Project cypress
Branch Review 10501-studio-telemetry
Run status status check passed Passed #62037
Run duration 18m 11s
Commit git commit 06b12e60fb: Update packages/server/lib/StudioLifecycleManager.ts
Committer Adam Stone-Lord
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 2
Tests that did not run due to a developer annotating a test with .skip  Pending 154
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 11248
View all changes introduced in this branch ↗︎

Warning

No Report: Something went wrong and we could not generate a report for the Application Quality products.

@astone123 astone123 changed the title chore: (studio) capture anonymous telemetry for studio initialization internal: (studio) capture anonymous telemetry for studio initialization Apr 18, 2025
@astone123 astone123 marked this pull request as ready for review April 18, 2025 18:32
@jennifer-shehane
Copy link
Member

@astone123 Lint is failing here

@astone123 astone123 requested a review from ryanthemanuel April 28, 2025 13:03
@mschile mschile requested a review from Copilot April 29, 2025 02:30
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 introduces asynchronous initialization for Cypress Cloud Studio, ensuring the cloud bundle is always loaded and Studio is initialized without blocking project startup. Key changes include always capturing Studio’s init event, refactoring protocol setup using a new StudioLifecycleManager, and updating tests and related configuration to support the new initialization flow.

Reviewed Changes

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

Show a summary per file
File Description
packages/server/test/unit/cloud/studio_spec.ts Added flag “shouldEnableStudio” to test studio manager behavior
packages/server/test/unit/cloud/api/studio/get_and_initialize_studio_manager_spec.ts Updated environment variable handling and restoration for studio tests
packages/server/test/unit/StudioLifecycleManager_spec.ts Extensive tests for new StudioLifecycleManager functionality
packages/server/lib/socket-base.ts Updated socket event handling to register Studio readiness callbacks
packages/server/lib/routes.ts Modified Studio route initialization using a dedicated router
packages/server/lib/project-base.ts Reworked studio initialization and protocol setup using the lifecycle manager
packages/server/lib/modes/results.ts Removed obsolete config key from the results output
packages/server/lib/cloud/studio.ts Updated StudioManager setup to conditionally set status based on enable flag
packages/server/lib/cloud/api/studio/get_and_initialize_studio_manager.ts Passed through “shouldEnableStudio” flag to the studio manager setup
packages/server/lib/StudioLifecycleManager.ts New file encapsulating studio lifecycle management logic
packages/graphql/src/schemaTypes/objectTypes/gql-Query.ts Adjusted GraphQL resolve logic for studio status
packages/driver/src/util/config.ts Removed outdated config key checks
packages/data-context/src/data/coreDataShape.ts Updated core data shape to use the new lifecycle manager
packages/config/src/options.ts & snapshots Removed support for the obsolete “isStudioProtocolEnabled” flag
packages/app/src/runner/event-manager.ts Updated protocol-enabled state handling via studio:protocol:enabled event
packages/app/src/runner/SpecRunnerOpenMode.vue Adjusted UI display logic to reflect the new enabled status
packages/app/cypress/e2e/studio/studio.cy.ts Added new e2e test to simulate a hanging studio UI load scenario
Files not reviewed (1)
  • packages/graphql/schemas/schema.graphql: Language not supported

@astone123 astone123 merged commit a5ba8c4 into develop Apr 29, 2025
89 of 91 checks passed
@astone123 astone123 deleted the 10501-studio-telemetry branch April 29, 2025 13:37
@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.

5 participants