4.3 KiB
4.3 KiB
Data Model: Central Tenant Status Presentation
1. TenantLifecycleState
- Purpose: The canonical tenant lifecycle domain value already defined by Spec 143 and implemented in
TenantLifecycle. - Source: Existing tenant domain model.
- Fields:
value: enum string- Allowed values:
draft,onboarding,active,archived
- Allowed values:
label: string- Allowed values:
Draft,Onboarding,Active,Archived
- Allowed values:
- Relationships:
- Derived from one
Tenant - Referenced by one
TenantLifecyclePresentation
- Derived from one
- Validation rules:
- Must be one of the four canonical lifecycle values for normal presentation flow
- Non-canonical values must bypass canonical rendering and enter invalid-data fallback only
- State transitions:
- Not defined here; owned by Spec 143 and the tenant domain
2. TenantLifecyclePresentation
- Purpose: The authoritative UI presentation contract for a lifecycle state.
- Ownership: Presentation layer only; no persistence required.
- Fields:
value: canonical lifecycle valuelabel: canonical operator-facing labelbadge_color: concise badge/chip color tokenbadge_icon: icon token for badge or chip renderingshort_description: concise explanatory text for detail or selector surfaceslong_description: longer helper text for infolists, banners, or canonical viewersis_invalid_fallback: boolean flag reserved for corrupted or unexpected input
- Relationships:
- Belongs to one
TenantLifecycleStatewhen canonical - May be constructed from a referenced tenant in a canonical viewer
- Belongs to one
- Validation rules:
- Canonical values must always produce
is_invalid_fallback = false - Invalid fallback must never be used for
draft,onboarding,active, orarchived labelmust match the canonical lifecycle vocabulary for canonical values
- Canonical values must always produce
3. TenantLifecyclePresentationVariant
- Purpose: Surface-specific density derived from the same underlying lifecycle meaning.
- Ownership: Presentation composition only.
- Fields:
surface: enum-like string- Expected values:
table,detail,selector,canonical_viewer,banner
- Expected values:
show_badge: booleanshow_short_description: booleanshow_long_description: booleanshow_context_note: boolean
- Relationships:
- Belongs to one
TenantLifecyclePresentation
- Belongs to one
- Validation rules:
- Must not alter
valueorlabel - May change density only, never meaning
- Must not alter
4. ReferencedTenantLifecycleContext
- Purpose: Captures how lifecycle is shown when a tenant appears as context on another record, such as an operation run.
- Ownership: Canonical viewer presentation only.
- Fields:
tenant_id: integer or nulltenant_name: string or nulllifecycle_value: canonical lifecycle value or invalid raw valueviewer_context: string- Expected examples:
operation_run,report,audit_reference
- Expected examples:
context_note: optional explanatory text describing why the referenced tenant may be non-active
- Relationships:
- References one
Tenant - Uses one
TenantLifecyclePresentation
- References one
- Validation rules:
- Must only be constructed after existing viewer authorization succeeds
- Must not imply the canonical record is invalid when the tenant lifecycle is
onboardingorarchived
5. Existing Domain Models in Scope
Tenant
- Existing model:
App\Models\Tenant - Relevant existing fields:
statusdeleted_at/ soft-delete stateworkspace_idnamedomainapp_statusrbac_status
- Relevant derived methods:
lifecycle()isDraft()isOnboarding()isArchived()
OperationRun
- Existing model:
App\Models\OperationRun - Relevant existing fields:
tenant_idworkspace_idstatusoutcomecontext
- Role in this feature:
- Supplies referenced tenant context only
- No lifecycle ownership changes
- No
OperationRunstate machine changes
6. Invariants
- Tenant lifecycle presentation must remain exhaustive for canonical states.
- Lifecycle presentation must not redefine lifecycle transitions or authorization.
- Lifecycle and health-like domains must remain separate in the rendered UI.
- Surface-specific rendering may change density, but not label or semantic meaning.
- Invalid fallback is reserved exclusively for non-canonical lifecycle data.