---
id: CAP-MBR-STR-004
title: Close units or remove units without retained dependencies
feature: FEAT-MBR-STR-01
product_area: membership
module: structure
revision: 1
status: draft
product_intent: proposed
implementation_evidence: observed
supersedes:
  - react-console acceptance inventory CAP-MBR-STR-007
source_sha:
  services-membership: 5994c270e8a37a30f848e99ba5b5ee6b87c08893
  react-console: baf6dae382d6f41dce976c7f848667ccc37e076f
intent_sources: []
purpose: Staff choose preservation or removal according to the references that still depend on a unit.
outcomes:
  - Closed units remain available for historical interpretation.
  - Removal is refused while retained records depend on the unit.
concepts:
  - CON-MBR-STR-001
  - CON-MBR-STR-002
actors:
  - ACT-MBR-001
surfaces:
  - api
preconditions: []
postconditions: []
permissions:
  - key: membership.structure.manage
    where_checked: api
    scope: tenant
  - key: membership.application.access
    where_checked: api
    scope: tenant
rules:
  - id: BR-CAP-MBR-STR-004-01
    statement: >-
      Deactivation retains a unit’s children, placement, history, links and finance records, leaves child
      statuses unchanged and prevents new children and member affiliations.
    kind: lifecycle
    enforced_at:
      - service
    must_prove: true
    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
    origin: none
  - id: BR-CAP-MBR-STR-004-02
    statement: >-
      Repeated deactivation leaves an inactive unit unchanged, rejects merged units and checks a version only
      when one is supplied.
    kind: lifecycle
    enforced_at:
      - service
    must_prove: true
    provenance: observed
    source: 'services-membership:modules/structure/services/tree/tree-edits.ts:deactivateUnit'
    origin: none
  - id: BR-CAP-MBR-STR-004-03
    statement: 'Unit reactivation has no operation, and detail replacement discards a submitted status.'
    kind: lifecycle
    enforced_at:
      - api
      - service
    must_prove: false
    provenance: observed
    source: 'services-membership:modules/structure/aws/api/structure-requests.ts:unitReplaceBody'
    origin: none
  - id: BR-CAP-MBR-STR-004-04
    statement: 'Any retained member affiliation, including an ended affiliation, prevents unit deletion.'
    kind: validation
    enforced_at:
      - service
    must_prove: true
    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
    origin: none
  - id: BR-CAP-MBR-STR-004-05
    statement: >-
      Current children, retained history naming the unit as parent, organization links, dues products and
      merged units naming it as survivor prevent deletion.
    kind: validation
    enforced_at:
      - service
    must_prove: true
    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
    origin: none
  - id: BR-CAP-MBR-STR-004-06
    statement: >-
      Deletion is refused with the referencing constraint when a program, membership identity or application
      still depends on the unit.
    kind: validation
    enforced_at:
      - service
      - database
    must_prove: true
    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
    origin: none
  - id: BR-CAP-MBR-STR-004-07
    statement: >-
      Removing an unreferenced unit also removes its own parent history, current tree pairs, custom values and
      financial settings.
    kind: lifecycle
    enforced_at:
      - service
      - database
    must_prove: true
    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
    origin: none
scenarios:
  - id: SC-CAP-MBR-STR-004-01
    given: A closed chapter retains past member affiliations.
    when: Staff retire the chapter through deactivation.
    then: 'Its placement and history remain, but new affiliations are blocked.'
    provenance: test
    source: >-
      services-membership:tests/acceptance/structure/MBR-ACC-0020.acceptance.ts#MBR-ACC-0020 deactivating a
      chapter freezes it, and there is no way back
edge_cases:
  - id: SC-CAP-MBR-STR-004-02
    given: A chapter loses its only child through a correction effective on the first placement day.
    when: Staff remove the otherwise unreferenced chapter.
    then: Removal succeeds because the current history row no longer names that chapter as a parent.
    provenance: documented
    source: 'react-console:acceptance/membership/journeys/structure/MBR-ACC-0011.json'
constraints: []
depends_on:
  - CAP-MBR-STR-002
related:
  - CAP-MBR-STR-003
  - CAP-MBR-STR-007
  - CAP-MBR-STR-008
journeys: []
open_questions:
  - OQ-MBR-STR-002
evidence:
  - >-
    services-membership: Examination of deactivate and delete in the tree edits, the reference counts of the
    unit persistence.
  - >-
    services-membership: Examination of unit-merge integration tests, structure end-to-end, database refusals
    end-to-end and scenario 13.
  - 'services-membership:modules/structure/aws/api/structure-requests.ts'
  - 'services-membership:modules/structure/services/tree/tree-edits.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/e2e/database-refusals.e2e.spec.ts'
  - 'services-membership:tests/e2e/structure-api.e2e.spec.ts'
controls: [TC-AVL-002, TC-AVL-003, TC-AZ-001, TC-AZ-002, TC-AZ-003, TC-AZ-004, TC-AZ-005, TC-AZ-006, TC-CHG-001, TC-CHG-002, TC-CHG-003, TC-CHG-004, TC-CRY-001, TC-CRY-002, TC-CRY-003, TC-DAT-001, TC-DAT-004, TC-DAT-007, TC-IAM-001, TC-IAM-002, TC-IAM-004, TC-IAM-005, TC-LOG-001, TC-LOG-002, TC-LOG-003, TC-LOG-004, TC-PI-001, TC-PI-003, TC-PI-005, TC-SEC-001, TC-SEC-004, TC-TEN-001, TC-TEN-002, TC-TEN-003]
---

# Close units or remove units without retained dependencies

## Purpose

Staff choose preservation or removal according to the references that still depend on a unit.

## How It Works

Staff deactivate a unit when it has closed but its identity remains useful. The record and its existing relationships remain available. Its active children keep their own status. New children and affiliations cannot be added through their normal operations. Repeating deactivation is harmless. A merged unit rejects that action because it already has a different terminal structural state. There is currently no reactivation operation. Deletion is assessed against retained references rather than the unit’s age or status. The service refuses removal when affiliation history or another dependent record still names it. An eligible deletion removes owned details alongside the unit. The product should decide how a reopened unit can regain active status without replacing its identity.

## Relationships

- Placement operations maintain the structure retained after closure.
- Merged status has its own restrictions under unit combination.
- Organization and finance records contribute dependencies that prevent removal.
