From ed2e547aebadf6b5b4b666711c361d9983e3d461 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 27 Jun 2026 15:46:57 +0100 Subject: [PATCH] Read RTS publications through CultMesh documents --- .../aetheria-local-publication-reader.ts | 36 ++++++++++++------- .../scripts/verify-stage7b-rts-client.ps1 | 12 +++++-- 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/Aetheria.Rts.Web/Electron/aetheria-local-publication-reader.ts b/Aetheria.Rts.Web/Electron/aetheria-local-publication-reader.ts index 05f594a23..e8b43a602 100644 --- a/Aetheria.Rts.Web/Electron/aetheria-local-publication-reader.ts +++ b/Aetheria.Rts.Web/Electron/aetheria-local-publication-reader.ts @@ -1,5 +1,4 @@ -import { decode } from "@msgpack/msgpack"; -import { SingleFileMessagePackBackingStore } from "cultcache-ts"; +import { CultMesh } from "cultmesh-ts"; export class AetheriaLocalPublicationReader { public constructor(private readonly statePath: string) {} @@ -9,28 +8,41 @@ export class AetheriaLocalPublicationReader { } public readDaemonFrame(): Promise { - return this.readSingleDocument(`${this.statePath}.daemon.frame.cc`, "gamecult.aetheria.daemon_frame.v1"); + return this.readSingleDocument( + `${this.statePath}.daemon.frame.cc`, + "gamecult.aetheria.daemon_frame.v1", + "daemon:aetheria.frame.latest.v1"); } public readDaemonHealth(): Promise { - return this.readSingleDocument(`${this.statePath}.daemon.health.cc`, "gamecult.aetheria.daemon_health.v1"); + return this.readSingleDocument( + `${this.statePath}.daemon.health.cc`, + "gamecult.aetheria.daemon_health.v1", + "daemon:aetheria.health.latest.v1"); } public readAuthorityPolicy(): Promise { - return this.readSingleDocument(`${this.statePath}.authority.policy.cc`, "gamecult.aetheria.verse_authority_policy.v1"); + return this.readSingleDocument( + `${this.statePath}.authority.policy.cc`, + "gamecult.aetheria.verse_authority_policy.v1", + "daemon:aetheria.authority.policy.latest.v1"); } public readStarbridgeSessionSummary(): Promise { return this.readSingleDocument( `${this.statePath}.daemon.starbridge.session.cc`, - "gamecult.aetheria.starbridge_session_summary.v1"); + "gamecult.aetheria.starbridge_session_summary.v1", + "daemon:aetheria.starbridge.session.latest.v1"); } - private async readSingleDocument(path: string, schemaId: string): Promise { - const records = await new SingleFileMessagePackBackingStore(path).pullAll(); - const record = records.find(candidate => candidate.schemaId === schemaId); - if (!record) - throw new Error(`Aetheria local publication ${path} did not contain schema ${schemaId}.`); - return decode(record.payload); + private readSingleDocument( + path: string, + schemaId: string, + documentId: string, + ): Promise { + return CultMesh.documentFromSingleFile(path, schemaId, { + documentId, + sourceId: documentId, + }).latest(); } } diff --git a/Aetheria.Rts.Web/scripts/verify-stage7b-rts-client.ps1 b/Aetheria.Rts.Web/scripts/verify-stage7b-rts-client.ps1 index c1bb17563..4bc8f1808 100644 --- a/Aetheria.Rts.Web/scripts/verify-stage7b-rts-client.ps1 +++ b/Aetheria.Rts.Web/scripts/verify-stage7b-rts-client.ps1 @@ -473,9 +473,17 @@ foreach ($symbol in $requiredProjectionSymbols) { } } -& rg -q 'SingleFileMessagePackBackingStore' Electron/aetheria-local-publication-reader.ts +& rg -q 'CultMesh.documentFromSingleFile' Electron/aetheria-local-publication-reader.ts if ($LASTEXITCODE -ne 0) { - Write-Error "Stage 7B verifier failed: local CultCache publication reader was not found." + Write-Error "Stage 7B verifier failed: local publications should be read through CultMesh document handles." +} + +$forbiddenLocalPublicationReaderPlumbing = & rg -n 'SingleFileMessagePackBackingStore|decode\(|pullAll\(' Electron/aetheria-local-publication-reader.ts 2>$null +if ($LASTEXITCODE -eq 0) { + Write-Error "Stage 7B verifier failed: local publication reader still owns backing-store or MessagePack plumbing.`n$forbiddenLocalPublicationReaderPlumbing" +} +if ($LASTEXITCODE -gt 1) { + Write-Error "Stage 7B verifier could not run rg for local publication reader plumbing checks." } & rg -q 'readStarbridgeSessionSummary' Electron/aetheria-local-publication-reader.ts