Remove pre-1.0 audit and protected request scaffolding

This commit is contained in:
npc0-hue
2026-08-20 23:42:02 +08:00
parent 40b35b05c7
commit a7e2e4c6c0
130 changed files with 526 additions and 3767 deletions
+13 -16
View File
@@ -16,7 +16,7 @@ const status = {
profileKey: "scum-client",
available: false,
reason: "component heartbeat is unavailable",
commandTypes: ["scum.announcement.send"],
commandTypes: ["scum.diagnostic.ping"],
snapshotTypes: ["scum.players"],
queryTemplateKeys: ["scum.player.search"]
}]
@@ -27,12 +27,11 @@ const pendingCommand = {
serverInstanceId: "server-1",
pluginId: "game.scum",
profileKey: "scum-client",
commandType: "scum.announcement.send",
commandType: "scum.diagnostic.ping",
priority: 20,
state: "pending",
approvalState: "pending",
requesterId: "user-1",
auditReferences: ["audit-command-1"],
expiresAt: later,
createdAt: now,
updatedAt: now
@@ -42,10 +41,10 @@ const completedCommand = {
...pendingCommand,
state: "succeeded",
approvalState: "approved",
resultSummary: "announcement delivered",
resultSummary: "diagnostic completed",
result: {
status: "succeeded",
summary: "announcement delivered",
summary: "diagnostic completed",
payload: { delivered: true, recipientCount: 12 },
completedAt: later
},
@@ -57,7 +56,6 @@ const cancellation = {
commandId: pendingCommand.id,
state: "cancelled",
cancellation: { requestedBy: "user-1", reason: "maintenance window changed", cancelledAt: later },
auditReferences: ["audit-command-1", "audit-command-cancel-1"],
updatedAt: later
} as const;
@@ -73,19 +71,18 @@ const snapshot = {
observedAt: now,
payload: { players: [{ playerId: "player-1", displayName: "Moonlight" }] },
retention: { keepForSeconds: 3600, maxRecords: 24 },
auditReferences: ["audit-snapshot-1"],
createdAt: now,
expiresAt: later
} as const;
const manifestDeclaration: GameClientBridgeManifestResponse = {
commands: [{
type: "scum.announcement.send",
title: "Send announcement",
type: "scum.diagnostic.ping",
title: "Diagnostic ping",
permission: "server.game-client.command",
approvalLevel: "operator",
payloadSchemaRef: "schemas/bridge/commands/announcement.request.json",
resultSchemaRef: "schemas/bridge/commands/announcement.result.json",
payloadSchemaRef: "schemas/bridge/commands/diagnostic-ping.request.json",
resultSchemaRef: "schemas/bridge/commands/diagnostic-ping.result.json",
timeoutSeconds: 30,
maxPayloadBytes: 4096
}],
@@ -104,7 +101,7 @@ const manifestDeclaration: GameClientBridgeManifestResponse = {
}],
commandRetentionSeconds: 86400,
maxCommands: 1000,
pages: [{ pageKey: "operations", commandTypes: ["scum.announcement.send"], snapshotTypes: ["scum.players"], queryTemplateKeys: ["scum.player.search"] }],
pages: [{ pageKey: "operations", commandTypes: ["scum.diagnostic.ping"], snapshotTypes: ["scum.players"], queryTemplateKeys: ["scum.player.search"] }],
companion: {
profileKey: "scum-client-manager",
configTemplateKey: "client-config",
@@ -151,15 +148,15 @@ describe("PlatformApiClient Game Client Bridge operator API", () => {
const client = new PlatformApiClient("/api/v1", () => "operator-session");
const queueRequest: GameClientBridgeQueueRequest = {
profileKey: "scum-client",
commandType: "scum.announcement.send",
commandType: "scum.diagnostic.ping",
payload: { message: "Restart in ten minutes", channels: ["global"] },
idempotencyKey: "announcement-1",
idempotencyKey: "diagnostic-1",
priority: 20,
expiresAt: later
};
await expect(client.getGameClientBridgeStatus("server-1")).resolves.toMatchObject({ available: false, profiles: [{ profileKey: "scum-client" }] });
await expect(client.listGameClientBridgeCommands("server-1", { profileKey: "scum-client", state: "pending", commandType: "scum.announcement.send" })).resolves.toMatchObject({ count: 1 });
await expect(client.listGameClientBridgeCommands("server-1", { profileKey: "scum-client", state: "pending", commandType: "scum.diagnostic.ping" })).resolves.toMatchObject({ count: 1 });
await expect(client.queueGameClientBridgeCommand("server-1", queueRequest)).resolves.toMatchObject({ state: "pending", approvalState: "pending" });
await expect(client.getGameClientBridgeCommand("server-1", pendingCommand.id)).resolves.toMatchObject({ result: { status: "succeeded", payload: { delivered: true } } });
await expect(client.cancelGameClientBridgeCommand("server-1", pendingCommand.id, { reason: "maintenance window changed" })).resolves.toMatchObject({ state: "cancelled" });
@@ -167,7 +164,7 @@ describe("PlatformApiClient Game Client Bridge operator API", () => {
expect(calls.map((call) => `${call.method} ${call.url}`)).toEqual([
"GET /api/v1/server-instances/server-1/game-client-bridge",
"GET /api/v1/server-instances/server-1/game-client-bridge/commands?profileKey=scum-client&state=pending&commandType=scum.announcement.send",
"GET /api/v1/server-instances/server-1/game-client-bridge/commands?profileKey=scum-client&state=pending&commandType=scum.diagnostic.ping",
"POST /api/v1/server-instances/server-1/game-client-bridge/commands",
"GET /api/v1/server-instances/server-1/game-client-bridge/commands/command-1",
"POST /api/v1/server-instances/server-1/game-client-bridge/commands/command-1/cancel",