Skip to content

fix(workspace): notify about collections that fail to open in Workspa…#8719

Open
ravindra-bruno wants to merge 2 commits into
usebruno:mainfrom
ravindra-bruno:fix/bru-2508
Open

fix(workspace): notify about collections that fail to open in Workspa…#8719
ravindra-bruno wants to merge 2 commits into
usebruno:mainfrom
ravindra-bruno:fix/bru-2508

Conversation

@ravindra-bruno

@ravindra-bruno ravindra-bruno commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

[JIRA - BRU-2508]

Cause: When a workspace was opened, any local collection that couldn't be loaded, its folder had been moved or deleted, or the path held no valid collection config was silently discarded during resolution. Because it was dropped entirely, Workspace Home showed nothing, no notification fired, and the user had no way to see why it failed or to remove the stale entry.

Resolution: Instead of discarding the broken entry, it's now kept and flagged with a failure reason (either "not found" or "invalid"). On switching workspaces the user gets an error notification, the collection stays visible with a red "Missing" / "Failed to open" badge, clicking it explains the reason, and it can be removed from the workspace via the row menu. The flags are transient in-memory state, so nothing changes on disk.

Description

Contribution Checklist:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.

Publishing to New Package Managers

Please see here for more information.

Summary by CodeRabbit

  • New Features

    • Collections that can’t be opened are now surfaced in the UI with clear “Missing” or “Failed to open” status.
    • Notifications now distinguish missing vs invalid collections, and failed collections can be removed directly from the workspace.
    • When switching workspaces, collections that couldn’t be opened are reported with actionable error messaging.
  • Bug Fixes

    • Previously hidden/dropped collections are now retained and displayed with failure details instead of disappearing silently.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ea79d0aa-2e20-42cf-a541-42c2b4bf786c

📥 Commits

Reviewing files that changed from the base of the PR and between 257587b and b1c19c3.

📒 Files selected for processing (2)
  • packages/bruno-app/src/components/WorkspaceHome/WorkspaceOverview/CollectionsList/index.js
  • packages/bruno-electron/src/utils/workspace-config.js
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/bruno-app/src/components/WorkspaceHome/WorkspaceOverview/CollectionsList/index.js
  • packages/bruno-electron/src/utils/workspace-config.js

Walkthrough

Changes

Failed Collection Flow

Layer / File(s) Summary
Classify and retain collection failures
packages/bruno-electron/src/utils/workspace-config.js, packages/bruno-electron/tests/utils/workspace-config.spec.js
Missing and invalid collection paths are retained with failedToOpen and corresponding failure reasons, with tests covering both cases.
Handle failed collections during workspace switching
packages/bruno-app/src/providers/ReduxStore/slices/workspaces/actions.js
Workspace switching excludes known failures, accumulates newly failed or invalid paths, and displays an unopened-collection error summary.
Surface and remove failed collections
packages/bruno-app/src/components/WorkspaceHome/WorkspaceOverview/CollectionsList/index.js
The collection list displays failure badges, shows reason-specific open errors, and removes failed entries through the workspace removal action.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant WorkspaceConfig
  participant WorkspaceActions
  participant CollectionsList
  participant Toast
  WorkspaceConfig-->>WorkspaceActions: provide failedToOpen and failureReason
  WorkspaceActions->>WorkspaceActions: skip failed collections during workspace switch
  WorkspaceActions->>Toast: report unopened collection failures
  CollectionsList->>Toast: show collection-specific open failure
  CollectionsList->>WorkspaceActions: remove failed collection from workspace
Loading

Possibly related PRs

  • usebruno/bruno#8710: Matches the implementation for propagating and surfacing failed collection metadata.

Suggested reviewers: helloanoop

Poem

Missing paths now raise a flag,
Failed collections leave their tag.
Toasts explain what could not start,
Removal gives a cleaner chart.
Badges glow where errors grew—
Workspace flow knows what to do.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: surfacing and notifying when workspace collections fail to open.
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.
✨ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
packages/bruno-app/src/providers/ReduxStore/slices/workspaces/actions.js (1)

374-380: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add regression coverage for switch-time failure aggregation.

Cover previously failed workspace entries, openResult.failed, openResult.invalid, and both singular and plural toast messages in actions.spec.js. These branches can otherwise regress by reopening failed paths or silently omitting the notification.

As per coding guidelines, add or update tests for meaningful code changes and prioritize high-value failure-path coverage.

Also applies to: 395-402, 404-409

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/bruno-app/src/providers/ReduxStore/slices/workspaces/actions.js`
around lines 374 - 380, Add regression tests in actions.spec.js for the
workspace-switch flow covering previously failed entries, openResult.failed, and
openResult.invalid. Verify failed paths are not reopened or included in
collectionPaths, and assert the correct singular and plural toast messages for
each failure count.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/bruno-app/src/components/WorkspaceHome/WorkspaceOverview/CollectionsList/index.js`:
- Around line 80-81: Update the collection-mapping logic in CollectionsList so
wc.failedToOpen takes precedence over any loadedCollection for the same path.
Only return or use loadedCollection when !wc.failedToOpen; otherwise preserve
the failure metadata and prevent stale collection data from being mounted.

In `@packages/bruno-electron/src/utils/workspace-config.js`:
- Around line 566-575: Update getCollectionFailureReason so filesystem
exceptions are classified as not-found only when the error code is ENOENT or
ENOTDIR; return invalid for other failures such as EACCES. Preserve the existing
not-found result for missing or non-directory paths.

---

Nitpick comments:
In `@packages/bruno-app/src/providers/ReduxStore/slices/workspaces/actions.js`:
- Around line 374-380: Add regression tests in actions.spec.js for the
workspace-switch flow covering previously failed entries, openResult.failed, and
openResult.invalid. Verify failed paths are not reopened or included in
collectionPaths, and assert the correct singular and plural toast messages for
each failure count.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 493eabd4-ed47-49e2-8815-de3c114fc436

📥 Commits

Reviewing files that changed from the base of the PR and between bf40778 and 257587b.

📒 Files selected for processing (4)
  • packages/bruno-app/src/components/WorkspaceHome/WorkspaceOverview/CollectionsList/index.js
  • packages/bruno-app/src/providers/ReduxStore/slices/workspaces/actions.js
  • packages/bruno-electron/src/utils/workspace-config.js
  • packages/bruno-electron/tests/utils/workspace-config.spec.js

Comment thread packages/bruno-electron/src/utils/workspace-config.js
Comment on lines +403 to +409

if (unopened.length > 0) {
const message = unopened.length === 1
? `Collection could not be opened: ${unopened[0]}`
: `${unopened.length} collections could not be opened`;
toast.error(message);
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This toast would fires on every workspace switch, indented behaviour ?

Comment on lines +333 to +338
{collection.failedToOpen && (
<StatusBadge status="danger" size="xs">
{collection.failureReason === 'not-found' ? 'Missing' : 'Failed to open'}
</StatusBadge>
)}
{!isDefaultWorkspace && collection.isLoaded === false && !collection.failedToOpen && (

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There is an assertion for the Git badge on workspace overview (git-backed-collections.spec.ts), we can do the same for the new badges and their click behaviour.

Comment on lines +104 to +110
if (collection.failedToOpen) {
if (collection.failureReason === 'not-found') {
toast.error(`Collection "${collection.name}" could not be opened — not found at ${collection.pathname}`);
} else {
toast.error(`Collection "${collection.name}" could not be opened — no valid collection found at ${collection.pathname}`);
}
return;

@gopu-bruno gopu-bruno Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we match the toast style used in actions.js? Would keep the two surfaces consistent.

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