MEDIUM story-organizational-hierarchy-structure-management-organization-admin-007 5 pts

User Story

As a Organization Administrator
I want to receive automatic validation feedback before committing structural changes to the organizational hierarchy
So that I do not accidentally create orphaned units, circular references, or invalid organizational configurations that would break reporting and access control

Acceptance Criteria

  • Given I attempt to set a unit's parent to one of its own descendants, when I try to save, then validation blocks the save and displays a 'circular reference detected' error specifying the conflicting units
  • Given I deactivate a regional node that has active child chapters, when validation runs, then I receive a list of all child chapters that will be without a parent and must be reassigned before the change can be committed
  • Given I make a structural change that would invalidate existing RLS policies, when validation runs, then I am warned which user access scopes will be affected and given the option to review before proceeding
  • Given all validation checks pass, when I confirm the structural change, then the edit is committed to the database within 3 seconds and the hierarchy tree refreshes automatically
  • Given validation has produced warnings (non-blocking), when I review them, then each warning has a 'Fix now' shortcut that navigates directly to the affected unit's management screen

Business Value

Structural hierarchy errors are difficult to detect and correct after the fact — they silently corrupt reporting data, break user access, and may not surface until a Bufdir submission deadline. Pre-commit validation acts as a safety net that allows admins to make structural changes confidently, reducing the risk of accidental data corruption in a system managing the organizational structure of thousands of volunteers.