Skip to content

fix(variables): show folder scope for folder vars used in folder settings - #9679

Merged
sachin-thakur-bruno merged 1 commit into
usebruno:mainfrom
pooja-bruno:fix/folder-var-scope-in-folder-settings
Oct 28, 2026
Merged

sachin-thakur-bruno merged 1 commit into
usebruno:mainfrom
pooja-bruno:fix/folder-var-scope-in-folder-settings

Conversation

@pooja-bruno

@pooja-bruno pooja-bruno commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Description

BRU-4903

Fixes the scope shown in the variable info popup for folder variables used in the same folder's settings.

Problem

Hovering {{folderVar}} in a folder's Auth tab showed the scope as Request, and the source link did not open the folder Vars tab.

Fix

getVariableScope skips the request-scope check when the item is a folder, so folder vars resolve as folder. Added a unit test.

Screenshots

Before
image

After
image

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 tested these changes locally and confirmed they work as expected.
  • 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.
  • I've run the claude code review skill locally.

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

  • Bug Fixes
    • Variable lookup for folders now checks folder-level variables before continuing to other scopes, rather than using request-level variables. This helps ensure folders resolve their own variable values correctly.
    • Added coverage confirming that a variable defined on the selected folder is identified as a folder-scoped value.

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between e720803 and 9cff2e0.

Files selected for processing: 2
  • packages/bruno-app/src/utils/collections/index.js
  • packages/bruno-app/src/utils/collections/index.spec.js

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

getVariableScope skips request-variable lookup for folders. A test verifies that a variable defined on the selected folder resolves with folder scope data.

Changes

Folder variable scope

Layer / File(s) Summary
Folder scope lookup
packages/bruno-app/src/utils/collections/index.js, packages/bruno-app/src/utils/collections/index.spec.js
Folder items skip request-variable lookup. The test checks that the selected folder variable resolves with type: 'folder' and includes the folder in scopeInfo.data.

Priority: Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Possibly related PRs

  • usebruno/bruno#9532: Updates getVariableScope behavior for folder-variable scope resolution used by sensitive-field tooltips.

Suggested labels: size/XS

Suggested reviewers: sachin-thakur-bruno, sid-bruno

Merge Risk: Minimal · up to 9cff2

The change correctly resolves folder variables as folder-scoped, and the focused test covers this behavior.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: showing the folder scope for variables used in folder settings.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
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.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Folders keep their scope in view
Request lookup steps aside
A test confirms the folder
Its variable resolves there
Scope data points the way

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

@sachin-thakur-bruno sachin-thakur-bruno left a comment

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.

LGTM

@sachin-thakur-bruno
sachin-thakur-bruno merged commit 4d7caae into usebruno:main Oct 28, 2026
18 of 19 checks passed
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