1- using ModularityKit . Mutator . Abstractions . Context ;
2- using ModularityKit . Mutator . Abstractions . Effects ;
31using ModularityKit . Mutator . Abstractions . Intent ;
4- using ModularityKit . Mutator . Abstractions . Policies ;
5- using ModularityKit . Mutator . Governance . Abstractions . Lifecycle . Model ;
6- using ModularityKit . Mutator . Governance . Abstractions . Requests . Factory ;
72using ModularityKit . Mutator . Governance . Abstractions . Requests . Model ;
83using ModularityKit . Mutator . Governance . Redis . Serialization ;
4+ using ModularityKit . Mutator . Governance . Redis . Tests . TestSupport . Serialization ;
5+ using ModularityKit . Mutator . Governance . Redis . Tests . TestSupport . Serialization . Models ;
96using Xunit ;
107
118namespace ModularityKit . Mutator . Governance . Redis . Tests . Serialization ;
@@ -15,71 +12,7 @@ public sealed class RedisMutationRequestSerializerTests
1512 [ Fact ]
1613 public void Roundtrip_preserves_request_shape_needed_by_governance_runtime ( )
1714 {
18- var request = MutationRequestFactory . PendingApproval (
19- stateId : "tenant-42:roles" ,
20- stateType : "IamRoleState" ,
21- mutationType : "GrantRoleMutation" ,
22- intent : new MutationIntent
23- {
24- OperationName = "GrantRole" ,
25- Category = "Security" ,
26- Description = "Grant elevated access" ,
27- Tags = new HashSet < string > { "security" , "urgent" } ,
28- EstimatedBlastRadius = BlastRadius . Module ,
29- Metadata = new Dictionary < string , object >
30- {
31- [ "risk-owner" ] = "platform"
32- }
33- } ,
34- context : MutationContext . User ( "requester-1" , "Requester One" , "Need emergency access" ) with
35- {
36- StateId = "tenant-42:roles" ,
37- Metadata = new Dictionary < string , object >
38- {
39- [ "source" ] = "tests"
40- }
41- } ,
42- requirements :
43- [
44- new PolicyRequirement
45- {
46- Type = "Approval" ,
47- Description = "Requires security approval" ,
48- Data = new Dictionary < string , object >
49- {
50- [ "Approver" ] = "security-lead" ,
51- [ "Reason" ] = "Elevated role" ,
52- [ "StepOrder" ] = 1L ,
53- [ "RequiredApprovals" ] = 1L
54- }
55- }
56- ] ,
57- expectedStateVersion : "v10" ,
58- metadata : new Dictionary < string , object >
59- {
60- [ "team" ] = "security" ,
61- [ "priority" ] = "high"
62- } )
63- with
64- {
65- Lifecycle = new MutationRequestLifecycleDetails
66- {
67- Status = MutationRequestStatus . Pending ,
68- PendingReason = PendingMutationReason . Approval ,
69- CreatedAt = new DateTimeOffset ( 2026 , 6 , 25 , 9 , 0 , 0 , TimeSpan . Zero ) ,
70- UpdatedAt = new DateTimeOffset ( 2026 , 6 , 25 , 9 , 5 , 0 , TimeSpan . Zero )
71- } ,
72- SideEffects =
73- [
74- SideEffect . Critical (
75- type : "WorkflowRejected" ,
76- description : "Workflow rejection requires action" ,
77- data : new RedisGovernanceSideEffectData
78- {
79- Ticket = "INC-42"
80- } )
81- ]
82- } ;
15+ var request = RedisMutationRequestSerializerRequestFactory . CreateRoundtripRequest ( ) ;
8316
8417 var json = RedisMutationRequestSerializer . Serialize ( request ) ;
8518 var roundtrip = RedisMutationRequestSerializer . Deserialize ( json ) ;
@@ -104,10 +37,4 @@ public void Roundtrip_preserves_request_shape_needed_by_governance_runtime()
10437 Assert . Equal ( request . Lifecycle . CreatedAt , roundtrip . Lifecycle . CreatedAt ) ;
10538 Assert . Equal ( request . Lifecycle . UpdatedAt , roundtrip . Lifecycle . UpdatedAt ) ;
10639 }
107-
108- [ SideEffectDataContract ( "redis.governance.side-effect" , 1 ) ]
109- private sealed record RedisGovernanceSideEffectData
110- {
111- public required string Ticket { get ; init ; }
112- }
11340}
0 commit comments