@quenty/saveslot 2.7.1 → 2.8.1

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/CHANGELOG.md CHANGED
@@ -3,6 +3,23 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.8.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/saveslot@2.8.0...@quenty/saveslot@2.8.1) (2026-08-14)
7
+
8
+ **Note:** Version bump only for package @quenty/saveslot
9
+
10
+ # [2.8.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/saveslot@2.7.1...@quenty/saveslot@2.8.0) (2026-08-13)
11
+
12
+ ### Bug Fixes
13
+
14
+ - **datastore:** release a borrowed session even when the caller is torn down ([2537a0b](https://github.com/Quenty/NevermoreEngine/commit/2537a0b8e90a658cca96f83a515b5ffac8662518))
15
+ - Transfers now are more secure ([cd068ce](https://github.com/Quenty/NevermoreEngine/commit/cd068ced353b388892e64e06282c505f57a4b245))
16
+
17
+ ### Features
18
+
19
+ - Fix a lot of cmdr issues ([05b6025](https://github.com/Quenty/NevermoreEngine/commit/05b60255c6f436872895e8d9398fed12dd3ab1d5))
20
+ - **saveslot:** make every save slot command work on players who are not in this server ([795549c](https://github.com/Quenty/NevermoreEngine/commit/795549cdcb4c8584a4acd22eb7377c7aea149182))
21
+ - **saveslot:** take playerIds on every save slot command ([8069fe5](https://github.com/Quenty/NevermoreEngine/commit/8069fe53fd564899a6c025e5371ad9a7f4e0b275))
22
+
6
23
  ## [2.7.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/saveslot@2.7.0...@quenty/saveslot@2.7.1) (2026-08-10)
7
24
 
8
25
  ### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/saveslot",
3
- "version": "2.7.1",
3
+ "version": "2.8.1",
4
4
  "description": "PlayerDataStoreService wrapper for save slots",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -28,34 +28,34 @@
28
28
  "Quenty"
29
29
  ],
30
30
  "dependencies": {
31
- "@quenty/adorneedata": "7.41.0",
32
- "@quenty/attributeutils": "14.36.0",
33
- "@quenty/baseobject": "10.15.0",
34
- "@quenty/binder": "14.43.1",
35
- "@quenty/brio": "14.35.1",
36
- "@quenty/cmdrservice": "13.56.1",
37
- "@quenty/datastore": "13.51.1",
38
- "@quenty/instanceutils": "13.35.1",
39
- "@quenty/loader": "10.11.0",
40
- "@quenty/maid": "3.11.0",
41
- "@quenty/nevermore-test-runner": "1.5.0",
42
- "@quenty/observablecollection": "12.47.0",
43
- "@quenty/playerbinder": "14.46.0",
44
- "@quenty/playermock": "1.6.0",
45
- "@quenty/promise": "10.23.0",
46
- "@quenty/propertyvalue": "7.35.1",
47
- "@quenty/remoting": "12.41.1",
48
- "@quenty/rx": "13.33.0",
49
- "@quenty/servicebag": "11.20.0",
50
- "@quenty/signal": "7.13.1",
31
+ "@quenty/adorneedata": "7.41.1",
32
+ "@quenty/attributeutils": "14.36.1",
33
+ "@quenty/baseobject": "10.15.1",
34
+ "@quenty/binder": "14.43.2",
35
+ "@quenty/brio": "14.35.2",
36
+ "@quenty/cmdrservice": "13.57.1",
37
+ "@quenty/datastore": "13.52.1",
38
+ "@quenty/instanceutils": "13.35.2",
39
+ "@quenty/loader": "10.11.1",
40
+ "@quenty/maid": "3.11.1",
41
+ "@quenty/nevermore-test-runner": "1.5.1",
42
+ "@quenty/observablecollection": "12.47.1",
43
+ "@quenty/playerbinder": "14.46.1",
44
+ "@quenty/playermock": "1.6.1",
45
+ "@quenty/promise": "10.23.1",
46
+ "@quenty/propertyvalue": "7.35.2",
47
+ "@quenty/remoting": "12.41.2",
48
+ "@quenty/rx": "13.33.1",
49
+ "@quenty/servicebag": "11.20.1",
50
+ "@quenty/signal": "7.13.2",
51
51
  "@quenty/table": "3.9.2",
52
- "@quenty/teleportserviceutils": "10.3.2",
53
- "@quenty/tie": "10.47.0",
54
- "@quenty/valueobject": "13.36.1",
52
+ "@quenty/teleportserviceutils": "10.3.3",
53
+ "@quenty/tie": "10.47.1",
54
+ "@quenty/valueobject": "13.36.2",
55
55
  "@quentystudios/jest-lua": "3.10.0-quenty.2"
56
56
  },
57
57
  "publishConfig": {
58
58
  "access": "public"
59
59
  },
60
- "gitHead": "4bd956dcbbcd2b4d50e8517343d2f9a1e2d45f8a"
60
+ "gitHead": "f084360c3729ea424d49d9bc42f8f0d1c128fa82"
61
61
  }
@@ -33,6 +33,7 @@ function SaveSlotServiceClient.Init(self: SaveSlotServiceClient, serviceBag: Ser
33
33
  self._maid = Maid.new()
34
34
 
35
35
  -- External
36
+ self._serviceBag:GetService(require("DataStoreServiceClient"))
36
37
  self._teleportDataServiceClient = self._serviceBag:GetService(TeleportDataServiceClient)
37
38
 
38
39
  -- Internal
@@ -176,7 +176,7 @@ describe("HasSaveSlots.PromiseExportSlot / PromiseImportSlot", function()
176
176
  local sourceSlotId = createSelectAndWrite(hasSaveSlots, 2)
177
177
 
178
178
  -- Rewind the live session's clock so the export observes ~120s of unflushed play.
179
- local tracker: any = hasSaveSlots
179
+ local tracker: any = hasSaveSlots:GetSlotsDataStore()
180
180
  tracker._playSessionStart = os.time() - 120
181
181
  tracker._playSessionLastFlush = os.time() - 120
182
182
 
@@ -14,6 +14,7 @@ local PlayerDataStoreService = require("PlayerDataStoreService")
14
14
  local PlayerMock = require("PlayerMock")
15
15
  local PromiseTestUtils = require("PromiseTestUtils")
16
16
  local SaveSlotConstants = require("SaveSlotConstants")
17
+ local SaveSlotExportUtils = require("SaveSlotExportUtils")
17
18
  local SaveSlotSharedDataStoreService = require("SaveSlotSharedDataStoreService")
18
19
  local ServiceBag = require("ServiceBag")
19
20
 
@@ -124,6 +125,42 @@ describe("HasSaveSlots shared-store save/import", function()
124
125
  end)
125
126
  end)
126
127
 
128
+ it("tags what it writes as a share code, keeping it out of the teleport arrival path", function()
129
+ runWithContext(function(context)
130
+ local hasSaveSlots = context.hasSaveSlots
131
+ local sourceSlotId = createSelectAndWrite(hasSaveSlots, 2)
132
+ awaitValueOf(hasSaveSlots:PromiseSaveSlotToSharedDataStore(sourceSlotId, "code-kind"))
133
+
134
+ local stored = awaitValueOf(context.sharedService:PromiseRead("code-kind"))
135
+ expect(stored.kind).toEqual(SaveSlotExportUtils.Kind.CODE)
136
+ end)
137
+ end)
138
+
139
+ it("refuses to import a transfer snapshot, whose key every client can read", function()
140
+ runWithContext(function(context)
141
+ awaitValueOf(
142
+ context.sharedService:PromiseWrite(
143
+ "transfer-key",
144
+ SaveSlotExportUtils.withKind({ data = { Coins = 5 } }, SaveSlotExportUtils.Kind.TRANSFER)
145
+ )
146
+ )
147
+
148
+ expect(awaitResolved(context.hasSaveSlots:PromiseImportSlotFromSharedDataStore("transfer-key"))).toEqual(
149
+ false
150
+ )
151
+ end)
152
+ end)
153
+
154
+ it("still imports an entry written before kinds existed", function()
155
+ runWithContext(function(context)
156
+ awaitValueOf(context.sharedService:PromiseWrite("legacy-code", { data = { Coins = 5 } }))
157
+
158
+ local newSlotId = awaitValueOf(context.hasSaveSlots:PromiseImportSlotFromSharedDataStore("legacy-code"))
159
+ local reexport = awaitValueOf(context.hasSaveSlots:PromiseExportSlot(newSlotId))
160
+ expect(reexport.data.Coins).toEqual(5)
161
+ end)
162
+ end)
163
+
127
164
  it("propagates the main-slot guard through a shared-store save", function()
128
165
  runWithContext(function(context)
129
166
  local hasSaveSlots = context.hasSaveSlots
@@ -15,6 +15,7 @@ local PlayerDataStoreService = require("PlayerDataStoreService")
15
15
  local PlayerMock = require("PlayerMock")
16
16
  local PromiseTestUtils = require("PromiseTestUtils")
17
17
  local SaveSlotConstants = require("SaveSlotConstants")
18
+ local SaveSlotExportUtils = require("SaveSlotExportUtils")
18
19
  local SaveSlotSharedDataStoreService = require("SaveSlotSharedDataStoreService")
19
20
  local ServiceBag = require("ServiceBag")
20
21
 
@@ -88,6 +89,13 @@ local function awaitValueOf(promise)
88
89
  return value
89
90
  end
90
91
 
92
+ -- What a teleport re-save leaves behind, and the only thing the arrival path will load.
93
+ local function writeTransfer(context: any, key: string, export)
94
+ return awaitValueOf(
95
+ context.sharedService:PromiseWrite(key, SaveSlotExportUtils.withKind(export, SaveSlotExportUtils.Kind.TRANSFER))
96
+ )
97
+ end
98
+
91
99
  local function awaitResolved(promise): boolean
92
100
  if not PromiseTestUtils.awaitSettled(promise, 10) then
93
101
  error("promise hung", 0)
@@ -104,12 +112,7 @@ describe("HasSaveSlots.PromiseSelectTransferableEphemeralSlot", function()
104
112
  it("loads a transferable ephemeral slot from a shared-store key", function()
105
113
  runWithContext(function(context)
106
114
  local hasSaveSlots = context.hasSaveSlots
107
- awaitValueOf(
108
- context.sharedService:PromiseWrite(
109
- "code-1",
110
- { data = { Coins = 5, World_2 = { Eggs = 1 } }, slotName = "Snap" }
111
- )
112
- )
115
+ writeTransfer(context, "code-1", { data = { Coins = 5, World_2 = { Eggs = 1 } }, slotName = "Snap" })
113
116
 
114
117
  local slotId = awaitValueOf(hasSaveSlots:PromiseSelectTransferableEphemeralSlot("code-1"))
115
118
  expect(hasSaveSlots.ActiveSlotId.Value).toEqual(slotId)
@@ -138,18 +141,95 @@ describe("HasSaveSlots.PromiseSelectTransferableEphemeralSlot", function()
138
141
 
139
142
  it("rejects when the shared store read fails", function()
140
143
  runWithContext(function(context)
141
- awaitValueOf(context.sharedService:PromiseWrite("code-x", { data = { Coins = 1 } }))
144
+ writeTransfer(context, "code-x", { data = { Coins = 1 } })
142
145
  context.sharedMock:FailNextRequests(1)
143
146
  expect(awaitResolved(context.hasSaveSlots:PromiseSelectTransferableEphemeralSlot("code-x"))).toEqual(false)
144
147
  end)
145
148
  end)
149
+
150
+ it("refuses a share code, which is what keeps a leaked one from being played", function()
151
+ runWithContext(function(context)
152
+ -- The key reaching this path comes from the arriving client, so a code a player was handed
153
+ -- must not load here. It is redeemed through PromiseImportEphemeralSaveSlotFromCode instead.
154
+ awaitValueOf(
155
+ context.sharedService:PromiseWrite(
156
+ "shared-code",
157
+ SaveSlotExportUtils.withKind({ data = { Coins = 5 } }, SaveSlotExportUtils.Kind.CODE)
158
+ )
159
+ )
160
+
161
+ expect(awaitResolved(context.hasSaveSlots:PromiseSelectTransferableEphemeralSlot("shared-code"))).toEqual(
162
+ false
163
+ )
164
+ end)
165
+ end)
166
+
167
+ it("refuses an entry written before kinds existed, which may be a code", function()
168
+ runWithContext(function(context)
169
+ awaitValueOf(context.sharedService:PromiseWrite("legacy", { data = { Coins = 5 } }))
170
+
171
+ expect(awaitResolved(context.hasSaveSlots:PromiseSelectTransferableEphemeralSlot("legacy"))).toEqual(false)
172
+ end)
173
+ end)
174
+ end)
175
+
176
+ describe("HasSaveSlots.PromiseImportEphemeralSaveSlotFromCode", function()
177
+ local function writeCode(context: any, key: string, export)
178
+ return awaitValueOf(
179
+ context.sharedService:PromiseWrite(key, SaveSlotExportUtils.withKind(export, SaveSlotExportUtils.Kind.CODE))
180
+ )
181
+ end
182
+
183
+ it("redeems a share code into a transferable ephemeral slot", function()
184
+ runWithContext(function(context)
185
+ local hasSaveSlots = context.hasSaveSlots
186
+ writeCode(context, "code-redeem", { data = { Coins = 5 } })
187
+
188
+ local slotId = awaitValueOf(hasSaveSlots:PromiseImportEphemeralSaveSlotFromCode("code-redeem"))
189
+ expect(hasSaveSlots.ActiveSlotId.Value).toEqual(slotId)
190
+ expect(activeSlotData(hasSaveSlots).Coins).toEqual(5)
191
+ end)
192
+ end)
193
+
194
+ it("still redeems a code written before kinds existed", function()
195
+ runWithContext(function(context)
196
+ local hasSaveSlots = context.hasSaveSlots
197
+ awaitValueOf(context.sharedService:PromiseWrite("legacy-code", { data = { Coins = 9 } }))
198
+
199
+ awaitValueOf(hasSaveSlots:PromiseImportEphemeralSaveSlotFromCode("legacy-code"))
200
+ expect(activeSlotData(hasSaveSlots).Coins).toEqual(9)
201
+ end)
202
+ end)
203
+
204
+ it("transfers onward under a fresh key, so the code itself is never published", function()
205
+ runWithContext(function(context)
206
+ local hasSaveSlots = context.hasSaveSlots
207
+ writeCode(context, "code-onward", { data = { Coins = 5 } })
208
+ awaitValueOf(hasSaveSlots:PromiseImportEphemeralSaveSlotFromCode("code-onward"))
209
+
210
+ -- The client carries this key across a teleport and every client can read it, so it must not
211
+ -- be the code -- and the slice must not write a transfer over the code's entry.
212
+ local transferKey = assert(hasSaveSlots.ActiveTransferableEphemeralKey.Value, "No transfer key")
213
+ expect(transferKey).never.toEqual("code-onward")
214
+
215
+ local slice = awaitValueOf(hasSaveSlots:PromiseBuildEphemeralTransferSlice())
216
+ expect(slice[EPHEMERAL_KEY]).toEqual(transferKey)
217
+
218
+ local code = awaitValueOf(context.sharedService:PromiseRead("code-onward"))
219
+ expect(code.kind).toEqual(SaveSlotExportUtils.Kind.CODE)
220
+
221
+ -- And the fresh key holds a transfer, which is what the arrival path will accept.
222
+ local transfer = awaitValueOf(context.sharedService:PromiseRead(transferKey))
223
+ expect(transfer.kind).toEqual(SaveSlotExportUtils.Kind.TRANSFER)
224
+ end)
225
+ end)
146
226
  end)
147
227
 
148
228
  describe("HasSaveSlots.PromiseBuildEphemeralTransferSlice", function()
149
229
  it("re-saves the live state and carries the key", function()
150
230
  runWithContext(function(context)
151
231
  local hasSaveSlots = context.hasSaveSlots
152
- awaitValueOf(context.sharedService:PromiseWrite("code-2", { data = { Coins = 5 } }))
232
+ writeTransfer(context, "code-2", { data = { Coins = 5 } })
153
233
  awaitValueOf(hasSaveSlots:PromiseSelectTransferableEphemeralSlot("code-2"))
154
234
 
155
235
  -- Mutate live state after loading.
@@ -178,7 +258,7 @@ describe("HasSaveSlots.PromiseBuildEphemeralTransferSlice", function()
178
258
  it("degrades to nil (does not block the teleport) when the re-save fails", function()
179
259
  runWithContext(function(context)
180
260
  local hasSaveSlots = context.hasSaveSlots
181
- awaitValueOf(context.sharedService:PromiseWrite("code-5", { data = { Coins = 5 } }))
261
+ writeTransfer(context, "code-5", { data = { Coins = 5 } })
182
262
  awaitValueOf(hasSaveSlots:PromiseSelectTransferableEphemeralSlot("code-5"))
183
263
 
184
264
  -- The re-save write fails; the slice must resolve nil rather than reject.
@@ -192,7 +272,7 @@ describe("HasSaveSlots.PromiseLoadTransferableEphemeralSlotFromTeleport", functi
192
272
  it("re-selects the slot from a key in the trusted band", function()
193
273
  runWithContext(function(context)
194
274
  local hasSaveSlots = context.hasSaveSlots
195
- awaitValueOf(context.sharedService:PromiseWrite("code-3", { data = { Coins = 7 } }))
275
+ writeTransfer(context, "code-3", { data = { Coins = 7 } })
196
276
 
197
277
  context.teleportDataService:SetTrustedArrivedTeleportDataForTesting(
198
278
  context.fakePlayer,
@@ -209,7 +289,7 @@ describe("HasSaveSlots.PromiseLoadTransferableEphemeralSlotFromTeleport", functi
209
289
  it("re-selects the slot from a key in the client band (client-initiated teleport)", function()
210
290
  runWithContext(function(context)
211
291
  local hasSaveSlots = context.hasSaveSlots
212
- awaitValueOf(context.sharedService:PromiseWrite("code-4", { data = { Coins = 7 } }))
292
+ writeTransfer(context, "code-4", { data = { Coins = 7 } })
213
293
 
214
294
  -- Egg-hunt's menu resume is a client-initiated teleport, so the key rides the client band; the
215
295
  -- unified arrival read honors it (see PromiseLoadTransferableEphemeralSlotFromTeleport).
@@ -229,7 +309,7 @@ describe("HasSaveSlots.ActiveTransferableEphemeralKey (replicated for the client
229
309
  it("reflects the active transferable-ephemeral key and clears it on deselect", function()
230
310
  runWithContext(function(context)
231
311
  local hasSaveSlots = context.hasSaveSlots
232
- awaitValueOf(context.sharedService:PromiseWrite("code-6", { data = { Coins = 1 } }))
312
+ writeTransfer(context, "code-6", { data = { Coins = 1 } })
233
313
 
234
314
  awaitValueOf(hasSaveSlots:PromiseSelectTransferableEphemeralSlot("code-6"))
235
315
  expect(hasSaveSlots.ActiveTransferableEphemeralKey.Value).toEqual("code-6")