---
id: ATS-CRM-REG-011
scope: CAP-CRM-REG-011
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-011-01
    title: Start authority uses the admin-tier key
    level: unit
    proves:
      - BR-CAP-CRM-REG-011-01
    preconditions: The regional permission catalogue is published.
    steps: Inspect the start requirement and its published tier.
    expected: Starting uses the administrator-tier recalculation permission.
    negative: true
    data_needs: Published operation-access metadata.
    bound_to:
      - TST-CRM-REG-067
    provenance: test
    source: >-
      services-crm:tests/unit/regions-authorization.spec.ts#requires crm.regions.recalculate to start a
      recalculation
    category: permission
    test_assertions:
      - >-
        services-crm:tests/unit/regions-authorization.spec.ts#requires crm.regions.recalculate to start a
        recalculation
      - >-
        services-crm:tests/unit/regions-authorization.spec.ts#publishes crm.regions.recalculate in the
        catalog, at tier admin
  - id: ATS-CRM-REG-011-02
    title: Repeated starts return one active run
    level: api
    proves:
      - BR-CAP-CRM-REG-011-02
    preconditions: The workspace has a running recalculation.
    steps: Request another start twice.
    expected: The requests return the existing run and create no additional run record.
    negative: false
    data_needs: Record volume requiring continuation.
    bound_to:
      - TST-CRM-REG-058
      - TST-CRM-REG-052
      - TST-CRM-REG-001
    provenance: test
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#a
      recalculation resumed in batches › answers the running run to a second request instead of starting
      another
    category: concurrency
    test_assertions:
      - >-
        services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#a
        recalculation resumed in batches › answers the running run to a second request instead of
        starting another
      - >-
        services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#a
        start request while a run nothing has advanced is in progress › answers the run in progress
        rather than starting another
      - >-
        services-crm:modules/regions/tests/integration/services/persistence/region-recalculations.integration.spec.js#refuses
        a second running run for the tenant
      - >-
        services-crm:modules/regions/tests/integration/services/persistence/region-recalculations.integration.spec.js#allows
        a running run in another tenant at the same time
      - 'react-console:acceptance/crm/playwright/journeys/adversarial/CRM-ACC-0749.spec.ts#CRM-ACC-0749'
  - id: ATS-CRM-REG-011-03
    title: Request processing and continuation share the run
    level: api
    proves:
      - BR-CAP-CRM-REG-011-03
    preconditions: One workspace is small and another needs multiple batches.
    steps: Start work in each with the relevant processing budget.
    expected: >-
      The small run can complete in the request; unfinished work remains running and requests
      continuation.
    negative: false
    data_needs: Two distinct customer workspaces.
    bound_to:
      - TST-CRM-REG-058
      - TST-CRM-REG-047
    provenance: test
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#rule
      changes and the recalculation › finishes a small tenant within the request
    category: transition
    test_assertions:
      - >-
        services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#rule
        changes and the recalculation › finishes a small tenant within the request
      - >-
        services-crm:modules/regions/tests/e2e/regions.e2e.spec.js#answers the recalculation, completed
        within the request
      - >-
        services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#a
        recalculation resumed in batches › answers a run still running after one batch
      - >-
        services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#a
        recalculation resumed in batches › asks for the next worker by incrementing `continuation`
  - id: ATS-CRM-REG-011-04
    title: Continuation resumes committed progress
    level: api
    proves:
      - BR-CAP-CRM-REG-011-04
    preconditions: A run has committed its first batch.
    steps: Continue processing until completion.
    expected: The committed traversal advances without repeating already traversed records.
    negative: false
    data_needs: A population beyond the batch boundary.
    bound_to:
      - TST-CRM-REG-058
    provenance: test
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#a
      recalculation resumed in batches › continues from its cursor, never repeating a record
    category: transition
    test_assertions:
      - >-
        services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#a
        recalculation resumed in batches › continues from its cursor, never repeating a record
      - >-
        services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#a
        recalculation resumed in batches › ends completed, with every record examined once
  - id: ATS-CRM-REG-011-05
    title: Recalculation applies changed coverage
    level: api
    proves:
      - BR-CAP-CRM-REG-011-05
      - AS-JNY-CRM-REG-002-01
    preconditions: Saved rules now point to different targets.
    steps: Run recalculation.
    expected: Eligible contacts and organizations receive the new targets.
    negative: false
    data_needs: CRM records with prior regional placements.
    bound_to:
      - TST-CRM-REG-058
      - TST-CRM-REG-047
      - TST-CRM-REG-066
      - TST-CRM-REG-009
      - TST-CRM-REG-061
    provenance: test
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#rule
      changes and the recalculation › moves a contact to its region under the new rules
    category: rule
    test_assertions:
      - >-
        services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#rule
        changes and the recalculation › moves a contact to its region under the new rules
      - >-
        services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#rule
        changes and the recalculation › moves an organization to its region under the new rules
      - >-
        services-crm:modules/regions/tests/e2e/regions.e2e.spec.js#moves the contact to its region under
        the new rules
      - >-
        services-crm:tests/e2e/dev/regions.dev.spec.ts#moves the contact to its region under the new
        rules
      - 'react-console:acceptance/crm/playwright/journeys/configuration/CRM-ACC-0360.spec.ts#CRM-ACC-0360'
      - >-
        services-crm:modules/regions/tests/legacy/rolodex-regions/tests/e2e/recalculate-regions.e2e.spec.js#Recalculate
        Regions (e2e) › organization should have updated the region
  - id: ATS-CRM-REG-011-06
    title: Held and never-addressed records remain
    level: api
    proves:
      - BR-CAP-CRM-REG-011-06
      - AS-JNY-CRM-REG-002-02
    preconditions: One contact is overridden and another has a manual region with no past deciding address.
    steps: Recalculate the policy.
    expected: Both preserve their existing regions.
    negative: false
    data_needs: A pair of contact records.
    bound_to:
      - TST-CRM-REG-058
    provenance: test
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#rule
      changes and the recalculation › leaves a contact that overrides automatic assignment
    category: invariant
    test_assertions:
      - >-
        services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#rule
        changes and the recalculation › leaves a contact that overrides automatic assignment
      - >-
        services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#rule
        changes and the recalculation › leaves a contact with no address (nothing decides its region)
  - id: ATS-CRM-REG-011-07
    title: Identical-policy repetition changes no placement
    level: api
    proves:
      - BR-CAP-CRM-REG-011-07
      - AS-JNY-CRM-REG-002-03
    preconditions: The preceding recalculation completed successfully.
    steps: Start a further run without changing inputs.
    expected: A new run is recorded without changing record placements.
    negative: false
    data_needs: CRM records with prior regional placements.
    bound_to:
      - TST-CRM-REG-058
    provenance: test
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#rule
      changes and the recalculation › starts a new run when asked again after the first finished
    category: invariant
    test_assertions:
      - >-
        services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#rule
        changes and the recalculation › starts a new run when asked again after the first finished
      - >-
        services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#rule
        changes and the recalculation › changes nothing on a second run under the same rules
  - id: ATS-CRM-REG-011-08
    title: Concurrent address editing converges
    level: api
    proves:
      - BR-CAP-CRM-REG-011-08
    preconditions: Recalculation is processing a contact.
    steps: Commit a new contact address during its batch.
    expected: Eventual placement corresponds to the newest address.
    negative: false
    data_needs: A contact selected during the concurrent batch.
    bound_to:
      - TST-CRM-REG-058
    provenance: test
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#a
      save racing a recalculation › ends with the region of the newest address
    category: concurrency
    test_assertions:
      - >-
        services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#a
        save racing a recalculation › ends with the region of the newest address
  - id: ATS-CRM-REG-011-09
    title: Counters distinguish traversal from placement changes
    level: api
    proves:
      - BR-CAP-CRM-REG-011-10
    preconditions: Five records are traversed and two placements change.
    steps: Finish recalculation and inspect the result.
    expected: Examined includes all traversed records and changed counts the two placement changes.
    negative: false
    data_needs: Five traversed CRM records.
    bound_to:
      - TST-CRM-REG-053
    provenance: test
    source: >-
      services-crm:modules/regions/tests/integration/services/persistence/region-recalculations.queries.integration.spec.js#the
      record a batch of the run answers › answers the whole record of the run the following batches
      finished, counting every record it walked
    category: rule
    test_assertions:
      - >-
        services-crm:modules/regions/tests/integration/services/persistence/region-recalculations.queries.integration.spec.js#the
        record a batch of the run answers › answers the whole record of the run the following batches
        finished, counting every record it walked
  - id: ATS-CRM-REG-011-10
    title: Recalculation preserves exceptions and reports its coverage
    category: interaction
    level: api
    proves:
      - BR-CAP-CRM-REG-011-01
      - BR-CAP-CRM-REG-011-05
      - BR-CAP-CRM-REG-011-06
      - BR-CAP-CRM-REG-010-02
      - BR-CAP-CRM-REG-012-01
    preconditions: >-
      An enabled policy changes the target for existing addressed contacts and organizations; one contact
      has a hold.
    steps: >-
      Check authority, start a small-batch run, read progress, finish it and read both placement and
      policy currency.
    expected: >-
      Authorized traversal moves eligible placements, retains the held contact and exposes completion;
      currency clears only for coverage of current policy.
    negative: false
    data_needs: >-
      An enabled policy changes the target for existing addressed contacts and organizations; one contact
      has a hold.
    bound_to: []
    provenance: proposed
    source: WF-CRM-REG-003
    exercises:
      - CAP-CRM-REG-008
      - CAP-CRM-REG-009
      - CAP-CRM-REG-010
      - CAP-CRM-REG-011
      - CAP-CRM-REG-012
      - CAP-CRM-REG-013
  - id: ATS-CRM-REG-011-11
    title: Traversal handles empty exact and overflow batch sizes
    category: boundary
    level: api
    proves:
      - BR-CAP-CRM-REG-011-04
      - BR-CAP-CRM-REG-011-10
      - INV-DOM-CRM-REG-004-04
    preconditions: >-
      Separate workspaces have zero, exactly one batch and one more than a batch of eligible records in
      each kind.
    steps: 'Run with a fixed small batch size and inspect every phase change, cursor and final count.'
    expected: >-
      Each record is examined once, exact-size phases use a later short batch to advance, and both phases
      finish without omission.
    negative: false
    data_needs: >-
      Separate workspaces have zero, exactly one batch and one more than a batch of eligible records in
      each kind.
    bound_to: []
    provenance: proposed
    source: 'services-crm:modules/regions/services/region-assignment/region-recalculation.ts:recalculateBatch'
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:tests/unit/regions-authorization.spec.ts'
  - >-
    services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js
  - >-
    services-crm:modules/regions/tests/integration/services/persistence/region-recalculations.integration.spec.js
  - 'react-console:acceptance/crm/playwright/journeys/adversarial/CRM-ACC-0749.spec.ts'
  - 'services-crm:modules/regions/tests/e2e/regions.e2e.spec.js'
  - 'services-crm:tests/e2e/dev/regions.dev.spec.ts'
  - 'react-console:acceptance/crm/playwright/journeys/configuration/CRM-ACC-0360.spec.ts'
  - 'services-crm:modules/regions/tests/legacy/rolodex-regions/tests/e2e/recalculate-regions.e2e.spec.js'
  - >-
    services-crm:modules/regions/tests/integration/services/persistence/region-recalculations.queries.integration.spec.js
