---
id: ATS-CRM-REG-005
scope: CAP-CRM-REG-005
product_area: crm
module: regions
revision: 3
status: proposed
approved_by: null
approved_at: null
source_sha:
  services-crm: a8d1364f1dd44b723bb5f9acba12f983e9ec8d69
  react-console: baf6dae382d6f41dce976c7f848667ccc37e076f
scenarios:
  - id: ATS-CRM-REG-005-01
    title: Insertion supports append and earlier placement
    level: api
    proves:
      - BR-CAP-CRM-REG-005-01
    preconditions: Two rules occupy consecutive positions.
    steps: Create without a position and then create at the first position.
    expected: 'The first appends; the second precedes the others, which retain a consecutive order.'
    negative: false
    data_needs: A two-entry assignment policy.
    bound_to:
      - TST-CRM-REG-047
    provenance: test
    source: >-
      services-crm:modules/regions/tests/e2e/regions.e2e.spec.js#appends a created rule at the end of the
      order
    category: rule
    test_assertions:
      - >-
        services-crm:modules/regions/tests/e2e/regions.e2e.spec.js#appends a created rule at the end of
        the order
      - >-
        services-crm:modules/regions/tests/e2e/regions.e2e.spec.js#lists both rules in the order they are
        tried
  - id: ATS-CRM-REG-005-02
    title: Individual editing checks its version
    level: api
    proves:
      - BR-CAP-CRM-REG-005-02
    preconditions: A rule has version two.
    steps: 'Replace with version one, omit the replacement version and patch with the current version test.'
    expected: The stale and missing versions are rejected while the current patch succeeds.
    negative: true
    data_needs: A single policy entry.
    bound_to: []
    provenance: proposed
    source: FND-CRM-REG-022
    category: concurrency
  - id: ATS-CRM-REG-005-03
    title: Deletion closes the position gap
    level: api
    proves:
      - BR-CAP-CRM-REG-005-04
    preconditions: The policy contains two rules.
    steps: Remove the first rule.
    expected: The retained rule occupies the first position.
    negative: false
    data_needs: A two-entry assignment policy.
    bound_to:
      - TST-CRM-REG-047
    provenance: test
    source: 'services-crm:modules/regions/tests/e2e/regions.e2e.spec.js#deletes a rule'
    category: invariant
    test_assertions:
      - 'services-crm:modules/regions/tests/e2e/regions.e2e.spec.js#deletes a rule'
      - >-
        services-crm:modules/regions/tests/e2e/regions.e2e.spec.js#closes the gap the delete left, so the
        rule that remains is at the first position
  - id: ATS-CRM-REG-005-04
    title: Reorder requires the complete distinct set
    level: api
    proves:
      - BR-CAP-CRM-REG-005-05
    preconditions: Two identified rules exist.
    steps: 'Submit incomplete, duplicate and unknown-containing orders, then the valid reversed order.'
    expected: Invalid orders identify their problems and preserve order; the valid order reverses the sequence.
    negative: true
    data_needs: A two-entry assignment policy.
    bound_to:
      - TST-CRM-REG-047
    provenance: test
    source: >-
      services-crm:modules/regions/tests/e2e/regions.e2e.spec.js#answers 400 for an order that does not
      name every rule of the tenant
    category: validation
    test_assertions:
      - >-
        services-crm:modules/regions/tests/e2e/regions.e2e.spec.js#answers 400 for an order that does not
        name every rule of the tenant
      - >-
        services-crm:modules/regions/tests/e2e/regions.e2e.spec.js#puts the rules in the order the body
        names, renumbering the positions
  - id: ATS-CRM-REG-005-05
    title: Individual writes invalidate older policy drafts
    level: api
    proves:
      - BR-CAP-CRM-REG-005-06
    preconditions: A client reads settings at version four.
    steps: Create a rule and submit the older whole-list draft.
    expected: The settings version advances and the older draft conflicts without dropping the new rule.
    negative: true
    data_needs: An existing assignment configuration.
    bound_to:
      - TST-CRM-REG-050
    provenance: test
    source: >-
      services-crm:modules/regions/tests/integration/services/persistence/region-assignment-settings.integration.spec.js#rules
      written one at a time, beside a settings save › moves the settings’ version once for each rule
      written, as a settings save does
    category: concurrency
    test_assertions:
      - >-
        services-crm:modules/regions/tests/integration/services/persistence/region-assignment-settings.integration.spec.js#rules
        written one at a time, beside a settings save › moves the settings’ version once for each rule
        written, as a settings save does
      - >-
        services-crm:modules/regions/tests/integration/services/persistence/region-assignment-settings.integration.spec.js#rules
        written one at a time, beside a settings save › a whole-list save read before a rule was created
        › is refused as stale, so the new rule is not dropped
      - >-
        services-crm:modules/regions/tests/integration/services/persistence/region-assignment-settings.integration.spec.js#rules
        written one at a time, beside a settings save › a whole-list save read before a rule was created
        › leaves the rule created beside it in the list
  - id: ATS-CRM-REG-005-06
    title: Enabled assignment tolerates removal of its final rule
    level: api
    proves:
      - BR-CAP-CRM-REG-005-09
    preconditions: The policy has one enabled rule.
    steps: Disable and then remove that rule.
    expected: The requests succeed and assignment remains enabled with no rules.
    negative: false
    data_needs: A single policy entry.
    bound_to:
      - TST-CRM-REG-047
    provenance: test
    source: >-
      services-crm:modules/regions/tests/e2e/regions.e2e.spec.js#the last enabled rule while assignment
      is on › disables it, leaving the tenant assignment on with nothing to match
    category: edge
    test_assertions:
      - >-
        services-crm:modules/regions/tests/e2e/regions.e2e.spec.js#the last enabled rule while assignment
        is on › disables it, leaving the tenant assignment on with nothing to match
      - >-
        services-crm:modules/regions/tests/e2e/regions.e2e.spec.js#the last enabled rule while assignment
        is on › deletes it
      - >-
        services-crm:modules/regions/tests/e2e/regions.e2e.spec.js#the last enabled rule while assignment
        is on › leaves assignment on, so the console’s switch stays usable with no rule
  - id: ATS-CRM-REG-005-07
    title: Rule reads cannot cross workspaces
    level: api
    proves:
      - BR-CAP-CRM-REG-005-11
    preconditions: Separate workspaces hold rules.
    steps: List through the other workspace and request an unknown rule.
    expected: No foreign rule appears and the unknown read returns not found.
    negative: true
    data_needs: Two distinct customer workspaces.
    bound_to:
      - TST-CRM-REG-047
    provenance: test
    source: >-
      services-crm:modules/regions/tests/e2e/regions.e2e.spec.js#the rules, one at a time › answers none
      of this tenant's rules to another tenant's list
    category: boundary
    test_assertions:
      - >-
        services-crm:modules/regions/tests/e2e/regions.e2e.spec.js#the rules, one at a time › answers
        none of this tenant's rules to another tenant's list
      - >-
        services-crm:modules/regions/tests/e2e/regions.e2e.spec.js#answers 404 for a rule the tenant does
        not have
  - id: ATS-CRM-REG-005-08
    title: A single-rule edit changes matching and invalidates bulk currency
    category: interaction
    level: api
    proves:
      - BR-CAP-CRM-REG-005-05
      - BR-CAP-CRM-REG-005-06
      - BR-CAP-CRM-REG-006-01
      - BR-CAP-CRM-REG-010-03
    preconditions: An enabled policy has a completed current-generation run and two overlapping rules.
    steps: >-
      Read a whole-policy draft, reorder rules individually, preview the overlap, inspect need and
      attempt to save the old draft.
    expected: >-
      The reordered first match supplies the result, another recalculation is needed and the stale
      whole-policy save conflicts.
    negative: false
    data_needs: An enabled policy has a completed current-generation run and two overlapping rules.
    bound_to: []
    provenance: proposed
    source: WF-CRM-REG-004
    exercises:
      - CAP-CRM-REG-004
      - CAP-CRM-REG-005
      - CAP-CRM-REG-006
      - CAP-CRM-REG-010
  - id: ATS-CRM-REG-005-09
    title: The first individual rule initializes disabled settings
    category: transition
    level: api
    proves:
      - BR-CAP-CRM-REG-005-08
      - BR-CAP-CRM-REG-005-04
    preconditions: A workspace has never saved settings and has one local target region.
    steps: 'Create its first rule, read settings, delete that rule and read settings again.'
    expected: >-
      The first write creates disabled defaults; deletion leaves saved disabled settings and an empty
      order.
    negative: false
    data_needs: A workspace has never saved settings and has one local target region.
    bound_to: []
    provenance: proposed
    source: >-
      services-crm:modules/regions/services/persistence/region-assignment-settings.ts:lockSettingsRowForRuleWrite
