Skip to content

chore: cy prompt infrastructure #31748

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

Open
wants to merge 10 commits into
base: feat/cy-prompt
Choose a base branch
from

Conversation

ryanthemanuel
Copy link
Collaborator

@ryanthemanuel ryanthemanuel commented May 20, 2025

Additional details

This PR lays the ground work for consuming the cloud code that will be responsible for supporting cy.prompt()

Steps to test

How has the user experience changed?

PR Tasks

@ryanthemanuel ryanthemanuel changed the base branch from develop to feat/cy-prompt May 20, 2025 18:01
Copy link

cypress bot commented May 20, 2025

cypress    Run #62638

Run Properties:  status check passed Passed #62638  •  git commit dcd49e89df: PR comments
Project cypress
Branch Review ryanm/feat/cy-prompt-infra
Run status status check passed Passed #62638
Run duration 19m 45s
Commit git commit dcd49e89df: PR comments
Committer Ryan Manuel
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 10
Tests that did not run due to a developer annotating a test with .skip  Pending 1232
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 32164
View all changes introduced in this branch ↗︎
UI Coverage  45.56%
  Untested elements 191  
  Tested elements 164  
Accessibility  92.73%
  Failed rules  3 critical   9 serious   2 moderate   2 minor
  Failed elements 696  

@ryanthemanuel ryanthemanuel requested a review from mschile May 20, 2025 20:26
@ryanthemanuel ryanthemanuel self-assigned this May 20, 2025
@ryanthemanuel ryanthemanuel requested a review from mschile May 23, 2025 02:45
@mschile mschile requested a review from Copilot May 23, 2025 03:08
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 provides the foundational infrastructure for the new cy.prompt() command by pulling down, verifying, and loading a remotely hosted bundle, wiring in lifecycle managers, and enabling the experimental flag across server, driver, config, and docs.

  • Adds bundle download/extract helpers and cloud API calls for cy-prompt
  • Introduces CyPromptManager and CyPromptLifecycleManager for runtime orchestration
  • Registers the experimentalPromptCommand flag in config, driver, tests, and documentation

Reviewed Changes

Copilot reviewed 43 out of 43 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/server/lib/cloud/cy-prompt/ensure_cy_prompt_bundle.ts Fetches or copies and extracts the cy-prompt bundle
packages/server/lib/cloud/cy-prompt/CyPromptManager.ts Invokes methods on dynamically loaded cy-prompt server scripts
packages/server/lib/cloud/cy-prompt/CyPromptLifecycleManager.ts Orchestrates session creation, bundle setup, and manager ready
packages/server/lib/cloud/api/cy-prompt/post_cy_prompt_session.ts Implements POST to start a cy-prompt session
packages/server/lib/cloud/api/cy-prompt/get_cy_prompt_bundle.ts Downloads and verifies the signed cy-prompt bundle
packages/data-context/src/data/coreDataShape.ts Adds cyPromptLifecycleManager to the shared data context shape
packages/driver/src/cy/commands/prompt/prompt-driver-types.ts Defines driver interface for cy.prompt
packages/driver/src/cy/commands/prompt/index.ts Implements the prompt command using module federation runtime
packages/driver/src/cy/commands/index.ts Registers the prompt command under driver commands
packages/driver/package.json Adds @module-federation/runtime dependency
packages/driver/cypress/e2e/commands/prompt.cy.ts Basic end-to-end smoke test for cy.prompt
packages/driver/cypress/e2e/e2e/origin/commands/misc.cy.ts Updated command list to include prompt
packages/driver/cypress.config.ts Enables experimentalPromptCommand
packages/config/src/options.ts Introduces new experimental flag
packages/config/test/project/utils.spec.ts Updates default and public config keys tests
packages/config/snapshots/index.spec.ts.js Updates snapshots to include the new flag
packages/frontend-shared/src/locales/en-US.json Adds UI copy for the new experimental flag
guides/cy-prompt-development.md Documents local and remote development workflows for cy.prompt
Comments suppressed due to low confidence (1)

packages/driver/cypress/e2e/commands/prompt.cy.ts:7

  • [nitpick] This test only verifies that the command does not throw—consider adding assertions on expected side effects or backend calls to improve coverage.
cy.prompt('Hello, world!')

Comment on lines +56 to +62
throw new Error('Unable to get studio signature')
}

const verified = await verifySignatureFromFile(bundlePath, responseSignature)

if (!verified) {
throw new Error('Unable to verify studio signature')
Copy link
Preview

Copilot AI May 23, 2025

Choose a reason for hiding this comment

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

The error message below refers to 'studio signature' but this is for cy-prompt; update it to reference 'cy-prompt signature' to avoid confusion.

Suggested change
throw new Error('Unable to get studio signature')
}
const verified = await verifySignatureFromFile(bundlePath, responseSignature)
if (!verified) {
throw new Error('Unable to verify studio signature')
throw new Error('Unable to get cy-prompt signature')
}
const verified = await verifySignatureFromFile(bundlePath, responseSignature)
if (!verified) {
throw new Error('Unable to verify cy-prompt signature')

Copilot uses AI. Check for mistakes.

const verified = await verifySignatureFromFile(bundlePath, responseSignature)

if (!verified) {
throw new Error('Unable to verify studio signature')
Copy link
Preview

Copilot AI May 23, 2025

Choose a reason for hiding this comment

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

The error thrown here mentions 'Unable to verify studio signature'—it should reference 'cy-prompt signature' for accuracy.

Suggested change
throw new Error('Unable to verify studio signature')
throw new Error('Unable to verify cy-prompt signature')

Copilot uses AI. Check for mistakes.


- Set:
- `CYPRESS_INTERNAL_ENV=<environment>` (e.g. `staging` or `production` if you want to hit those deployments of `cypress-services` or `development` if you want to hit a locally running version of `cypress-services`)
```
Copy link
Preview

Copilot AI May 23, 2025

Choose a reason for hiding this comment

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

There is an unmatched code fence here that breaks the markdown list; remove or properly close the block so the document renders correctly.

Copilot uses AI. Check for mistakes.

Comment on lines +58 to +59
// TODO: handle this better
throw new Error('CyPromptDriver not found')
Copy link
Preview

Copilot AI May 23, 2025

Choose a reason for hiding this comment

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

Catching any error and rethrowing a generic 'CyPromptDriver not found' hides the original error—consider rethrowing or logging the original exception for better debugging.

Suggested change
// TODO: handle this better
throw new Error('CyPromptDriver not found')
throw new Error('CyPromptDriver not found', { cause: error })

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants