From 1d14148606c41b9560b01600e015b2e711bab9bb Mon Sep 17 00:00:00 2001 From: bbassie <17990055+bbassie@users.noreply.github.com> Date: Sat, 17 Oct 2026 15:32:20 +0000 Subject: [PATCH] Show the instance ID when its details can't be fetched InstanceDetailsGetRequest needs core.instance.get, which the player-sync list and show commands are not documented to require. Co-Authored-By: Claude Opus 5.5 --- plugins/player_sync/ctl.ts | 9 +++++++-- plugins/player_sync/test/plugin.js | 10 ++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/plugins/player_sync/ctl.ts b/plugins/player_sync/ctl.ts index d92b6550..c0028faf 100644 --- a/plugins/player_sync/ctl.ts +++ b/plugins/player_sync/ctl.ts @@ -13,8 +13,13 @@ async function instanceName(ctl: Ctl, instanceId: number | undefined) { if (instanceId === undefined) { return "-"; } - let instance = await ctl.send(new lib.InstanceDetailsGetRequest(instanceId)); - return `${instance.name} (${instanceId})`; + try { + let instance = await ctl.send(new lib.InstanceDetailsGetRequest(instanceId)); + return `${instance.name} (${instanceId})`; + } catch (err) { + // Viewing player data does not require core.instance.get + return String(instanceId); + } } const playerSyncCommands = new lib.CommandTree({ diff --git a/plugins/player_sync/test/plugin.js b/plugins/player_sync/test/plugin.js index be8442be..3c0e5f7a 100644 --- a/plugins/player_sync/test/plugin.js +++ b/plugins/player_sync/test/plugin.js @@ -181,6 +181,16 @@ describe("player_sync plugin", function() { ` 1 exported item ${lib.formatBytes(4)}`, ]); }); + it("should show the instance ID when details can't be fetched", async function() { + responses.set(lib.InstanceDetailsGetRequest, () => { + throw new lib.PermissionError("Permission denied"); + }); + await run("list"); + assert.equal(printed[2], "bob | - | - | 1"); + printed = []; + await run("show", { player: "alice" }); + assert.equal(printed[0], "acquired by: 1"); + }); it("show should handle players without data", async function() { await run("show", { player: "carol" }); assert.deepEqual(printed, ["acquired by: -", "No player data stored for carol"]);