11using ModularityKit . Mutator . Abstractions . Context ;
2+ using ModularityKit . Mutator . Abstractions . Effects ;
23using ModularityKit . Mutator . Abstractions . Intent ;
34using ModularityKit . Mutator . Abstractions . Policies ;
45using ModularityKit . Mutator . Governance . Abstractions . Lifecycle . Model ;
@@ -61,7 +62,17 @@ public void Roundtrip_preserves_request_shape_needed_by_governance_runtime()
6162 with
6263 {
6364 CreatedAt = new DateTimeOffset ( 2026 , 6 , 25 , 9 , 0 , 0 , TimeSpan . Zero ) ,
64- UpdatedAt = new DateTimeOffset ( 2026 , 6 , 25 , 9 , 5 , 0 , TimeSpan . Zero )
65+ UpdatedAt = new DateTimeOffset ( 2026 , 6 , 25 , 9 , 5 , 0 , TimeSpan . Zero ) ,
66+ SideEffects =
67+ [
68+ SideEffect . Critical (
69+ type : "WorkflowRejected" ,
70+ description : "Workflow rejection requires action" ,
71+ data : new RedisGovernanceSideEffectData
72+ {
73+ Ticket = "INC-42"
74+ } )
75+ ]
6576 } ;
6677
6778 var json = RedisMutationRequestSerializer . Serialize ( request ) ;
@@ -75,9 +86,20 @@ public void Roundtrip_preserves_request_shape_needed_by_governance_runtime()
7586 Assert . Equal ( BlastRadiusScope . Module , roundtrip . Intent . EstimatedBlastRadius ? . Scope ) ;
7687 Assert . Equal ( "platform" , roundtrip . Intent . Metadata [ "risk-owner" ] ) ;
7788 Assert . Equal ( "security" , roundtrip . Metadata [ "team" ] ) ;
89+ Assert . Single ( roundtrip . SideEffects ) ;
90+ Assert . Equal ( "WorkflowRejected" , roundtrip . SideEffects [ 0 ] . Type ) ;
91+ Assert . Equal ( "redis.governance.side-effect" , roundtrip . SideEffects [ 0 ] . DataContractType ) ;
92+ Assert . True ( roundtrip . SideEffects [ 0 ] . TryGetData < RedisGovernanceSideEffectData > ( out var sideEffectData ) ) ;
93+ Assert . Equal ( "INC-42" , sideEffectData ! . Ticket ) ;
7894 Assert . Single ( roundtrip . Requirements ) ;
7995 Assert . Single ( roundtrip . ApprovalRequirements ) ;
8096 Assert . Equal ( "security-lead" , roundtrip . ApprovalRequirements [ 0 ] . ApproverId ) ;
8197 Assert . Equal ( 3 , roundtrip . Decisions . Count ) ;
8298 }
99+
100+ [ SideEffectDataContract ( "redis.governance.side-effect" , 1 ) ]
101+ private sealed record RedisGovernanceSideEffectData
102+ {
103+ public required string Ticket { get ; init ; }
104+ }
83105}
0 commit comments