@optimystic/db-core 1.22.0 → 1.24.0

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.
Files changed (176) hide show
  1. package/README.md +8 -4
  2. package/dist/src/collection/action.d.ts +7 -4
  3. package/dist/src/collection/action.d.ts.map +1 -1
  4. package/dist/src/collection/action.js +13 -5
  5. package/dist/src/collection/action.js.map +1 -1
  6. package/dist/src/collection/collection.d.ts +134 -46
  7. package/dist/src/collection/collection.d.ts.map +1 -1
  8. package/dist/src/collection/collection.js +207 -70
  9. package/dist/src/collection/collection.js.map +1 -1
  10. package/dist/src/collection/struct.d.ts +38 -8
  11. package/dist/src/collection/struct.d.ts.map +1 -1
  12. package/dist/src/collection/struct.js.map +1 -1
  13. package/dist/src/collection/write-attempts.d.ts +138 -34
  14. package/dist/src/collection/write-attempts.d.ts.map +1 -1
  15. package/dist/src/collection/write-attempts.js +168 -101
  16. package/dist/src/collection/write-attempts.js.map +1 -1
  17. package/dist/src/collections/diary/diary.d.ts.map +1 -1
  18. package/dist/src/collections/diary/diary.js +5 -1
  19. package/dist/src/collections/diary/diary.js.map +1 -1
  20. package/dist/src/collections/tree/tree.d.ts +15 -9
  21. package/dist/src/collections/tree/tree.d.ts.map +1 -1
  22. package/dist/src/collections/tree/tree.js +6 -4
  23. package/dist/src/collections/tree/tree.js.map +1 -1
  24. package/dist/src/hlc/clock-store.d.ts +63 -0
  25. package/dist/src/hlc/clock-store.d.ts.map +1 -0
  26. package/dist/src/hlc/clock-store.js +49 -0
  27. package/dist/src/hlc/clock-store.js.map +1 -0
  28. package/dist/src/hlc/clock.d.ts +64 -0
  29. package/dist/src/hlc/clock.d.ts.map +1 -0
  30. package/dist/src/hlc/clock.js +171 -0
  31. package/dist/src/hlc/clock.js.map +1 -0
  32. package/dist/src/hlc/hlc.d.ts +38 -0
  33. package/dist/src/hlc/hlc.d.ts.map +1 -0
  34. package/dist/src/hlc/hlc.js +41 -0
  35. package/dist/src/hlc/hlc.js.map +1 -0
  36. package/dist/src/hlc/index.d.ts +5 -0
  37. package/dist/src/hlc/index.d.ts.map +1 -0
  38. package/dist/src/hlc/index.js +5 -0
  39. package/dist/src/hlc/index.js.map +1 -0
  40. package/dist/src/hlc/skew.d.ts +35 -0
  41. package/dist/src/hlc/skew.d.ts.map +1 -0
  42. package/dist/src/hlc/skew.js +35 -0
  43. package/dist/src/hlc/skew.js.map +1 -0
  44. package/dist/src/index.d.ts +2 -0
  45. package/dist/src/index.d.ts.map +1 -1
  46. package/dist/src/index.js +2 -0
  47. package/dist/src/index.js.map +1 -1
  48. package/dist/src/lane/index.d.ts +2 -0
  49. package/dist/src/lane/index.d.ts.map +1 -0
  50. package/dist/src/lane/index.js +2 -0
  51. package/dist/src/lane/index.js.map +1 -0
  52. package/dist/src/lane/lane.d.ts +46 -0
  53. package/dist/src/lane/lane.d.ts.map +1 -0
  54. package/dist/src/lane/lane.js +26 -0
  55. package/dist/src/lane/lane.js.map +1 -0
  56. package/dist/src/log/log.d.ts +50 -22
  57. package/dist/src/log/log.d.ts.map +1 -1
  58. package/dist/src/log/log.js +21 -13
  59. package/dist/src/log/log.js.map +1 -1
  60. package/dist/src/log/struct.d.ts +61 -1
  61. package/dist/src/log/struct.d.ts.map +1 -1
  62. package/dist/src/log/struct.js +24 -0
  63. package/dist/src/log/struct.js.map +1 -1
  64. package/dist/src/network/i-repo.d.ts +10 -0
  65. package/dist/src/network/i-repo.d.ts.map +1 -1
  66. package/dist/src/network/stale-failure.d.ts +20 -7
  67. package/dist/src/network/stale-failure.d.ts.map +1 -1
  68. package/dist/src/network/stale-failure.js +29 -7
  69. package/dist/src/network/stale-failure.js.map +1 -1
  70. package/dist/src/network/struct.d.ts +35 -0
  71. package/dist/src/network/struct.d.ts.map +1 -1
  72. package/dist/src/network/struct.js.map +1 -1
  73. package/dist/src/offline/entry.d.ts +14 -0
  74. package/dist/src/offline/entry.d.ts.map +1 -1
  75. package/dist/src/offline/entry.js +2 -0
  76. package/dist/src/offline/entry.js.map +1 -1
  77. package/dist/src/offline/journal.d.ts +10 -0
  78. package/dist/src/offline/journal.d.ts.map +1 -1
  79. package/dist/src/offline/queue.d.ts +10 -0
  80. package/dist/src/offline/queue.d.ts.map +1 -1
  81. package/dist/src/offline/queue.js +29 -3
  82. package/dist/src/offline/queue.js.map +1 -1
  83. package/dist/src/offline/status.d.ts +7 -0
  84. package/dist/src/offline/status.d.ts.map +1 -1
  85. package/dist/src/offline/status.js.map +1 -1
  86. package/dist/src/testing/test-transactor.d.ts +9 -1
  87. package/dist/src/testing/test-transactor.d.ts.map +1 -1
  88. package/dist/src/testing/test-transactor.js +6 -1
  89. package/dist/src/testing/test-transactor.js.map +1 -1
  90. package/dist/src/transaction/actions-engine.d.ts +3 -0
  91. package/dist/src/transaction/actions-engine.d.ts.map +1 -1
  92. package/dist/src/transaction/actions-engine.js +3 -0
  93. package/dist/src/transaction/actions-engine.js.map +1 -1
  94. package/dist/src/transaction/coordinator.d.ts +10 -5
  95. package/dist/src/transaction/coordinator.d.ts.map +1 -1
  96. package/dist/src/transaction/coordinator.js +197 -48
  97. package/dist/src/transaction/coordinator.js.map +1 -1
  98. package/dist/src/transaction/entry-commit.d.ts +45 -10
  99. package/dist/src/transaction/entry-commit.d.ts.map +1 -1
  100. package/dist/src/transaction/entry-commit.js +20 -7
  101. package/dist/src/transaction/entry-commit.js.map +1 -1
  102. package/dist/src/transaction/errors.d.ts +69 -1
  103. package/dist/src/transaction/errors.d.ts.map +1 -1
  104. package/dist/src/transaction/errors.js +70 -1
  105. package/dist/src/transaction/errors.js.map +1 -1
  106. package/dist/src/transaction/index.d.ts +1 -1
  107. package/dist/src/transaction/index.d.ts.map +1 -1
  108. package/dist/src/transaction/index.js +1 -1
  109. package/dist/src/transaction/index.js.map +1 -1
  110. package/dist/src/transaction/session.d.ts.map +1 -1
  111. package/dist/src/transaction/session.js +18 -5
  112. package/dist/src/transaction/session.js.map +1 -1
  113. package/dist/src/transaction/transaction.d.ts +74 -15
  114. package/dist/src/transaction/transaction.d.ts.map +1 -1
  115. package/dist/src/transaction/transaction.js +35 -15
  116. package/dist/src/transaction/transaction.js.map +1 -1
  117. package/dist/src/transaction/validator.d.ts +25 -4
  118. package/dist/src/transaction/validator.d.ts.map +1 -1
  119. package/dist/src/transaction/validator.js +45 -5
  120. package/dist/src/transaction/validator.js.map +1 -1
  121. package/dist/src/transactor/block-floors.d.ts +12 -1
  122. package/dist/src/transactor/block-floors.d.ts.map +1 -1
  123. package/dist/src/transactor/block-floors.js +14 -1
  124. package/dist/src/transactor/block-floors.js.map +1 -1
  125. package/dist/src/transactor/network-transactor.d.ts +8 -0
  126. package/dist/src/transactor/network-transactor.d.ts.map +1 -1
  127. package/dist/src/transactor/network-transactor.js +8 -4
  128. package/dist/src/transactor/network-transactor.js.map +1 -1
  129. package/dist/src/transactor/transactor-source.d.ts +11 -0
  130. package/dist/src/transactor/transactor-source.d.ts.map +1 -1
  131. package/dist/src/transactor/transactor-source.js +5 -1
  132. package/dist/src/transactor/transactor-source.js.map +1 -1
  133. package/dist/src/transactor/transactor.d.ts +8 -0
  134. package/dist/src/transactor/transactor.d.ts.map +1 -1
  135. package/dist/src/transform/cache-source.d.ts +7 -0
  136. package/dist/src/transform/cache-source.d.ts.map +1 -1
  137. package/dist/src/transform/cache-source.js +14 -18
  138. package/dist/src/transform/cache-source.js.map +1 -1
  139. package/package.json +1 -1
  140. package/src/collection/action.ts +13 -5
  141. package/src/collection/collection.ts +250 -76
  142. package/src/collection/struct.ts +38 -8
  143. package/src/collection/write-attempts.ts +213 -109
  144. package/src/collections/diary/diary.ts +5 -1
  145. package/src/collections/tree/tree.ts +18 -11
  146. package/src/hlc/clock-store.ts +68 -0
  147. package/src/hlc/clock.ts +196 -0
  148. package/src/hlc/hlc.ts +56 -0
  149. package/src/hlc/index.ts +4 -0
  150. package/src/hlc/skew.ts +55 -0
  151. package/src/index.ts +2 -0
  152. package/src/lane/index.ts +1 -0
  153. package/src/lane/lane.ts +54 -0
  154. package/src/log/log.ts +341 -310
  155. package/src/log/struct.ts +62 -1
  156. package/src/network/i-repo.ts +11 -1
  157. package/src/network/stale-failure.ts +31 -7
  158. package/src/network/struct.ts +805 -770
  159. package/src/offline/entry.ts +16 -0
  160. package/src/offline/journal.ts +10 -0
  161. package/src/offline/queue.ts +38 -4
  162. package/src/offline/status.ts +7 -0
  163. package/src/testing/test-transactor.ts +1065 -1053
  164. package/src/transaction/actions-engine.ts +3 -0
  165. package/src/transaction/coordinator.ts +229 -54
  166. package/src/transaction/entry-commit.ts +56 -14
  167. package/src/transaction/errors.ts +60 -0
  168. package/src/transaction/index.ts +1 -1
  169. package/src/transaction/session.ts +18 -5
  170. package/src/transaction/transaction.ts +90 -17
  171. package/src/transaction/validator.ts +46 -5
  172. package/src/transactor/block-floors.ts +15 -1
  173. package/src/transactor/network-transactor.ts +15 -4
  174. package/src/transactor/transactor-source.ts +15 -1
  175. package/src/transactor/transactor.ts +9 -0
  176. package/src/transform/cache-source.ts +15 -17
@@ -112,20 +112,89 @@ export class CoordinatorPartialCommitError extends Error {
112
112
  export class CoordinatorStaleLossError extends Error {
113
113
  failedCollections;
114
114
  reason;
115
+ staleAtByCollection;
115
116
  constructor(
116
117
  /** Collections that lost the race this attempt (all had their local state reverted for retry). */
117
118
  failedCollections,
118
119
  /** The underlying stale/conflict reason surfaced by the failed pend/commit phase. */
119
- reason) {
120
+ reason,
121
+ /** Per collection, the revision a responder CONFIRMED is committed under another action
122
+ * (`StaleFailure.staleAt`), for every failed collection whose refusal carried one. A collection
123
+ * refused with no confirmed number, cancelled because a sibling was refused, or refused in a
124
+ * batch whose number belongs to a sibling (see `staleAtOwner`) has no entry. Revisions are
125
+ * per-collection counters, which is why this is a map and not one number; the coordinator's
126
+ * retry loop reads each entry against its own collection's next revision (`RevisionStallWatch`). */
127
+ staleAtByCollection = new Map()) {
120
128
  // Deliberately does not assert that nothing committed: this is also the internal signal a
121
129
  // half-landed attempt retries on, and it then surfaces as a partial error's `reason`.
122
130
  super(`Multi-collection commit lost a stale race for [${failedCollections.join(', ')}]` +
123
131
  (reason ? ` — ${reason}` : ''));
124
132
  this.failedCollections = failedCollections;
125
133
  this.reason = reason;
134
+ this.staleAtByCollection = staleAtByCollection;
126
135
  this.name = 'CoordinatorStaleLossError';
127
136
  }
128
137
  }
138
+ /**
139
+ * Thrown by {@link TransactionCoordinator.commit} and {@link TransactionCoordinator.commitEntry}
140
+ * when refreshing repeatedly moved one participant nowhere at all while a responder confirmed a
141
+ * revision at or above the one that participant's next attempt would request — the client's view
142
+ * of that collection disagrees with the cluster's, and retrying would re-send the identical taken
143
+ * number. The multi-collection counterpart of `SyncRevisionStalledError`, decided by the same rule
144
+ * per participant (`RevisionStallWatch` in `packages/db-core/src/collection/write-attempts.ts`,
145
+ * `SyncOptions.maxStalledAttempts` strikes), and reported as `commit:revision-stalled`.
146
+ *
147
+ * The distinction from plain stale-loss exhaustion matters because the two failures need different
148
+ * responses: a budget spent on lost races can succeed on a later try, where this one is provably
149
+ * identical on every remaining attempt, so the caller's view of {@link collectionId} has to be
150
+ * repaired first. The coordinator deliberately does NOT adopt the confirmed revision to get past
151
+ * it, for the reason `SyncRevisionStalledError` gives.
152
+ *
153
+ * Extends {@link CoordinatorStaleLossError} so existing catches keep working and
154
+ * `classifyCommitFailure` files it as `contention`, the choice `SyncRevisionStalledError` made by
155
+ * subclassing exhaustion. Like any error escaping the retry loop after a participant was saved, it
156
+ * surfaces inside a {@link CoordinatorPartialCommitError} as its `reason`.
157
+ */
158
+ export class CoordinatorRevisionStalledError extends CoordinatorStaleLossError {
159
+ collectionId;
160
+ staleAt;
161
+ requestedRev;
162
+ heldRev;
163
+ attempts;
164
+ constructor(
165
+ /** The participant whose view is wedged. */
166
+ collectionId,
167
+ /** The confirmed revision the stall is based on: the block a responder named, and the
168
+ * revision it reported that block already committed at, under {@link collectionId}'s counter. */
169
+ staleAt,
170
+ /** The revision the participant's next attempt would have requested. */
171
+ requestedRev,
172
+ /** The revision this client holds for the participant; `undefined` for a collection that has
173
+ * committed nothing. */
174
+ heldRev,
175
+ /** Losses the commit took before stopping — attempts refused, and refresh rounds refused for a
176
+ * cause that can clear. */
177
+ attempts,
178
+ /** Every participant still to commit when the commit stopped, the wedged one included. */
179
+ failedCollections,
180
+ /** The last refusal's reason, when one was given. */
181
+ reason) {
182
+ super(failedCollections, reason, new Map([[collectionId, staleAt]]));
183
+ this.collectionId = collectionId;
184
+ this.staleAt = staleAt;
185
+ this.requestedRev = requestedRev;
186
+ this.heldRev = heldRev;
187
+ this.attempts = attempts;
188
+ // The base class's "lost a stale race" wording is deliberately NOT reused: it reads as
189
+ // ordinary contention, which is exactly the misdiagnosis this class exists to prevent.
190
+ this.message = `Multi-collection commit stopped after ${attempts} attempts: `
191
+ + `this client holds rev ${heldRev ?? 'none'} of collection ${collectionId} and would request rev ${requestedRev}, `
192
+ + `but block ${staleAt.blockId} is confirmed committed at rev ${staleAt.rev} and `
193
+ + `refreshing did not close the gap`
194
+ + (reason ? `: ${reason}` : '');
195
+ this.name = 'CoordinatorRevisionStalledError';
196
+ }
197
+ }
129
198
  /**
130
199
  * Thrown by {@link TransactionCoordinator.applyActions} and {@link TransactionCoordinator.commit}
131
200
  * (and returned as a failure result by {@link TransactionCoordinator.execute}) when a second
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/transaction/errors.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAA8B,MAAM,iBAAiB,CAAC;AAEpF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,MAAM,OAAO,6BAA8B,SAAQ,KAAK;IAiBtC;IAKA;IArBjB;;6CAEyC;IAChC,oBAAoB,CAA0B;IACvD;;yDAEqD;IAC5C,UAAU,CAAwB;IAE3C;IACC;iFAC6E;IAC7E,SAAiE;IACjE;;uCAEmC;IACnB,iBAA0C;IAC1D;;;kGAG8F;IAC9E,MAAgB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AAc;QAG1B,YAAO,GAAP,OAAO,CAAmB;QAE1B,iBAAY,GAAZ,YAAY,CAAQ;QAGpB,YAAO,GAAP,OAAO,CAAoB;QAG3B,aAAQ,GAAR,QAAQ,CAAQ;QAOhC,uFAAuF;QACvF,uFAAuF;QACvF,IAAI,CAAC,OAAO,GAAG,yCAAyC,QAAQ,aAAa;cAC1E,yBAAyB,OAAO,IAAI,MAAM,kBAAkB,YAAY,0BAA0B,YAAY,IAAI;cAClH,aAAa,OAAO,CAAC,OAAO,kCAAkC,OAAO,CAAC,GAAG,OAAO;cAChF,kCAAkC;cAClC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,iCAAiC,CAAC;IAC/C,CAAC;CACD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,OAAO,+BAAgC,SAAQ,KAAK;IAGxC;IAEA;IAJjB;IACC,kDAAkD;IAClC,WAAmB;IACnC,kCAAkC;IAClB,eAAuB;QAEvC,KAAK,CACJ,qBAAqB,eAAe,uDAAuD;YAC3F,GAAG,WAAW,6EAA6E;YAC3F,mDAAmD,WAAW,2BAA2B;YACzF,uFAAuF;YACvF,uFAAuF;YACvF,uEAAuE,CACvE,CAAC;QAXc,gBAAW,GAAX,WAAW,CAAQ;QAEnB,oBAAe,GAAf,eAAe,CAAQ;QAUvC,IAAI,CAAC,IAAI,GAAG,iCAAiC,CAAC;IAC/C,CAAC;CACD"}
@@ -4,7 +4,7 @@ export { ActionsEngine, ACTIONS_ENGINE_ID, } from './actions-engine.js';
4
4
  export { ReadDependencyCollector } from './read-dependency-collector.js';
5
5
  export { TransactionCoordinator } from './coordinator.js';
6
6
  export type { CoordinatorOptions, PendValidationMode } from './coordinator.js';
7
- export { CoordinatorConcurrentStampError, CoordinatorPartialCommitError, CoordinatorStaleLossError } from './errors.js';
7
+ export { CoordinatorConcurrentStampError, CoordinatorPartialCommitError, CoordinatorStaleLossError, CoordinatorRevisionStalledError } from './errors.js';
8
8
  export { classifyCommitFailure, isCohortUnreachableRead, refusalReason } from './commit-failure-class.js';
9
9
  export type { CommitFailureClass } from './commit-failure-class.js';
10
10
  export { transactionDurability, recordCollectionDurability } from './durability.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transaction/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACX,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,uBAAuB,EACvB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,sBAAsB,EACtB,cAAc,EACd,mBAAmB,EACnB,uBAAuB,EACvB,0BAA0B,EAC1B,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,mBAAmB,EACnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,aAAa,EACb,iBAAiB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,+BAA+B,EAAE,6BAA6B,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACxH,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1G,YAAY,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AACpF,YAAY,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAC7D,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,YAAY,EAAE,kBAAkB,EAAE,4BAA4B,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAE3G,OAAO,EACN,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,0BAA0B,EAC1B,cAAc,EACd,gBAAgB,EAChB,eAAe,GACf,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transaction/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACX,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,uBAAuB,EACvB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,sBAAsB,EACtB,cAAc,EACd,mBAAmB,EACnB,uBAAuB,EACvB,0BAA0B,EAC1B,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,mBAAmB,EACnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,aAAa,EACb,iBAAiB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,+BAA+B,EAAE,6BAA6B,EAAE,yBAAyB,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAC;AACzJ,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1G,YAAY,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AACpF,YAAY,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAC7D,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,YAAY,EAAE,kBAAkB,EAAE,4BAA4B,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAE3G,OAAO,EACN,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,0BAA0B,EAC1B,cAAc,EACd,gBAAgB,EAChB,eAAe,GACf,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC"}
@@ -2,7 +2,7 @@ export { createTransactionStamp, computeStampId, createTransactionId, createActi
2
2
  export { ActionsEngine, ACTIONS_ENGINE_ID, } from './actions-engine.js';
3
3
  export { ReadDependencyCollector } from './read-dependency-collector.js';
4
4
  export { TransactionCoordinator } from './coordinator.js';
5
- export { CoordinatorConcurrentStampError, CoordinatorPartialCommitError, CoordinatorStaleLossError } from './errors.js';
5
+ export { CoordinatorConcurrentStampError, CoordinatorPartialCommitError, CoordinatorStaleLossError, CoordinatorRevisionStalledError } from './errors.js';
6
6
  export { classifyCommitFailure, isCohortUnreachableRead, refusalReason } from './commit-failure-class.js';
7
7
  export { transactionDurability, recordCollectionDurability } from './durability.js';
8
8
  export { TransactionSession } from './session.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transaction/index.ts"],"names":[],"mappings":"AAiBA,OAAO,EACN,sBAAsB,EACtB,cAAc,EACd,mBAAmB,EACnB,uBAAuB,EACvB,0BAA0B,EAC1B,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,mBAAmB,EACnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,aAAa,EACb,iBAAiB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,EAAE,+BAA+B,EAAE,6BAA6B,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACxH,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1G,OAAO,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAGpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAGtD,OAAO,EACN,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,0BAA0B,EAC1B,cAAc,EACd,gBAAgB,EAChB,eAAe,GACf,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transaction/index.ts"],"names":[],"mappings":"AAiBA,OAAO,EACN,sBAAsB,EACtB,cAAc,EACd,mBAAmB,EACnB,uBAAuB,EACvB,0BAA0B,EAC1B,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,mBAAmB,EACnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,aAAa,EACb,iBAAiB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,s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,QAAQ,CAAC,UAAU,CAAgB;IAC3C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmB;IACzC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,UAAU,CAAS;IAE3B,OAAO;IASP;;;;;;;OAOG;WACU,MAAM,CAClB,WAAW,EAAE,sBAAsB,EACnC,MAAM,EAAE,kBAAkB,EAC1B,MAAM,GAAE,MAAgB,EACxB,UAAU,GAAE,MAAW,EACvB,KAAK,CAAC,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,iBAAiB,GACxB,OAAO,CAAC,kBAAkB,CAAC;IAW9B;;;;;;;;;OASG;IACG,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IA+C9G;;;;;;;;;OASG;IACG,MAAM,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC;IA2D7D;;;;;;;;;;OAUG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAe/B;;OAEG;IACH,UAAU,IAAI,MAAM;IAIpB;;OAEG;IACH,QAAQ,IAAI,gBAAgB;IAI5B;;OAEG;IACH,aAAa,IAAI,SAAS,MAAM,EAAE;IAIlC;;OAEG;IACH,WAAW,IAAI,OAAO;IAItB;;OAEG;IACH,YAAY,IAAI,OAAO;CAGvB"}
@@ -69,11 +69,15 @@ export class TransactionSession {
69
69
  }
70
70
  else {
71
71
  // Create a temporary transaction with just this statement for translation
72
+ // Temporary, for translation only: neither the id, the HLC nor the lane is ever read,
73
+ // since the engine translates statements here and commits nothing.
72
74
  const tempTransaction = {
73
75
  stamp: this.stamp,
74
76
  statements: [statement],
75
77
  reads: [],
76
- id: 'temp' // Temporary ID for translation only
78
+ hlc: this.coordinator.clock.now(),
79
+ lane: 'serializable',
80
+ id: 'temp'
77
81
  };
78
82
  const result = await this.engine.execute(tempTransaction);
79
83
  if (!result.success || !result.actions) {
@@ -116,20 +120,29 @@ export class TransactionSession {
116
120
  }
117
121
  // Collect read dependencies from all participating collections
118
122
  const reads = this.coordinator.getReadDependencies();
123
+ // The HLC is minted AFTER the read set is final, so it sits above every HLC a read of this
124
+ // transaction observed (see Transaction.hlc), and once per transaction: the coordinator's
125
+ // retries re-send this same object.
126
+ const hlc = this.coordinator.clock.now();
127
+ // The lane is the caller's classification of the whole transaction (`SyncOptions.lane`, one
128
+ // lane over every participant), and `serializable` for an engine that declared nothing.
129
+ const lane = options?.lane ?? 'serializable';
119
130
  // Create the complete transaction
120
131
  const transaction = {
121
132
  stamp: this.stamp,
122
133
  statements: this.statements,
123
134
  reads,
124
- id: await createTransactionId(this.stamp.id, this.statements, reads)
135
+ hlc,
136
+ lane,
137
+ id: await createTransactionId(this.stamp.id, this.statements, reads, hlc, lane)
125
138
  };
126
- // Sign the canonical client-signature payload if a signer was supplied. The
127
- // payload covers stamp.id + statements + reads, which are all final now. A signer failure
139
+ // Sign the canonical client-signature payload if a signer was supplied. The payload covers
140
+ // stamp.id + statements + reads + hlc + lane, which are all final now. A signer failure
128
141
  // (e.g. a wrong-key-type libp2p sign) is caught and surfaced as a clean commit failure BEFORE
129
142
  // coordinator.commit runs — the transaction object is local and discarded, so a failed sign can
130
143
  // never leak a partially-built unsigned transaction into consensus.
131
144
  if (this.signer) {
132
- const payload = clientSignaturePayload(this.stamp.id, this.statements, reads);
145
+ const payload = clientSignaturePayload(this.stamp.id, this.statements, reads, hlc, lane);
133
146
  try {
134
147
  transaction.signature = await this.signer(payload);
135
148
  }
@@ -1 +1 @@
1
- {"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/transaction/session.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE7H;;;;;;;;;;;;;;;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C,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,WAAW,CAAC,qBAAqB,EAAE,CAAC;QACzC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,UAAU;QACT,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,QAAQ;QACP,OAAO,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,aAAa;QACZ,OAAO,IAAI,CAAC,UAAU,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,WAAW;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,YAAY;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACxB,CAAC;CACD"}
@@ -1,6 +1,8 @@
1
1
  import type { BlockId } from "../blocks/index.js";
2
2
  import type { CollectionId } from "../collection/index.js";
3
3
  import type { TransactionDurability } from "./durability.js";
4
+ import type { Hlc } from "../hlc/hlc.js";
5
+ import type { Lane } from "../lane/lane.js";
4
6
  /**
5
7
  * Transaction Stamp: Created at BEGIN, stable throughout transaction lifecycle.
6
8
  *
@@ -48,13 +50,44 @@ export type Transaction = {
48
50
  statements: string[];
49
51
  /** Read dependencies for optimistic concurrency control */
50
52
  reads: ReadDependency[];
51
- /** Transaction identifier (hash of stamp.id + statements + reads)
53
+ /**
54
+ * The transaction's hybrid logical clock value (docs/crdt-sync.md §Migration Path, Stage 1):
55
+ * minted at COMMIT, after the read set is final, from the committing transactor's clock
56
+ * (`clockOf(transactor).now()`), and stamped on every participant's log entry (`LogEntry.hlc`,
57
+ * through `WriteContext.hlc`). On the transaction rather than the stamp because the stamp is
58
+ * fixed at BEGIN, before any of the transaction's reads, and an HLC minted then could sit below
59
+ * one a later read observed — the causal rule the HLC exists to keep. Folded into {@link id} and
60
+ * into the client signature ({@link clientSignaturePayload}), so a relaying peer cannot alter
61
+ * it; excluded from nothing else. Fixed per transaction: a retry of the same `Transaction` object
62
+ * re-sends it, like `stamp.timestamp`.
63
+ *
64
+ * Required of every transaction this build builds; a validator meeting one from an older build
65
+ * on the wire tolerates its absence at that one ingress (`TransactionValidator.validate`).
66
+ */
67
+ hlc: Hlc;
68
+ /**
69
+ * The transaction's lane (`Lane` in `packages/db-core/src/lane/lane.ts`): whether its conflicts
70
+ * with other machines' concurrent writes are the quorum's to decide (`serializable`) or may be
71
+ * merged later under each collection's declaration (`convergent`). ONE lane for every
72
+ * participant: a transaction over several collections takes the stricter of its parts, decided by
73
+ * the caller before the transaction is built (`TransactionSession.commit` takes it from
74
+ * `SyncOptions.lane`, `serializable` when the engine declared nothing), and stamped on every
75
+ * participant's log entry (`ActionEntry.lane`, through `WriteContext.lane`) and on every pend and
76
+ * commit of it. Folded into {@link id} and into the client signature
77
+ * ({@link clientSignaturePayload}), so a relaying peer cannot alter it. Nothing admits by it yet.
78
+ *
79
+ * Required of every transaction this build builds; a validator meeting one from an older build
80
+ * on the wire tolerates its absence at that one ingress as `serializable`
81
+ * (`TransactionValidator.validate`), every write then having been serializable.
82
+ */
83
+ lane: Lane;
84
+ /** Transaction identifier (hash of stamp.id + statements + reads + hlc + lane)
52
85
  * Final transaction identity, used in logs
53
86
  */
54
87
  id: string;
55
88
  /**
56
89
  * Optional client signature (base64url) over {@link clientSignaturePayload}
57
- * `(stamp.id, statements, reads)`, produced at commit by an injected
90
+ * `(stamp.id, statements, reads, hlc, lane)`, produced at commit by an injected
58
91
  * {@link TransactionSigner}.
59
92
  *
60
93
  * A node that wires a {@link ClientSignatureVerifier} into its
@@ -166,8 +199,9 @@ export declare function computeStampId(fields: StampFields): Promise<string>;
166
199
  */
167
200
  export declare function createTransactionStamp(peerId: string, timestamp: number, schemaHash: string, engineId: string, ttlMs?: number): Promise<TransactionStamp>;
168
201
  /**
169
- * Create a transaction id from stamp id, statements, and reads.
170
- * This is the final transaction identity used in logs.
202
+ * Create a transaction id from stamp id, statements, reads, the transaction's HLC and its lane.
203
+ * This is the final transaction identity used in logs, and the action id the log records, so two
204
+ * transactions that differ only in when they committed, or in the lane they claim, differ in id.
171
205
  *
172
206
  * NOTE: reads are serialized in their given order here (non-canonical). This differs
173
207
  * from {@link clientSignaturePayload}, which canonicalises reads before hashing. That is
@@ -176,31 +210,44 @@ export declare function createTransactionStamp(peerId: string, timestamp: number
176
210
  * design-consensus-hygiene-notes), NOT fixed here to avoid changing existing tx ids.
177
211
  *
178
212
  * NOTE: {@link Transaction.priority} is deliberately absent from this preimage — the id is a pure
179
- * function of `(stampId, statements, reads)`, so two retry attempts that differ only in aged
180
- * priority produce the SAME id. Do not add priority here.
213
+ * function of `(stampId, statements, reads, hlc, lane)`, so two retry attempts that differ only in
214
+ * aged priority produce the SAME id. Do not add priority here.
181
215
  */
182
- export declare function createTransactionId(stampId: string, statements: string[], reads: ReadDependency[]): Promise<string>;
216
+ export declare function createTransactionId(stampId: string, statements: string[], reads: ReadDependency[], hlc: Hlc, lane: Lane): Promise<string>;
183
217
  /**
184
218
  * Version prefix for the client-signature payload, so the signed form can evolve
185
219
  * without ambiguity. Distinct from (but consistent in spirit with) the operations-hash
186
220
  * canonical form — this covers transaction INPUTS, not operations.
221
+ *
222
+ * `v2` added the transaction's HLC to the signed bytes, and `v3` its lane. Mixed-version cost, the
223
+ * same for both bumps: a writer on an earlier build signs the old payload, and a verifier on this
224
+ * build reports `Invalid client signature` against it. Accepted on the precedent the validity marker
225
+ * set (docs/internals.md, *A reject that judges the transaction itself wrong*), because no deployment
226
+ * wires a `ClientSignatureVerifier` today (backlog `feat-no-deployment-validates-transactions-at-pend`),
227
+ * and because the question "can a relaying peer alter the HLC, or the lane a write claims" is best
228
+ * settled while nothing verifies.
187
229
  */
188
- export declare const CLIENT_SIG_VERSION = "txsig:v1";
230
+ export declare const CLIENT_SIG_VERSION = "txsig:v3";
189
231
  /**
190
232
  * Canonical bytes a client signs and a node verifies. Deterministic: reads are sorted
191
- * (blockId, then revision); statements keep their sequential order.
233
+ * (blockId, then revision); statements keep their sequential order; the HLC's three fields are
234
+ * written in a fixed order; the lane is one of two literal strings.
192
235
  *
193
- * Binds three things at once: the CLIENT IDENTITY (via `stampId`, which hashes peerId +
194
- * nonce), the EXACT statements, and the OCC read set (blockId + revision — "tail
195
- * binding" for anti-replay). Both signer and verifier derive the bytes from
196
- * `transaction.stamp.id` + `transaction.statements` + `transaction.reads` through this
197
- * one function, so they reproduce identical bytes regardless of read ordering.
236
+ * Binds five things at once: the CLIENT IDENTITY (via `stampId`, which hashes peerId +
237
+ * nonce), the EXACT statements, the OCC read set (blockId + revision — "tail
238
+ * binding" for anti-replay), the transaction's HLC, which validators order by in a later
239
+ * stage and a relaying peer must therefore not be able to alter, and the lane the writer claims,
240
+ * which a member checks against the collections' declarations in a later stage and a relaying peer
241
+ * must not be able to loosen. Both signer and verifier derive the bytes from
242
+ * `transaction.stamp.id` + `transaction.statements` + `transaction.reads` + `transaction.hlc` +
243
+ * `transaction.lane` through this one function, so they reproduce identical bytes regardless of
244
+ * read ordering.
198
245
  *
199
246
  * NOTE: {@link Transaction.priority} is deliberately absent from the signed bytes — a retry that
200
247
  * only bumps priority keeps the same signature, so anti-replay / OCC binding never churns. Do not
201
248
  * add priority here.
202
249
  */
203
- export declare function clientSignaturePayload(stampId: string, statements: readonly string[], reads: readonly ReadDependency[]): Uint8Array;
250
+ export declare function clientSignaturePayload(stampId: string, statements: readonly string[], reads: readonly ReadDependency[], hlc: Hlc, lane: Lane): Uint8Array;
204
251
  /**
205
252
  * Signs the canonical client-signature payload, returning base64url. Async to allow
206
253
  * libp2p `PrivateKey.sign`; tests pass a synchronous fake.
@@ -266,6 +313,17 @@ export interface ITransactionEngine {
266
313
  * @returns The resulting actions from execution
267
314
  */
268
315
  execute(transaction: Transaction): Promise<ExecutionResult>;
316
+ /**
317
+ * The strictest lane this engine's catalog allows the transaction's statements: `serializable`
318
+ * when any statement's write must be ordered by the quorum, else `convergent`. What a
319
+ * {@link TransactionValidator} checks a `convergent` claim against (docs/transactions.md §Which
320
+ * lane a transaction takes), so it must be computable identically by every machine whose schema
321
+ * hash matches the writer's, from the statements as replicated — never from what only the writer
322
+ * saw (a key's provenance, a value read). Omitted by an engine with no catalog to classify against
323
+ * ({@link ActionsEngine}), whose transactions' lanes a validator then accepts unchecked; a throw
324
+ * means this node could not judge.
325
+ */
326
+ laneCeiling?(transaction: Transaction): Promise<Lane>;
269
327
  }
