Skip to content

Commit 82549e9

Browse files
committed
Docs: Rebuild governance package guides
1 parent c220b23 commit 82549e9

4 files changed

Lines changed: 116 additions & 65 deletions

File tree

Examples/Governance/ApprovalWorkflow/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Governance ApprovalWorkflow
22

3-
This example shows the governance approval workflow built on top of `MutationRequest.PendingApproval(...)` and `MutationRequestApprovalWorkflowManager`.
3+
This example shows the governance approval workflow built on top of `MutationRequestFactory.PendingApproval(...)` and `MutationRequestApprovalWorkflowManager`.
44

55
It demonstrates:
66

Examples/Governance/RequestLifecycle/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ It focuses on `MutationRequest`, `IMutationRequestStore`, and `MutationRequestLi
66

77
## What it demonstrates
88

9-
- creating governed requests with `MutationRequest.Pending(...)` and `MutationRequest.Approved(...)`
9+
- creating governed requests with `MutationRequestFactory.Pending(...)` and `MutationRequestFactory.Approved(...)`
1010
- storing requests in `InMemoryMutationRequestStore`
1111
- moving requests through the lifecycle with `MutationRequestLifecycleManager`
1212
- listing pending requests globally and by `StateId`

Examples/Governance/VersionedResolution/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ var resolver = new MutationRequestVersionResolver();
3636
var manager = new MutationRequestVersionResolutionManager(store, resolver);
3737

3838
var request = await store.Create(
39-
MutationRequest.Approved(
39+
MutationRequestFactory.Approved(
4040
stateId: "tenant-42:roles",
4141
stateType: "IamRoleState",
4242
mutationType: "GrantRoleMutation",

src/Governance/README.md

Lines changed: 113 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -10,106 +10,158 @@ The core package stays responsible for direct mutation execution. Governance bui
1010
- **Pending Lifecycle** - represent requests that cannot execute immediately
1111
- **Decision History** - record approvals, rejections, cancellations, and other lifecycle transitions
1212
- **Approval Workflow** - model request-level approval requirements and explicit approver actions
13+
- **Governed Execution** - execute approved requests through resolution and the core mutation engine
1314
- **Request Storage Contracts** - define a persistence seam for governance-oriented stores
1415
- **Runtime Lifecycle Management** - move requests through pending, approval, expiration, and execution transitions
1516
- **In-Memory Runtime Support** - provide lightweight request runtime services for development and tests
1617

17-
## Current Structure
18+
## Governance Flow
1819

19-
### Abstractions
20+
The package is built around a request-driven governance loop:
2021

21-
The package defines governance-first abstractions under:
22+
1. create `MutationRequest`
23+
2. move it through pending lifecycle states when direct execution is not allowed
24+
3. collect approval decisions when approval is required
25+
4. resolve the request against the current state version before execution
26+
5. execute the underlying mutation through the core engine
27+
6. persist the terminal governance outcome and execution metadata
2228

23-
- `Abstractions/Requests`
24-
- `Abstractions/Approval`
25-
- `Abstractions/Lifecycle`
26-
- `Abstractions/Storage`
27-
- `Abstractions/Resolution`
28-
- `Abstractions/Exceptions`
29+
The important point is that governance owns the request lifecycle around execution. The base `ModularityKit.Mutator` package still owns the mutation engine itself.
30+
31+
## Main Entry Points
32+
33+
Most consumers only need a small set of types.
2934

30-
Key types:
35+
### Request Model
3136

3237
- `MutationRequest`
33-
- `MutationApprovalRequirement`
34-
- `MutationApprovalRequirementStatus`
38+
- `MutationRequestFactory`
3539
- `MutationRequestDecision`
36-
- `MutationRequestDecisionType`
37-
- `MutationRequestDecisionCategory`
38-
- `MutationRequestLifecycleDecisionType`
39-
- `MutationRequestApprovalDecisionType`
40-
- `MutationRequestVersionResolutionDecisionType`
4140
- `MutationRequestStatus`
4241
- `PendingMutationReason`
42+
43+
Use these to create and inspect governed requests.
44+
45+
### Storage
46+
4347
- `IMutationRequestStore`
44-
- `IMutationRequestApprovalWorkflowManager`
48+
- `InMemoryMutationRequestStore`
49+
50+
Use the store to persist requests and load them back into governance runtime services.
51+
52+
### Lifecycle
53+
4554
- `IMutationRequestLifecycleManager`
55+
- `MutationRequestLifecycleManager`
56+
57+
Use lifecycle services to submit, pend, approve, reject, expire, supersede, cancel, and mark requests as executed.
58+
59+
### Approval
60+
61+
- `IMutationRequestApprovalWorkflowManager`
62+
- `MutationRequestApprovalWorkflowManager`
63+
- `MutationApprovalRequirement`
64+
65+
Use approval workflow services when a request must be explicitly approved by one or more actors before execution.
66+
67+
### Version Resolution
68+
4669
- `IMutationRequestVersionResolver`
4770
- `IMutationRequestVersionResolutionManager`
4871
- `MutationRequestVersionResolution`
4972
- `MutationRequestVersionResolutionOutcome`
5073
- `VersionedRequestResolutionStrategy`
51-
- `MutationRequestAlreadyExistsException`
52-
- `MutationApprovalRequirementNotFoundException`
53-
- `InvalidMutationApprovalActionException`
54-
- `MutationRequestConcurrencyException`
55-
- `MutationRequestNotFoundException`
56-
- `InvalidMutationRequestTransitionException`
5774

58-
`Abstractions/Requests` is further split into:
75+
Use resolution services to decide what happens when deferred request no longer matches the state version it was created against.
76+
77+
### Governed Execution
78+
79+
- `IGovernanceExecutionManager`
80+
- `GovernanceExecutionManager`
81+
- `GovernedExecutionResult<TState>`
82+
83+
Use governed execution to close the loop from approved request to core mutation execution and terminal governance state.
84+
85+
## Package Areas
86+
87+
The codebase is organized by governance concern rather than by framework layer alone.
88+
89+
### Requests
90+
91+
`Abstractions/Requests` contains the durable request model, decision taxonomy, and request factory methods.
5992

6093
- `Requests/Model`
6194
- `Requests/Decisions`
95+
- `Requests/Factory`
96+
97+
### Lifecycle
98+
99+
`Lifecycle` owns generic request movement between governance states such as pending, approved, rejected, expired, superseded, and executed.
62100

63-
`Abstractions/Approval` is further split into:
101+
- `Lifecycle/Contracts`
102+
- `Lifecycle/Model`
103+
- `Runtime/Lifecycle/Execution`
104+
- `Runtime/Lifecycle/Validation`
105+
- `Runtime/Lifecycle/State`
106+
107+
### Approval
108+
109+
`Approval` builds request-level approval workflow on top of the generic lifecycle model.
64110

65111
- `Approval/Contracts`
66112
- `Approval/Model`
67113
- `Approval/Mapping`
114+
- `Runtime/Approval/Execution`
115+
- `Runtime/Approval/State`
116+
117+
### Resolution
68118

69-
`Abstractions/Resolution` is further split into:
119+
`Resolution` owns version-aware request handling before governed execution.
70120

71121
- `Resolution/Contracts`
72122
- `Resolution/Model`
73123
- `Resolution/Strategies`
124+
- `Runtime/Resolution/Evaluation`
125+
- `Runtime/Resolution/Execution`
74126

75-
`Abstractions/Lifecycle` is further split into:
127+
### Execution
76128

77-
- `Lifecycle/Contracts`
78-
- `Lifecycle/Model`
129+
`Execution` owns the bridge from governance request semantics into the core mutation engine.
79130

80-
`Abstractions/Exceptions` is further split into:
131+
- `Execution/Contracts`
132+
- `Execution/Model`
133+
- `Runtime/Execution/Mutation`
134+
- `Runtime/Execution/Orchestration`
135+
- `Runtime/Execution/Outcome`
136+
- `Runtime/Execution/Persistence`
81137

82-
- `Exceptions/Approval`
83-
- `Exceptions/Lifecycle`
84-
- `Exceptions/Storage`
138+
### Storage and Exceptions
85139

86-
### Runtime
140+
`Storage` defines persistence seams. `Exceptions` contains governance-specific failures grouped by concern.
87141

88-
The initial runtime layer currently provides:
89-
90-
- `Runtime/Storage/InMemoryMutationRequestStore`
91-
- `Runtime/Approval/MutationRequestApprovalWorkflowManager`
92-
- `Runtime/Lifecycle/MutationRequestLifecycleManager`
93-
- `Runtime/Resolution/MutationRequestVersionResolver`
94-
- `Runtime/Resolution/MutationRequestVersionResolutionManager`
95-
96-
`Runtime/Resolution` is further split into:
97-
98-
- `Resolution/Evaluation`
99-
- `Resolution/Execution`
142+
- `Abstractions/Storage`
143+
- `Abstractions/Exceptions/Approval`
144+
- `Abstractions/Exceptions/Lifecycle`
145+
- `Abstractions/Exceptions/Storage`
100146

101-
`Runtime/Lifecycle` is further split into:
147+
## What Exists Today
102148

103-
- `Lifecycle/Execution`
104-
- `Lifecycle/Validation`
105-
- `Lifecycle/State`
149+
Today the package already provides:
106150

107-
`Runtime/Approval` is further split into:
151+
- durable `MutationRequest` modeling
152+
- request-level approval requirements
153+
- optimistic concurrency in request storage
154+
- explicit lifecycle transitions
155+
- version-aware request resolution
156+
- governed execution through the core mutation engine
157+
- in-memory runtime support for examples and tests
108158

109-
- `Approval/Execution`
110-
- `Approval/State`
159+
What it does not try to do yet:
111160

112-
This keeps the first version small while leaving room for later persistence providers such as Entity Framework Core or PostgreSQL-backed governance stores.
161+
- persistence providers such as EF Core or PostgreSQL
162+
- query stores for operational governance reporting
163+
- compensation and retry orchestration
164+
- external async approval or policy integrations
113165

114166
## Relationship to Core
115167

@@ -135,14 +187,13 @@ Responsible for:
135187

136188
## Direction
137189

138-
This package is intentionally the place where broader governance behavior should grow.
190+
This package is the place where broader governance behavior should grow without turning the core mutation engine into a workflow framework.
139191

140-
That includes future work such as:
192+
The near-term direction is:
141193

142-
- pending mutation resolution
143-
- approval workflow execution
144-
- version aware deferred execution
145-
- governance persistence providers
146-
- governance query APIs
194+
- harden governed execution semantics
195+
- add governance persistence and query providers
196+
- expose governance metadata operationally
197+
- support richer approval and integration scenarios
147198

148199
The goal is to keep the core runtime small and execution focused while letting governance evolve as an opt-in extension.

0 commit comments

Comments
 (0)