coverage:
  rule: covered
  transition: covered
  validation: 'gap: FND-CRM-REG-056'
  permission: covered
  edge: 'gap: FND-CRM-REG-056'
  failure: 'gap: FND-CRM-REG-056'
  boundary: covered
  concurrency: covered
  invariant: covered
  interaction: covered
---

# Apply the current policy across existing records: 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-011-01` | `ATS-CRM-REG-011-01`, `ATS-CRM-REG-011-10` |
| `BR-CAP-CRM-REG-011-02` | `ATS-CRM-REG-011-02` |
| `BR-CAP-CRM-REG-011-03` | `ATS-CRM-REG-011-03` |
| `BR-CAP-CRM-REG-011-04` | `ATS-CRM-REG-011-04`, `ATS-CRM-REG-011-11` |
| `BR-CAP-CRM-REG-011-05` | `ATS-CRM-REG-011-05`, `ATS-CRM-REG-011-10` |
| `BR-CAP-CRM-REG-011-06` | `ATS-CRM-REG-011-06`, `ATS-CRM-REG-011-10` |
| `BR-CAP-CRM-REG-011-07` | `ATS-CRM-REG-011-07` |
| `BR-CAP-CRM-REG-011-08` | `ATS-CRM-REG-011-08` |
| `BR-CAP-CRM-REG-011-10` | `ATS-CRM-REG-011-09`, `ATS-CRM-REG-011-11` |

## Interactions With Related Capabilities

Recalculation preserves exceptions and reports its coverage. The interaction scenario connects keep placements aligned with address changes, preserve a deliberate regional exception, identify placements that need recalculation, monitor recalculation and recover from failure with this capability. Cross-workflow expectations are proposed where no executable binding is present.
