---
id: TST-CRM-REG-058
title: Record placement and recalculation integration
kind: integration
product_area: crm
module: regions
revision: 1
status: draft
source_sha:
  services-crm: a8d1364f1dd44b723bb5f9acba12f983e9ec8d69
repository: services-crm
files:
  - modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js
implements:
  - ATS-CRM-REG-003-03
  - ATS-CRM-REG-004-05
  - ATS-CRM-REG-006-01
  - ATS-CRM-REG-006-04
  - ATS-CRM-REG-008-01
  - ATS-CRM-REG-008-02
  - ATS-CRM-REG-008-03
  - ATS-CRM-REG-008-04
  - ATS-CRM-REG-008-05
  - ATS-CRM-REG-008-06
  - ATS-CRM-REG-008-10
  - ATS-CRM-REG-008-11
  - ATS-CRM-REG-008-14
  - ATS-CRM-REG-009-01
  - ATS-CRM-REG-009-02
  - ATS-CRM-REG-009-03
  - ATS-CRM-REG-009-04
  - ATS-CRM-REG-010-01
  - ATS-CRM-REG-011-02
  - ATS-CRM-REG-011-03
  - ATS-CRM-REG-011-04
  - ATS-CRM-REG-011-05
  - ATS-CRM-REG-011-06
  - ATS-CRM-REG-011-07
  - ATS-CRM-REG-011-08
  - FAS-CRM-REG-03-01
  - ATS-CRM-REG-006-14
environment: local
implementation_state: implemented
latest_result: not-run
latest_run_at: null
latest_run_ref: null
conformance: not-verified
estimated_minutes: 2
isolation: Suite-owned workspace and records in the prepared test database.
evidence:
  - >-
    services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js
