-
Notifications
You must be signed in to change notification settings - Fork 3.3k
internal: (studio) set up hot reloading for the studio bundle #31796
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
Conversation
cypress
|
Project |
cypress
|
Branch Review |
ryanm/internal/hot-reloading
|
Run status |
|
Run duration | 18m 59s |
Commit |
|
Committer | Ryan Manuel |
View all properties for this run ↗︎ |
Test results | |
---|---|
|
0
|
|
13
|
|
1232
|
|
0
|
|
32181
|
View all changes introduced in this branch ↗︎ |
UI Coverage
45.83%
|
|
---|---|
|
190
|
|
165
|
Accessibility
92.74%
|
|
---|---|
|
3 critical
9 serious
2 moderate
2 minor
|
|
697
|
…/test/unit/cloud/get_cloud_metadata_spec.ts
…est/unit/cloud/get_cloud_metadata_spec.ts
…/test/unit/cloud/get_cloud_metadata_spec.ts
…est/unit/cloud/get_cloud_metadata_spec.ts
…/test/unit/cloud/get_cloud_metadata_spec.ts
…est/unit/cloud/get_cloud_metadata_spec.ts
There was a problem hiding this 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 refactors the studio bundle loading and enables hot reloading of the local studio bundle by:
- Introducing
ensureStudioBundle
andgetCloudMetadata
helpers and updating theStudioLifecycleManager
to use them. - Updating tooling snapshots, scripts, and the pack hook to reference the new studio files.
- Adding file‐watching logic in Gulp tasks and the lifecycle manager for local‐path‐based development.
Reviewed Changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 5 comments.
Show a summary per file
File | Description |
---|---|
tooling/v8-snapshot/cache/linux/snapshot-meta.json | Replaced old studio manager snapshot entries with new studio files |
tooling/v8-snapshot/cache/darwin/snapshot-meta.json | Same updates for Darwin snapshots |
scripts/gulp/tasks/gulpCloudDeliveredTypes.ts | Switched to ensureStudioBundle and added chokidar watchers |
scripts/after-pack-hook.js | Updated paths and validations for new studio files |
packages/server/lib/cloud/studio/ensure_studio_bundle.ts | New helper for downloading and extracting the studio bundle |
packages/server/lib/cloud/studio/StudioLifecycleManager.ts | Refactored to use new helpers, add caching, and hot-reload logic |
packages/server/lib/cloud/get_cloud_metadata.ts | New utility to fetch cloud URL and headers |
packages/server/lib/project-base.ts | Switched to getCloudMetadata for unified cloud config |
Various test files in packages/server/test/unit/cloud/studio |
Adjusted imports and added tests for new modules |
packages/server/test/unit/cloud/studio/StudioLifecycleManager_spec.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not seeing hot updates for server code, for instance in spec-writer.ts
, but I do see them for code in the app
folder. Is this expected, or is there something up with my environment maybe
We worked through this offline. There were some issues on @astone123's machine with watching files in general. |
StudioLifecycleManager.watcher = chokidar.watch(path.join(process.env.CYPRESS_LOCAL_STUDIO_PATH, 'server', 'index.js'), { | ||
awaitWriteFinish: true, | ||
}).on('change', async () => { | ||
await this.studioManager?.destroy() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a console.log
here so we have an indicator that the server has reloaded.
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Additional details
This PR sets up hot reloading for the cloud delivered studio code when
CYPRESS_STUDIO_LOCAL_PATH
is set. When that environment variable is set, we set up a watcher for the server file and trigger the studio life cycle manager loading promise when that file changes. This promise will eventually resolve with the new studio code and notify the appropriate listeners of the update (note that we don't clean up the listeners when the environment variable is set). Some additional code streamlining has also been done to make this watching a little bit easier to implement.Steps to test
How has the user experience changed?
PR Tasks
cypress-documentation
?type definitions
?