270
328
  /**
271
329
  * Result of transaction execution.
@@ -380,6 +438,7 @@ export interface ITransactionValidator {
380
438
  * 0.5. Verify the client signature (only if a signature verifier is wired)
381
439
  * 1. Verify stamp.engineId matches a known engine
382
440
  * 2. Verify stamp.schemaHash matches local schema
441
+ * 2.5. Verify a `convergent` lane claim against the engine's ceiling (only if the engine offers one)
383
442
  * 3. Verify read dependencies (no stale reads)
384
443
  * 4. Re-execute transaction.statements through engine (isolated state)
385
444
  * 5. Collect operations from re-execution
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../src/transaction/transaction.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAG7D;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC9B,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;IAEf,0DAA0D;IAC1D,SAAS,EAAE,MAAM,CAAC;IAElB,+CAA+C;IAC/C,UAAU,EAAE,MAAM,CAAC;IAEnB,4DAA4D;IAC5D,QAAQ,EAAE,MAAM,CAAC;IAEjB,2DAA2D;IAC3D,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;;;;OAQG;IACH,KAAK,EAAE,MAAM,CA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IAC3F,iBAAiB,CAAC,EAAE,YAAY,EAAE,CAAC;IACnC;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,qBAAqB,CAAC;CACnC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC/B,4BAA4B;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,OAAO,EAAE,OAAO,EAAE,CAAC;CACnB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,iBAAiB,EAAE,GAAG,MAAM,EAAE,CAElF;AAED;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC9B,WAAW,EAAE,iBAAiB,EAAE,CAAC;CACjC,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC/B,oGAAoG;IACpG,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC9B,mCAAmC;IACnC,KAAK,EAAE,OAAO,CAAC;IACf,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qGAAqG;IACrG,QAAQ,CAAC,EAAE,iBAAiB,CAAC;CAC7B,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,WAAW,qBAAqB;IACrC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,QAAQ,CAAC,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAEtF;;;;;;OAMG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CAC7D"}
@@ -89,8 +89,9 @@ export async function createTransactionStamp(peerId, timestamp, schemaHash, engi
89
89
  return { peerId, timestamp, schemaHash, engineId, expiration, nonce, id };
90
90
  }
91
91
  /**
92
- * Create a transaction id from stamp id, statements, and reads.
93
- * This is the final transaction identity used in logs.
92
+ * Create a transaction id from stamp id, statements, reads, the transaction's HLC and its lane.
93
+ * This is the final transaction identity used in logs, and the action id the log records, so two
94
+ * transactions that differ only in when they committed, or in the lane they claim, differ in id.
94
95
  *
95
96
  * NOTE: reads are serialized in their given order here (non-canonical). This differs
96
97
  * from {@link clientSignaturePayload}, which canonicalises reads before hashing. That is
@@ -99,39 +100,58 @@ export async function createTransactionStamp(peerId, timestamp, schemaHash, engi
99
100
  * design-consensus-hygiene-notes), NOT fixed here to avoid changing existing tx ids.
100
101
  *
101
102
  * NOTE: {@link Transaction.priority} is deliberately absent from this preimage — the id is a pure
102
- * function of `(stampId, statements, reads)`, so two retry attempts that differ only in aged
103
- * priority produce the SAME id. Do not add priority here.
103
+ * function of `(stampId, statements, reads, hlc, lane)`, so two retry attempts that differ only in
104
+ * aged priority produce the SAME id. Do not add priority here.
104
105
  */
