---
id: ATS-MBR-STR-004
scope: CAP-MBR-STR-004
product_area: membership
module: structure
revision: 1
status: proposed
approved_by: null
approved_at: null
source_sha:
  services-membership: 5994c270e8a37a30f848e99ba5b5ee6b87c08893
  react-console: baf6dae382d6f41dce976c7f848667ccc37e076f
scenarios:
  - id: ATS-MBR-STR-004-01
    title: Closing a parent preserves its existing branch
    level: api
    proves:
      - BR-CAP-MBR-STR-004-01
    preconditions: >-
      An isolated Membership-licensed workspace contains the relevant records, with caller permissions
      selected for the case.
    steps: Deactivate a populated chapter and attempt a new child and affiliation.
    expected: Existing sections stay active and the new relationships are rejected.
    negative: false
    data_needs: The FAA example records or equivalent records prepared within the isolated workspace.
    bound_to:
      - >-
        services-membership:modules/structure/tests/integration/services/tree/unit-merge.integration.spec.ts#the
        tree edits affiliations bind › delete and deactivate › deactivates it instead
      - >-
        services-membership:tests/acceptance/structure/MBR-ACC-0020.acceptance.ts#MBR-ACC-0020 deactivating a
        chapter freezes it, and there is no way back
    provenance: test
    source: >-
      services-membership:modules/structure/tests/integration/services/tree/unit-merge.integration.spec.ts#the
      tree edits affiliations bind › delete and deactivate › deactivates it instead
  - id: ATS-MBR-STR-004-02
    title: Ended affiliations still protect unit identity
    level: api
    proves:
      - BR-CAP-MBR-STR-004-04
    preconditions: >-
      An isolated Membership-licensed workspace contains the relevant records, with caller permissions
      selected for the case.
    steps: >-
      Attempt deletion of a unit referenced only by ended affiliations and a source with transferred
      affiliation history.
    expected: Both responses refuse removal and report the affiliation count.
    negative: true
    data_needs: The FAA example records or equivalent records prepared within the isolated workspace.
    bound_to:
      - >-
        services-membership:modules/structure/tests/integration/services/tree/unit-merge.integration.spec.ts#the
        tree edits affiliations bind › delete and deactivate › refuses to delete a unit a closed affiliation
        names, 409 unit_has_affiliations with the count
      - >-
        services-membership:tests/e2e/s13-unit-merge.e2e.spec.ts#a unit merge moves its members: Savannah into
        Atlanta › refuses to delete Savannah while affiliations name it (unit_has_affiliations)
      - >-
        services-membership:modules/structure/tests/unit/services/tree-edits.spec.ts#the tree edits › delete ›
        refuses 409 unit_has_affiliations while an affiliation names the unit, before deleting
    provenance: test
    source: >-
      services-membership:modules/structure/tests/integration/services/tree/unit-merge.integration.spec.ts#the
      tree edits affiliations bind › delete and deactivate › refuses to delete a unit a closed affiliation
      names, 409 unit_has_affiliations with the count
  - id: ATS-MBR-STR-004-03
    title: Structural references prevent removal
    level: api
    proves:
      - BR-CAP-MBR-STR-004-05
    preconditions: >-
      An isolated Membership-licensed workspace contains the relevant records, with caller permissions
      selected for the case.
    steps: 'Test deletion while children, retained parent periods, organization links or survivor references remain.'
    expected: Each response identifies retained use and preserves the unit.
    negative: true
    data_needs: The FAA example records or equivalent records prepared within the isolated workspace.
    bound_to:
      - >-
        services-membership:tests/e2e/structure-api.e2e.spec.ts#the structure API, end to end in process ›
        refuses to delete a unit in use, 409 unit_in_use
      - >-
        services-membership:modules/structure/tests/integration/services/persistence/organizational-units.integration.spec.ts#organizational
        units in the database › the refusals › refuses to delete a unit that has children
    provenance: test
    source: >-
      services-membership:tests/e2e/structure-api.e2e.spec.ts#the structure API, end to end in process ›
      refuses to delete a unit in use, 409 unit_in_use
  - id: ATS-MBR-STR-004-04
    title: Other membership records protect unit identity
    level: api
    proves:
      - BR-CAP-MBR-STR-004-06
    preconditions: >-
      An isolated Membership-licensed workspace contains the relevant records, with caller permissions
      selected for the case.
    steps: Attempt deletion of a program-owning unit and a membership-identifying unit.
    expected: Each refusal identifies the reference and keeps the unit.
    negative: true
    data_needs: The FAA example records or equivalent records prepared within the isolated workspace.
    bound_to:
      - >-
        services-membership:tests/e2e/database-refusals.e2e.spec.ts#mistakes only the database catches,
        through the API › DEF-MBR-0084: a structure delete a program’s reference blocks › refuses deleting a
        unit a program is owned by 409 unit_in_use, and keeps it
      - >-
        services-membership:tests/e2e/database-refusals.e2e.spec.ts#mistakes only the database catches,
        through the API › DEF-MBR-0012: a structure delete an identity-bound membership blocks › refuses
        deleting a unit a membership is identified by 409 unit_in_use naming the reference, and keeps it
      - >-
        services-membership:tests/acceptance/structure/MBR-ACC-0037.acceptance.ts#MBR-ACC-0037 what other
        parts of Membership name in the structure
    provenance: test
    source: >-
      services-membership:tests/e2e/database-refusals.e2e.spec.ts#mistakes only the database catches, through
      the API › DEF-MBR-0084: a structure delete a program’s reference blocks › refuses deleting a unit a
      program is owned by 409 unit_in_use, and keeps it
  - id: ATS-MBR-STR-004-05
    title: Removing a free leaf clears its owned data
    level: api
    proves:
      - BR-CAP-MBR-STR-004-07
    preconditions: >-
      An isolated Membership-licensed workspace contains the relevant records, with caller permissions
      selected for the case.
    steps: 'Remove a leaf whose references are all absent, then inspect its owned rows.'
    expected: 'The unit and its current pairs, parent periods, custom values and finance settings are absent.'
    negative: false
    data_needs: The FAA example records or equivalent records prepared within the isolated workspace.
    bound_to:
      - >-
        services-membership:modules/structure/tests/unit/services/tree-edits.spec.ts#the tree edits › delete ›
        deletes a unit no affiliation and nothing else names
    provenance: test
    source: >-
      services-membership:modules/structure/tests/unit/services/tree-edits.spec.ts#the tree edits › delete ›
      deletes a unit no affiliation and nothing else names
