---
id: TST-MBR-STR-006
title: 'Unit persistence, ancestry and protected history'
kind: integration
product_area: membership
module: structure
revision: 1
status: draft
source_sha:
  services-membership: 5994c270e8a37a30f848e99ba5b5ee6b87c08893
  react-console: baf6dae382d6f41dce976c7f848667ccc37e076f
repository: services-membership
files:
  - modules/structure/tests/integration/services/persistence/organizational-units.integration.spec.ts
implements:
  - ATS-MBR-STR-002-01
  - ATS-MBR-STR-002-02
  - ATS-MBR-STR-002-03
  - ATS-MBR-STR-002-06
  - ATS-MBR-STR-002-07
  - ATS-MBR-STR-003-02
  - ATS-MBR-STR-003-03
  - ATS-MBR-STR-004-03
  - ATS-MBR-STR-005-01
  - ATS-MBR-STR-005-02
  - ATS-MBR-STR-005-04
  - ATS-MBR-STR-005-05
  - ATS-MBR-STR-005-07
  - ATS-MBR-STR-006-01
  - ATS-MBR-STR-006-07
  - ATS-MBR-STR-019-05
environment: local
implementation_state: implemented
latest_result: not-run
latest_run_at: null
latest_run_ref: null
conformance: not-verified
estimated_minutes: 3
isolation: A uniquely named local workspace and its seeded records; the suite owns its fixture data and cleanup.
evidence:
  - >-
    services-membership:modules/structure/tests/integration/services/persistence/organizational-units.integration.spec.ts
