Reserve the deleted marker for tombstones

Imports and uploads could carry deleted: false, which the loader took for
a tombstone on the next restart. The schemas now reject the property, and
the loader only treats deleted: true as a tombstone and strips the key from
entries already saved with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 5.5 committed 2026-10-18 19:53:36 +00:00
1 parent feb3253bec
commit 9ecd497f1e
4 files changed
+40 -12

No files matched your search

+10
View File
@@ -51,6 +51,14 @@ describe("player_sync plugin", function() {
assert(!validate(request), `accepted ${generation}`);
}
});
it("should reject uploads carrying the tombstone marker", function() {
const validate = lib.compile(msg.UploadRequest.jsonSchema);
assert(validate({ instanceId: 1, playerName: "player", playerData: playerData("player", 5) }));
for (const deleted of [false, true]) {
const data = playerData("player", 5, { deleted });
assert(!validate({ instanceId: 1, playerName: "player", playerData: data }), `accepted ${deleted}`);
}
});
describe("SetPlayerDataRequest schema", function() {
const validate = lib.compile(msg.SetPlayerDataRequest.jsonSchema);
// Shaped like module/serialize.lua output
@@ -116,6 +124,8 @@ describe("player_sync plugin", function() {
for (const [field, value] of [
["controller", "not-a-controller"],
["controller", "remote"],
["deleted", false],
["deleted", true],
["color", "red"],
["force", 1],
["ticks_to_respawn", -1],