@dreamforgestudiollc/emet 0.3.6 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +29 -0
- package/CHANGELOG.md +25 -1
- package/README.md +9 -3
- package/RELEASE_NOTES-0.2.6.md +1 -1
- package/RELEASE_NOTES-0.3.7.md +19 -0
- package/docs/BOTS.md +1 -1
- package/docs/DEPLOY.md +14 -1
- package/docs/ERROR-CODES-SPEC.md +4 -0
- package/docs/ERROR-CODES.md +7 -0
- package/docs/ROADMAP.md +3 -3
- package/docs/SETUP.md +4 -0
- package/docs/SUBKEYS.md +3 -1
- package/docs/continuity-currency-statechart.md +34 -0
- package/docs/features/README.md +21 -0
- package/docs/features/access.md +28 -0
- package/docs/features/documents.md +35 -0
- package/docs/features/errors.md +32 -0
- package/docs/features/gems.md +31 -0
- package/docs/features/memory.md +29 -0
- package/docs/features/pages.md +28 -0
- package/docs/features/record.md +27 -0
- package/docs/features/search.md +27 -0
- package/docs/features/startup.md +29 -0
- package/docs/features/subkeys.md +30 -0
- package/docs/features/transcripts.md +33 -0
- package/docs/per-tag-handoff-statechart.md +147 -0
- package/docs/subkey-session-statechart.md +57 -0
- package/package.json +3 -2
- package/server.json +27 -2
- package/src/annotations.js +4 -3
- package/src/attribution.js +1 -1
- package/src/chooser.js +74 -3
- package/src/conformance.js +2 -0
- package/src/continuity-currency-statechart.js +139 -0
- package/src/continuity-currency.js +869 -0
- package/src/dispatch.js +1 -1
- package/src/error-codes.js +7 -0
- package/src/http-remote.js +27 -4
- package/src/index.js +1 -0
- package/src/pages.js +15 -0
- package/src/per-tag-handoff-statechart.js +264 -0
- package/src/per-tag-handoff.js +988 -0
- package/src/persons.js +16 -0
- package/src/session-graph.js +118 -7
- package/src/session.js +54 -10
- package/src/setup.js +22 -1
- package/src/startup-pages.js +13 -2
- package/src/subkey-lifecycle.js +105 -0
- package/src/subkey-session-statechart.js +253 -0
- package/src/subkeys.js +648 -89
- package/src/tools.js +157 -32
- package/src/version.js +1 -1
- package/templates/INDEX.md +1 -0
- package/templates/TAGHANDOFF.md +45 -0
- package/verification/continuity-currency/ContinuityCurrency.cfg +12 -0
- package/verification/continuity-currency/ContinuityCurrency.tla +239 -0
- package/verification/continuity-currency/tlc-output.txt +32 -0
- package/verification/continuity-currency/view.mjs +54 -0
- package/verification/per-tag-handoff/PerTagHandoff.cfg +10 -0
- package/verification/per-tag-handoff/PerTagHandoff.tla +191 -0
- package/verification/per-tag-handoff/StampCounter.cfg +10 -0
- package/verification/per-tag-handoff/out/report.md +6 -0
- package/verification/per-tag-handoff/out-counter/chart.mmd +30 -0
- package/verification/per-tag-handoff/out-counter/report.md +15 -0
- package/verification/per-tag-handoff/out-counter/tlc.out +130 -0
- package/verification/per-tag-handoff/split/PerTagConflict.cfg +6 -0
- package/verification/per-tag-handoff/split/PerTagConflict.tla +104 -0
- package/verification/per-tag-handoff/split/PerTagTime.cfg +8 -0
- package/verification/per-tag-handoff/split/PerTagTime.tla +100 -0
- package/verification/per-tag-handoff/split/conflict-chart.mmd +47 -0
- package/verification/per-tag-handoff/split/conflict-report.md +8 -0
- package/verification/per-tag-handoff/split/conflict-tlc.txt +19 -0
- package/verification/per-tag-handoff/split/conflict-view.mjs +34 -0
- package/verification/per-tag-handoff/split/time-chart.mmd +44 -0
- package/verification/per-tag-handoff/split/time-report.md +8 -0
- package/verification/per-tag-handoff/split/time-tlc.txt +19 -0
- package/verification/per-tag-handoff/split/time-view.mjs +33 -0
- package/verification/per-tag-handoff/tlc-output.txt +19 -0
- package/verification/per-tag-handoff/v1-draft/PerTagHandoff.cfg +5 -0
- package/verification/per-tag-handoff/v1-draft/PerTagHandoff.tla +94 -0
- package/verification/per-tag-handoff/v1-draft/out/chart.mmd +37 -0
- package/verification/per-tag-handoff/v1-draft/out/report.md +7 -0
- package/verification/per-tag-handoff/v1-draft/out/tlc.out +19 -0
- package/verification/per-tag-handoff/v1-draft/view.mjs +20 -0
- package/verification/per-tag-handoff/view.mjs +31 -0
- package/verification/subkey-session/SubkeySession.cfg +11 -0
- package/verification/subkey-session/SubkeySession.tla +254 -0
- package/verification/subkey-session/tlc-output.txt +13 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
---- MODULE ContinuityCurrency ----
|
|
2
|
+
\* Continuity-currency (tip-lag) gate.
|
|
3
|
+
\* Warn, current, documented no-op, no handoff, unreadable, or fallback-only.
|
|
4
|
+
\* The gate does not rewrite HANDOFF or STATE and does not block.
|
|
5
|
+
\* This is not wiki page currency. Episodic ids are not states in this model.
|
|
6
|
+
\* `newer` and `claim` are the classes the comparison can see.
|
|
7
|
+
\* `fallback` is a logged tip. It warns and it is not block-eligible.
|
|
8
|
+
|
|
9
|
+
EXTENDS Integers
|
|
10
|
+
|
|
11
|
+
VARIABLES phase, flag, newer, claim, handoffMutated, blocked, warning, blockEligible
|
|
12
|
+
vars == <<phase, flag, newer, claim, handoffMutated, blocked, warning, blockEligible>>
|
|
13
|
+
|
|
14
|
+
Phase == {
|
|
15
|
+
"GateOff", "Comparing", "Current", "DocumentedNoOp", "Warning", "BlockHeld",
|
|
16
|
+
"NoHandoff", "Unreadable", "FallbackOnly", "FallbackHeld"
|
|
17
|
+
}
|
|
18
|
+
Flag == {"off", "warn"}
|
|
19
|
+
Newer == {"none", "scratch", "material", "fallback"}
|
|
20
|
+
Claim == {"at_tip", "behind", "version_only"}
|
|
21
|
+
|
|
22
|
+
TypeOK ==
|
|
23
|
+
/\ phase \in Phase
|
|
24
|
+
/\ flag \in Flag
|
|
25
|
+
/\ newer \in Newer
|
|
26
|
+
/\ claim \in Claim
|
|
27
|
+
/\ handoffMutated \in BOOLEAN
|
|
28
|
+
/\ blocked \in BOOLEAN
|
|
29
|
+
/\ warning \in BOOLEAN
|
|
30
|
+
/\ blockEligible \in BOOLEAN
|
|
31
|
+
|
|
32
|
+
Init ==
|
|
33
|
+
/\ phase = "GateOff"
|
|
34
|
+
/\ flag = "off"
|
|
35
|
+
/\ newer = "none"
|
|
36
|
+
/\ claim = "at_tip"
|
|
37
|
+
/\ handoffMutated = FALSE
|
|
38
|
+
/\ blocked = FALSE
|
|
39
|
+
/\ warning = FALSE
|
|
40
|
+
/\ blockEligible = FALSE
|
|
41
|
+
|
|
42
|
+
\* The warn flag stays off. No warning is shown.
|
|
43
|
+
FlagStaysOff ==
|
|
44
|
+
/\ phase = "GateOff"
|
|
45
|
+
/\ flag = "off"
|
|
46
|
+
/\ phase' = "GateOff"
|
|
47
|
+
/\ warning' = FALSE
|
|
48
|
+
/\ UNCHANGED <<flag, newer, claim, handoffMutated, blocked, blockEligible>>
|
|
49
|
+
|
|
50
|
+
\* The warn flag is turned on. The next initialize compares.
|
|
51
|
+
EnableWarn ==
|
|
52
|
+
/\ phase = "GateOff"
|
|
53
|
+
/\ flag = "off"
|
|
54
|
+
/\ flag' = "warn"
|
|
55
|
+
/\ phase' = "Comparing"
|
|
56
|
+
/\ warning' = FALSE
|
|
57
|
+
/\ blockEligible' = FALSE
|
|
58
|
+
/\ UNCHANGED <<newer, claim, handoffMutated, blocked>>
|
|
59
|
+
|
|
60
|
+
\* The handoff cites the live material tip.
|
|
61
|
+
SeeCurrent ==
|
|
62
|
+
/\ phase = "Comparing"
|
|
63
|
+
/\ flag = "warn"
|
|
64
|
+
/\ claim' = "at_tip"
|
|
65
|
+
/\ newer' = "none"
|
|
66
|
+
/\ phase' = "Current"
|
|
67
|
+
/\ warning' = FALSE
|
|
68
|
+
/\ blockEligible' = FALSE
|
|
69
|
+
/\ UNCHANGED <<flag, handoffMutated, blocked>>
|
|
70
|
+
|
|
71
|
+
\* A documented no-op has no newer material tip.
|
|
72
|
+
SeeNoOp ==
|
|
73
|
+
/\ phase = "Comparing"
|
|
74
|
+
/\ flag = "warn"
|
|
75
|
+
/\ claim' = "at_tip"
|
|
76
|
+
/\ newer' = "none"
|
|
77
|
+
/\ phase' = "DocumentedNoOp"
|
|
78
|
+
/\ warning' = FALSE
|
|
79
|
+
/\ blockEligible' = FALSE
|
|
80
|
+
/\ UNCHANGED <<flag, handoffMutated, blocked>>
|
|
81
|
+
|
|
82
|
+
\* A newer episodic is scratch or diagnosis only. The material tip did not move.
|
|
83
|
+
SeeScratch ==
|
|
84
|
+
/\ phase = "Comparing"
|
|
85
|
+
/\ flag = "warn"
|
|
86
|
+
/\ claim' = "at_tip"
|
|
87
|
+
/\ newer' = "scratch"
|
|
88
|
+
/\ phase' = "Current"
|
|
89
|
+
/\ warning' = FALSE
|
|
90
|
+
/\ blockEligible' = FALSE
|
|
91
|
+
/\ UNCHANGED <<flag, handoffMutated, blocked>>
|
|
92
|
+
|
|
93
|
+
\* A version number alone cannot see a material tip that the handoff does not cite.
|
|
94
|
+
SeeVersionOnly ==
|
|
95
|
+
/\ phase = "Comparing"
|
|
96
|
+
/\ flag = "warn"
|
|
97
|
+
/\ claim' = "version_only"
|
|
98
|
+
/\ newer' = "material"
|
|
99
|
+
/\ phase' = "Current"
|
|
100
|
+
/\ warning' = FALSE
|
|
101
|
+
/\ blockEligible' = FALSE
|
|
102
|
+
/\ UNCHANGED <<flag, handoffMutated, blocked>>
|
|
103
|
+
|
|
104
|
+
\* The material tip is newer than the handoff claim.
|
|
105
|
+
SeeLag ==
|
|
106
|
+
/\ phase = "Comparing"
|
|
107
|
+
/\ flag = "warn"
|
|
108
|
+
/\ claim' = "behind"
|
|
109
|
+
/\ newer' = "material"
|
|
110
|
+
/\ phase' = "Warning"
|
|
111
|
+
/\ warning' = TRUE
|
|
112
|
+
/\ blockEligible' = TRUE
|
|
113
|
+
/\ handoffMutated' = FALSE
|
|
114
|
+
/\ blocked' = FALSE
|
|
115
|
+
/\ UNCHANGED <<flag>>
|
|
116
|
+
|
|
117
|
+
\* Only a fallback tip is newer. The warning is logged. It is not block-eligible.
|
|
118
|
+
SeeFallback ==
|
|
119
|
+
/\ phase = "Comparing"
|
|
120
|
+
/\ flag = "warn"
|
|
121
|
+
/\ claim' = "behind"
|
|
122
|
+
/\ newer' = "fallback"
|
|
123
|
+
/\ phase' = "FallbackOnly"
|
|
124
|
+
/\ warning' = TRUE
|
|
125
|
+
/\ blockEligible' = FALSE
|
|
126
|
+
/\ handoffMutated' = FALSE
|
|
127
|
+
/\ blocked' = FALSE
|
|
128
|
+
/\ UNCHANGED <<flag>>
|
|
129
|
+
|
|
130
|
+
\* The store has no handoff to compare. That is not a warning.
|
|
131
|
+
SeeNoHandoff ==
|
|
132
|
+
/\ phase = "Comparing"
|
|
133
|
+
/\ flag = "warn"
|
|
134
|
+
/\ claim' = "at_tip"
|
|
135
|
+
/\ newer' = "none"
|
|
136
|
+
/\ phase' = "NoHandoff"
|
|
137
|
+
/\ warning' = FALSE
|
|
138
|
+
/\ blockEligible' = FALSE
|
|
139
|
+
/\ handoffMutated' = FALSE
|
|
140
|
+
/\ blocked' = FALSE
|
|
141
|
+
/\ UNCHANGED <<flag>>
|
|
142
|
+
|
|
143
|
+
\* The comparison could not be read. That is not a warning.
|
|
144
|
+
SeeUnreadable ==
|
|
145
|
+
/\ phase = "Comparing"
|
|
146
|
+
/\ flag = "warn"
|
|
147
|
+
/\ claim' = "at_tip"
|
|
148
|
+
/\ newer' = "none"
|
|
149
|
+
/\ phase' = "Unreadable"
|
|
150
|
+
/\ warning' = FALSE
|
|
151
|
+
/\ blockEligible' = FALSE
|
|
152
|
+
/\ handoffMutated' = FALSE
|
|
153
|
+
/\ blocked' = FALSE
|
|
154
|
+
/\ UNCHANGED <<flag>>
|
|
155
|
+
|
|
156
|
+
\* Phase 2 was asked for. Only a block-eligible lag moves to BlockHeld.
|
|
157
|
+
\* `blockEligible` is the guard: FallbackOnly is in the phase set and is refused.
|
|
158
|
+
AskBlock ==
|
|
159
|
+
/\ phase \in {"Warning", "FallbackOnly"}
|
|
160
|
+
/\ blockEligible = TRUE
|
|
161
|
+
/\ phase' = "BlockHeld"
|
|
162
|
+
/\ warning' = TRUE
|
|
163
|
+
/\ blocked' = FALSE
|
|
164
|
+
/\ handoffMutated' = FALSE
|
|
165
|
+
/\ UNCHANGED <<flag, newer, claim, blockEligible>>
|
|
166
|
+
|
|
167
|
+
\* Phase 2 was asked for on a lag that is not block-eligible.
|
|
168
|
+
AskBlockOnFallback ==
|
|
169
|
+
/\ phase \in {"Warning", "FallbackOnly"}
|
|
170
|
+
/\ blockEligible = FALSE
|
|
171
|
+
/\ phase' = "FallbackHeld"
|
|
172
|
+
/\ warning' = TRUE
|
|
173
|
+
/\ blocked' = FALSE
|
|
174
|
+
/\ handoffMutated' = FALSE
|
|
175
|
+
/\ UNCHANGED <<flag, newer, claim, blockEligible>>
|
|
176
|
+
|
|
177
|
+
\* The next initialize compares again. Documents stay as they were.
|
|
178
|
+
CompareAgain ==
|
|
179
|
+
/\ phase \in {"Current", "DocumentedNoOp", "Warning", "BlockHeld", "NoHandoff", "Unreadable", "FallbackOnly", "FallbackHeld"}
|
|
180
|
+
/\ flag = "warn"
|
|
181
|
+
/\ phase' = "Comparing"
|
|
182
|
+
/\ warning' = FALSE
|
|
183
|
+
/\ blockEligible' = FALSE
|
|
184
|
+
/\ UNCHANGED <<flag, newer, claim, handoffMutated, blocked>>
|
|
185
|
+
|
|
186
|
+
Next ==
|
|
187
|
+
\/ FlagStaysOff
|
|
188
|
+
\/ EnableWarn
|
|
189
|
+
\/ SeeCurrent
|
|
190
|
+
\/ SeeNoOp
|
|
191
|
+
\/ SeeScratch
|
|
192
|
+
\/ SeeVersionOnly
|
|
193
|
+
\/ SeeLag
|
|
194
|
+
\/ SeeFallback
|
|
195
|
+
\/ SeeNoHandoff
|
|
196
|
+
\/ SeeUnreadable
|
|
197
|
+
\/ AskBlock
|
|
198
|
+
\/ AskBlockOnFallback
|
|
199
|
+
\/ CompareAgain
|
|
200
|
+
|
|
201
|
+
Spec == Init /\ [][Next]_vars
|
|
202
|
+
|
|
203
|
+
\* No action rewrites a continuity record.
|
|
204
|
+
NeverRewrites == handoffMutated = FALSE
|
|
205
|
+
|
|
206
|
+
\* Phase 1 does not block, including after a block is asked for.
|
|
207
|
+
NeverBlocks == blocked = FALSE
|
|
208
|
+
|
|
209
|
+
\* A warning is a material lag, or a fallback-only lag. Scratch, a no-op, and a version number are not.
|
|
210
|
+
WarnOnlyOnMaterialLag ==
|
|
211
|
+
warning = TRUE =>
|
|
212
|
+
/\ blocked = FALSE
|
|
213
|
+
/\ handoffMutated = FALSE
|
|
214
|
+
/\ \/ (phase \in {"Warning", "BlockHeld"} /\ newer = "material" /\ claim = "behind" /\ blockEligible = TRUE)
|
|
215
|
+
\/ (phase \in {"FallbackOnly", "FallbackHeld"} /\ newer = "fallback" /\ claim = "behind" /\ blockEligible = FALSE)
|
|
216
|
+
|
|
217
|
+
\* The flag-off surface shows nothing.
|
|
218
|
+
FlagOffShowsNothing == flag = "off" => phase = "GateOff" /\ warning = FALSE
|
|
219
|
+
|
|
220
|
+
\* A documented no-op is not a warning.
|
|
221
|
+
NoOpIsNotAWarning == phase = "DocumentedNoOp" => warning = FALSE
|
|
222
|
+
|
|
223
|
+
\* No handoff is not a warning, and nothing is written.
|
|
224
|
+
NoHandoffIsQuiet == phase = "NoHandoff" => warning = FALSE /\ blocked = FALSE /\ handoffMutated = FALSE
|
|
225
|
+
|
|
226
|
+
\* An unreadable comparison is not a warning, and nothing is written.
|
|
227
|
+
UnreadableIsQuiet == phase = "Unreadable" => warning = FALSE /\ blocked = FALSE /\ handoffMutated = FALSE
|
|
228
|
+
|
|
229
|
+
\* Fallback-only warns and is not block-eligible.
|
|
230
|
+
FallbackOnlyIsNotBlockEligible ==
|
|
231
|
+
newer = "fallback" => blocked = FALSE /\ blockEligible = FALSE
|
|
232
|
+
|
|
233
|
+
\* Scratch or diagnosis-only does not warn.
|
|
234
|
+
ScratchIsNotAWarning == newer = "scratch" => warning = FALSE
|
|
235
|
+
|
|
236
|
+
\* Version alone cannot see the lag class.
|
|
237
|
+
VersionAloneDoesNotWarn == claim = "version_only" => warning = FALSE
|
|
238
|
+
|
|
239
|
+
====
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# ContinuityCurrency
|
|
2
|
+
|
|
3
|
+
TLC reached 16 distinct states. The depth of the complete state graph is 4.
|
|
4
|
+
Deadlock checking was on. The invariants are the ones in ContinuityCurrency.cfg.
|
|
5
|
+
Episodic ids are not states. `newer` and `claim` are classes.
|
|
6
|
+
`fallback` is a logged tip. No handoff and unreadable are phases.
|
|
7
|
+
|
|
8
|
+
## Rules that hold
|
|
9
|
+
TypeOK, NeverRewrites, NeverBlocks, WarnOnlyOnMaterialLag, FlagOffShowsNothing, NoOpIsNotAWarning, NoHandoffIsQuiet, UnreadableIsQuiet, FallbackOnlyIsNotBlockEligible, ScratchIsNotAWarning, VersionAloneDoesNotWarn, NoDeadlock
|
|
10
|
+
|
|
11
|
+
TLC stdout for verification/continuity-currency/ContinuityCurrency.tla
|
|
12
|
+
TLC2 Version 2.19 of 08 August 2024
|
|
13
|
+
Warning: Please run the Java VM which executes TLC with a throughput optimized garbage collector by passing the "-XX:+UseParallelGC" property.
|
|
14
|
+
(Use the -nowarning option to disable this warning.)
|
|
15
|
+
Running breadth-first search Model-Checking with fp 0 and seed 6051156359700788678 with 1 worker on 4 cores with 3746MB heap and 64MB offheap memory [pid: 6689] (Linux 6.12.113+ amd64, Ubuntu 21.0.12.1 x86_64, MSBDiskFPSet, DiskStateQueue).
|
|
16
|
+
Parsing file ContinuityCurrency.tla
|
|
17
|
+
Parsing file Integers.tla
|
|
18
|
+
Parsing file Naturals.tla
|
|
19
|
+
Semantic processing of module Naturals
|
|
20
|
+
Semantic processing of module Integers
|
|
21
|
+
Semantic processing of module ContinuityCurrency
|
|
22
|
+
Starting... (2026-11-10 02:09:10)
|
|
23
|
+
Computing initial states...
|
|
24
|
+
Finished computing initial states: 1 distinct state generated at 2026-11-10 02:09:10.
|
|
25
|
+
Model checking completed. No error has been found.
|
|
26
|
+
Estimates of the probability that TLC did not check all reachable states
|
|
27
|
+
because two distinct states had the same fingerprint:
|
|
28
|
+
calculated (optimistic): val = 3.4E-17
|
|
29
|
+
55 states generated, 16 distinct states found, 0 states left on queue.
|
|
30
|
+
The depth of the complete state graph search is 4.
|
|
31
|
+
The average outdegree of the complete state graph is 1 (minimum is 0, the maximum 8 and the 95th percentile is 8).
|
|
32
|
+
Finished in 00s at (2026-11-10 02:09:10)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/** Reader labels for the continuity-currency tip-lag chart. Episodic ids are not drawn. */
|
|
2
|
+
|
|
3
|
+
export const title = "Continuity currency";
|
|
4
|
+
|
|
5
|
+
export const state = (v) => {
|
|
6
|
+
if (v.phase === "GateOff") return "Gate off";
|
|
7
|
+
if (v.phase === "Comparing") return "Comparing";
|
|
8
|
+
if (v.phase === "Current") return "Current";
|
|
9
|
+
if (v.phase === "DocumentedNoOp") return "Documented no-op";
|
|
10
|
+
if (v.phase === "Warning") return "Warning, does not block";
|
|
11
|
+
if (v.phase === "BlockHeld") return "Block asked, still open";
|
|
12
|
+
if (v.phase === "NoHandoff") return "No handoff";
|
|
13
|
+
if (v.phase === "Unreadable") return "Unreadable";
|
|
14
|
+
if (v.phase === "FallbackOnly") return "Fallback only, does not block";
|
|
15
|
+
if (v.phase === "FallbackHeld") return "Block asked of a fallback, still open";
|
|
16
|
+
return v.phase;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const step = (action) => {
|
|
20
|
+
const labels = {
|
|
21
|
+
FlagStaysOff: "warn flag stays off",
|
|
22
|
+
EnableWarn: "warn flag on",
|
|
23
|
+
SeeCurrent: "handoff cites the live material tip",
|
|
24
|
+
SeeNoOp: "documented no-op, no newer material tip",
|
|
25
|
+
SeeScratch: "newer episodic is scratch or diagnosis only",
|
|
26
|
+
SeeVersionOnly: "version number alone",
|
|
27
|
+
SeeLag: "material tip is newer",
|
|
28
|
+
SeeFallback: "only a fallback tip is newer",
|
|
29
|
+
SeeNoHandoff: "no handoff to compare",
|
|
30
|
+
SeeUnreadable: "the comparison could not be read",
|
|
31
|
+
AskBlock: "block asked, still does not block",
|
|
32
|
+
AskBlockOnFallback: "block asked, still does not block",
|
|
33
|
+
CompareAgain: "the next initialize compares again"
|
|
34
|
+
};
|
|
35
|
+
return labels[action] ?? null;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const group = (v) => {
|
|
39
|
+
if (v.phase === "Warning" || v.phase === "BlockHeld") return "warn";
|
|
40
|
+
if (v.phase === "FallbackOnly" || v.phase === "FallbackHeld") return "fallback";
|
|
41
|
+
if (v.phase === "NoHandoff" || v.phase === "Unreadable") return "missing";
|
|
42
|
+
if (v.phase === "GateOff") return "off";
|
|
43
|
+
if (v.phase === "Comparing") return "compare";
|
|
44
|
+
return "clear";
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const colors = {
|
|
48
|
+
off: "tan",
|
|
49
|
+
compare: "blue",
|
|
50
|
+
clear: "teal",
|
|
51
|
+
warn: "orange",
|
|
52
|
+
fallback: "yellow",
|
|
53
|
+
missing: "purple"
|
|
54
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
SPECIFICATION Spec
|
|
2
|
+
INVARIANT TypeOK
|
|
3
|
+
INVARIANT OwnHandoffOnly
|
|
4
|
+
INVARIANT RowPatchedOnlyByOpener
|
|
5
|
+
INVARIANT NoLostBoardUpdate
|
|
6
|
+
INVARIANT ReadOnlyWritesNothing
|
|
7
|
+
INVARIANT IdsCarryPerson
|
|
8
|
+
INVARIANT OpenWorkOnlyInProgress
|
|
9
|
+
INVARIANT StaleMarkOnlyWhileOpen
|
|
10
|
+
INVARIANT StampReproducible
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
---- MODULE PerTagHandoff ----
|
|
2
|
+
EXTENDS Naturals
|
|
3
|
+
\* Build model for per-tag handoffs, with the locked decisions.
|
|
4
|
+
\* Two write tags (hub keeps HANDOFF.md; writer is a bot), one read-only tag.
|
|
5
|
+
\* Handoff ids carry a person segment (reserved now; one person until the multi-user phase).
|
|
6
|
+
\* One board row is enough to show the opener rule: one tag opens it, the other is foreign.
|
|
7
|
+
Writers == {"hub", "writer"}
|
|
8
|
+
Readers == {"guest"}
|
|
9
|
+
Tags == Writers \cup Readers
|
|
10
|
+
Person == "owner"
|
|
11
|
+
MaxV == 1
|
|
12
|
+
MaxB == 2
|
|
13
|
+
|
|
14
|
+
\* A write is allowed only when the credential's (person, tag) equals the document's.
|
|
15
|
+
DocId(w) == <<Person, w>>
|
|
16
|
+
Cred(t) == <<Person, t>>
|
|
17
|
+
|
|
18
|
+
VARIABLES phase, hv, author, board, seen, patches, refused,
|
|
19
|
+
opener, patchedBy, resolvedBy, conflict,
|
|
20
|
+
hage, openAge, epiOpen, ptr, stamp, viewSeen
|
|
21
|
+
vars == <<phase, hv, author, board, seen, patches, refused,
|
|
22
|
+
opener, patchedBy, resolvedBy, conflict,
|
|
23
|
+
hage, openAge, epiOpen, ptr, stamp, viewSeen>>
|
|
24
|
+
|
|
25
|
+
\* The merged view, computed on read. Each line: (handoff version, currency class).
|
|
26
|
+
\* Age 1 means older than 7 days, shown "aging".
|
|
27
|
+
LineClass(a) == IF a = 1 THEN "aging" ELSE "current"
|
|
28
|
+
ViewAt(v, a) == [w \in Writers |-> IF v[w] = 0 THEN <<0, "none">> ELSE <<v[w], LineClass(a[w])>>]
|
|
29
|
+
EmptyView == ViewAt([w \in Writers |-> 0], [w \in Writers |-> 0])
|
|
30
|
+
|
|
31
|
+
Init ==
|
|
32
|
+
/\ phase = [t \in Tags |-> "out"]
|
|
33
|
+
/\ hv = [w \in Writers |-> 0]
|
|
34
|
+
/\ author = [w \in Writers |-> "none"]
|
|
35
|
+
/\ board = 0 /\ patches = 0
|
|
36
|
+
/\ seen = [t \in Tags |-> 0]
|
|
37
|
+
/\ refused = FALSE
|
|
38
|
+
/\ opener = "none" /\ patchedBy = {} /\ resolvedBy = {} /\ conflict = FALSE
|
|
39
|
+
/\ hage = [w \in Writers |-> 0]
|
|
40
|
+
/\ openAge = [t \in Tags |-> 0]
|
|
41
|
+
/\ epiOpen = [t \in Tags |-> FALSE]
|
|
42
|
+
/\ ptr = [w \in Writers |-> 0]
|
|
43
|
+
/\ stamp = [t \in Tags |-> [v |-> [w \in Writers |-> 0], a |-> [w \in Writers |-> 0]]]
|
|
44
|
+
/\ viewSeen = [t \in Tags |-> EmptyView]
|
|
45
|
+
|
|
46
|
+
\* Any tag starts: reads the merged view and records a stamp (versions AND the as-of age).
|
|
47
|
+
Start(t) ==
|
|
48
|
+
/\ phase[t] = "out"
|
|
49
|
+
/\ phase' = [phase EXCEPT ![t] = "in"]
|
|
50
|
+
/\ seen' = [seen EXCEPT ![t] = board]
|
|
51
|
+
/\ stamp' = [stamp EXCEPT ![t] = [v |-> hv, a |-> hage]]
|
|
52
|
+
/\ viewSeen' = [viewSeen EXCEPT ![t] = ViewAt(hv, hage)]
|
|
53
|
+
/\ openAge' = [openAge EXCEPT ![t] = 0]
|
|
54
|
+
/\ refused' = FALSE
|
|
55
|
+
/\ UNCHANGED <<hv, author, board, patches, opener, patchedBy, resolvedBy, conflict, hage, epiOpen, ptr>>
|
|
56
|
+
|
|
57
|
+
BoardWrite(t) ==
|
|
58
|
+
/\ seen[t] = board /\ board < MaxB
|
|
59
|
+
/\ board' = board + 1 /\ patches' = patches + 1
|
|
60
|
+
/\ seen' = [seen EXCEPT ![t] = board + 1]
|
|
61
|
+
/\ refused' = FALSE
|
|
62
|
+
|
|
63
|
+
\* A write tag opens the row; it becomes the row's opener.
|
|
64
|
+
OpenRow(t) ==
|
|
65
|
+
/\ t \in Writers /\ phase[t] = "in" /\ opener = "none"
|
|
66
|
+
/\ BoardWrite(t)
|
|
67
|
+
/\ opener' = t
|
|
68
|
+
/\ UNCHANGED <<phase, hv, author, patchedBy, resolvedBy, conflict, hage, openAge, epiOpen, ptr, stamp, viewSeen>>
|
|
69
|
+
|
|
70
|
+
\* Only the opener may patch its row.
|
|
71
|
+
PatchOwnRow(t) ==
|
|
72
|
+
/\ t \in Writers /\ phase[t] = "in" /\ opener = t
|
|
73
|
+
/\ BoardWrite(t)
|
|
74
|
+
/\ patchedBy' = patchedBy \cup {t}
|
|
75
|
+
/\ UNCHANGED <<phase, hv, author, opener, resolvedBy, conflict, hage, openAge, epiOpen, ptr, stamp, viewSeen>>
|
|
76
|
+
|
|
77
|
+
\* Any other tag patching the row is refused (the hub too, unless it is resolving a marked conflict).
|
|
78
|
+
ForeignRowPatch(t) ==
|
|
79
|
+
/\ phase[t] = "in" /\ opener \notin {t, "none"}
|
|
80
|
+
/\ ~(t = "hub" /\ conflict)
|
|
81
|
+
/\ refused' = TRUE
|
|
82
|
+
/\ UNCHANGED <<phase, hv, author, board, seen, patches, opener, patchedBy, resolvedBy, conflict, hage, openAge, epiOpen, ptr, stamp, viewSeen>>
|
|
83
|
+
|
|
84
|
+
\* The hub resolves a marked conflict on a row it did not open; the mark clears.
|
|
85
|
+
ResolveConflict ==
|
|
86
|
+
/\ phase["hub"] = "in" /\ conflict /\ opener \notin {"hub", "none"}
|
|
87
|
+
/\ BoardWrite("hub")
|
|
88
|
+
/\ resolvedBy' = resolvedBy \cup {"hub"}
|
|
89
|
+
/\ conflict' = FALSE
|
|
90
|
+
/\ UNCHANGED <<phase, hv, author, opener, patchedBy, hage, openAge, epiOpen, ptr, stamp, viewSeen>>
|
|
91
|
+
|
|
92
|
+
\* A board write on a version that moved since this tag read it is refused; the tag re-reads.
|
|
93
|
+
StalePatch(t) ==
|
|
94
|
+
/\ t \in Writers /\ phase[t] = "in" /\ seen[t] # board
|
|
95
|
+
/\ seen' = [seen EXCEPT ![t] = board]
|
|
96
|
+
/\ refused' = TRUE
|
|
97
|
+
/\ UNCHANGED <<phase, hv, author, board, patches, opener, patchedBy, resolvedBy, conflict, hage, openAge, epiOpen, ptr, stamp, viewSeen>>
|
|
98
|
+
|
|
99
|
+
\* A write tag saves material work in an open session (B-137 shows it as "in progress").
|
|
100
|
+
SaveMaterial(t) ==
|
|
101
|
+
/\ t \in Writers /\ phase[t] = "in" /\ ~epiOpen[t]
|
|
102
|
+
/\ epiOpen' = [epiOpen EXCEPT ![t] = TRUE]
|
|
103
|
+
/\ refused' = FALSE
|
|
104
|
+
/\ UNCHANGED <<phase, hv, author, board, seen, patches, opener, patchedBy, resolvedBy, conflict, hage, openAge, ptr, stamp, viewSeen>>
|
|
105
|
+
|
|
106
|
+
\* Time passes: open sessions pass 24 hours, written handoff lines pass 7 days.
|
|
107
|
+
Tick ==
|
|
108
|
+
/\ \/ \E t \in Tags : phase[t] = "in" /\ openAge[t] = 0
|
|
109
|
+
\/ \E w \in Writers : hv[w] > 0 /\ hage[w] = 0
|
|
110
|
+
/\ openAge' = [t \in Tags |-> IF phase[t] = "in" THEN 1 ELSE openAge[t]]
|
|
111
|
+
/\ hage' = [w \in Writers |-> IF hv[w] > 0 THEN 1 ELSE hage[w]]
|
|
112
|
+
/\ refused' = FALSE
|
|
113
|
+
/\ UNCHANGED <<phase, hv, author, board, seen, patches, opener, patchedBy, resolvedBy, conflict, epiOpen, ptr, stamp, viewSeen>>
|
|
114
|
+
|
|
115
|
+
\* Wrap-up: a write tag supersedes only its own handoff, last. Its line may disagree
|
|
116
|
+
\* with the opener's on the row, which marks a conflict for the hub. Only now does the
|
|
117
|
+
\* session's material work count as a B-137 pointer (closed sessions only).
|
|
118
|
+
WrapOwn(t, disagree) ==
|
|
119
|
+
/\ t \in Writers /\ phase[t] = "in" /\ hv[t] < MaxV
|
|
120
|
+
/\ Cred(t) = DocId(t)
|
|
121
|
+
/\ hv' = [hv EXCEPT ![t] = hv[t] + 1]
|
|
122
|
+
/\ author' = [author EXCEPT ![t] = t]
|
|
123
|
+
/\ hage' = [hage EXCEPT ![t] = 0]
|
|
124
|
+
/\ phase' = [phase EXCEPT ![t] = "out"]
|
|
125
|
+
/\ ptr' = [ptr EXCEPT ![t] = IF epiOpen[t] THEN ptr[t] + 1 ELSE ptr[t]]
|
|
126
|
+
/\ epiOpen' = [epiOpen EXCEPT ![t] = FALSE]
|
|
127
|
+
/\ openAge' = [openAge EXCEPT ![t] = 0]
|
|
128
|
+
/\ conflict' = (conflict \/ (disagree /\ opener \notin {t, "none"}))
|
|
129
|
+
/\ refused' = FALSE
|
|
130
|
+
/\ UNCHANGED <<board, seen, patches, opener, patchedBy, resolvedBy, stamp, viewSeen>>
|
|
131
|
+
|
|
132
|
+
\* Any tag (bot, non-bot, or read-only) writing another tag's handoff is refused,
|
|
133
|
+
\* including a non-hub tag writing HANDOFF.md: the non-bot write gap is closed.
|
|
134
|
+
ForeignWrite(t, u) ==
|
|
135
|
+
/\ phase[t] = "in" /\ u \in Writers /\ u # t
|
|
136
|
+
/\ Cred(t) # DocId(u)
|
|
137
|
+
/\ refused' = TRUE
|
|
138
|
+
/\ UNCHANGED <<phase, hv, author, board, seen, patches, opener, patchedBy, resolvedBy, conflict, hage, openAge, epiOpen, ptr, stamp, viewSeen>>
|
|
139
|
+
|
|
140
|
+
\* A read-only tag leaves without writing anything.
|
|
141
|
+
LeaveReadOnly(t) ==
|
|
142
|
+
/\ t \in Readers /\ phase[t] = "in"
|
|
143
|
+
/\ phase' = [phase EXCEPT ![t] = "out"]
|
|
144
|
+
/\ openAge' = [openAge EXCEPT ![t] = 0]
|
|
145
|
+
/\ refused' = FALSE
|
|
146
|
+
/\ UNCHANGED <<hv, author, board, seen, patches, opener, patchedBy, resolvedBy, conflict, hage, epiOpen, ptr, stamp, viewSeen>>
|
|
147
|
+
|
|
148
|
+
Done == /\ \A w \in Writers : hv[w] = MaxV
|
|
149
|
+
/\ UNCHANGED vars
|
|
150
|
+
|
|
151
|
+
Next ==
|
|
152
|
+
\/ \E t \in Tags : Start(t)
|
|
153
|
+
\/ \E t \in Writers : OpenRow(t) \/ PatchOwnRow(t) \/ StalePatch(t) \/ SaveMaterial(t)
|
|
154
|
+
\/ \E t \in Tags : ForeignRowPatch(t)
|
|
155
|
+
\/ ResolveConflict
|
|
156
|
+
\/ Tick
|
|
157
|
+
\/ \E t \in Writers, d \in BOOLEAN : WrapOwn(t, d)
|
|
158
|
+
\/ \E t \in Tags, u \in Writers : ForeignWrite(t, u)
|
|
159
|
+
\/ \E t \in Readers : LeaveReadOnly(t)
|
|
160
|
+
\/ Done
|
|
161
|
+
|
|
162
|
+
Spec == Init /\ [][Next]_vars
|
|
163
|
+
|
|
164
|
+
TypeOK ==
|
|
165
|
+
/\ phase \in [Tags -> {"out", "in"}]
|
|
166
|
+
/\ hv \in [Writers -> 0..MaxV]
|
|
167
|
+
/\ board \in 0..MaxB
|
|
168
|
+
/\ opener \in Writers \cup {"none"}
|
|
169
|
+
/\ hage \in [Writers -> 0..1] /\ openAge \in [Tags -> 0..1]
|
|
170
|
+
|
|
171
|
+
\* Decision 4 and the closed gap: each handoff (HANDOFF.md for the hub) is written only by its own tag.
|
|
172
|
+
OwnHandoffOnly == \A w \in Writers : author[w] \in {w, "none"}
|
|
173
|
+
\* Decision 3: only the opener patches a row; the hub's only exception is resolving a marked conflict.
|
|
174
|
+
RowPatchedOnlyByOpener == patchedBy \subseteq {opener} /\ resolvedBy \subseteq {"hub"}
|
|
175
|
+
\* No board write is lost: every applied write is one board version.
|
|
176
|
+
NoLostBoardUpdate == board = patches
|
|
177
|
+
\* A read-only tag writes nothing anywhere.
|
|
178
|
+
ReadOnlyWritesNothing ==
|
|
179
|
+
/\ \A w \in Writers : author[w] \notin Readers
|
|
180
|
+
/\ opener \notin Readers /\ patchedBy \cap Readers = {}
|
|
181
|
+
\* Decision 8: every handoff id carries the person segment.
|
|
182
|
+
IdsCarryPerson == \A w \in Writers : DocId(w)[1] = Person
|
|
183
|
+
\* Decision 5: open-session work is never a pointer; it shows as in progress until close,
|
|
184
|
+
\* and a stale-open mark exists only on a session that is still open.
|
|
185
|
+
OpenWorkOnlyInProgress == \A t \in Tags : epiOpen[t] => phase[t] = "in"
|
|
186
|
+
StaleMarkOnlyWhileOpen == \A t \in Tags : openAge[t] = 1 => phase[t] = "in"
|
|
187
|
+
\* Decision 6: the view an AI read can be rebuilt from its stamp alone (versions plus as-of age).
|
|
188
|
+
StampReproducible == \A t \in Tags : phase[t] = "in" => viewSeen[t] = ViewAt(stamp[t].v, stamp[t].a)
|
|
189
|
+
\* Counter-check (expected to FAIL): a stamp of versions only is not enough, because aging moves.
|
|
190
|
+
StampVersionsOnly == \A t \in Tags : phase[t] = "in" => viewSeen[t] = ViewAt(stamp[t].v, hage)
|
|
191
|
+
====
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
SPECIFICATION Spec
|
|
2
|
+
INVARIANT TypeOK
|
|
3
|
+
INVARIANT OwnHandoffOnly
|
|
4
|
+
INVARIANT RowPatchedOnlyByOpener
|
|
5
|
+
INVARIANT NoLostBoardUpdate
|
|
6
|
+
INVARIANT ReadOnlyWritesNothing
|
|
7
|
+
INVARIANT IdsCarryPerson
|
|
8
|
+
INVARIANT OpenWorkOnlyInProgress
|
|
9
|
+
INVARIANT StaleMarkOnlyWhileOpen
|
|
10
|
+
INVARIANT StampVersionsOnly
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# PerTagHandoff
|
|
2
|
+
|
|
3
|
+
TLC reached 958,557 states, more than the chart budget of 500, so the command wrote no chart.mmd.
|
|
4
|
+
|
|
5
|
+
## Rules that hold
|
|
6
|
+
TypeOK, OwnHandoffOnly, RowPatchedOnlyByOpener, NoLostBoardUpdate, ReadOnlyWritesNothing, IdsCarryPerson, OpenWorkOnlyInProgress, StaleMarkOnlyWhileOpen, StampReproducible, NoDeadlock
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Per-tag handoffs: own handoff, opener-only rows, merged view on read"
|
|
3
|
+
---
|
|
4
|
+
stateDiagram-v2
|
|
5
|
+
state "Legend" as legend {
|
|
6
|
+
lg0: session
|
|
7
|
+
lg1: rest
|
|
8
|
+
lg2: Breaks StampVersionsOnly in some cases
|
|
9
|
+
lg3: Path to the StampVersionsOnly bug
|
|
10
|
+
}
|
|
11
|
+
class lg0 blue
|
|
12
|
+
class lg1 teal
|
|
13
|
+
class lg2 mayBreak
|
|
14
|
+
class lg3 bugPath
|
|
15
|
+
s0: No handoffs yet
|
|
16
|
+
s1: In session, merged view read
|
|
17
|
+
s2: Handoffs at rest
|
|
18
|
+
[*] --> s0
|
|
19
|
+
s0 --> s1: an AI starts, reads the merged view, and stamps it
|
|
20
|
+
s1 --> s2: a write AI writes its own handoff last
|
|
21
|
+
s2 --> s1: an AI starts, reads the merged view, and stamps it
|
|
22
|
+
s1 --> s1: time passes (24 hours open, 7 days aging)
|
|
23
|
+
classDef mayBreak fill:#fff3e6,stroke:#e8730c,stroke-width:2.5px,color:#b85a06
|
|
24
|
+
class s0 teal
|
|
25
|
+
class s0 bugPath
|
|
26
|
+
class s1 blue
|
|
27
|
+
class s1 mayBreak
|
|
28
|
+
class s1 bugPath
|
|
29
|
+
class s2 teal
|
|
30
|
+
class s2 bugPath
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# PerTagHandoff
|
|
2
|
+
|
|
3
|
+
TLC reached more states than the chart budget of 500, so the chart draws only the bug paths: 3 states and 4 arrows.
|
|
4
|
+
|
|
5
|
+
## StampVersionsOnly breaks
|
|
6
|
+
The shortest path has 4 steps:
|
|
7
|
+
0. No handoffs yet
|
|
8
|
+
1. an AI starts, reads the merged view, and stamps it: In session, merged view read
|
|
9
|
+
2. a write AI writes its own handoff last: Handoffs at rest
|
|
10
|
+
3. an AI starts, reads the merged view, and stamps it: In session, merged view read
|
|
11
|
+
4. time passes (24 hours open, 7 days aging): In session, merged view read
|
|
12
|
+
|
|
13
|
+
## Rules not checked
|
|
14
|
+
TypeOK, OwnHandoffOnly, RowPatchedOnlyByOpener, NoLostBoardUpdate, ReadOnlyWritesNothing, IdsCarryPerson, OpenWorkOnlyInProgress, StaleMarkOnlyWhileOpen, NoDeadlock
|
|
15
|
+
After the first break, each TLC run stops at 100,000 distinct states. A run reached that bound before it checked these rules in every state.
|