bindings:
  - scenario: ATS-MBR-STR-002-01
    source: >-
      services-membership:modules/structure/tests/integration/services/persistence/organizational-units.integration.spec.ts#organizational
      units in the database › the refusals › refuses a root of a type that may not be one
    provenance: test
  - scenario: ATS-MBR-STR-002-01
    source: >-
      services-membership:modules/structure/tests/integration/services/persistence/organizational-units.integration.spec.ts#organizational
      units in the database › the refusals › refuses, in the database itself, a parent of a type not
      allowed (the constraint trigger)
    provenance: test
  - scenario: ATS-MBR-STR-002-02
    source: >-
      services-membership:modules/structure/tests/integration/services/persistence/organizational-units.integration.spec.ts#organizational
      units in the database › the refusals › refuses a move under the unit’s own descendant as a cycle
    provenance: test
  - scenario: ATS-MBR-STR-002-02
    source: >-
      services-membership:modules/structure/tests/integration/services/persistence/organizational-units.integration.spec.ts#organizational
      units in the database › the refusals › refuses a move under the unit itself as a cycle
    provenance: test
  - scenario: ATS-MBR-STR-002-03
    source: >-
      services-membership:modules/structure/tests/integration/services/persistence/organizational-units.integration.spec.ts#organizational
      units in the database › the refusals › refuses a new child under an inactive unit
    provenance: test
  - scenario: ATS-MBR-STR-002-06
    source: >-
      services-membership:modules/structure/tests/integration/services/persistence/organizational-units.integration.spec.ts#organizational
      units in the database › the parent history and the as-of tree › refuses a move dated before the
      current parent began
    provenance: test
  - scenario: ATS-MBR-STR-002-06
    source: >-
      services-membership:modules/structure/tests/integration/services/persistence/organizational-units.integration.spec.ts#organizational
      units in the database › the parent history and the as-of tree › refuses a move dated after today
    provenance: test
  - scenario: ATS-MBR-STR-002-07
    source: >-
      services-membership:modules/structure/tests/integration/services/persistence/organizational-units.integration.spec.ts#organizational
      units in the database › the parent history and the as-of tree › closes the open row at the day
      before the new one and keeps one open row per unit
    provenance: test
  - scenario: ATS-MBR-STR-003-02
    source: >-
      services-membership:modules/structure/tests/integration/services/persistence/organizational-units.integration.spec.ts#organizational
      units in the database › merge › moves the children under the survivor, marks the unit merged and
      lists what it left
    provenance: test
  - scenario: ATS-MBR-STR-003-03
    source: >-
      services-membership:modules/structure/tests/integration/services/persistence/organizational-units.integration.spec.ts#organizational
      units in the database › merge › moves the children under the survivor, marks the unit merged and
      lists what it left
    provenance: test
  - scenario: ATS-MBR-STR-004-03
    source: >-
      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
  - scenario: ATS-MBR-STR-005-01
    source: >-
      services-membership:modules/structure/tests/integration/services/persistence/organizational-units.integration.spec.ts#organizational
      units in the database › the closure › answers the descendants of a unit from the closure, nearest
      first
    provenance: test
  - scenario: ATS-MBR-STR-005-01
    source: >-
      services-membership:modules/structure/tests/integration/services/persistence/organizational-units.integration.spec.ts#organizational
      units in the database › the closure › answers the ancestors of a unit from the closure, nearest
      first
    provenance: test
  - scenario: ATS-MBR-STR-005-02
    source: >-
      services-membership:modules/structure/tests/integration/services/persistence/organizational-units.integration.spec.ts#organizational
      units in the database › the parent history and the as-of tree › answers the descendants as of
      2026-06-30 equal to the tree recorded that day
    provenance: test
  - scenario: ATS-MBR-STR-005-02
    source: >-
      services-membership:modules/structure/tests/integration/services/persistence/organizational-units.integration.spec.ts#organizational
      units in the database › the parent history and the as-of tree › answers the descendants as of
      2027-06-30 equal to the tree recorded that day
    provenance: test
  - scenario: ATS-MBR-STR-005-02
    source: >-
      services-membership:modules/structure/tests/integration/services/persistence/organizational-units.integration.spec.ts#organizational
      units in the database › the parent history and the as-of tree › answers the descendants as of
      2027-12-31 equal to the tree recorded that day
    provenance: test
  - scenario: ATS-MBR-STR-005-02
    source: >-
      services-membership:modules/structure/tests/integration/services/persistence/organizational-units.integration.spec.ts#organizational
      units in the database › the parent history and the as-of tree › answers nothing for a known_at
      before the moves were recorded, beyond the tree as it was then known
    provenance: test
  - scenario: ATS-MBR-STR-005-04
    source: >-
      services-membership:modules/structure/tests/integration/services/persistence/organizational-units.integration.spec.ts#organizational
      units in the database › the published functions › answers membership.unit_descendants to
      rhythm_table_reader in its tenant
    provenance: test
  - scenario: ATS-MBR-STR-005-04
    source: >-
      services-membership:modules/structure/tests/integration/services/persistence/organizational-units.integration.spec.ts#organizational
      units in the database › the published functions › answers membership.unit_ancestors to
      rhythm_table_reader in its tenant
    provenance: test
  - scenario: ATS-MBR-STR-005-04
    source: >-
      services-membership:modules/structure/tests/integration/services/persistence/organizational-units.integration.spec.ts#organizational
      units in the database › the published functions › answers nothing of a tenant other than the
      reader’s own
    provenance: test
  - scenario: ATS-MBR-STR-005-05
    source: >-
      services-membership:modules/structure/tests/integration/services/persistence/organizational-units.integration.spec.ts#organizational
      units in the database › row-level security › reads nothing of another tenant’s unit by id
    provenance: test
  - scenario: ATS-MBR-STR-005-05
    source: >-
      services-membership:modules/structure/tests/integration/services/persistence/organizational-units.integration.spec.ts#organizational
      units in the database › row-level security › shows another tenant none of the units
    provenance: test
  - scenario: ATS-MBR-STR-005-07
    source: >-
      services-membership:modules/structure/tests/integration/services/persistence/organizational-units.integration.spec.ts#pages
      the tree breadth first with each unit’s parent
    provenance: test
  - scenario: ATS-MBR-STR-006-01
    source: >-
      services-membership:modules/structure/tests/integration/services/persistence/organizational-units.integration.spec.ts#organizational
      units in the database › the refusals › refuses a code the tenant already has
    provenance: test
  - scenario: ATS-MBR-STR-006-07
    source: >-
      services-membership:modules/structure/tests/integration/services/persistence/organizational-units.integration.spec.ts#organizational
      units in the database › the versions › writes a version of the unit for its creation, its update
      and its move, each with the actor of its context
    provenance: test
  - scenario: ATS-MBR-STR-006-07
    source: >-
      services-membership:modules/structure/tests/integration/services/persistence/organizational-units.integration.spec.ts#organizational
      units in the database › the versions › refuses the application role a direct write to a version
      table
    provenance: test
  - scenario: ATS-MBR-STR-019-05
    source: >-
      services-membership:modules/structure/tests/integration/services/persistence/organizational-units.integration.spec.ts#organizational
      units in the database › row-level security › shows another tenant none of the units
    provenance: test
invocation: 'npm run test:integration'
coverage_limit: >-
  Bindings identify the concrete cases executed in this file. A compound specification may also depend on
  other registered suites or remain partly proposed; registration is not a passing execution result.
provenance: test
source:
  - >-
    services-membership:modules/structure/tests/integration/services/persistence/organizational-units.integration.spec.ts
---

# Unit persistence, ancestry and protected history

## Verification Boundary

This suite invokes the local implementation against the prepared database and checks its persisted results. Unit persistence, ancestry and protected history defines the scope of its examples.

## What This Suite Proves

The suite executes the concrete examples named by its binding ledger. Those examples contribute to the linked capability or feature scenarios within the boundary of the test assertions.

## What It Does Not Prove

Registration supplies no fresh execution result or deployed conformance verdict. Browser behavior, deployed infrastructure and unasserted variants require separate evidence.

## Real Dependencies and Test Doubles

PostgreSQL, local Membership services and the suite’s persistence path are real. The business clock and caller fixtures are controlled by the harness.

## Must Not Be Doubled

The Membership path under examination, transaction behavior and database constraints stay real. Replacing those boundaries would remove the persisted proof the suite is intended to supply.
