Repository navigation
fix(ui): correct “modified” indicator state across collection, folder, request, and presets/auth tabs (#3386) - #8027
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughCentralizes auth-inheritance logic, adds preset request-type constants and BrunoPresets types, updates filestore parsing and fixtures, wires effective-auth detection into request panes and settings for StatusDot indicators, and adds tests and test ids validating behavior. ChangesAuth Inheritance and Presets Indicators
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 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 |
There was a problem hiding this comment.
Actionable comments posted: 7
🤖 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/RequestPane/GraphQLRequestPane/index.js`:
- Line 26: The auth-resolution logic in GraphQLRequestPane incorrectly filters
out the string 'none', causing a parent folder explicitly set to No Auth to be
ignored and inheritance to continue; update the functions/blocks around the
auth-dot computation (the code handling environment/auth lookup—see references
to findEnvironmentInCollection and getTreePathFromCollectionToItem and the auth
filtering at lines ~176-202 and 184) to stop excluding 'none' from consideration
and instead treat 'none' as a valid resolved value that should short-circuit
inheritance and result in no auth indicator; ensure both places where auth
values are filtered/checked treat 'none' as an explicit value (not
undefined/null) so the parent folder's No Auth is respected.
In `@packages/bruno-app/src/components/RequestPane/GrpcRequestPane/index.js`:
- Around line 11-13: The auth-resolution logic in GrpcRequestPane incorrectly
skips ancestor folders with auth.mode === 'none', allowing collection-level auth
to leak through; update the helper(s) that use getTreePathFromCollectionToItem /
getPropertyFromDraftOrRequest so that when traversing ancestor folders an
auth.mode of 'none' is treated as the effective auth (i.e. stop traversal and
return 'none' instead of falling through to parent/collection auth). Apply the
same change to the other helper block around lines 59-74 so parent-folder 'none'
is consistently honored.
In `@packages/bruno-app/src/components/RequestPane/WSRequestPane/index.js`:
- Around line 5-10: The current resolver in WSRequestPane uses
getPropertyFromDraftOrRequest and getTreePathFromCollectionToItem but fails to
stop inheritance when an ancestor folder has folderAuth.mode === 'none'; update
the logic to call the shared auth resolver (the same function used elsewhere in
the app) instead of the ad-hoc walk so that if any ancestor folder has
folderAuth.mode === 'none' you short-circuit and return no auth; specifically
replace the current manual inheritance checks in WSRequestPane with a call to
the shared resolver and/or add an explicit check that inspects folderAuth.mode
=== 'none' on the tree path returned by getTreePathFromCollectionToItem and
stops propagation (no fallthrough to collection root), so the tab indicator and
auth view remain in sync.
In `@packages/bruno-filestore/src/formats/yml/parseCollection.ts`:
- Around line 39-40: The preset fields requestType and requestUrl are currently
copied directly from YAML and may be non-string types; update the parsing in
parseCollection (where the local presets object is mapped into
brunoConfig.presets) to coerce these values to strings at parse time (e.g.,
replace direct references to presets.request.type and presets.request.url with a
string-coercion that falls back to '' for null/undefined/non-string), ensuring
requestType and requestUrl always become '' or a proper string to avoid leaking
invalid types downstream.
In `@packages/bruno-filestore/src/formats/yml/tests/parseCollection.spec.js`:
- Around line 8-51: The tests in this spec (describe 'yml parseCollection -
presets', the it blocks that call parseCollection(loadFixture(...)), and all
expect/assert lines) are missing trailing semicolons; update every statement in
this file (including const declarations like const { brunoConfig } =
parseCollection(...), expect(...) lines, and closing statements in each it
block) to include a semicolon so the file consistently follows the repo's
"always use semicolons" rule.
In `@tests/collection/presets-indicator.spec.ts`:
- Around line 5-71: The file lacks semicolons on many statements (e.g., the
top-level test.describe call, const collectionName declaration, let presetsTab,
all await expressions within test.step blocks, and expect/assert lines); update
the spec to terminate each statement with a semicolon to match repo formatting
rules—add semicolons after declarations (collectionName, presetsTab), after each
await line (createCollection(...);, presetsTab.click();, expect(...) assertions;
etc.), and after all standalone expressions inside the test and test.step blocks
so every statement (including calls to createTmpDir, page.locator/... checks,
click(), fill(), and expect(...) calls) ends with a semicolon.
- Around line 6-8: The cleanup currently runs in test.afterAll using the
test-scoped page fixture (closeAllCollections(page)), which is invalid because
page isn't available at worker scope; change the hook to test.afterEach(async ({
page }) => { await closeAllCollections(page); }) so each test's page is cleaned
up, or if you truly need a single afterAll, switch to using the browser fixture
to create a page (e.g., const page = await browser.newPage()) then call
closeAllCollections(page) and close the page; update the hook surrounding
closeAllCollections accordingly.
🪄 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: 3fc0510f-b926-4a20-9fb0-f92c00ae694f
📒 Files selected for processing (24)
packages/bruno-app/src/components/CollectionSettings/index.jspackages/bruno-app/src/components/FolderSettings/Auth/index.jspackages/bruno-app/src/components/RequestPane/Auth/index.jspackages/bruno-app/src/components/RequestPane/GraphQLRequestPane/index.jspackages/bruno-app/src/components/RequestPane/GrpcRequestPane/GrpcAuth/index.jspackages/bruno-app/src/components/RequestPane/GrpcRequestPane/index.jspackages/bruno-app/src/components/RequestPane/HttpRequestPane/index.jspackages/bruno-app/src/components/RequestPane/WSRequestPane/WSAuth/index.jspackages/bruno-app/src/components/RequestPane/WSRequestPane/index.jspackages/bruno-app/src/utils/auth/index.jspackages/bruno-app/src/utils/common/constants.jspackages/bruno-converters/src/opencollection/bruno-to-opencollection.tspackages/bruno-converters/src/opencollection/opencollection-to-bruno.tspackages/bruno-converters/src/opencollection/types.tspackages/bruno-filestore/src/formats/yml/parseCollection.tspackages/bruno-filestore/src/formats/yml/parseFolder.tspackages/bruno-filestore/src/formats/yml/tests/fixtures/presets/empty-request.ymlpackages/bruno-filestore/src/formats/yml/tests/fixtures/presets/no-presets.ymlpackages/bruno-filestore/src/formats/yml/tests/fixtures/presets/no-request-key.ymlpackages/bruno-filestore/src/formats/yml/tests/fixtures/presets/type-only-realistic.ymlpackages/bruno-filestore/src/formats/yml/tests/fixtures/presets/with-type-and-url.ymlpackages/bruno-filestore/src/formats/yml/tests/parseCollection.spec.jspackages/bruno-filestore/src/types.tstests/collection/presets-indicator.spec.ts
There was a problem hiding this comment.
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/FolderSettings/index.js`:
- Around line 35-36: The folder Auth indicator currently uses the raw auth mode
(const auth = get(folderRoot, 'request.auth.mode')) which treats 'inherit' as
active; change it to use the effective auth resolution instead: compute an
effective mode (e.g., const effectiveAuth = get(folderRoot,
'request.auth.effectiveMode') or call the existing
resolveEffectiveAuth/resolveAuth helper if present) and then set hasAuth =
effectiveAuth && effectiveAuth !== AUTH_MODES.NONE so the dot only shows when
the resolved/effective auth is not NONE; update the references to auth/hasAuth
in this component to use effectiveAuth and the revised hasAuth check.
In `@packages/bruno-app/src/utils/auth/index.js`:
- Line 82: The auth lookup for items currently sets const auth = item?.draft ?
get(item, 'draft.request.auth') : get(item, 'request.auth') which misses folder
auth stored at root.request.auth; update the expression to fall back to
get(item, 'root.request.auth') when request.auth is undefined (mirroring the
pattern used earlier around the lines that check draft vs request vs root), so
that folder items resolve their auth and the subsequent inheritance logic (the
code referencing auth after this assignment) runs correctly.
- Line 64: The ancestor-folder auth lookup in resolveInheritedAuth currently
uses get(i, 'root.request.auth') and thus ignores unsaved draft changes; update
the logic where folderAuth is computed to first check i?.draft and, if present,
read from the draft path (e.g., 'draft.request.auth') otherwise fall back to
'root.request.auth' (use the same safe get helper) so that resolveInheritedAuth
and any traversal over ancestor items respect draft auth overrides.
🪄 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: 65ba6618-f93b-4366-a859-a2ef06018955
📒 Files selected for processing (9)
packages/bruno-app/src/components/FolderSettings/index.jspackages/bruno-app/src/components/RequestPane/GraphQLRequestPane/index.jspackages/bruno-app/src/components/RequestPane/GrpcRequestPane/GrpcAuth/index.jspackages/bruno-app/src/components/RequestPane/GrpcRequestPane/index.jspackages/bruno-app/src/components/RequestPane/HttpRequestPane/index.jspackages/bruno-app/src/components/RequestPane/WSRequestPane/WSAuth/index.jspackages/bruno-app/src/components/RequestPane/WSRequestPane/index.jspackages/bruno-app/src/utils/auth/index.jspackages/bruno-app/src/utils/common/constants.js
🚧 Files skipped from review as they are similar to previous changes (4)
- packages/bruno-app/src/utils/common/constants.js
- packages/bruno-app/src/components/RequestPane/GrpcRequestPane/GrpcAuth/index.js
- packages/bruno-app/src/components/RequestPane/HttpRequestPane/index.js
- packages/bruno-app/src/components/RequestPane/WSRequestPane/WSAuth/index.js
There was a problem hiding this comment.
♻️ Duplicate comments (2)
packages/bruno-app/src/utils/auth/index.js (2)
82-82:⚠️ Potential issue | 🟠 Major | ⚡ Quick winAdd folder-shape fallback in
hasEffectiveAuth.Line 82 misses
root.request.authfallback for folder items, which can incorrectly report no effective auth.Proposed fix
- const auth = item?.draft ? get(item, 'draft.request.auth') : get(item, 'request.auth'); + const auth = item?.draft + ? get(item, 'draft.request.auth') + : (get(item, 'request.auth') ?? get(item, 'root.request.auth'));🤖 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/utils/auth/index.js` at line 82, The current assignment for auth in hasEffectiveAuth only checks draft.request.auth and request.auth and misses folder-level auth (root.request.auth); update the logic in hasEffectiveAuth (where auth is computed) to fall back to get(item, 'root.request.auth') for folder items (or when request.auth is absent), so auth = item?.draft ? get(item, 'draft.request.auth') : (get(item, 'request.auth') || get(item, 'root.request.auth')); ensure you reference the hasEffectiveAuth function and the auth variable when making the change.
64-64:⚠️ Potential issue | 🟠 Major | ⚡ Quick winUse draft-aware folder auth when resolving ancestor inheritance.
Line 64 ignores unsaved folder draft auth, so effective auth can be stale while editing.
Proposed fix
- const folderAuth = get(i, 'root.request.auth'); + const folderAuth = i?.draft ? get(i, 'draft.request.auth') : get(i, 'root.request.auth');🤖 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/utils/auth/index.js` at line 64, The code currently reads folder auth with get(i, 'root.request.auth') which ignores unsaved draft auth; update the resolution to prefer draft-aware auth by checking root.request.draft.auth first and falling back to root.request.auth when absent (i.e., use the draft value if present for folderAuth and any ancestor inheritance logic), and update the symbol(s) folderAuth and the ancestor-resolution logic that uses i/root.request to use this draft-first lookup.
🤖 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.
Duplicate comments:
In `@packages/bruno-app/src/utils/auth/index.js`:
- Line 82: The current assignment for auth in hasEffectiveAuth only checks
draft.request.auth and request.auth and misses folder-level auth
(root.request.auth); update the logic in hasEffectiveAuth (where auth is
computed) to fall back to get(item, 'root.request.auth') for folder items (or
when request.auth is absent), so auth = item?.draft ? get(item,
'draft.request.auth') : (get(item, 'request.auth') || get(item,
'root.request.auth')); ensure you reference the hasEffectiveAuth function and
the auth variable when making the change.
- Line 64: The code currently reads folder auth with get(i, 'root.request.auth')
which ignores unsaved draft auth; update the resolution to prefer draft-aware
auth by checking root.request.draft.auth first and falling back to
root.request.auth when absent (i.e., use the draft value if present for
folderAuth and any ancestor inheritance logic), and update the symbol(s)
folderAuth and the ancestor-resolution logic that uses i/root.request to use
this draft-first lookup.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 9cd4c4f6-ef59-410b-85bd-5f58424aa4bb
📒 Files selected for processing (1)
packages/bruno-app/src/utils/auth/index.js
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@tests/auth/auth-mode/effective-auth-mode.spec.ts`:
- Line 86: Remove the debug breakpoint call page.pause() from the E2E test so it
no longer blocks CI; locate the usage of page.pause() in the
effective-auth-mode.spec test and delete that call (or replace it with an
explicit wait/assertion if synchronous timing is required), ensuring any needed
waiting is done via deterministic Playwright waits like page.waitForSelector or
expect(...).toBeVisible rather than pausing the browser.
🪄 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: 1db0415a-a5c3-4167-9c7a-820fdb9916ad
📒 Files selected for processing (11)
packages/bruno-app/src/components/CollectionSettings/Auth/AuthMode/index.jspackages/bruno-app/src/components/FolderSettings/Auth/index.jspackages/bruno-app/src/components/FolderSettings/AuthMode/index.jspackages/bruno-app/src/components/RequestPane/Auth/AuthMode/index.jspackages/bruno-app/src/components/RequestPane/Auth/index.jspackages/bruno-app/src/components/StatusDot/index.jstests/auth/auth-mode/effective-auth-mode.spec.tstests/auth/auth-mode/modified-indicator-for-auth.spec.tstests/utils/page/actions.tstests/utils/page/constants.tstests/utils/page/index.ts
✅ Files skipped from review due to trivial changes (5)
- tests/utils/page/index.ts
- packages/bruno-app/src/components/StatusDot/index.js
- tests/utils/page/constants.ts
- packages/bruno-app/src/components/CollectionSettings/Auth/AuthMode/index.js
- packages/bruno-app/src/components/FolderSettings/AuthMode/index.js
🚧 Files skipped from review as they are similar to previous changes (2)
- packages/bruno-app/src/components/FolderSettings/Auth/index.js
- packages/bruno-app/src/components/RequestPane/Auth/index.js
eea6e4d to
ce76303
Compare
… use Collection Auth
…orization verification
…w constants file and update import in folder-no-auth-stops-inheritance.spec.ts
… and request tabs (including presets/Auth sections).
… and request tabs (including presets/Auth sections).
…eturning to defaults
e0f587e to
c75091d
Compare
…ance-ignored' into fix/modified-indicator-shown-incorrectly-on-collection-folder-request-tab
…, request, and presets/auth tabs (usebruno#3386) (usebruno#8027) * fix: 3296 Folder-level No Auth inheritance is ignored; requests still use Collection Auth
Jira link: https://usebruno.atlassian.net/browse/BRU-3386
https://usebruno.atlassian.net/browse/BRU-3421
Description
Fixes the false "modified" indicator dot shown on the Auth tab for requests and folders when auth mode is
inherit. Previously the dot was driven purely byauth.mode !== 'none', which is always true forinherit— so the dot lit up even when the resolved inherited auth chain produced no actual auth.The dot now reflects the effective auth: it follows the inherit chain up through parent folders to the collection root, and only shows when the resolved auth mode is set and not
none.Scope:
Refactor:
getEffectiveAuthSource(collection, item)helper (previously inlined inRequestPane/Auth,GrpcAuth,WSAuth,HttpRequestPane, andFolderSettings/Auth) into a shared utility atpackages/bruno-app/src/utils/auth/index.js. The util handles both request and folder shapes and explicitly skips the item itself when walking the tree.Filestore fix:
parseFolder.tswas returningrequest: nullfor folders that had no folder-level config on disk, causing inconsistent shape and downstream null-reference issues during save. The parser now always initializesrequestwith the default empty shape ({ headers: [], auth: toBrunoAuth(...), script, vars, tests }) — matching how the request parsers already behave.Additionally fixes BRU-3421
This PR also resolves the three issues tracked in BRU-3421 — Auth inheritance issues in nested folders and No Auth selection state:
See the linked ticket for full repro steps and expected vs. current behavior.
Contribution Checklist:
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
Bug Fixes
Tests
Refactor