Skip to content

fix(timeout): allow inherit request timeout for yaml requests#8382

Open
shubh-bruno wants to merge 5 commits into
usebruno:mainfrom
shubh-bruno:fix/timeout-yaml
Open

fix(timeout): allow inherit request timeout for yaml requests#8382
shubh-bruno wants to merge 5 commits into
usebruno:mainfrom
shubh-bruno:fix/timeout-yaml

Conversation

@shubh-bruno

@shubh-bruno shubh-bruno commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Description

JIRA

Problem

Request-level timeout set to 'inherit' was reset to 0 on save for .yaml requests (.bru worked fine). The YAML stringifiers forced timeout withisNumber(timeout) ? timeout : 0, dropping the 'inherit' string. The YAML parse path and both .bru paths already handled 'inherit' correctly, so the loss happened only on save

Solution

Allow 'inherit' to pass through alongside numbers in the YAML stringifiers and the OpenCollection converters.

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

Summary by CodeRabbit

  • Bug Fixes

    • Request timeout handling now correctly preserves the “inherit” option instead of reverting to 0.
    • HTTP and GraphQL request import/export now keep inherited timeouts consistent.
    • YAML request save/serialize now respects inherited timeout values.
  • Tests

    • Expanded Playwright timeout coverage to validate global preference changes and end-to-end inherit behavior for both .bru and YAML requests, including new/updated fixtures.

@coderabbitai

coderabbitai Bot commented Jun 26, 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

Walkthrough

Timeout handling for HTTP and GraphQL requests now accepts 'inherit' in serialization, OpenCollection conversion, fixtures, and Playwright coverage instead of defaulting to 0.

Changes

Timeout inherit support

Layer / File(s) Summary
Shared timeout sentinel
packages/bruno-common/src/utils/index.ts, packages/bruno-converters/src/opencollection/common/index.ts
TIMEOUT_INHERIT is added in common utilities and re-exported through OpenCollection common exports.
OpenCollection conversion
packages/bruno-converters/src/opencollection/items/graphql.ts, packages/bruno-converters/src/opencollection/items/http.ts
HTTP and GraphQL OpenCollection converters now accept TIMEOUT_INHERIT when reading and writing timeout settings.
YAML stringification and request settings coverage
packages/bruno-filestore/src/formats/yml/items/stringifyGraphQLRequest.ts, packages/bruno-filestore/src/formats/yml/items/stringifyHttpRequest.ts, tests/request/settings/*
HTTP and GraphQL YAML stringification now accepts TIMEOUT_INHERIT, and the request settings fixtures, init data, and Playwright coverage exercise the inherited-timeout flows.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

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

Poem

A timeout once fixed at zero,
Found 'inherit' as its hero.
HTTP and GraphQL now sing,
With YAML tests in gentle swing. 🌸

🚥 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 reflects the main timeout inherit fix, though it highlights YAML while the change also covers .bru requests and converters.
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: 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-filestore/src/formats/yml/items/stringifyHttpRequest.ts`:
- Around line 121-124: Add regression tests for the timeout
serialization/deserialization path in stringifyHttpRequest and the corresponding
load logic to cover the new “inherit” support. Include cases for both HTTP and
GraphQL requests that round-trip timeout: 'inherit' and a numeric timeout, and
assert they do not fall back to 0. Place the coverage near the existing request
format tests so the behavior stays tied to the stringify/load contract.
🪄 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: 1d2a4cc9-5fa4-44f7-bd4b-9d23839109fd

📥 Commits

Reviewing files that changed from the base of the PR and between d6e17e1 and da9b45d.

📒 Files selected for processing (4)
  • packages/bruno-converters/src/opencollection/items/graphql.ts
  • packages/bruno-converters/src/opencollection/items/http.ts
  • packages/bruno-filestore/src/formats/yml/items/stringifyGraphQLRequest.ts
  • packages/bruno-filestore/src/formats/yml/items/stringifyHttpRequest.ts

Comment on lines 121 to 124
if (isNumber(timeout) || timeout === 'inherit') {
settings.timeout = timeout;
} else {
settings.timeout = 0;

@coderabbitai coderabbitai Bot Jun 26, 2026

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add regression coverage for the 'inherit' timeout round-trip.

This fixes a cross-layer serialization contract, but no matching tests are included here. Please add cases that save/load both HTTP and GraphQL requests with timeout: 'inherit' and with a numeric timeout so this path does not silently fall back to 0 again. As per coding guidelines, "Add tests for any new functionality or meaningful changes."

🤖 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-filestore/src/formats/yml/items/stringifyHttpRequest.ts`
around lines 121 - 124, Add regression tests for the timeout
serialization/deserialization path in stringifyHttpRequest and the corresponding
load logic to cover the new “inherit” support. Include cases for both HTTP and
GraphQL requests that round-trip timeout: 'inherit' and a numeric timeout, and
assert they do not fall back to 0. Place the coverage near the existing request
format tests so the behavior stays tied to the stringify/load contract.

Source: Coding guidelines

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.

@shubh-bruno we should add this.

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.

@sachin-thakur-bruno agreed — adding regression coverage here would be the right follow-up.

Please cover both HTTP and GraphQL round-trips for:

  • timeout: 'inherit'
  • a numeric timeout

and assert the value survives save/load without falling back to 0. Placing them next to the existing request format tests would keep the contract clear.

🐇👍


🧠 Learnings used
Learnt from: sanish-bruno
Repo: usebruno/bruno PR: 8387
File: packages/bruno-cli/src/utils/persist-variables.js:330-337
Timestamp: 2026-06-26T21:24:02.726Z
Learning: In the usebruno/bruno repository, the codebase is standardized to LF line endings. During code review, do not flag CRLF-preservation/line-ending change concerns for these text-based source/config files unless the file format or an explicit workflow/tooling requirement requires preserving CRLF (e.g., a Windows-specific file type or a mandated EOL rule).

@shubh-bruno shubh-bruno Jun 29, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@coderabbitai e2e playwrights tests for this already exists but only for .bru files we just need to add fixtures for .yml and run the same tests against .yml requests file tests/request/settings/timeout.spec.ts

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.

@shubh-bruno that makes sense — thanks for the pointer.

Reusing the existing Playwright coverage in tests/request/settings/timeout.spec.ts and extending it with .yaml fixtures sounds like the right follow-up here, instead of adding a separate test path.

(ᵔᴥᵔ)


✏️ Learnings added
Learnt from: shubh-bruno
Repo: usebruno/bruno PR: 8382
File: packages/bruno-filestore/src/formats/yml/items/stringifyHttpRequest.ts:121-124
Timestamp: 2026-06-29T07:26:17.002Z
Learning: In the `usebruno/bruno` repository, regression coverage for request timeout save/load behavior is handled by the Playwright end-to-end test file `tests/request/settings/timeout.spec.ts`. Existing coverage already applies to `.bru` files; for YAML request timeout regressions, the expected approach is to add `.yaml` fixtures and reuse the same save tests rather than creating a separate test file.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: sanish-bruno
Repo: usebruno/bruno PR: 8387
File: packages/bruno-cli/src/utils/persist-variables.js:330-337
Timestamp: 2026-06-26T21:24:02.726Z
Learning: In the usebruno/bruno repository, the codebase is standardized to LF line endings. During code review, do not flag CRLF-preservation/line-ending change concerns for these text-based source/config files unless the file format or an explicit workflow/tooling requirement requires preserving CRLF (e.g., a Windows-specific file type or a mandated EOL rule).

@shubh-bruno shubh-bruno changed the title fix(timeout): allow inherit in timout for yaml requests fix(timeout): allow inherit request timeout for yaml requests Jun 26, 2026
const settings: GraphQLRequestSettings = {
encodeUrl: typeof brunoSettings.encodeUrl === 'boolean' ? brunoSettings.encodeUrl : true,
timeout: typeof brunoSettings.timeout === 'number' ? brunoSettings.timeout : 0,
timeout: typeof brunoSettings.timeout === 'number' || brunoSettings.timeout === 'inherit' ? brunoSettings.timeout : 0,

@sachin-thakur-bruno sachin-thakur-bruno Jun 29, 2026

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.

nit: please create const for inherit and use.

@pull-request-size pull-request-size Bot added size/L and removed size/S labels Jun 29, 2026
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
{}

@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 `@tests/request/settings/timeout.spec.ts`:
- Around line 114-140: The current timeout test only verifies the in-memory
inherit state and never exercises YAML persistence, so it can miss regressions
in save serialization. In timeout.spec.ts, after clicking the Reset to inherit
control in the request Settings tab, save the request, reopen/reload it, and
assert the Settings UI still shows the Inherit state before sending. Use the
existing helpers like setGlobalRequestTimeout, selectRequestPaneTab, and the
resetButton/inheritButton flow to locate the change, and keep the final request
execution to confirm the inherited timeout still resolves correctly after
reload.
🪄 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: 01f424c9-5c22-4ca5-a99f-3c5f6042ea16

📥 Commits

Reviewing files that changed from the base of the PR and between 5f2592d and 7a71697.

📒 Files selected for processing (15)
  • packages/bruno-common/src/utils/index.ts
  • packages/bruno-converters/src/opencollection/common/index.ts
  • packages/bruno-converters/src/opencollection/items/graphql.ts
  • packages/bruno-converters/src/opencollection/items/http.ts
  • packages/bruno-filestore/src/formats/yml/items/stringifyGraphQLRequest.ts
  • packages/bruno-filestore/src/formats/yml/items/stringifyHttpRequest.ts
  • tests/request/settings/collection/requests-settings-bru/bruno.json
  • tests/request/settings/collection/requests-settings-bru/max-redirects.bru
  • tests/request/settings/collection/requests-settings-bru/no-redirects.bru
  • tests/request/settings/collection/requests-settings-bru/timeout.bru
  • tests/request/settings/collection/requests-settings-yml/opencollection.yml
  • tests/request/settings/collection/requests-settings-yml/timeout.yml
  • tests/request/settings/init-user-data/collection-security.json
  • tests/request/settings/init-user-data/preferences.json
  • tests/request/settings/timeout.spec.ts
✅ Files skipped from review due to trivial changes (3)
  • tests/request/settings/collection/requests-settings-yml/opencollection.yml
  • tests/request/settings/collection/requests-settings-yml/timeout.yml
  • packages/bruno-converters/src/opencollection/common/index.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • packages/bruno-filestore/src/formats/yml/items/stringifyGraphQLRequest.ts
  • packages/bruno-filestore/src/formats/yml/items/stringifyHttpRequest.ts
  • packages/bruno-converters/src/opencollection/items/graphql.ts
  • packages/bruno-converters/src/opencollection/items/http.ts

Comment thread tests/request/settings/timeout.spec.ts Outdated

@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.

🧹 Nitpick comments (1)
tests/request/settings/timeout.spec.ts (1)

36-38: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

Restoring fixtures via git checkout mutates the tracked working tree — prefer execFileSync and confirm parallel-safety.

Two points on this cleanup hook:

  1. Both scenarios save into the committed fixture files (timeout.bru/timeout.yml) and rely on git checkout to undo it. That pollutes the working tree mid-run and silently discards any local uncommitted edits a developer made to those fixtures. Per the E2E parallel-safety guideline ("No shared user data directories, ports, files..."), shared in-repo fixtures mutated in place aren't parallel-safe if the suite ever runs with multiple workers.
  2. Building a shell string also trips the SAST command-injection hint. The args here are static (__dirname-derived), so it isn't exploitable, but execFileSync with an argument array avoids the shell entirely and handles paths containing spaces more reliably across platforms.
♻️ Suggested tweak to drop the shell
-import { execSync } from 'child_process';
+import { execFileSync } from 'child_process';
   test.afterAll(() => {
-    execSync(`git checkout -- "${bruRequestPath}" "${yamlRequestPath}"`);
+    execFileSync('git', ['checkout', '--', bruRequestPath, yamlRequestPath]);
   });

Can you confirm whether this suite runs with workers > 1? If so, copying the fixtures into an isolated temp dir would be the more robust fix.

🤖 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 `@tests/request/settings/timeout.spec.ts` around lines 36 - 38, The cleanup in
`timeout.spec.ts` uses `execSync` with `git checkout` to restore
`bruRequestPath` and `yamlRequestPath`, which both mutates the tracked working
tree and goes through a shell. Update the `test.afterAll` hook to use
`execFileSync` with an argument array instead of a shell command, and avoid
in-place restoration of shared fixtures if this suite can run with `workers > 1`
by isolating the files in temp copies.

Sources: Coding guidelines, Linters/SAST tools

🤖 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.

Nitpick comments:
In `@tests/request/settings/timeout.spec.ts`:
- Around line 36-38: The cleanup in `timeout.spec.ts` uses `execSync` with `git
checkout` to restore `bruRequestPath` and `yamlRequestPath`, which both mutates
the tracked working tree and goes through a shell. Update the `test.afterAll`
hook to use `execFileSync` with an argument array instead of a shell command,
and avoid in-place restoration of shared fixtures if this suite can run with
`workers > 1` by isolating the files in temp copies.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a51dce8f-edd3-458a-bea7-0961c7dda03a

📥 Commits

Reviewing files that changed from the base of the PR and between e0f7846 and 7ff1b72.

📒 Files selected for processing (1)
  • tests/request/settings/timeout.spec.ts

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