evidence:
  - >-
    services-membership:modules/structure/tests/integration/services/persistence/organizational-units.integration.spec.ts
  - 'services-membership:modules/structure/tests/integration/services/tree/unit-merge.integration.spec.ts'
  - 'services-membership:modules/structure/tests/unit/services/tree-edits.spec.ts'
  - 'services-membership:tests/acceptance/structure/MBR-ACC-0020.acceptance.ts'
  - 'services-membership:tests/acceptance/structure/MBR-ACC-0037.acceptance.ts'
  - 'services-membership:tests/e2e/database-refusals.e2e.spec.ts'
  - 'services-membership:tests/e2e/s13-unit-merge.e2e.spec.ts'
  - 'services-membership:tests/e2e/structure-api.e2e.spec.ts'
---

# Close units or remove units without retained dependencies: Acceptance Test Set

## Coverage

| Rule | Proof Scenario or Open Finding |
|---|---|
| `BR-CAP-MBR-STR-004-01` | `ATS-MBR-STR-004-01` |
| `BR-CAP-MBR-STR-004-02` | no scenario: `FND-MBR-STR-036` |
| `BR-CAP-MBR-STR-004-04` | `ATS-MBR-STR-004-02` |
| `BR-CAP-MBR-STR-004-05` | `ATS-MBR-STR-004-03` |
| `BR-CAP-MBR-STR-004-06` | `ATS-MBR-STR-004-04` |
| `BR-CAP-MBR-STR-004-07` | `ATS-MBR-STR-004-05` |
