source: flexoentity/org/transitions.org@ 3389960

unify_backends
Last change on this file since 3389960 was 54941b4, checked in by Enrico Schwass <ennoausberlin@…>, 4 days ago

add some transition rules for entities in org

  • Property mode set to 100644
File size: 3.8 KB
RevLine 
[54941b4]1FLEXO ID Decision Flowchart
2
3We assume:
4
5flexo_base_id = logical identity
6
7flexo_version = content evolution
8
9lifecycle suffix = process state
10
11fingerprint = canonical JSON hash
12
13STEP 0 — What is happening?
14
15You must classify the operation into one of three categories:
16
17State transition
18
19Content modification
20
21Logical duplication / fork
22
23Everything falls into one of these.
24
25FLOWCHART
26START
27 |
28 |-- Is this operation creating a new independent lineage?
29 | (copy into new catalog? fork? split ownership?)
30 |
31 |-- YES --> Generate NEW flexo_base_id
32 | flexo_version = 1
33 | lifecycle_state = Draft
34 | origin_flexo_id = previous full ID
35 | END
36 |
37 |-- NO
38 |
39 |-- Is canonical content different from last saved version?
40 | (compare normalized JSON, excluding lifecycle metadata)
41 |
42 |-- YES --> flexo_base_id stays the same
43 | flexo_version = previous_version + 1
44 | lifecycle_state = Draft
45 | END
46 |
47 |-- NO
48 |
49 |-- Is this a lifecycle transition?
50 |
51 |-- YES --> flexo_base_id stays the same
52 | flexo_version stays the same
53 | lifecycle_state changes
54 | END
55 |
56 |-- NO
57 |
58 |-- No ID change required
59 (metadata only, DB-only operation)
60 END
61Now Let’s Make It Concrete
621️⃣ Logical Duplication (NEW BASE ID)
63
64Trigger conditions:
65
66Copy question into new catalog (independent evolution)
67
68Split catalog into two
69
70Fork domain for separate governance
71
72“Save as new” intentionally
73
74Effect:
75
76new_base_id = generate()
77version = 1
78state = Draft
79origin_flexo_id = previous full ID
80
81Strict rule:
82
83If future changes must not affect original lineage → new base ID.
84
852️⃣ Content Modification (VERSION BUMP)
86
87Trigger:
88
89Canonical JSON changed (after normalization).
90
91Examples:
92
93Question text edited
94
95Options reordered (if order matters)
96
97Points changed
98
99Domain description changed
100
101Exam layout changed
102
103Embedded question snapshot changed
104
105Effect:
106
107base_id unchanged
108version += 1
109state = Draft
110
111Strict rule:
112
113If fingerprint changes → version bump.
114
115No exceptions.
116
1173️⃣ Lifecycle Transition (STATE ONLY)
118
119Trigger:
120
121Draft → Approved
122
123Approved → Signed
124
125Signed → Published
126
127Published → Obsolete
128
129Effect:
130
131base_id unchanged
132version unchanged
133state changes
134
135Strict rule:
136
137Lifecycle does not alter content version.
138
139Edge Case Handling
140Approved entity edited
141
142Flow:
143
144Content change detected
145
146Version bump
147
148State automatically reset to Draft
149
150So:
151
152BASE@001P → edit → BASE@002D
153
154Clean and auditable.
155
156Draft → Approved where draft ID is “temporary”
157
158Your earlier idea suggested generating new ID at approval.
159
160Under strict logic:
161
162That is unnecessary and breaks lineage.
163
164Instead:
165
166BASE@001D → BASE@001A
167
168Same logical identity.
169
170If you must isolate drafts operationally:
171Use different database tiers, not different IDs.
172
173* Decision Matrix Summary
174
175| Operation | New Base ID | Version++ | State Change |
176|-------------------------+-------------+------------+--------------|
177| Copy/fork | | reset to 1 | Draft |
178| Content edit | | | Draft |
179| State promotion | No | No | Yes |
180| Metadata-only DB change | | | |
181
182One Important Constraint
183
184Fingerprint must exclude:
185
186- lifecycle_state
187- owner_id
188- DB storage metadata
189
190Otherwise state transitions would falsely trigger version bump.
191
192Fingerprint must represent semantic content only !!!
193
194Final Integrity Principle
195
196There must never exist:
197
198- two different canonical JSONs with same base ID + version
199- two identical canonical JSONs with different base ID (unless forked intentionally)
200
201If those invariants hold, your identity system is mathematically clean.
Note: See TracBrowser for help on using the repository browser.