@chaos-overlords/kernel 0.9.6 → 0.9.8
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/LICENSE +21 -674
- package/NOTICE +9 -12
- package/README.md +1 -1
- package/dist/domain/entities.d.ts +13 -0
- package/dist/domain/entities.d.ts.map +1 -1
- package/dist/domain/entities.js.map +1 -1
- package/dist/logic/canonical-json.js +28 -11
- package/dist/logic/canonical-json.js.map +1 -1
- package/dist/ports/storage.d.ts +75 -8
- package/dist/ports/storage.d.ts.map +1 -1
- package/dist/services/EventPublisher.d.ts +11 -0
- package/dist/services/EventPublisher.d.ts.map +1 -1
- package/dist/services/EventPublisher.js +19 -1
- package/dist/services/EventPublisher.js.map +1 -1
- package/dist/services/LobbyService.d.ts.map +1 -1
- package/dist/services/LobbyService.js +5 -1
- package/dist/services/LobbyService.js.map +1 -1
- package/dist/services/SnapshotService.d.ts +16 -5
- package/dist/services/SnapshotService.d.ts.map +1 -1
- package/dist/services/SnapshotService.js +26 -7
- package/dist/services/SnapshotService.js.map +1 -1
- package/dist/services/TurnService.d.ts +47 -2
- package/dist/services/TurnService.d.ts.map +1 -1
- package/dist/services/TurnService.js +256 -76
- package/dist/services/TurnService.js.map +1 -1
- package/dist/testing/InMemoryStorage.d.ts +2 -0
- package/dist/testing/InMemoryStorage.d.ts.map +1 -1
- package/dist/testing/InMemoryStorage.js +87 -8
- package/dist/testing/InMemoryStorage.js.map +1 -1
- package/package.json +3 -3
|
@@ -103,12 +103,16 @@ export class SnapshotService {
|
|
|
103
103
|
* The merge is judged before anything is written: a refusal after the row landed would leave a
|
|
104
104
|
* stored snapshot the caller was told was rejected, with no `snapshot.available` and no verdict.
|
|
105
105
|
* Re-running the settings schema over the merge is what holds the blob to its cap, which is why
|
|
106
|
-
* every upload path comes through here before its write.
|
|
106
|
+
* every upload path comes through here before its write. It is judged once, against the blob as
|
|
107
|
+
* it is stored now rather than the copy read when the request was authenticated, and the write
|
|
108
|
+
* after the row only merges what was judged.
|
|
107
109
|
*/
|
|
108
110
|
async store(match, uploadedByPlayerId, request) {
|
|
109
|
-
const
|
|
111
|
+
const current = await this.deps.storage.matches.get(match.id);
|
|
112
|
+
if (current)
|
|
113
|
+
mergeSeatSummaries(current.settings.gameSettings, request.seatSummaries);
|
|
110
114
|
await this.deps.storage.snapshots.put(this.snapshotOf(match, uploadedByPlayerId, request));
|
|
111
|
-
await this.
|
|
115
|
+
await this.writeSeatSummaries(match.id, request.seatSummaries);
|
|
112
116
|
await this.pruneOldSnapshots(match.id);
|
|
113
117
|
}
|
|
114
118
|
snapshotOf(match, uploadedByPlayerId, request) {
|
|
@@ -128,9 +132,9 @@ export class SnapshotService {
|
|
|
128
132
|
* Late-join hints are optional metadata; the snapshot the players are waiting on is not. A
|
|
129
133
|
* transient failure of this write is logged and never fails the upload that already succeeded.
|
|
130
134
|
*/
|
|
131
|
-
async
|
|
135
|
+
async writeSeatSummaries(matchId, seatSummaries) {
|
|
132
136
|
try {
|
|
133
|
-
await this.deps.storage.matches.
|
|
137
|
+
await this.deps.storage.matches.updateSeatSummaries(matchId, seatSummaries, this.deps.clock.now());
|
|
134
138
|
}
|
|
135
139
|
catch (error) {
|
|
136
140
|
this.deps.logger.warn('could not publish seat summaries', { matchId, error: String(error) });
|
|
@@ -218,9 +222,24 @@ export class SnapshotService {
|
|
|
218
222
|
}
|
|
219
223
|
}
|
|
220
224
|
/**
|
|
221
|
-
*
|
|
225
|
+
* Write the host's seat summaries into the match's stored `gameSettings`.
|
|
222
226
|
*
|
|
223
|
-
*
|
|
227
|
+
* Only the summaries are written, and the storage merges them into the blob as it stands when the
|
|
228
|
+
* statement runs. The whole blob used to be replaced with the caller's copy, which was the one read
|
|
229
|
+
* when the request was authenticated — a report and an upload in flight together each put back the
|
|
230
|
+
* settings they started from. The cap is judged against the blob as it is now, for the same reason.
|
|
231
|
+
*/
|
|
232
|
+
export async function publishSeatSummaries(deps, matchId, seatSummaries) {
|
|
233
|
+
const current = await deps.storage.matches.get(matchId);
|
|
234
|
+
if (!current)
|
|
235
|
+
return;
|
|
236
|
+
mergeSeatSummaries(current.settings.gameSettings, [...seatSummaries]);
|
|
237
|
+
await deps.storage.matches.updateSeatSummaries(matchId, seatSummaries, deps.clock.now());
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* The settings blob with the seat summaries merged in, or a refusal when it would not fit.
|
|
241
|
+
*
|
|
242
|
+
* `createMatch` holds `gameSettings` to 8 KiB and to a nesting depth; the summaries go in through
|
|
224
243
|
* `json_set` and would otherwise skip both, which would make the merge a way around a cap that is
|
|
225
244
|
* there because the blob is served on every match read and in every public listing. Re-running the
|
|
226
245
|
* schema over the merged object is what keeps the blob's cap the blob's cap. The array itself is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SnapshotService.js","sourceRoot":"","sources":["../../src/services/SnapshotService.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"SnapshotService.js","sourceRoot":"","sources":["../../src/services/SnapshotService.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,kBAAkB,GAGnB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEnC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAC/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAI7D,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAG7E;;;GAGG;AACH,MAAM,wBAAwB,GAAG,CAAC,CAAA;AAElC;;;;GAIG;AACH,MAAM,OAAO,eAAe;IAEP,IAAI;IACJ,SAAS;IACT,KAAK;IAHxB,YACmB,IAAgB,EAChB,SAAyB,EACzB,KAAkB;oBAFlB,IAAI;yBACJ,SAAS;qBACT,KAAK;IACrB,CAAC;IAEJ,KAAK,CAAC,MAAM,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AkB;IAChC,OAAO;QACL,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,aAAa,EAAE,QAAQ,CAAC,aAAa;QACrC,eAAe,EAAE,QAAQ,CAAC,eAAe;QACzC,cAAc,EAAE,QAAQ,CAAC,cAAc;QACvC,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,kBAAkB,EAAE,QAAQ,CAAC,kBAAkB;QAC/C,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,WAAW,EAAE;QAC7C,IAAI,EAAE,QAAQ,CAAC,IAAI;KACpB,CAAA;AACH,CAAC"}
|
|
@@ -101,6 +101,13 @@ export declare class TurnService {
|
|
|
101
101
|
* announce it, and open the next turn. Each step is conditional on its own predecessor, so a call
|
|
102
102
|
* on a turn that is already complete changes nothing and a call on one that stopped halfway
|
|
103
103
|
* finishes it. Orders are immutable from the CAS onwards, so the digest it derives is stable.
|
|
104
|
+
*
|
|
105
|
+
* The announcement is made by every caller that gets this far, not only by the one that froze
|
|
106
|
+
* the set, and it is keyed (`publishOnce`) so the log carries it once. The freeze's winner used to
|
|
107
|
+
* be the only publisher, so an append that threw after the freeze lost `turn.sealed` for good:
|
|
108
|
+
* the sweep found the stalled seal, saw the set frozen, opened the successor without announcing
|
|
109
|
+
* the seal, and every client waited on it forever. Announcing before `openTurn` also makes an
|
|
110
|
+
* open successor proof that its predecessor's seal is in the log, whichever caller opened it.
|
|
104
111
|
*/
|
|
105
112
|
private completeSeal;
|
|
106
113
|
/**
|
|
@@ -174,13 +181,51 @@ export declare class TurnService {
|
|
|
174
181
|
private announceDeadline;
|
|
175
182
|
/** Re-run the verdict of every unconfirmed turn and the auto-seal of the open one. */
|
|
176
183
|
reevaluate(matchId: string): Promise<void>;
|
|
177
|
-
/**
|
|
178
|
-
|
|
184
|
+
/**
|
|
185
|
+
* Decide turn `number` from the reports on file. Idempotent and race-safe through CAS. Returns
|
|
186
|
+
* whether this call finished anything a confirmation cut short (see `finishConfirmation`), which
|
|
187
|
+
* is what the sweep reports as a repair.
|
|
188
|
+
*/
|
|
189
|
+
settle(matchId: string, number: number): Promise<boolean>;
|
|
190
|
+
/**
|
|
191
|
+
* Tell clients a match is paused, unless the log's last word on its status already says so.
|
|
192
|
+
*
|
|
193
|
+
* The pause is one fact however many turns diverge behind it, and the turn whose verdict paused
|
|
194
|
+
* the match cannot be told from the others once that verdict is cut short, so the owed
|
|
195
|
+
* announcement is judged from the log rather than from the verdict. Only a match that is still
|
|
196
|
+
* paused is announced as paused; a pause lifted while this ran is announced as lifted as well,
|
|
197
|
+
* since the lift saw no pause to announce and so said nothing.
|
|
198
|
+
*/
|
|
199
|
+
private announcePause;
|
|
200
|
+
/**
|
|
201
|
+
* Log `match.statusChanged` for a pause or its lift when it is owed: a pause when the last status
|
|
202
|
+
* announced is anything but a pause, a lift only when it is the pause (a match never paused, or
|
|
203
|
+
* whose pause was never announced, has nothing to lift in any client's eyes). Keyed by the status
|
|
204
|
+
* event it follows, so racing callers who read the same last word log the change once. Returns
|
|
205
|
+
* whether this call logged it.
|
|
206
|
+
*/
|
|
207
|
+
private announceStatus;
|
|
208
|
+
/**
|
|
209
|
+
* Everything a confirmation owes after its compare-and-swap: announce it, lift a desync pause it
|
|
210
|
+
* ends, finish a match it completes, then stamp `settledAt`. Every step is conditional on its own
|
|
211
|
+
* state or keyed in the log, so a repeat — by the sweep, over a verdict cut short — finishes what
|
|
212
|
+
* the first attempt left and duplicates nothing. Returns whether this call logged or changed
|
|
213
|
+
* anything, which for a repeat means it found work the first attempt left.
|
|
214
|
+
*/
|
|
215
|
+
private finishConfirmation;
|
|
179
216
|
/**
|
|
180
217
|
* Lift a desync pause once nothing is unsettled. Orders were refused for the whole pause while
|
|
181
218
|
* the open turn's deadline kept running, so the turn would otherwise seal empty the moment the
|
|
182
219
|
* match resumes: its clock restarts here, and clients are told the new deadline.
|
|
220
|
+
*
|
|
221
|
+
* The lift's follow-ups are owed by the lift, not by the call that won its compare-and-swap. A
|
|
222
|
+
* call that finds the match already running while the log still says it is paused completes them
|
|
223
|
+
* for a lift that died half way; the announcement goes last, as their receipt. Returns whether
|
|
224
|
+
* this call lifted the pause or completed a lift.
|
|
183
225
|
*/
|
|
184
226
|
private resumeAfterDesync;
|
|
227
|
+
/** Whether the log's last status announcement is still the pause. */
|
|
228
|
+
private liftUnannounced;
|
|
229
|
+
private restartClockAfterPause;
|
|
185
230
|
}
|
|
186
231
|
//# sourceMappingURL=TurnService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TurnService.d.ts","sourceRoot":"","sources":["../../src/services/TurnService.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACvB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAGL,KAAK,KAAK,
|
|
1
|
+
{"version":3,"file":"TurnService.d.ts","sourceRoot":"","sources":["../../src/services/TurnService.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACvB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAGL,KAAK,KAAK,EAIX,MAAM,oBAAoB,CAAA;AAW3B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAKtD,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,UAAU,CAAA;AAE9C,yFAAyF;AACzF,eAAO,MAAM,UAAU,IAAI,CAAA;AAE3B;;;GAGG;AACH,eAAO,MAAM,uBAAuB,MAAM,CAAA;AAmB1C;;;;;;;;;;GAUG;AACH,qBAAa,WAAW;IAKpB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAL5B,qGAAqG;IACrG,OAAO,CAA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