105
- export async function createTransactionId(stampId, statements, reads) {
106
- const txData = JSON.stringify({ stampId, statements, reads });
106
+ export async function createTransactionId(stampId, statements, reads, hlc, lane) {
107
+ const txData = JSON.stringify({ stampId, statements, reads, hlc: canonicalHlc(hlc), lane });
107
108
  return `tx:${await hashString(txData)}`;
108
109
  }
109
110
  /**
110
111
  * Version prefix for the client-signature payload, so the signed form can evolve
111
112
  * without ambiguity. Distinct from (but consistent in spirit with) the operations-hash
112
113
  * canonical form — this covers transaction INPUTS, not operations.
114
+ *
115
+ * `v2` added the transaction's HLC to the signed bytes, and `v3` its lane. Mixed-version cost, the
116
+ * same for both bumps: a writer on an earlier build signs the old payload, and a verifier on this
117
+ * build reports `Invalid client signature` against it. Accepted on the precedent the validity marker
118
+ * set (docs/internals.md, *A reject that judges the transaction itself wrong*), because no deployment
119
+ * wires a `ClientSignatureVerifier` today (backlog `feat-no-deployment-validates-transactions-at-pend`),
120
+ * and because the question "can a relaying peer alter the HLC, or the lane a write claims" is best
121
+ * settled while nothing verifies.
113
122
  */
114
- export const CLIENT_SIG_VERSION = 'txsig:v1';
123
+ export const CLIENT_SIG_VERSION = 'txsig:v3';
115
124
  /**
116
125
  * Canonical bytes a client signs and a node verifies. Deterministic: reads are sorted
117
- * (blockId, then revision); statements keep their sequential order.
126
+ * (blockId, then revision); statements keep their sequential order; the HLC's three fields are
127
+ * written in a fixed order; the lane is one of two literal strings.
118
128
  *
119
- * Binds three things at once: the CLIENT IDENTITY (via `stampId`, which hashes peerId +
120
- * nonce), the EXACT statements, and the OCC read set (blockId + revision — "tail
121
- * binding" for anti-replay). Both signer and verifier derive the bytes from
122
- * `transaction.stamp.id` + `transaction.statements` + `transaction.reads` through this
123
- * one function, so they reproduce identical bytes regardless of read ordering.
129
+ * Binds five things at once: the CLIENT IDENTITY (via `stampId`, which hashes peerId +
130
+ * nonce), the EXACT statements, the OCC read set (blockId + revision — "tail
131
+ * binding" for anti-replay), the transaction's HLC, which validators order by in a later
132
+ * stage and a relaying peer must therefore not be able to alter, and the lane the writer claims,
133
+ * which a member checks against the collections' declarations in a later stage and a relaying peer
134
+ * must not be able to loosen. Both signer and verifier derive the bytes from
135
+ * `transaction.stamp.id` + `transaction.statements` + `transaction.reads` + `transaction.hlc` +
136
+ * `transaction.lane` through this one function, so they reproduce identical bytes regardless of
137
+ * read ordering.
124
138
  *
125
139
  * NOTE: {@link Transaction.priority} is deliberately absent from the signed bytes — a retry that
126
140
  * only bumps priority keeps the same signature, so anti-replay / OCC binding never churns. Do not
127
141
  * add priority here.
128
142
  */
129
- export function clientSignaturePayload(stampId, statements, reads) {
143
+ export function clientSignaturePayload(stampId, statements, reads, hlc, lane) {
130
144
  const canonicalReads = [...reads].sort((a, b) => a.blockId < b.blockId ? -1 : a.blockId > b.blockId ? 1
131
145
  : a.revision - b.revision);
132
- const body = JSON.stringify({ stampId, statements, reads: canonicalReads });
146
+ const body = JSON.stringify({ stampId, statements, reads: canonicalReads, hlc: canonicalHlc(hlc), lane });
133
147
  return new TextEncoder().encode(`${CLIENT_SIG_VERSION}:${body}`);
134
148
  }
149
+ /** The HLC's three fields in one fixed key order, so the two preimages above do not depend on the
150
+ * key order of whatever object carried the value — a JSON round trip preserves order, but a value
151
+ * rebuilt by hand need not. */
152
+ function canonicalHlc(hlc) {
153
+ return { wallMs: hlc.wallMs, logical: hlc.logical, nodeId: hlc.nodeId };
154
+ }
135
155
  /**
136
156
  * Helper to create an actions-based transaction statements array.
137
157
  * Each CollectionActions becomes a separate JSON-encoded statement.
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../src/transaction/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,QAAQ,IAAI,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAIvE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAuHvD,qEAAqE;AACrE,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC;AAE7B;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,QAA4B;IACzD,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;QAC7E,OAAO,CAAC,CAAC;IACV,CAAC;IACD,kGAAkG;IAClG,gFAAgF;IAChF,IAAI,QAAQ,IAAI,WAAW,EAAE,CAAC;QAC7B,OAAO,WAAW,CAAC;IACpB,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAC7B,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAErC,qDAAqD;AACrD,MAAM,UAAU,oBAAoB,CAAC,KAAuB;IAC3D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AAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC/D,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAC1B,CAAC;IACF,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,YAAY,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1G,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,GAAG,kBAAkB,IAAI,IAAI,EAAE,CAAC,CAAC;AAClE,CAAC;AAED;;+BAE+B;AAC/B,SAAS,YAAY,CAAC,GAAQ;IAC7B,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC;AACzE,CAAC;AA2ID;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,WAAgC;IACvE,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAChD,CAAC"}
@@ -34,11 +34,12 @@ export type BlockStateProvider = (blockId: BlockId) => Promise<BlockActionState
34
34
  * Used by cluster participants when receiving PendRequests.
35
35
  *
36
36
  * Every refusal is classed, because a writer and the dispute path act on the class and must never
37
- * read the prose to find it. Five refusals judge the transaction itself wrong and carry
37
+ * read the prose to find it. Six refusals judge the transaction itself wrong and carry
38
38
  * `validity` ({@link validityRefusal}): a tampered stamp, a missing or invalid client signature, a
39
- * failed re-execution, and an operations-hash mismatch. The rest carry none: an expired stamp (a
40
- * clock judgement), a stale read (out of date — a re-read can win), and an unknown engine, a schema
41
- * mismatch or an operations-hash format this node does not produce (this node cannot judge).
39
+ * lane mismatch, a failed re-execution, and an operations-hash mismatch. The rest carry none: an
40
+ * expired stamp (a clock judgement), a stale read (out of date — a re-read can win), and an unknown
41
+ * engine, a schema mismatch or an operations-hash format this node does not produce (this node
42
+ * cannot judge).
42
43
  */
43
44
  export declare class TransactionValidator implements ITransactionValidator {
44
45
  private readonly engines;
@@ -47,6 +48,26 @@ export declare class TransactionValidator implements ITransactionValidator {
47
48
  private readonly verifyClientSignature?;
48
49
  constructor(engines: Map<string, EngineRegistration>, createValidationCoordinator: ValidationCoordinatorFactory, blockStateProvider?: BlockStateProvider | undefined, verifyClientSignature?: ClientSignatureVerifier | undefined);
49
50
  validate(transaction: Transaction, operationsHash: string): Promise<ValidationResult>;
51
+ /**
52
+ * Whether `transaction` claims `convergent` where this node's engine computes `serializable`
53
+ * (docs/transactions.md §Which lane a transaction takes). The classification is the writer's
54
+ * engine's; this node never reclassifies, it only refuses a claim it can disprove. Only a
55
+ * `convergent` claim is checked, since `serializable` is always acceptable; an absent lane (a
56
+ * writer on a build before the field) is `serializable`; an engine without `laneCeiling` is not
57
+ * asked. A throw out of the engine propagates: the node could not judge, which the pend check in
58
+ * db-p2p turns into an unmarked `validator-fault` reject.
59
+ *
60
+ * The bound of the check: the ceiling is what every machine with the writer's schema computes
61
+ * from the replicated statements alone, and an honest writer's lane is at or below it. What only
62
+ * the writer saw is not in the replicated statements — a key's provenance, a value it read, and
63
+ * for Quereus's rebuilt statements which columns an UPDATE assigned — so a writer that lies about
64
+ * those passes here; the replay stage's guards are what catch that, at merge time.
65
+ *
66
+ * NOTE: no deployment validates at pend today (backlog
67
+ * `feat-no-deployment-validates-transactions-at-pend`), so this runs only where a validator is
68
+ * wired by hand — db-p2p's mesh specs and unit tests.
69
+ */
70
+ private claimsLaneAboveCeiling;
50
71
  getSchemaHash(engineId: string): Promise<string | undefined>;
51
72
  }
52
73
  //# sourceMappingURL=validator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../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