assertions:
  - scenario: ATS-CRM-REG-003-03
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#assignment
      switched off › gives a contact created while only organizations are assigned no region
  - scenario: ATS-CRM-REG-003-03
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#assignment
      switched off › still assigns organizations
  - scenario: ATS-CRM-REG-004-05
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#refusals
      › refuses settings whose rule names a region the tenant does not have
  - scenario: ATS-CRM-REG-006-01
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#incomplete
      addresses and the matcher’s own comparisons › answers the first rule in order when two match
      (postal code before state)
  - scenario: ATS-CRM-REG-006-04
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#incomplete
      addresses and the matcher’s own comparisons › matches a ZIP+4 postal code inside a five-digit range
  - scenario: ATS-CRM-REG-008-01
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#initial
      assignment › answers no region from the create itself, because the assignment is a reaction to the
      committed save
  - scenario: ATS-CRM-REG-008-01
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#initial
      assignment › gives a contact created with a matching address that address's region
  - scenario: ATS-CRM-REG-008-02
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#moving
      › moves a contact from region A to region B when its address moves
  - scenario: ATS-CRM-REG-008-02
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#moving
      › moves an organization when its main address moves
  - scenario: ATS-CRM-REG-008-03
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#moving
      › clears the region when the deciding address is removed
  - scenario: ATS-CRM-REG-008-03
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#moving
      › clears the region when the new address matches no rule
  - scenario: ATS-CRM-REG-008-03
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#moving
      › clears an organization's region when its main address is removed
  - scenario: ATS-CRM-REG-008-04
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#moving
      › ignores a change to an address that does not decide the region
  - scenario: ATS-CRM-REG-008-04
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#the
      deciding address type › ignores a change of the home address then
  - scenario: ATS-CRM-REG-008-05
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#moving
      › follows the address that became preferred
  - scenario: ATS-CRM-REG-008-05
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#the
      deciding address type › decides by the address of the named type, not by an address of another type
  - scenario: ATS-CRM-REG-008-05
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#the
      deciding address type › decides an organization by the address type the settings name, not by its
      main address
  - scenario: ATS-CRM-REG-008-06
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#initial
      assignment › keeps a region the client sends with a contact that has no address (nothing decides
      it)
  - scenario: ATS-CRM-REG-008-10
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#the
      version an organization’s assignment bumps › leaves an organization at the version its save
      answered when its region does not change
  - scenario: ATS-CRM-REG-008-10
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#the
      version an organization’s assignment bumps › bumps it once past the save when the region moves
  - scenario: ATS-CRM-REG-008-11
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#a
      linked address (docs/affiliations/README.md §0b.3, the fan-out) › moves the linked contact when its
      organization’s address moves, though no contact row was written
  - scenario: ATS-CRM-REG-008-11
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#a
      linked address (docs/affiliations/README.md §0b.3, the fan-out) › bumps the contact’s version once,
      for the region that moved and nothing else
  - scenario: ATS-CRM-REG-008-14
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#tenant
      isolation › assigns nothing in a tenant with no settings, whatever another tenant's rules say
  - scenario: ATS-CRM-REG-009-01
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#manual
      regions and the override › never changes the region of a contact that overrides automatic
      assignment
  - scenario: ATS-CRM-REG-009-01
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#manual
      regions and the override › never changes the region of an organization that overrides automatic
      assignment
  - scenario: ATS-CRM-REG-009-02
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#manual
      regions and the override › keeps a manual region while the deciding address is unchanged
  - scenario: ATS-CRM-REG-009-02
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#manual
      regions and the override › replaces a manual region when the deciding address changes
  - scenario: ATS-CRM-REG-009-03
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#manual
      regions and the override › a contact moved while overridden, then switched back to automatic › kept
      the region while the override was on, so the move was left undecided
  - scenario: ATS-CRM-REG-009-03
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#manual
      regions and the override › a contact moved while overridden, then switched back to automatic ›
      assigns the region of the address it moved to once the override is off
  - scenario: ATS-CRM-REG-009-03
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#manual
      regions and the override › an organization moved while overridden, then switched back to automatic
      › assigns the region of the address it moved to once the override is off
  - scenario: ATS-CRM-REG-009-04
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#refusals
      › refuses a contact naming a region the tenant does not have
  - scenario: ATS-CRM-REG-010-01
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#rule
      changes and the recalculation › changes no record when the rules are saved
  - scenario: ATS-CRM-REG-011-02
    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
  - scenario: ATS-CRM-REG-011-02
    source: >-
      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
  - scenario: ATS-CRM-REG-011-03
    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
  - scenario: ATS-CRM-REG-011-03
    source: >-
      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
  - scenario: ATS-CRM-REG-011-03
    source: >-
      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`
  - scenario: ATS-CRM-REG-011-04
    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
  - scenario: ATS-CRM-REG-011-04
    source: >-
      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
  - scenario: ATS-CRM-REG-011-05
    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
  - scenario: ATS-CRM-REG-011-05
    source: >-
      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
  - scenario: ATS-CRM-REG-011-06
    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
  - scenario: ATS-CRM-REG-011-06
    source: >-
      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)
  - scenario: ATS-CRM-REG-011-07
    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
  - scenario: ATS-CRM-REG-011-07
    source: >-
      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
  - scenario: ATS-CRM-REG-011-08
    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
  - scenario: FAS-CRM-REG-03-01
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#moves
      the contact when its deciding address moves
  - scenario: ATS-CRM-REG-006-14
    source: >-
      services-crm:modules/regions/tests/integration/services/region-assignment/region-assignment.integration.spec.js#normalized
      address variants (the save-time cleaning, docs/migrations/contact-and-organization-cleaning/) ›
      matches a state rule from the state written out in full
binding_scope: >-
  Exact assertion anchors identify the contribution of this file. Scenario-level bindings may compose
  several files; registration does not assert that every file alone executes every scenario step.
---

# Record placement and recalculation integration

## Verification Boundary

The suite exercises real regional persistence and processing against the prepared database. It verifies the source assertions linked in this register.

## What This Suite Proves

The linked source assertions contribute checks for record-kind selection limits placement; foreign and absent rule targets are rejected; ordering resolves overlapping criteria; text intervals include their endpoints; placement is a reaction to committed creation; moving the deciding address changes placement; lost deciding input clears calculated placement; other address edits preserve placement; configured sources determine reassignment; no past address preserves a manual region; version effects depend on placement change; linked placement follows organization address edits; workspace policies do not leak; overrides preserve manual exceptions; manual placement without override follows changed input; releasing an override uses the current address; foreign regions cannot be saved on records; policy saves preserve existing placements; repeated starts return one active run; request processing and continuation share the run; continuation resumes committed progress; recalculation applies changed coverage; held and never-addressed records remain; identical-policy repetition changes no placement; concurrent address editing converges; a changed deciding address moves an eligible record; save-time geographic cleaning feeds matching. A scenario spanning several files relies on those assertions together; this file supplies only its named checks.

## What It Does Not Prove

The register establishes neither a current passing run nor verified conformance. Unbound scenarios, broader feature chains and the delegated infrastructure beyond this execution boundary remain unproved.

## Real Dependencies and Test Doubles

PostgreSQL, event capture, dispatch, consumer routing and regional processing are real. The delivery harness replaces the external queue with an in-memory message list.

## Must Not Be Doubled

Regional matching, regional persistence and the stored values under assertion must remain real. A substitute answer for these dependencies cannot qualify the linked regional outcomes.
