From ab8711da5c1431d272716b2ea83f3bd58613f183 Mon Sep 17 00:00:00 2001 From: npc0-hue Date: Tue, 11 Aug 2026 16:52:52 +0800 Subject: [PATCH] refactor(scum): retire projection event sources --- .../tasks.md | 2 +- .../log-events/player-position.event.schema.json | 2 +- .../log-events/player-vehicle-enter.event.schema.json | 2 +- .../log-events/player-vehicle-leave.event.schema.json | 2 +- .../log-events/vehicle-position.event.schema.json | 2 +- plugins/tests/manifest-validation.test.ts | 11 ++++++++++- 6 files changed, 15 insertions(+), 6 deletions(-) diff --git a/openspec/changes/replace-scum-projections-with-real-data-management/tasks.md b/openspec/changes/replace-scum-projections-with-real-data-management/tasks.md index c26c1aa..347664c 100644 --- a/openspec/changes/replace-scum-projections-with-real-data-management/tasks.md +++ b/openspec/changes/replace-scum-projections-with-real-data-management/tasks.md @@ -142,7 +142,7 @@ ## 12. Projection, Workflow, Intelligence, and Placeholder Removal - [x] 12.1 Inventory references before deletion and distinguish SCUM-only projection/Workflow/player-intelligence code from generic durable Run jobs, internal write evidence, and non-SCUM consumers. -- [ ] 12.2 Remove SCUM Workflow instance/step/status APIs, repositories, services, routes, clients, manifest declarations, page components, workflow creation/listing, pending-review counters, operation approval routes, and approval/confirmation queue surfaces without removing generic Run job execution. +- [x] 12.2 Remove SCUM Workflow instance/step/status APIs, repositories, services, routes, clients, manifest declarations, page components, workflow creation/listing, pending-review counters, operation approval routes, and approval/confirmation queue surfaces without removing generic Run job execution. - [ ] 12.3 Remove SCUM projection/observation/freshness snapshot types, ingestion, metadata fields, refresh/audit services, page actions, and manual synchronization endpoints; removed endpoints must return not found or a stable removal response and dispatch no job. - [ ] 12.4 Remove SCUM dependencies on alias history, shared IP/fingerprint, access attempts, automatic risk/security signals, and player intelligence; delete shared implementation only after proving it has no remaining non-SCUM consumer. - [x] 12.5 Remove the standalone `管理` and `Workflow 状态` tabs, legacy placeholders/routes, fake maintenance/backup evidence, hard-coded increments, opaque `855` action, hard-coded `starter-pack`, fixed notification, gradient-only map, arbitrary percentage points, and sample/generated players/world data. diff --git a/plugins/examples/scum-server-plugin/schemas/log-events/player-position.event.schema.json b/plugins/examples/scum-server-plugin/schemas/log-events/player-position.event.schema.json index 8cf9a42..123e3e6 100644 --- a/plugins/examples/scum-server-plugin/schemas/log-events/player-position.event.schema.json +++ b/plugins/examples/scum-server-plugin/schemas/log-events/player-position.event.schema.json @@ -1 +1 @@ -{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","additionalProperties":false,"required":["occurredAt","collectedAt","source","mapId","mapVersion","playerId","worldX","worldY"],"properties":{"occurredAt":{"type":"string","format":"date-time","maxLength":40},"collectedAt":{"type":"string","format":"date-time","maxLength":40},"source":{"enum":["companion","log-projection"]},"mapId":{"const":"scum-island"},"mapVersion":{"type":"string","maxLength":80},"playerId":{"type":"string","pattern":"^[A-Za-z0-9_.:-]{1,96}$","maxLength":96},"worldX":{"type":"number","minimum":-500000,"maximum":500000},"worldY":{"type":"number","minimum":-500000,"maximum":500000}}} +{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","additionalProperties":false,"required":["occurredAt","collectedAt","source","mapId","mapVersion","playerId","worldX","worldY"],"properties":{"occurredAt":{"type":"string","format":"date-time","maxLength":40},"collectedAt":{"type":"string","format":"date-time","maxLength":40},"source":{"const":"companion"},"mapId":{"const":"scum-island"},"mapVersion":{"type":"string","maxLength":80},"playerId":{"type":"string","pattern":"^[A-Za-z0-9_.:-]{1,96}$","maxLength":96},"worldX":{"type":"number","minimum":-500000,"maximum":500000},"worldY":{"type":"number","minimum":-500000,"maximum":500000}}} diff --git a/plugins/examples/scum-server-plugin/schemas/log-events/player-vehicle-enter.event.schema.json b/plugins/examples/scum-server-plugin/schemas/log-events/player-vehicle-enter.event.schema.json index 2bbc446..0704c21 100644 --- a/plugins/examples/scum-server-plugin/schemas/log-events/player-vehicle-enter.event.schema.json +++ b/plugins/examples/scum-server-plugin/schemas/log-events/player-vehicle-enter.event.schema.json @@ -1 +1 @@ -{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","additionalProperties":false,"required":["occurredAt","source","mapId","mapVersion","playerId","vehicleId"],"properties":{"occurredAt":{"type":"string","format":"date-time","maxLength":40},"source":{"enum":["companion","log-projection"]},"mapId":{"const":"scum-island"},"mapVersion":{"type":"string","maxLength":80},"playerId":{"type":"string","pattern":"^[A-Za-z0-9_.:-]{1,96}$","maxLength":96},"vehicleId":{"type":"string","pattern":"^[A-Za-z0-9_.:-]{1,96}$","maxLength":96}}} +{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","additionalProperties":false,"required":["occurredAt","source","mapId","mapVersion","playerId","vehicleId"],"properties":{"occurredAt":{"type":"string","format":"date-time","maxLength":40},"source":{"const":"companion"},"mapId":{"const":"scum-island"},"mapVersion":{"type":"string","maxLength":80},"playerId":{"type":"string","pattern":"^[A-Za-z0-9_.:-]{1,96}$","maxLength":96},"vehicleId":{"type":"string","pattern":"^[A-Za-z0-9_.:-]{1,96}$","maxLength":96}}} diff --git a/plugins/examples/scum-server-plugin/schemas/log-events/player-vehicle-leave.event.schema.json b/plugins/examples/scum-server-plugin/schemas/log-events/player-vehicle-leave.event.schema.json index 2bbc446..0704c21 100644 --- a/plugins/examples/scum-server-plugin/schemas/log-events/player-vehicle-leave.event.schema.json +++ b/plugins/examples/scum-server-plugin/schemas/log-events/player-vehicle-leave.event.schema.json @@ -1 +1 @@ -{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","additionalProperties":false,"required":["occurredAt","source","mapId","mapVersion","playerId","vehicleId"],"properties":{"occurredAt":{"type":"string","format":"date-time","maxLength":40},"source":{"enum":["companion","log-projection"]},"mapId":{"const":"scum-island"},"mapVersion":{"type":"string","maxLength":80},"playerId":{"type":"string","pattern":"^[A-Za-z0-9_.:-]{1,96}$","maxLength":96},"vehicleId":{"type":"string","pattern":"^[A-Za-z0-9_.:-]{1,96}$","maxLength":96}}} +{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","additionalProperties":false,"required":["occurredAt","source","mapId","mapVersion","playerId","vehicleId"],"properties":{"occurredAt":{"type":"string","format":"date-time","maxLength":40},"source":{"const":"companion"},"mapId":{"const":"scum-island"},"mapVersion":{"type":"string","maxLength":80},"playerId":{"type":"string","pattern":"^[A-Za-z0-9_.:-]{1,96}$","maxLength":96},"vehicleId":{"type":"string","pattern":"^[A-Za-z0-9_.:-]{1,96}$","maxLength":96}}} diff --git a/plugins/examples/scum-server-plugin/schemas/log-events/vehicle-position.event.schema.json b/plugins/examples/scum-server-plugin/schemas/log-events/vehicle-position.event.schema.json index 8b95322..9c5d2bf 100644 --- a/plugins/examples/scum-server-plugin/schemas/log-events/vehicle-position.event.schema.json +++ b/plugins/examples/scum-server-plugin/schemas/log-events/vehicle-position.event.schema.json @@ -1 +1 @@ -{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","additionalProperties":false,"required":["occurredAt","collectedAt","source","mapId","mapVersion","vehicleId","worldX","worldY"],"properties":{"occurredAt":{"type":"string","format":"date-time","maxLength":40},"collectedAt":{"type":"string","format":"date-time","maxLength":40},"source":{"enum":["companion","log-projection"]},"mapId":{"const":"scum-island"},"mapVersion":{"type":"string","maxLength":80},"vehicleId":{"type":"string","pattern":"^[A-Za-z0-9_.:-]{1,96}$","maxLength":96},"worldX":{"type":"number","minimum":-500000,"maximum":500000},"worldY":{"type":"number","minimum":-500000,"maximum":500000}}} +{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","additionalProperties":false,"required":["occurredAt","collectedAt","source","mapId","mapVersion","vehicleId","worldX","worldY"],"properties":{"occurredAt":{"type":"string","format":"date-time","maxLength":40},"collectedAt":{"type":"string","format":"date-time","maxLength":40},"source":{"const":"companion"},"mapId":{"const":"scum-island"},"mapVersion":{"type":"string","maxLength":80},"vehicleId":{"type":"string","pattern":"^[A-Za-z0-9_.:-]{1,96}$","maxLength":96},"worldX":{"type":"number","minimum":-500000,"maximum":500000},"worldY":{"type":"number","minimum":-500000,"maximum":500000}}} diff --git a/plugins/tests/manifest-validation.test.ts b/plugins/tests/manifest-validation.test.ts index 23737ad..5b4a22e 100644 --- a/plugins/tests/manifest-validation.test.ts +++ b/plugins/tests/manifest-validation.test.ts @@ -595,7 +595,7 @@ describe("plugin manifest validation", () => { } }); - it("declares bounded SCUM snapshot schemas for operations projections", () => { + it("declares bounded SCUM snapshot schemas for local management reads", () => { const manifestPath = path.join(pluginsRoot, "examples/scum-server-plugin/manifest.json"); const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8")) as { gameClientBridge: { @@ -631,6 +631,15 @@ describe("plugin manifest validation", () => { expect(manifest.gameClientBridge.pages.find((page) => page.pageKey === "live-map")?.snapshotTypes).toEqual(expect.arrayContaining(["players", "vehicles", "flags"])); }); + it("rejects the retired SCUM log-projection source in map event schemas", () => { + const schemaDir = path.join(pluginsRoot, "examples/scum-server-plugin/schemas/log-events"); + for (const filename of ["player-position.event.schema.json", "vehicle-position.event.schema.json", "player-vehicle-enter.event.schema.json", "player-vehicle-leave.event.schema.json"]) { + const schema = JSON.parse(fs.readFileSync(path.join(schemaDir, filename), "utf8")) as { properties?: { source?: { const?: string; enum?: string[] } } }; + expect(schema.properties?.source).toEqual({ const: "companion" }); + expect(schema.properties?.source?.enum).toBeUndefined(); + } + }); + it("keeps SCUM.db query templates absent until current-service evidence exists", () => { const pluginDir = path.join(pluginsRoot, "examples/scum-server-plugin"); const manifest = JSON.parse(fs.readFileSync(path.join(pluginDir, "manifest.json"), "utf8")) as {