Skip to content

fix(proxy): refresh cached PAC content on demand - #8173

Merged
sid-bruno merged 1 commit into
usebruno:mainfrom
pooja-bruno:fix/pac-cache-manual-refresh
Jun 4, 2026
Merged

sid-bruno merged 1 commit into
usebruno:mainfrom
pooja-bruno:fix/pac-cache-manual-refresh

Conversation

@pooja-bruno

@pooja-bruno pooja-bruno commented Jun 3, 2026 •

Copy link
Copy Markdown
Collaborator

Description

JIRA

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

    • Added a "Refetch" button in Proxy Auto-Config (PAC) settings to reload the latest configuration from your configured source.
  • Tests

    • Added test coverage for PAC cache clearing and refresh functionality.

@coderabbitai

coderabbitai Bot commented Jun 3, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

This PR adds a PAC (Proxy Auto-Config) cache refresh feature across the renderer, Redux, Electron main process, and test layers. Users can now click a "Refetch" button in ProxySettings to clear cached PAC and HTTP/HTTPS agent state, ensuring the latest PAC script is read and applied. The system proxy refresh handler also clears these caches after refreshing proxy variables.

Changes

PAC Cache Refresh Feature

Layer / File(s) Summary
IPC handlers and cache clearing
packages/bruno-electron/src/ipc/preferences.js
Imports clearPacCache and adds renderer:refresh-pac-cache IPC handler that clears PAC and HTTP/HTTPS agent caches. Updates renderer:refresh-system-proxy handler to also clear both caches after refreshing proxy variables.
Redux thunk bridge
packages/bruno-app/src/providers/ReduxStore/slices/app.js
Exports refreshPacCache thunk that invokes renderer:refresh-pac-cache IPC endpoint and returns the Promise.
ProxySettings UI action
packages/bruno-app/src/components/Preferences/ProxySettings/index.js
Imports refreshPacCache thunk and IconRefresh icon. Adds handleRefreshPac handler that dispatches the thunk and shows success/error toasts. Conditionally renders a "Refetch" link when PAC source is configured.
Cache clearing test
packages/bruno-requests/src/utils/pac-resolver.spec.ts
Adds test verifying clearPacCache() forces cached PAC resolver to re-read filesystem source and reflect updated script directives.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • usebruno/bruno#7264: Modifies the same renderer:refresh-system-proxy IPC handler that this PR extends to clear PAC/agent caches.
  • usebruno/bruno#6990: Adds refreshSystemProxy thunk and UI refresh button on the same IPC channel that this PR extends with cache clearing.
  • usebruno/bruno#7651: Introduces PAC/pacUrl support in ProxySettings that this PR enhances with the cache refresh action.

Suggested reviewers

  • helloanoop
  • naman-bruno
  • bijin-bruno

Poem

A PAC script refresh, oh what delight,
Cache cleared and reloaded, proxies aligned right,
One button to fetch, no more stale state,
The electrons and Redux communicate! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and accurately summarizes the main change: adding a manual refresh capability for cached PAC content, which is reflected across all modified files (UI component, Redux thunk, IPC handler, and tests).
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 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: 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 `@packages/bruno-app/src/components/Preferences/ProxySettings/index.js`:
- Around line 460-468: Replace the non-focusable <span> used for "Refetch" with
a semantic <button> so it becomes keyboard-accessible and add a test id;
specifically, in the conditional that checks formik.values.pac.source, change
the span that renders the IconRefresh and text to a <button type="button">
preserving the existing className and onClick handler (handleRefreshPac), add a
data-testid (e.g. data-testid="refetch-pac"), and optionally include an
aria-label for clarity; ensure IconRefresh usage and layout remain the same so
behavior and styling are unchanged.
🪄 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: 1823c070-4ad7-4630-8153-76dafd569cc0

📥 Commits

Reviewing files that changed from the base of the PR and between 462a393 and a1c285e.

📒 Files selected for processing (4)
  • packages/bruno-app/src/components/Preferences/ProxySettings/index.js
  • packages/bruno-app/src/providers/ReduxStore/slices/app.js
  • packages/bruno-electron/src/ipc/preferences.js
  • packages/bruno-requests/src/utils/pac-resolver.spec.ts

@sid-bruno
sid-bruno merged commit 8f80230 into usebruno:main Jun 4, 2026
16 of 19 checks passed
sharan-bruno pushed a commit to sharan-bruno/bruno that referenced this pull request Jun 4, 2026
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