Skip to content

ATS-MBR-STR-002Restructure units while preserving dated placement: Capability Test Specification

Markdown

ATS-MBR-STR-002

Restructure units while preserving dated placement: Capability Test Specification

Markdown
  • DocumentProposed

KindAcceptance test setProduct areaMembershipModuleOrganizational Structure, Membership Configuration and TermsRevision2

Read atservices-membership 5994c270react-console baf6dae3

Coverage

  • Rule covered
  • Transition gap: FND-MBR-STR-055
  • Validation covered
  • Permission covered
  • Edge covered
  • Failure gap: FND-MBR-STR-055
  • Boundary covered
  • Concurrency covered
  • Invariant covered
  • Interaction covered

Test Scenarios

16 scenarios proving CAP-MBR-STR-002; 12 bound to an existing test.

01 Placement checks also guard direct writesvalidationapinegativetest
Proves
BR-CAP-MBR-STR-002-01 AS-JNY-MBR-STR-001-01 INV-DOM-MBR-STR-001-01
Preconditions
An isolated Membership-licensed workspace contains the relevant records, with caller permissions selected for the case.
Steps
Try a chapter under a disallowed region and as a disallowed root, then attempt invalid parentage through the database.
Expected
Both service cases fail and the database rejects the direct placement.
Data
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 a parent of a type not allowed, 409 parent_type_not_allowed
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
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)
services-membership:tests/acceptance/structure/MBR-ACC-0010.acceptance.ts#MBR-ACC-0010 every illegal placement of a new unit is refused
Source
services-membership:tests/e2e/structure-api.e2e.spec.ts#the structure API, end to end in process › refuses a parent of a type not allowed, 409 parent_type_not_allowed
02 Opposing concurrent moves preserve an acyclic treeconcurrencyapinegativetest
Proves
BR-CAP-MBR-STR-002-02 INV-DOM-MBR-STR-001-02
Preconditions
An isolated Membership-licensed workspace contains the relevant records, with caller permissions selected for the case.
Steps
Try moving a region beneath its chapter, then submit opposing moves concurrently.
Expected
The cycle fails; one concurrent move succeeds and the final ancestry matches a fresh parent walk.
Data
The FAA example records or equivalent records prepared within the isolated workspace.
Bound to
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
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
services-membership:modules/structure/tests/integration/services/tree/tree-scale.integration.spec.ts#the tree at scale › serialises two concurrent moves of one tenant by the tree lock, the second validating against the first’s closure
services-membership:tests/e2e/structure-api.e2e.spec.ts#the structure API, end to end in process › refuses a move under the unit’s own descendant, 409 move_creates_cycle
services-membership:tests/acceptance/structure/MBR-ACC-0016.acceptance.ts#MBR-ACC-0016 two staff reorganise the same chapters at once
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
03 Closed parents reject incoming childrenvalidationapinegativetest
Proves
BR-CAP-MBR-STR-002-03
Preconditions
An isolated Membership-licensed workspace contains the relevant records, with caller permissions selected for the case.
Steps
Try creation below an inactive unit and relocation below a merged unit.
Expected
Each attempt returns an inactive-parent refusal.
Data
The FAA example records or equivalent records prepared within the isolated workspace.
Bound to
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
services-membership:modules/structure/tests/unit/services/tree-edits.spec.ts#the tree edits › move › refuses an inactive parent
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
04 Only eligible units can change parentedgeapinegativetest
Proves
BR-CAP-MBR-STR-002-04
Preconditions
An isolated Membership-licensed workspace contains the relevant records, with caller permissions selected for the case.
Steps
Attempt relocation of inactive and merged units and relocation to an unchanged parent.
Expected
All attempts fail with the corresponding structural refusal and preserve earlier records.
Data
The FAA example records or equivalent records prepared within the isolated workspace.
Bound to
Source
services-membership:tests/acceptance/structure/MBR-ACC-0014.acceptance.ts#MBR-ACC-0014 every move the tree refuses
05 Depth checks reject the complete editboundaryunitnegativetest
Proves
BR-CAP-MBR-STR-002-05
Preconditions
Explicit inputs or a recording fixture represent the cases exercised below.
Steps
Propose a branch reaching depth 32 and separately simulate a rebuild at that depth.
Expected
Both paths reject the excessive depth.
Data
Recording tree-store fixtures and controlled operation inputs.
Bound to
services-membership:modules/structure/tests/unit/services/tree-edits.spec.ts#the tree edits › move › refuses a move that would put the subtree at the depth cap, before any write
services-membership:modules/structure/tests/unit/services/tree-edits.spec.ts#the tree edits › move › refuses the whole edit when the rebuilt tree reaches depth 32 (a cycle past validation)
services-membership:tests/acceptance/structure/MBR-ACC-0015.acceptance.ts#MBR-ACC-0015 thirty-one levels, a moved subtree and a second root
Source
services-membership:modules/structure/tests/unit/services/tree-edits.spec.ts#the tree edits › move › refuses a move that would put the subtree at the depth cap, before any write
06 Move dates use the workspace calendarboundaryapinegativetest
Proves
BR-CAP-MBR-STR-002-06
Preconditions
An isolated Membership-licensed workspace contains the relevant records, with caller permissions selected for the case.
Steps
Compare omitted dates with a date before current placement and a date after today.
Expected
Omission selects the workspace date and the out-of-range dates fail.
Data
The FAA example records or equivalent records prepared within the isolated workspace.
Bound to
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
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
services-membership:modules/structure/tests/unit/services/tree-edits.spec.ts#the tree edits › move › records the history from the tenant’s business date
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
07 Successive parent periods meet without overlapinvariantapitest
Proves
BR-CAP-MBR-STR-002-07 INV-DOM-MBR-STR-001-04
Preconditions
An isolated Membership-licensed workspace contains the relevant records, with caller permissions selected for the case.
Steps
Relocate a unit after its current placement’s first day.
Expected
The earlier period finishes the preceding day and one open attributed period remains.
Data
The FAA example records or equivalent records prepared within the isolated workspace.
Bound to
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
services-membership:tests/acceptance/structure/MBR-ACC-0013.acceptance.ts#MBR-ACC-0013 a backdated move and a same-day correction
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
08 Same-day corrections retain one current periodedgeapitest
Proves
BR-CAP-MBR-STR-002-08
Preconditions
An isolated Membership-licensed workspace contains the relevant records, with caller permissions selected for the case.
Steps
Submit two parent changes effective on the same date.
Expected
Current history names the later parent and retained versions explain the earlier change.
Data
The FAA example records or equivalent records prepared within the isolated workspace.
Bound to
services-membership:tests/acceptance/structure/MBR-ACC-0013.acceptance.ts#MBR-ACC-0013 a backdated move and a same-day correction
Source
services-membership:tests/acceptance/structure/MBR-ACC-0013.acceptance.ts#MBR-ACC-0013 a backdated move and a same-day correction
09 Large branch moves leave coherent ancestryinvariantapitest
Proves
BR-CAP-MBR-STR-002-09 INV-DOM-MBR-STR-001-03
Preconditions
An isolated Membership-licensed workspace contains the relevant records, with caller permissions selected for the case.
Steps
Relocate a 68-unit branch within a 500-unit structure and compare the result with a parent walk.
Expected
The edit preserves its checked operation order and the rebuilt ancestry matches the independent walk.
Data
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 › move › locks, validates against the current closure, changes the parent, records history, rebuilds, updates depths and checks the cap, in that order
services-membership:modules/structure/tests/integration/services/tree/tree-scale.integration.spec.ts#the tree at scale › leaves a closure equal to a fresh walk of the parents after the concurrent moves
services-membership:modules/structure/tests/integration/services/tree/tree-scale.integration.spec.ts#the tree at scale › answers the moved subtree under its new parent
services-membership:modules/structure/tests/unit/services/tree-statements.spec.ts#the tree statements › the closure rebuild › walks every unit down from itself at depth 0, one level per step, under the cap of 32, in every statement but the depths
services-membership:modules/structure/tests/unit/services/tree-statements.spec.ts#the tree statements › the closure rebuild › removes the tenant’s pairs the walk no longer has, at their depth, and only the tenant’s
Source
services-membership:modules/structure/tests/unit/services/tree-edits.spec.ts#the tree edits › move › locks, validates against the current closure, changes the parent, records history, rebuilds, updates depths and checks the cap, in that order
10 Parent changes publish their contextruleunittest
Proves
BR-CAP-MBR-STR-002-11
Preconditions
Explicit inputs or a recording fixture represent the cases exercised below.
Steps
Submit a valid unit relocation and inspect its business event.
Expected
The event identifies the unit, previous and new parents, effective date and attribution.
Data
Recording tree-store fixtures and controlled operation inputs.
Bound to
services-membership:modules/structure/tests/unit/services/tree-edits.spec.ts#the tree edits › move › states membership.unit.reparented with the old and the new parent and the business date
services-membership:modules/structure/tests/unit/services/tree-edits.spec.ts#the tree edits › move › builds the reparented payload from the move and the transaction’s attribution
Source
services-membership:modules/structure/tests/unit/services/tree-edits.spec.ts#the tree edits › move › states membership.unit.reparented with the old and the new parent and the business date
11 Regional membership views follow placementinteractionapitest
Proves
BR-CAP-MBR-STR-002-14 AS-JNY-MBR-STR-002-01 AS-JNY-MBR-STR-002-02
Preconditions
An isolated Membership-licensed workspace contains the relevant records, with caller permissions selected for the case.
Steps
Move Atlanta from Southeast to Pacific and inspect Jo’s affiliation and regional views.
Expected
The affiliation is unchanged while current and period-end views use their respective regions.
Data
The FAA example records or equivalent records prepared within the isolated workspace.
Bound to
services-membership:tests/e2e/s09-restructuring.e2e.spec.ts#scenario 9: organizational restructuring › rewrites no affiliation: Jo’s row is the same row, version and unit
services-membership:tests/e2e/s09-restructuring.e2e.spec.ts#scenario 9: organizational restructuring › shows Jo under the Western Region and the Pacific Zone today, and no longer under the Eastern Region
services-membership:tests/e2e/s09-restructuring.e2e.spec.ts#scenario 9: organizational restructuring › still holds Atlanta among the Eastern Region’s descendants as of the period end
services-membership:tests/acceptance/structure/MBR-ACC-0012.acceptance.ts#MBR-ACC-0012 scenario 9: Atlanta moves to the Pacific Zone
Source
services-membership:tests/e2e/s09-restructuring.e2e.spec.ts#scenario 9: organizational restructuring › rewrites no affiliation: Jo’s row is the same row, version and unit
12 A repeated completed move has no new effectedgeapinegativeproposed
Proves
BR-CAP-MBR-STR-002-12
Preconditions
An isolated workspace contains the records and current versions needed for the case.
Steps
Move a chapter to a different zone, retain the response and immediately repeat the request without a version.
Expected
The retry reports the current-parent conflict and adds no parent period.
Data
Separate fixture records for the accepted and refused operations.
Source
services-membership:docs/migrations/structure/README.md#What could not be done as specified, and why
13 Merge children obey the same placement choices as movesinteractionapiproposed
Proves
BR-CAP-MBR-STR-002-01 BR-CAP-MBR-STR-003-02
Preconditions
An isolated workspace contains the records and current versions needed for the case.
Steps
Prepare a source child whose kind disallows the survivor’s kind and attempt both a direct move and a source merge.
Expected
Both requests refuse the placement and the merge changes no child, source standing or affiliation.
Data
Separate fixture records for the accepted and refused operations.
Source
services-membership:tests/e2e/structure-api.e2e.spec.ts#the structure API, end to end in process › refuses a parent of a type not allowed, 409 parent_type_not_allowed,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
14 A move changes current reads while retaining dated readsinteractionapitest
Proves
BR-CAP-MBR-STR-002-07 BR-CAP-MBR-STR-005-02
Preconditions
An isolated workspace contains the records and current versions needed for the case.
Steps
Read a branch, move its chapter on a later date and repeat both current and earlier-date reads.
Expected
Current descendants follow the new branch and the earlier-date answer keeps the old placement.
Data
Separate fixture records for the accepted and refused operations.
Bound to
services-membership:tests/e2e/s09-restructuring.e2e.spec.ts#still holds Atlanta among the Eastern Region’s descendants as of the period end
Source
services-membership:modules/structure/services/persistence/organizational-units.ts:recordParentChange,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,services-membership:tests/e2e/s09-restructuring.e2e.spec.ts#still holds Atlanta among the Eastern Region’s descendants as of the period end
15 Detail replacement cannot undo a moveinteractionapiproposed
Proves
BR-CAP-MBR-STR-002-09 BR-CAP-MBR-STR-006-02
Preconditions
An isolated workspace contains the records and current versions needed for the case.
Steps
Move a chapter, then replace its local contact details while submitting its former parent in the body.
Expected
The local details change while the chapter retains the accepted placement and depth.
Data
Separate fixture records for the accepted and refused operations.
Source
services-membership:modules/structure/tests/unit/services/tree-edits.spec.ts#the tree edits › move › locks, validates against the current closure, changes the parent, records history, rebuilds, updates depths and checks the cap, in that order,services-membership:modules/structure/services/persistence/organizational-units.ts:updateOrganizationalUnit
16 Workspace authority gates this capabilitypermissionapinegativeproposed
Proves
BR-CAP-MBR-STR-019-01
Preconditions
An isolated workspace contains the records and current versions needed for the case.
Steps
Exercise the capability’s exposed operations with its read-only and management callers, then repeat with application access removed, an unlicensed workspace and an unavailable workspace.
Expected
Each named operation requires its declared authority; admission failures occur before any record or calculated result is exposed.
Data
Separate fixture records for the accepted and refused operations.
Source
services-membership:tests/unit/route-authorization.spec.ts#route authorization: every Membership operation names its permission › requires membership.structure.read of every structure read and membership.structure.manage of every change,services-membership:modules/configuration/aws/api/configuration.routes.ts:configurationModuleRoutes,services-membership:tests/e2e/terms-api.e2e.spec.ts#the terms API, end to end in process › refuses a caller who holds no key in the tenant

The Markdown files under specs/ in rhythmsoftware/rhythm-v2-docs are the canonical source of truth. This reader is a generated, read-only projection of them.