Skip to content

feat: opencollection actions#6460

Merged
helloanoop merged 1 commit intomainfrom
feat/opencollection-action
Dec 18, 2025
Merged

feat: opencollection actions#6460
helloanoop merged 1 commit intomainfrom
feat/opencollection-action

Conversation

@helloanoop
Copy link
Contributor

@helloanoop helloanoop commented Dec 18, 2025

Description

Opencollection Actions

Summary by CodeRabbit

  • New Features

    • Added support for post-response variables in HTTP and GraphQL requests.
  • Chores

    • Updated @opencollection/types dependency to version 0.3.0.

✏️ Tip: You can customize this high-level summary in your review settings.

Copilot AI review requested due to automatic review settings December 18, 2025 15:50
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 18, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This PR adds bidirectional conversion between Bruno post-response variables and OpenCollection actions. It introduces mapping helpers in actions.ts, updates request parsers to extract post-response variables from runtime actions, and modifies stringifiers to serialize post-response variables back to runtime actions. Dependency version is upgraded and TypeScript path mappings are adjusted.

Changes

Cohort / File(s) Summary
Dependency upgrades
package.json, packages/bruno-filestore/package.json
Version bump for @opencollection/types: removed 0.2.0, added 0.3.0 as devDependency in root package.json
Post-response variable converters
packages/bruno-filestore/src/formats/yml/common/actions.ts
Added toOpenCollectionActions() and toBrunoPostResponseVariables() helper functions for bidirectional mapping between Bruno post-response variables and OpenCollection actions
Variable handling refactor
packages/bruno-filestore/src/formats/yml/common/variables.ts
Simplified toOpenCollectionVariables() to process only req variables; removed post-response logic from toBrunoVariables()
Request parsers
packages/bruno-filestore/src/formats/yml/items/parseGraphQLRequest.ts, parseHttpRequest.ts
Added post-response variable extraction from runtime actions; structured brunoRequest.vars as { req, res } composite object
Request stringifiers
packages/bruno-filestore/src/formats/yml/items/stringifyGraphQLRequest.ts, stringifyHttpRequest.ts
Added runtime actions serialization from post-response variables using toOpenCollectionActions()
TypeScript configuration
packages/bruno-filestore/tsconfig.json
Updated @opencollection/types path mappings to reference top-level node_modules instead of nested package-specific resolution

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–25 minutes

  • Areas requiring extra attention:
    • Verify bidirectional mapping correctness in actions.ts (null/undefined handling and field mappings)
    • Confirm post-response variable handling consistency across all parser/stringifier pairs
    • Validate type safety for action filtering by phase and type
    • Check that composite vars structure ({ req, res }) is handled correctly throughout the codebase

Possibly related PRs

Suggested reviewers

  • lohit-bruno
  • naman-bruno
  • bijin-bruno

Poem

🔄 Variables dance in both directions now,
From post-response to actions, and back—
Bruno and OpenCollection bow,
Their schemas sync without a crack.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/opencollection-action

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a1c4113 and 9738a2a.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (9)
  • package.json (1 hunks)
  • packages/bruno-filestore/package.json (1 hunks)
  • packages/bruno-filestore/src/formats/yml/common/actions.ts (1 hunks)
  • packages/bruno-filestore/src/formats/yml/common/variables.ts (3 hunks)
  • packages/bruno-filestore/src/formats/yml/items/parseGraphQLRequest.ts (2 hunks)
  • packages/bruno-filestore/src/formats/yml/items/parseHttpRequest.ts (2 hunks)
  • packages/bruno-filestore/src/formats/yml/items/stringifyGraphQLRequest.ts (2 hunks)
  • packages/bruno-filestore/src/formats/yml/items/stringifyHttpRequest.ts (2 hunks)
  • packages/bruno-filestore/tsconfig.json (1 hunks)

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.

@helloanoop helloanoop merged commit c5827df into main Dec 18, 2025
11 of 12 checks passed
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces OpenCollection actions support by refactoring how post-response variables are handled. Bruno's post-response variables are now converted to OpenCollection 'set-variable' actions with phase 'after-response', providing a more structured approach to handling response-based variable assignments. The dependency on @opencollection/types has been upgraded from 0.2.0 to 0.3.0 and centralized to the root package.

  • Introduced new actions.ts module with bidirectional conversion functions between Bruno post-response variables and OpenCollection actions
  • Refactored variables.ts to handle only pre-request variables, removing post-response variable logic
  • Updated HTTP and GraphQL request stringify/parse functions to use the new actions conversion

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/bruno-filestore/tsconfig.json Updated TypeScript path mappings to reference @opencollection/types from root node_modules instead of package-specific location
packages/bruno-filestore/src/formats/yml/items/stringifyHttpRequest.ts Added actions conversion from Bruno post-response variables using toOpenCollectionActions
packages/bruno-filestore/src/formats/yml/items/stringifyGraphQLRequest.ts Added actions conversion from Bruno post-response variables using toOpenCollectionActions
packages/bruno-filestore/src/formats/yml/items/parseHttpRequest.ts Updated to convert OpenCollection actions back to Bruno post-response variables using toBrunoPostResponseVariables
packages/bruno-filestore/src/formats/yml/items/parseGraphQLRequest.ts Updated to convert OpenCollection actions back to Bruno post-response variables using toBrunoPostResponseVariables
packages/bruno-filestore/src/formats/yml/common/variables.ts Refactored to handle only pre-request variables, removed post-response variable scope marker logic
packages/bruno-filestore/src/formats/yml/common/actions.ts New module providing bidirectional conversion between Bruno post-response variables and OpenCollection set-variable actions
packages/bruno-filestore/package.json Removed @opencollection/types from devDependencies (now managed at root level)
package.json Added @opencollection/types 0.3.0 to root devDependencies
package-lock.json Updated lock file to reflect dependency changes - removed package-specific @opencollection/types 0.2.0 and added root-level 0.3.0

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

name: setVarAction.variable?.name || '',
value: setVarAction.selector?.expression || '',
enabled: setVarAction.disabled !== true,
local: false
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The local field is hardcoded to false, which causes loss of scope information during round-trip conversion. When an action has scope 'request', it should be converted to a Bruno variable with local: true, but currently all variables are set to local: false. This should be: local: setVarAction.variable?.scope === 'request'

Suggested change
local: false
local: setVarAction.variable?.scope === 'request'

Copilot uses AI. Check for mistakes.
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