Skip to content

Commit 4db292d

Browse files
Merge pull request #10 from godofthunder101/godofthunder101-patch-1
Godofthunder101 patch 1
2 parents 625e037 + 4962a9b commit 4db292d

11 files changed

Lines changed: 198 additions & 142 deletions

spec/CrypSA_Consistency_Model.md

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,29 @@ CrypSA does not rely on global state synchronization.
1616

1717
Instead:
1818

19-
> Consistency is achieved through agreement on canonical event history and deterministic replay.
19+
> Consistency is achieved through agreement on canonical event history and deterministic replay.
20+
> Canonical event history is the source of truth.
2021
2122
Observers may temporarily diverge, but must eventually converge on the same canonical history.
2223

2324
---
2425

26+
> Canonical event history is the source of truth.
27+
> Derived canonical state is a projection of canonical event history. It is not the source of truth.
28+
29+
---
30+
2531
## Consistency Goals
2632

2733
CrypSA provides:
2834

29-
* **Canonical Consistency**
35+
* **Canonical Consistency**
3036
All observers agree on accepted canonical events
3137

32-
* **Replay Consistency**
38+
* **Replay Consistency**
3339
Given the same canonical event history, all observers derive the same state
3440

35-
* **Eventual Convergence**
41+
* **Eventual Convergence**
3642
Temporary divergence is allowed, but must resolve
3743

3844
CrypSA does **not guarantee**:
@@ -50,8 +56,9 @@ CrypSA uses a hybrid consistency model:
5056
### 1. Event-Level Authority
5157

5258
* The validator is authoritative over event acceptance
53-
* Only accepted events enter canonical event history
54-
* Canonical event history defines shared truth
59+
* All candidate events must cross the invariant boundary before becoming canonical
60+
* Only accepted events become canonical and are appended to canonical event history
61+
* Canonical event history is the source of truth
5562

5663
---
5764

@@ -81,7 +88,7 @@ Canonical event history is strictly ordered by:
8188
This ordering is:
8289

8390
* authoritative
84-
* global within a validator instance
91+
* defined by the validator
8592
* used for replay and reconstruction
8693

8794
> `canonical_sequence` is assigned by the validator and defines canonical ordering.
@@ -97,7 +104,7 @@ Implementations may reason about events within scopes such as:
97104

98105
However:
99106

100-
> canonical ordering remains defined by validator-assigned sequence
107+
> canonical ordering remains defined by validator-assigned `canonical_sequence`
101108
102109
---
103110

@@ -114,8 +121,8 @@ Conflicts occur when:
114121

115122
The validator resolves conflicts during validation:
116123

117-
* events are evaluated atomically within the conflict scope
118-
* only one valid outcome is accepted
124+
* events are evaluated atomically within the relevant conflict scope
125+
* only valid outcomes can become canonical
119126
* rejected events do not enter canonical event history
120127

121128
---
@@ -130,7 +137,7 @@ Given:
130137

131138
The result must be:
132139

133-
> identical (accept or reject)
140+
> identical (accept or reject) given identical inputs
134141
135142
---
136143

@@ -140,23 +147,23 @@ The result must be:
140147
| ---------------- | ----------------------- |
141148
| Local simulation | Observer-only |
142149
| UI interaction | Minimal |
143-
| Canonical events | Strong (validated) |
150+
| Canonical events | Validator-enforced |
144151

145152
All canonical events require validation.
146153

147154
---
148155

149156
## Partitioning
150157

151-
CrypSA may partition the world into independent scopes:
158+
Implementations may partition the world into independent scopes:
152159

153160
* regions
154161
* zones
155162
* object groups
156163

157164
Within a partition:
158165

159-
* stronger consistency can be enforced
166+
* stronger coordination may be enforced
160167

161168
Across partitions:
162169

@@ -170,22 +177,24 @@ When events span partitions:
170177

171178
* coordination may be required
172179
* validation may involve multiple scopes
173-
* temporary inconsistency may occur
180+
* temporary inconsistency is expected during reconciliation
174181

175182
Possible strategies include:
176183

177184
* coordination protocols
178185
* staged validation
179186
* compensating events
180187

188+
These are implementation strategies, not core consistency requirements.
189+
181190
---
182191

183192
## Observer Reconciliation
184193

185194
Observers reconcile when:
186195

187196
* canonical events differ from local prediction
188-
* rejected events invalidate assumptions
197+
* rejected events invalidate local assumptions
189198

190199
Reconciliation may involve:
191200

@@ -197,12 +206,12 @@ Reconciliation may involve:
197206

198207
## Snapshot Consistency
199208

200-
Snapshots represent derived state at a specific canonical sequence.
209+
Snapshots represent derived state at a specific `canonical_sequence`.
201210

