Repository navigation
fix(workspace-watcher): use workspace-environment IPC channels so env file changes hot-reload - #8370
Conversation
… events to match renderer expectations and add regression tests
WalkthroughThe Electron main process now emits workspace-environment IPC events for global environment file add, change, and delete actions. A Playwright regression suite and new workspace fixtures verify live environment list and variable updates after on-disk edits without restarting the app. ChangesWorkspace environment hot-reload
Sequence Diagram(s)sequenceDiagram
participant watcher as workspace-watcher.js
participant webContents as win.webContents
participant settings as Global Environments settings
watcher->>webContents: send main:workspace-environment-added/changed/deleted
webContents->>settings: update environment list and variables table
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
… events to match renderer expectations and add regression tests (usebruno#8370)
JIRA
Description
Workspace global-environment file changes (
<workspace>/environments/*.yml) were not reflected in the UI until the app was restarted. Editing a variable, adding a new env, or deleting one all required a relaunch.Root cause — channel mismatch between emitter and listener:
packages/bruno-electron/src/app/workspace-watcher.js) was sending:main:global-environment-addedmain:global-environment-changedmain:global-environment-deletedpackages/bruno-app/src/providers/App/useIpcEvents.js) only subscribed to:main:workspace-environment-addedmain:workspace-environment-changedmain:workspace-environment-deletedNo consumer existed for the
global-environment-*names anywhere in the codebase, so chokidar events were silently dropped and Redux never refreshed.Fix — rename the three
webContents.sendcalls inworkspace-watcher.jsto the channels the renderer already subscribes to.Test plan
Added
tests/environments/workspace-env-watcher/Playwright e2e covering all three event paths against a live workspace:add— writeBeta.ymlto disk, assert it appears in the Global Environments settings listchange(value edit) — rewriteAlpha.ymlwithmode: alpha-updated, assert the variable row updateschange(new variable) — appendhotReloadedtoAlpha.yml, assert the new row rendersunlink— deleteBeta.yml, assert it disappearsRun with: `npx playwright test tests/environments/workspace-env-watcher --project=default`
Summary by CodeRabbit
Bug Fixes
Tests