> For the complete documentation index, see [llms.txt](https://docs.flxbl.io/flxbl/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flxbl.io/flxbl/codev/inspect/review-environments.md).

# Review Environments

<figure><img src="/files/3j6HKBwfDPneRZLObOGz" alt="Review Environments page"><figcaption><p>Review Environments showing assignment rules that map branch patterns and domains to targets</p></figcaption></figure>

Review environments define where [Change Validation](/flxbl/codev/inspect/change-validation.md) deploys your PR changes. They connect your pull requests to Salesforce environments — automatically assigning the right org for each PR based on rules you configure.

Without review environment rules, change validation would not know where to deploy. With them, every PR automatically gets an environment matched to its branch and domain.

## Choosing a setup

<figure><img src="/files/kACVhYMtCBF7Cpx7J3CG" alt="Review Environment setup options"><figcaption><p>Three ways to set up review environments — dedicated environment, sandbox pool, or scratch org pool</p></figcaption></figure>

codev offers three approaches, depending on your team size and needs:

### Dedicated environment

**Easiest to get started.** Use a single Salesforce org that is shared across PRs. Each PR deploys its changes on top of the previous ones. This is the quickest way to get validation running — all you need is an existing org.

The tradeoff is that PRs share the same org, so changes from one PR may affect validation of another. For small teams or projects with limited cross-package dependencies, this works well.

### Sandbox pool

**Recommended for teams.** Each PR gets its own isolated sandbox from a pre-provisioned [pool](/flxbl/codev/pools/overview.md). There is no cross-contamination between PRs — each validation runs in a clean environment that is automatically returned to the pool when done.

### Scratch org pool

**Best for scale.** Each PR gets a lightweight, disposable scratch org from a [pool](/flxbl/codev/pools/overview.md). Fresh orgs are provisioned with all packages and dependencies pre-installed, providing maximum isolation and consistent feedback for every PR.

## How assignment rules work

An assignment rule maps a combination of branch pattern and domain pattern to a target — either a pool or a dedicated Salesforce org.

For example, a rule might say: "For PRs targeting `main`, across all domains, use the pool `dev-pool-so`." Another rule might say: "For PRs targeting `release/*`, for the `service` domain, use the dedicated org `staging`."

When change validation runs, codev evaluates the PR's target branch and impacted domains against these rules and allocates the matching environment.

## Creating assignment rules

<figure><img src="/files/41n4DyFVuzxSfVfKCVb3" alt="Set Up Review Environment dialog"><figcaption><p>Setting up a review environment rule — choose target type, pool, branch pattern, domain patterns, and priority</p></figcaption></figure>

Click **Add Configuration** on the Review Environments page. The setup dialog asks for:

* **Target Type** — choose **Pool** (sandbox or scratch org pool) or **Dedicated Environment** (a specific Salesforce org)
* **Pool** — if using a pool, select which one. The pool must already be created in [Pools Management](/flxbl/codev/pools/overview.md)
* **Branch Pattern** — which base branches this rule applies to (e.g., `main`, `release/*`, `feature/*`). Use `*` for single-level wildcard, `**` for multi-level
* **Domain Patterns** — which domains this rule applies to. Leave empty to match all domains. Use comma-separated values for multiple (e.g., `core, sales-*`)
* **Priority** — when multiple rules match, the highest priority wins
* **Description** — optional notes about what this rule is for

## Viewing active assignments

Switch to the **Active Assignments** tab to see which environments are currently assigned to PRs. This shows the pool, branch, domain, and how long the assignment has been active.

## How review environments connect to validation

The full flow:

1. A PR is opened or updated
2. Change Validation detects impacted domains
3. For each domain, codev evaluates the review environment rules against the PR's target branch and domain name
4. The matching rule determines whether to use a pool or dedicated environment
5. codev acquires exclusive access (pool: fetch + acquire lock; dedicated: lock with access token)
6. Validation deploys and tests against the environment
7. codev releases access when validation completes

This happens automatically — developers do not need to think about which environment to use.

## Getting started

1. **Choose your approach** — dedicated environment (quickest), sandbox pool, or scratch org pool
2. If using a pool, **create it first** in [Pools Management](/flxbl/codev/pools/overview.md) with available instances
3. **Create an assignment rule** on this page mapping your main branch to the target
4. **Enable the PR validation workflow** in Change Validation > Workflow Settings
5. Open a PR — validation will automatically allocate an environment and run


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.flxbl.io/flxbl/codev/inspect/review-environments.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
