Repository navigation
fix: 3093 - Fix pm.setNextRequest(null) not translating to bru.runner.stopExecution() - #8049
Conversation
WalkthroughTranslator now treats pm.setNextRequest(null) and pm.setNextRequest('null') as stop signals and emits bru.runner.stopExecution(); other pm.setNextRequest(...) calls are emitted as bru.runner.setNextRequest(...). Corresponding translation patterns, AST transformation, and tests were updated. Changespm.setNextRequest null translation
Sequence Diagram(s)sequenceDiagram
participant PostmanScript
participant Translator
participant BruRunner
PostmanScript->>Translator: pm.setNextRequest(null)
Translator->>BruRunner: bru.runner.stopExecution()
alt non-null argument
PostmanScript->>Translator: pm.setNextRequest("Get User Details")
Translator->>BruRunner: bru.runner.setNextRequest("Get User Details")
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 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: 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-converters/src/postman/postman-translations.js`:
- Around line 21-22: The current fallback patterns for pm.setNextRequest(null)
don't allow spaces inside the parentheses, so variants like pm.setNextRequest(
null ) or pm.setNextRequest( "null" ) won't match and fall back to
bru.setNextRequest; update the two translation keys for
'pm\\.setNextRequest\\(null\\)' and 'pm\\.setNextRequest\\([\'\"]null[\'\"]\\)'
to accept optional whitespace inside the parentheses by adding \s* around the
null and around the quoted null (i.e., use patterns like
pm\.setNextRequest\(\s*null\s*\) and pm\.setNextRequest\(\s*[\'"]null[\'"]\s*\)
), keeping their replacement value as bru.runner.stopExecution(); this will
ensure pm.setNextRequest variants map to bru.runner.stopExecution instead of
bru.setNextRequest.
🪄 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: c22fba9c-f735-485a-bbbe-65742d9d382a
📒 Files selected for processing (3)
packages/bruno-converters/src/postman/postman-translations.jspackages/bruno-converters/src/utils/postman-to-bruno-translator.jspackages/bruno-converters/tests/postman/postman-translations/transpiler-tests/exec-flow.test.js
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/exec-flow.test.js (1)
23-27: ⚡ Quick winRemove or repurpose this duplicate
pm.setNextRequesttest.This case repeats the same non-null translation already asserted above, and the test title still mentions
bru.setNextRequest(...)while expectingbru.runner.setNextRequest(...). Consider deleting it or changing it to a genuinely different input case.🤖 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-converters/tests/postman/postman-translations/transpiler-tests/exec-flow.test.js` around lines 23 - 27, The test duplicating pm.setNextRequest should be removed or repurposed: locate the test using pm.setNextRequest in exec-flow.test.js (the one that calls translateCode and expects 'bru.runner.setNextRequest(...)') and either delete it or change it to a distinct scenario (e.g., null/undefined argument or a different request name) and update the test title to match the new behavior; ensure the assertion aligns with the translator function translateCode and with the correct target symbol (bru.setNextRequest vs bru.runner.setNextRequest) used elsewhere in the suite.
🤖 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
`@packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/exec-flow.test.js`:
- Around line 23-27: The test duplicating pm.setNextRequest should be removed or
repurposed: locate the test using pm.setNextRequest in exec-flow.test.js (the
one that calls translateCode and expects 'bru.runner.setNextRequest(...)') and
either delete it or change it to a distinct scenario (e.g., null/undefined
argument or a different request name) and update the test title to match the new
behavior; ensure the assertion aligns with the translator function translateCode
and with the correct target symbol (bru.setNextRequest vs
bru.runner.setNextRequest) used elsewhere in the suite.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 6ffcb853-7efd-4aa0-b5e5-b2813dcddc5e
📒 Files selected for processing (4)
packages/bruno-converters/src/utils/postman-to-bruno-translator.jspackages/bruno-converters/tests/bruno/bruno-to-postman-translations/execution.test.jspackages/bruno-converters/tests/postman/postman-translations/transpiler-tests/exec-flow.test.jspackages/bruno-converters/tests/postman/postman-translations/transpiler-tests/postman-references.test.js
….stopExecution() (usebruno#8049) * fix: 3093 - Fix pm.setNextRequest(null) not translating to bru.runner.stopExecution() * addressed review comments * addressed review comments
….stopExecution() (usebruno#8049) * fix: 3093 - Fix pm.setNextRequest(null) not translating to bru.runner.stopExecution() * addressed review comments * addressed review comments
….stopExecution() (usebruno#8049) * fix: 3093 - Fix pm.setNextRequest(null) not translating to bru.runner.stopExecution() * addressed review comments * addressed review comments
Jira link: https://usebruno.atlassian.net/browse/BRU-3093
Description
Fix pm.setNextRequest(null) / pm.setNextRequest('null') translating to a no-op
bru.setNextRequest(null) instead of bru.runner.stopExecution().
In Postman, passing null stops the collection runner. Bruno's setNextRequest
only nulls the next-request pointer; only bru.runner.stopExecution() actually
stops the runner — so imported scripts were silently broken.
transform that emits bru.runner.stopExecution() for null / 'null' literals,
otherwise bru.setNextRequest(arg).
pm.setNextRequest( rule.
Mirrors the existing pm.execution.setNextRequest(null) handling.
Fixes BRU-1367 / BRU-3093.
Before:

After:

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
Packages changed:
What changed
Tests
Issues fixed
Notes on scope/interdependencies