## Summary - introduce a shared reason-translation contract with envelopes, presenter helpers, fallback handling, and provider translation support - adopt translated operator-facing reason presentation across operation runs, notifications, provider guidance, tenant operability, and RBAC-related surfaces - add Spec 157 design artifacts and targeted regression coverage for translation quality, diagnostics retention, and authorization-safe guidance ## Validation - `vendor/bin/sail bin pint --dirty --format agent` - `vendor/bin/sail artisan test --compact tests/Architecture/ReasonTranslationPrimarySurfaceGuardTest.php tests/Unit/Support/ReasonTranslation/ReasonResolutionEnvelopeTest.php tests/Unit/Support/ReasonTranslation/ExecutionDenialReasonTranslationTest.php tests/Unit/Support/ReasonTranslation/TenantOperabilityReasonTranslationTest.php tests/Unit/Support/ReasonTranslation/RbacReasonTranslationTest.php tests/Unit/Support/ReasonTranslation/ProviderReasonTranslationTest.php tests/Feature/Notifications/OperationRunNotificationTest.php tests/Feature/Operations/OperationRunBlockedExecutionPresentationTest.php tests/Feature/Operations/TenantlessOperationRunViewerTest.php tests/Feature/ReasonTranslation/GovernanceReasonPresentationTest.php tests/Feature/Authorization/ReasonTranslationScopeSafetyTest.php tests/Feature/Monitoring/OperationRunBlockedSpec081Test.php tests/Feature/ProviderConnections/ProviderOperationBlockedGuidanceSpec081Test.php tests/Feature/ProviderConnections/ProviderGatewayRuntimeSmokeSpec081Test.php` ## Notes - Livewire v4.0+ compliance remains unchanged within the existing Filament v5 stack. - No new panel was added; provider registration remains in `bootstrap/providers.php`. - No new globally searchable resource was introduced. - No new destructive action family was introduced. - No new assets were added; the existing `filament:assets` deployment behavior remains unchanged. Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #187
7.7 KiB
Data Model: Operator Reason Code Translation and Humanization Contract
This feature defines a shared explanation model rather than introducing a new business-domain table. The entities below capture the contract the implementation and guard coverage must agree on.
Entities
ReasonCodeArtifact
Represents one source family that owns stable internal reason identifiers.
Fields:
key(string): stable artifact identifier such asprovider_reason_codesorexecution_denial_reason_codestructure(enum):string_constants,enum_without_message,enum_with_message,localized_helper,mixeddomain(string): source domain such asprovider,operations,tenants,rbac,baseline,verificationownsStableCodes(bool): whether the artifact is the source of truth for machine-readable codessupportsNativeBehavior(bool): whether the artifact can already expose methods such asmessage()adoptionPriority(enum):P0,P1,P2
Validation rules:
- Each adopted reason must belong to exactly one source artifact.
string_constantsartifacts require an adapter or registry-backed translation path.enum_without_messageartifacts require shared translation behavior before adoption.
ReasonTranslationEntry
Represents one mapping from a stable internal code to operator-facing explanation semantics.
Fields:
artifactKey(string): owningReasonCodeArtifactinternalCode(string): stable machine-readable reason codeoperatorLabel(string): primary human-readable labelshortExplanation(string): concise operator-facing explanationactionability(enum):retryable_transient,permanent_configuration,prerequisite_missing,non_actionablediagnosticVisibility(enum):always_available,secondary_onlynextStepPolicy(enum):required,optional,nonetaxonomyTerms(list): canonical outcome-taxonomy terms this translation relies onlegacyInputs(list): raw or heuristic inputs that may normalize into this entry
Validation rules:
operatorLabelmust not be the raw internal code.nextStepPolicy = requiredwhen the actionability class implies a useful remediation path.non_actionableentries must explicitly communicate that no operator action is required.
ReasonResolutionEnvelope
Represents the shared operator-facing contract returned by the translation layer.
Fields:
internalCode(string): stable machine-readable code preserved for diagnosticsoperatorLabel(string): primary translated labelshortExplanation(string): concise explanation for default-visible surfacesactionability(enum):retryable_transient,permanent_configuration,prerequisite_missing,non_actionablenextSteps(list): zero or more remediation optionsshowNoActionNeeded(bool): whether the envelope should explicitly say no action is requireddiagnosticCodeLabel(optional string): secondary detail label for raw-code display
Validation rules:
- Every adopted primary reason surface resolves through exactly one envelope.
- The envelope must preserve
internalCodeunchanged. - An envelope may contain no
nextStepsonly whennextStepPolicyisnoneor the surface cannot safely expose the next step.
NextStepOption
Represents one operator-facing remediation path associated with a translated reason.
Fields:
label(string): action-oriented guidance such asGrant admin consentorReview provider connectionkind(enum):link,instruction,diagnostic_onlydestination(optional string): logical destination or URL when the step is link-basedauthorizationRequired(bool): whether the destination requires entitlement checks before display or executionscope(enum):tenant,workspace,system,none
Validation rules:
destinationis required whenkind = link.- Unauthorized next-step options must not be surfaced on primary views.
diagnostic_onlynext steps cannot become the only primary guidance for actionable states.
TranslationFallbackRule
Represents the bounded fallback behavior used when a source reason lacks a domain-owned translation entry.
Fields:
sourcePattern(string): input code or normalized pattern being matchednormalizedCode(string): internal code chosen after bounded normalizationfallbackLabel(string): understandable operator-facing fallback labelfallbackExplanation(string): concise fallback explanationallowedSurfaces(list): where fallback behavior is acceptable
Validation rules:
- Fallback labels must remain understandable and must not expose raw internal code as the only primary message.
- Fallback behavior cannot become the preferred long-term path for adopted reason families.
AdoptionTarget
Represents one bounded surface family included in the first implementation slice.
Fields:
key(string): stable target identifierfamily(enum):operations,providers,tenants,rbac,baseline,verification,restore,onboarding,system_consolesourceArtifacts(list):ReasonCodeArtifactkeys adopted by this targetsurfaceTypes(list): examples such asnotification,run_detail,banner,summary_line,table,helper_copypriority(enum):P0,P1,P2rolloutStage(int): ordered rollout stage
Validation rules:
- The first slice must include operations, providers, tenant-operability governance, and adopted system-console RBAC or onboarding surfaces.
- Each target must identify both shared-code seams and user-visible surfaces.
RegressionGuardCase
Represents one reusable test or guard invariant enforcing the contract.
Fields:
name(string): guard identifierassertion(string): invariant being enforcedscope(enum):unit,feature,architecturecoversFamilies(list): adopted families touched by the guardfailureSignal(string): what should cause CI to fail
Validation rules:
- The first slice must include guards for raw-code primary exposure, fallback overuse, missing next-step guidance for actionable states, and cross-scope leak risks.
Relationships
ReasonCodeArtifact1-to-manyReasonTranslationEntryReasonTranslationEntry1-to-1ReasonResolutionEnvelopein adopted pathsReasonResolutionEnvelope1-to-manyNextStepOptionTranslationFallbackRulesupports manyReasonCodeArtifactfamilies when no direct entry existsAdoptionTargetconsumes manyReasonCodeArtifactandReasonTranslationEntrycombinationsRegressionGuardCasevalidates manyAdoptionTargetandReasonResolutionEnvelopecombinations
Initial First-Slice Adoption Set
Operations and notifications
- Source artifacts:
ExecutionDenialReasonCode, normalized failure reasons,OperationUxPresenter,OperationRunCompleted,SummaryCountsNormalizer - Primary needs: translated label, concise explanation, actionability guidance, diagnostic raw-code preservation
Provider blocking and guidance
- Source artifacts:
ProviderReasonCodes,ProviderNextStepsRegistry, provider-connection blocking flows - Primary needs: stable provider code translation, next-step guidance, bounded fallback for unknown provider errors
Tenant operability and RBAC governance
- Source artifacts:
TenantOperabilityReasonCode,RbacReason - Primary needs: move from raw enum values to translated operator-facing envelopes without changing existing domain semantics
Out-of-slice but adjacent families
BaselineReasonCodesandBaselineCompareReasonCode- onboarding lifecycle raw string reasons
- verification check reason payloads
- restore item-level reason payloads
These remain explicit downstream adoption candidates once the shared contract is proven on the first slice.