Skip to content

fix(converters): default env variable enabled to true when missing in postman env import - #8775

Closed
ravindra-bruno wants to merge 2 commits into
usebruno:mainfrom
ravindra-bruno:fix/bru-3960
Closed

ravindra-bruno wants to merge 2 commits into
usebruno:mainfrom
ravindra-bruno:fix/bru-3960

Conversation

@ravindra-bruno

@ravindra-bruno ravindra-bruno commented Jul 26, 2026 •

Copy link
Copy Markdown
Collaborator

[JIRA: BRU-3960]

Description

Importing a Postman environment fails with variables[N].enabled must be defined and aborts the import whenever a variable has no enabled field which Postman legitimately exports. No environment gets created.

Cause

The Postman environment converter copied enabled straight from the source, producing an undefined value when the field was absent. Environment validation requires enabled to be defined, so the import threw and aborted.

Resolution

Default enabled to true when it's missing (matching Postman, where a variable with no enabled field is treated as enabled) while still preserving an explicit false. Added a regression test covering both cases.

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

    • Postman environment variables that omit an explicit enabled setting are now treated as enabled by default during conversion.
    • Variables marked explicitly as disabled remain disabled in the converted Bruno environment.
  • Tests

    • Added test coverage for conversion and UI import behavior when enabled is missing, including fixture-based validation.

@coderabbitai

coderabbitai Bot commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Postman environment conversion now defaults missing enabled values to true, while preserving explicit false values. Unit and UI import tests cover omitted, enabled, and disabled variables.

Changes

Postman environment conversion

Layer / File(s) Summary
Apply and validate enabled defaults
packages/bruno-converters/src/postman/postman-env-to-bruno-env.js, packages/bruno-converters/tests/postman/postman-env-to-bruno-env.spec.js, tests/environments/import-environment/...
Converted variables are enabled unless explicitly disabled, with unit and UI import coverage for omitted and explicit enabled values.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers: sid-bruno, helloanoop, sanish-bruno

Poem

Missing flags now shine bright,
true turns absent keys to light.
Explicit false keeps its place,
Tests confirm each case with grace.

🚥 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 clearly matches the main change: defaulting missing Postman environment variable enabled flags to true during import.
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.

@sanishchirayath1

Copy link
Copy Markdown

@ravindra-bruno I believe there is already an issue and a PR to solve this, Also we may need to verify how the global environment and collection environment behave, are they both defaulting to true? can we merge the community PR to a feature branch, and work on top of it? Like adding tests and all of necessary? Or are we adopting a different approach that what is done in the community PR? #8681

@pull-request-size pull-request-size Bot added size/L and removed size/M labels Jul 26, 2026

@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

🧹 Nitpick comments (1)
tests/environments/import-environment/global-env-import-missing-enabled.spec.ts (1)

16-16: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use the single-collection fixture directory convention.

Line 16 points to fixtures/collection.json; single-collection E2E fixtures should be organized under fixtures/collection/. Move the collection fixture there and update this path.

Based on learnings, single-collection Bruno E2E fixtures use fixtures/collection rather than a flat collection fixture file.

🤖 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/environments/import-environment/global-env-import-missing-enabled.spec.ts`
at line 16, Update the fixture path in the test to use the single-collection
directory convention, changing the `collectionFile` construction to resolve
`fixtures/collection/collection.json`; move the fixture file into that directory
so the test continues loading the same collection.

Source: Learnings

🤖 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/environments/import-environment/global-env-import-missing-enabled.spec.ts`:
- Around line 29-37: Move the import-related selectors and interactions from
this spec into the relevant page module under tests/utils/page, including the
Import control, import modal, file chooser/file input, variable table, and
enabled checkboxes. Expose named locators or actions through that page module,
then update the spec’s import flow and assertions to use those abstractions
instead of page.getByText, page.locator, or raw selector strings; keep the spec
focused on user actions and expectations.

---

Nitpick comments:
In
`@tests/environments/import-environment/global-env-import-missing-enabled.spec.ts`:
- Line 16: Update the fixture path in the test to use the single-collection
directory convention, changing the `collectionFile` construction to resolve
`fixtures/collection/collection.json`; move the fixture file into that directory
so the test continues loading the same collection.
🪄 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 Plus

Run ID: 03a120b2-5b11-488f-9574-cab850d3d045

📥 Commits

Reviewing files that changed from the base of the PR and between a0de564 and 34d904e.

📒 Files selected for processing (2)
  • tests/environments/import-environment/fixtures/global-env-missing-enabled.json
  • tests/environments/import-environment/global-env-import-missing-enabled.spec.ts

Comment on lines +29 to +37
await page.getByText('Import', { exact: true }).click();

const importModal = page.locator('[data-testid="import-global-environment-modal"]');
await expect(importModal).toBeVisible();

const fileChooserPromise = page.waitForEvent('filechooser');
await page.locator('[data-testid="import-global-environment"]').click();
const fileChooser = await fileChooserPromise;
await fileChooser.setFiles(globalEnvFile);

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 | 🟠 Major | ⚡ Quick win

Move selectors and import actions into page modules.

This spec directly uses page.getByText, page.locator, and raw selector strings for the import controls, modal, file input, variable table, and enabled checkboxes. Expose these locators/actions through tests/utils/page/*; keep the spec focused on user actions and assertions.

As per path instructions, E2E specs must use locators/actions exposed by tests/utils/page/* and centralize selectors in page modules.

Also applies to: 46-49, 52-55

🤖 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/environments/import-environment/global-env-import-missing-enabled.spec.ts`
around lines 29 - 37, Move the import-related selectors and interactions from
this spec into the relevant page module under tests/utils/page, including the
Import control, import modal, file chooser/file input, variable table, and
enabled checkboxes. Expose named locators or actions through that page module,
then update the spec’s import flow and assertions to use those abstractions
instead of page.getByText, page.locator, or raw selector strings; keep the spec
focused on user actions and expectations.

Source: Path instructions

@helloanoop

Copy link
Copy Markdown
Contributor

@ravindra-bruno We will work on top of the community PR - #8681. Closing this

@helloanoop helloanoop closed this Jul 29, 2026
@ravindra-bruno

Copy link
Copy Markdown
Collaborator Author

@ravindra-bruno I believe there is already an issue and a PR to solve this, Also we may need to verify how the global environment and collection environment behave, are they both defaulting to true? can we merge the community PR to a feature branch, and work on top of it? Like adding tests and all of necessary? Or are we adopting a different approach that what is done in the community PR? #8681

Yes @sanishchirayath1 , they are defaulting to true. I have checked both the environment before creating the pr.

@ravindra-bruno

Copy link
Copy Markdown
Collaborator Author

@ravindra-bruno We will work on top of the community PR - #8681. Closing this

Okay @helloanoop . thanks

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.

4 participants