Skip to content

fix(workspace-watcher): use workspace-environment IPC channels so env file changes hot-reload - #8370

Merged
vijayh-bruno merged 1 commit into
usebruno:mainfrom
sanish-bruno:fix/workspace-env-watcher-emitter
Jun 26, 2026
Merged

vijayh-bruno merged 1 commit into
usebruno:mainfrom
sanish-bruno:fix/workspace-env-watcher-emitter

Conversation

@sanish-bruno

@sanish-bruno sanish-bruno commented Jun 25, 2026 •

Copy link
Copy Markdown
Collaborator

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:

  • Emitter (packages/bruno-electron/src/app/workspace-watcher.js) was sending:
    • main:global-environment-added
    • main:global-environment-changed
    • main:global-environment-deleted
  • Listener (packages/bruno-app/src/providers/App/useIpcEvents.js) only subscribed to:
    • main:workspace-environment-added
    • main:workspace-environment-changed
    • main:workspace-environment-deleted

No 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.send calls in workspace-watcher.js to 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 — write Beta.yml to disk, assert it appears in the Global Environments settings list
  • change (value edit) — rewrite Alpha.yml with mode: alpha-updated, assert the variable row updates
  • change (new variable) — append hotReloaded to Alpha.yml, assert the new row renders
  • unlink — delete Beta.yml, assert it disappears

Run with: `npx playwright test tests/environments/workspace-env-watcher --project=default`

Summary by CodeRabbit

  • Bug Fixes

    • Workspace environment changes now update in the app immediately when files are added, edited, or deleted.
    • Environment lists and variable values refresh live without restarting the application.
  • Tests

    • Added regression coverage for live workspace environment updates in the UI.

… events to match renderer expectations and add regression tests
@coderabbitai

coderabbitai Bot commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The 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.

Changes

Workspace environment hot-reload

Layer / File(s) Summary
IPC channel rename
packages/bruno-electron/src/app/workspace-watcher.js
win.webContents.send now emits main:workspace-environment-added, main:workspace-environment-changed, and main:workspace-environment-deleted for environment file lifecycle events.
Regression fixtures and hot-reload test
tests/environments/workspace-env-watcher/workspace-env-watcher.spec.ts, tests/environments/workspace-env-watcher/fixtures/workspace/*, tests/environments/workspace-env-watcher/init-user-data/preferences.json
The Playwright suite seeds workspace, collection, environment, and preference fixtures, then writes, edits, and deletes environment files to verify live updates in the Global Environments UI.

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • helloanoop
  • lohit-bruno
  • bijin-bruno

Poem

A watcher woke with a renamed chime,
Beta bloomed in test-space time.
Alpha shifted, variables grew,
and the UI hummed the truth anew. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: renaming workspace-watcher IPC channels to support environment hot-reload.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sanish-bruno sanish-bruno changed the title fix(workspace-watcher): update IPC channel names for environment file… fix(workspace-watcher): use workspace-environment IPC channels so env file changes hot-reload Jun 25, 2026
@vijayh-bruno
vijayh-bruno merged commit 7756564 into usebruno:main Jun 26, 2026
18 of 20 checks passed
abhishekp-bruno pushed a commit to abhishekp-bruno/bruno that referenced this pull request Jun 29, 2026
… events to match renderer expectations and add regression tests (usebruno#8370)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants