Skip to content

Feature(size/L): BRU-2542 Choose environments to include and show versions in the Generate Documentation modal - #8268

Merged
bijin-bruno merged 8 commits into
usebruno:mainfrom
sachin-bruno:sachin-bruno/feature-choose-environments
Jun 19, 2026
Merged

bijin-bruno merged 8 commits into
usebruno:mainfrom
sachin-bruno:sachin-bruno/feature-choose-environments

Conversation

@sachin-bruno

@sachin-bruno sachin-bruno commented Jun 15, 2026 •

Copy link
Copy Markdown
Contributor

Description

Problem
Generated docs include every environment in the collection, with no way to scope which envs ship in the exported docs, so internal, local, or staging envs leak into docs shared externally. The modal also gives no indication of which collection version the docs are generated from.

https://usebruno.atlassian.net/browse/BRU-2542

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.

image

Summary by CodeRabbit

Release Notes

  • New Features

    • Added an environment-selection UI to collection documentation generation with virtualized rows, tri-state “Select All,” and environment filtering that updates embedded generated output.
    • Added a configuration card showing the normalized collection version (with v prefix) plus folder/request counts.
  • Style / UX

    • Improved the error modal by constraining content height and enabling scrolling.
  • Quality

    • Added utilities and expanded tests/fixtures to verify version/count formatting and full environment-selection scenarios (including none selected).

@coderabbitai

coderabbitai Bot commented Jun 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: 7ad28ca2-40ce-4879-a1b2-734131975b9c

📥 Commits

Reviewing files that changed from the base of the PR and between 454b5c1 and e7270a2.

📒 Files selected for processing (5)
  • packages/bruno-app/src/components/Sidebar/Collections/Collection/GenerateDocumentation/CollectionVersionInfo/index.js
  • packages/bruno-app/src/components/Sidebar/Collections/Collection/GenerateDocumentation/EnvironmentSelectionList/index.js
  • packages/bruno-app/src/utils/collections/index.js
  • packages/bruno-app/src/utils/collections/index.spec.js
  • tests/utils/page/locators.ts
💤 Files with no reviewable changes (1)
  • packages/bruno-app/src/utils/collections/index.js
🚧 Files skipped from review as they are similar to previous changes (2)
  • tests/utils/page/locators.ts
  • packages/bruno-app/src/components/Sidebar/Collections/Collection/GenerateDocumentation/EnvironmentSelectionList/index.js

Walkthrough

Adds getCollectionItemCounts utility, a CollectionVersionInfo presentational component, and a virtualized EnvironmentSelectionList component. These are wired into GenerateDocumentation to display version/item metadata and let users filter which environments are embedded in the exported HTML docs. A scrollable pre fix is applied to IpcErrorModal.

Changes

Generate Documentation: version info and environment selection

Layer / File(s) Summary
Collection version and item-count utilities
packages/bruno-app/src/utils/collections/index.js, packages/bruno-app/src/utils/collections/index.spec.js
Adds getCollectionItemCounts (recursive folder/request counter) with full Jest test coverage.
CollectionVersionInfo and EnvironmentSelectionList components
packages/bruno-app/src/components/Sidebar/Collections/Collection/GenerateDocumentation/CollectionVersionInfo/index.js, packages/bruno-app/src/components/Sidebar/Collections/Collection/GenerateDocumentation/EnvironmentSelectionList/index.js
New memoized CollectionVersionInfo renders formatted v{semver} version and pluralized counts; new memoized EnvironmentSelectionList renders a react-virtuoso checkbox list of environments with O(1) selection lookup via Set memoization and tri-state "Select All" header.
GenerateDocumentation StyledWrapper redesign
packages/bruno-app/src/components/Sidebar/Collections/Collection/GenerateDocumentation/StyledWrapper.js
Removes .preview-container and introduces .config-card subtree with .version-info typography, .card-divider, and .env-section / .env-row flex layout and row styling.
GenerateDocumentation modal state and generate logic
packages/bruno-app/src/components/Sidebar/Collections/Collection/GenerateDocumentation/index.js
Adds currentVersion, folderCount, requestCount, deselectedEnvUids state, and toggleEnv callback; filters environments by selection and injects version into openCollection.info on generate; replaces static preview with CollectionVersionInfo and EnvironmentSelectionList in modal UI.
E2E tests: env selection and version display
tests/utils/page/actions.ts, tests/collection/generate-docs/generate-docs.spec.ts, tests/utils/page/locators.ts, tests/collection/generate-docs/fixtures/collection/environments/*.bru
Extends generateCollectionDocs with optional beforeGenerate callback hook, adds locators for version and environment UI, fixture baseUrl vars, and tests asserting version formatting, env list display, default inclusion, and selective exclusion plus tri-state "Select All" behavior.

IpcErrorModal pre-element overflow fix

Layer / File(s) Summary
IpcErrorModal scrollable pre-element
packages/bruno-app/src/components/Errors/IpcErrorModal/StyledWrapper.js
Adds max-height: 60vh and overflow: auto to the pre block to prevent unbounded growth and enable scrolling.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant GenerateDocumentation
  participant EnvironmentSelectionList
  participant handleGenerate

  rect rgba(70, 130, 180, 0.5)
    Note over User, GenerateDocumentation: Modal open
    User->>GenerateDocumentation: opens modal
    GenerateDocumentation->>EnvironmentSelectionList: environments + selectedEnvUids
  end

  rect rgba(144, 238, 144, 0.5)
    Note over User, EnvironmentSelectionList: Env toggle
    User->>EnvironmentSelectionList: unchecks "Development"
    EnvironmentSelectionList->>GenerateDocumentation: toggleEnv(uid)
    GenerateDocumentation->>GenerateDocumentation: adds uid to deselectedEnvUids
  end

  rect rgba(255, 165, 0, 0.5)
    Note over User, handleGenerate: Generate
    User->>GenerateDocumentation: clicks Generate
    GenerateDocumentation->>handleGenerate: selectedEnvUids + currentVersion
    handleGenerate->>handleGenerate: filters collectionCopy.environments
    handleGenerate->>handleGenerate: merges currentVersion into openCollection.info
    handleGenerate-->>User: HTML export with filtered envs
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • usebruno/bruno#6583: Directly extends the same GenerateDocumentation modal component with environment selection and version injection capabilities.

Suggested labels

size/L

Suggested reviewers

  • helloanoop
  • lohit-bruno
  • bijin-bruno
  • naman-bruno
  • sid-bruno

Poem

🗂️ Versions padded, folders counted with care,
Environments checked in a virtuoso list,
The docs generator now knows what's there —
Choose your envs, no release gets missed.
With a scrollable pre and a config card neat,
Bruno's doc exports are now complete! 🚀

🚥 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 accurately describes the two main features introduced: environment selection filtering and version display in the Generate Documentation modal.
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.

✏️ 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 and usage tips.

@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: 3

🤖 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/Sidebar/Collections/Collection/GenerateDocumentation/CollectionVersionInfo/index.js`:
- Around line 15-22: The version metadata block containing the version label,
version value, and version summary lacks data-testid attributes required for
stable Playwright E2E test assertions. Add data-testid hooks to each testable
element in this section: the outer version-info container div, the version-line
div containing the label and formatted version value, the version-label span,
the version-value span that displays formatCollectionVersion(version), and the
version-summary paragraph that renders the folder and request counts. Use
descriptive testid values that clearly identify each element's purpose for
reliable test targeting.

In `@packages/bruno-app/src/utils/collections/index.js`:
- Around line 933-938: In the `getCollectionItemCounts` function, the
`requestCount` calculation on line 937 includes transient requests but the
export flow excludes them. Modify the filter for requestCount to exclude
transient requests alongside the existing `isItemARequest` check, by adding a
condition that filters out items with transient properties set to true. This
ensures the displayed request counts in the UI match the actual content that
gets exported.

In `@tests/collection/generate-docs/generate-docs.spec.ts`:
- Around line 229-233: The test for generatedEnvironmentNames currently only
checks for the presence of specific environment names using individual toContain
and not.toContain assertions, but does not verify that the complete set matches
exactly what is expected. For this security-sensitive functionality, replace the
individual inclusion/exclusion checks with a single assertion that verifies the
exact array of environment names returned by generatedEnvironmentNames(content)
matches the expected set precisely, ensuring any unexpected environments would
cause the test to fail.
🪄 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: f6d99d4e-c288-4e6b-9187-a4a39726e6ba

📥 Commits

Reviewing files that changed from the base of the PR and between b73bf9d and 388c004.

📒 Files selected for processing (13)
  • packages/bruno-app/src/components/Errors/IpcErrorModal/StyledWrapper.js
  • packages/bruno-app/src/components/Sidebar/Collections/Collection/GenerateDocumentation/CollectionVersionInfo/index.js
  • packages/bruno-app/src/components/Sidebar/Collections/Collection/GenerateDocumentation/EnvironmentSelectionList/index.js
  • packages/bruno-app/src/components/Sidebar/Collections/Collection/GenerateDocumentation/StyledWrapper.js
  • packages/bruno-app/src/components/Sidebar/Collections/Collection/GenerateDocumentation/index.js
  • packages/bruno-app/src/utils/collections/index.js
  • packages/bruno-app/src/utils/collections/index.spec.js
  • tests/collection/generate-docs/fixtures/collection/environments/Development.bru
  • tests/collection/generate-docs/fixtures/collection/environments/Production.bru
  • tests/collection/generate-docs/fixtures/collection/environments/Staging.bru
  • tests/collection/generate-docs/generate-docs.spec.ts
  • tests/utils/page/actions.ts
  • tests/utils/page/locators.ts

Comment thread tests/utils/page/actions.ts Resolved
Comment thread tests/utils/page/locators.ts Resolved
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.

3 participants