202211
To remain consistent:
203212

204-
* snapshots must correspond to a specific `canonical_sequence`
205-
* replaying events after the snapshot must produce the same result as full replay
213+
* a snapshot must correspond to a specific `canonical_sequence`
214+
* replaying events after that snapshot must produce the same result as full replay
206215

207216
---
208217

@@ -212,7 +221,7 @@ The system must ensure:
212221

213222
* duplicate candidate events do not produce duplicate canonical events
214223

215-
Each `event_id` must be processed exactly once.
224+
Repeated submission of the same `event_id` must not result in more than one canonical event.
216225

217226
---
218227

@@ -224,7 +233,7 @@ The system must handle:
224233
* out-of-order delivery
225234
* missing events
226235
* conflicting submissions
227-
* partial history
236+
* incomplete observer history (missing canonical events)
228237

229238
Consistency must still converge under these conditions.
230239

@@ -257,11 +266,11 @@ CrypSA prioritizes:
257266
CrypSA consistency is:
258267

259268
* event-driven
260-
* validator-controlled
261-
* globally ordered (by canonical sequence)
269+
* validator-defined canonical authority
270+
* canonically ordered
262271
* eventually convergent
263272

264-
> Observers may disagree temporarily,
273+
> Observers may disagree temporarily,
265274
> but canonical event history ensures they eventually agree.
266275
267276
---

spec/CrypSA_Event_Model.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ This document defines the structure, behavior, and lifecycle of events in CrypSA
44

55
Events are the foundation of the system.
66

7-
> Canonical events define shared reality.
8-
> State is derived by replaying canonical event history.
7+
> Canonical event history is the source of truth.
8+
> Derived canonical state is a projection of canonical event history. It is not the source of truth.
99
1010
---
1111

@@ -15,7 +15,12 @@ CrypSA is event-driven.
1515

1616
* the world is not the source of truth
1717
* **canonical event history is the source of truth**
18-
* world state is derived from that history
18+
* derived canonical state is a projection of canonical event history. It is not the source of truth.
19+
20+
---
21+
22+
> Canonical event history is the source of truth.
23+
> Derived canonical state is a projection of canonical event history. It is not the source of truth.
1924
2025
---
2126

@@ -52,17 +57,17 @@ Every event follows this lifecycle:
5257
Event is submitted to the validator
5358

5459
3. **Validation**
55-
Validator evaluates the event
60+
The validator evaluates the event
5661

5762
4. **Decision**
5863

59-
* accepted → becomes canonical
60-
* rejected → discarded
64+
* accepted → proceeds to canonicalization
65+
* rejected → does not become canonical and does not enter canonical event history
6166

6267
5. **Canonicalization**
6368

6469
* canonical metadata assigned
65-
* appended to canonical event history
70+
* If accepted, an event becomes canonical and is appended to canonical event history
6671

6772
6. **Propagation**
6873
Observers receive the canonical event
@@ -87,7 +92,7 @@ CrypSA events consist of two layers:
8792

8893
* unique identifier for the candidate event
8994
* used for idempotency
90-
* must be unique per submission
95+
* must uniquely identify the candidate event
9196

9297
---
9398

@@ -120,7 +125,7 @@ Examples:
120125

121126
* event-specific data
122127
* must be deterministic
123-
* must contain all data required for replay
128+
* must contain all data required for deterministic replay
124129

125130
Example:
126131

@@ -189,7 +194,7 @@ A canonical event is an accepted candidate event that:
189194

190195
* has passed validation
191196
* has been assigned `canonical_sequence`
192-
* has been appended to canonical event history
197+
* has been appended to canonical event history by the validator
193198
* is immutable
194199

195200
---
@@ -213,7 +218,7 @@ Canonical events must satisfy:
213218

214219
The system must ensure that duplicate `event_id` submissions do not create duplicate canonical events.
215220

216-
Each candidate event must be processed exactly once.
221+
Repeated submission of the same `event_id` must not result in more than one canonical event.
217222

218223
---
219224

@@ -264,7 +269,7 @@ Rejected events:
264269

265270
## Invariant Boundary Relationship
266271

267-
Candidate events originate from actions that cross the invariant boundary.
272+
Candidate events originate from actions that cross the invariant boundary into validation.
268273

269274
The invariant boundary defines:
270275

@@ -284,8 +289,8 @@ CrypSA events:
284289

285290
* represent all canonical changes
286291
* are validated before acceptance
287-
* are stored in canonical event history
288-
* define shared reality
292+
* are appended to canonical event history
293+
* canonical event history is the source of truth
289294
* are replayed to reconstruct state
290295

291296
---

0 commit comments

Comments
 (0)