mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-17 23:33:12 +09:00
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:
1 parent
feb3253bec
commit
9ecd497f1e
4 files changed
+40
-12
No files matched your search
@@ -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],
|
||||
|
||||
Reference in new issue
Block a user