evidence:
  - >-
    services-crm: Examined the pinned regional implementation, its declared constraints and the
    supporting records.
  - 'react-console: Examined the pinned regional configuration surfaces and their available test evidence.'
  - 'services-crm:modules/regions/tests/e2e/regions.e2e.spec.js'
  - >-
    services-crm:modules/regions/tests/integration/services/persistence/region-assignment-settings.integration.spec.js
coverage:
  rule: covered
  transition: covered
  validation: covered
  permission: 'gap: FND-CRM-REG-050'
  edge: covered
  failure: 'gap: FND-CRM-REG-050'
  boundary: covered
  concurrency: covered
  invariant: covered
  interaction: covered
---

# Maintain individual rules alongside the shared policy: Capability Test Specification

## Coverage

Each row links a required rule to its authored proof. A covered category records a specification; executable and remaining variant gaps stay in the finding register.

| Rule | Proved By |
|---|---|
| `BR-CAP-CRM-REG-005-01` | `ATS-CRM-REG-005-01` |
| `BR-CAP-CRM-REG-005-02` | `ATS-CRM-REG-005-02` |
| `BR-CAP-CRM-REG-005-04` | `ATS-CRM-REG-005-03`, `ATS-CRM-REG-005-09` |
| `BR-CAP-CRM-REG-005-05` | `ATS-CRM-REG-005-04`, `ATS-CRM-REG-005-08` |
| `BR-CAP-CRM-REG-005-06` | `ATS-CRM-REG-005-05`, `ATS-CRM-REG-005-08` |
| `BR-CAP-CRM-REG-005-09` | `ATS-CRM-REG-005-06` |
| `BR-CAP-CRM-REG-005-11` | `ATS-CRM-REG-005-07` |

## Interactions With Related Capabilities

A single-rule edit changes matching and invalidates bulk currency. The interaction scenario connects build the geographic assignment policy, determine an address’s geographic region, identify placements that need recalculation with this capability. Cross-workflow expectations are proposed where no executable binding is present.
