diff --git a/Aetheria.State.Daemon/Program.cs b/Aetheria.State.Daemon/Program.cs index 8054bbebb..0fa1141af 100644 --- a/Aetheria.State.Daemon/Program.cs +++ b/Aetheria.State.Daemon/Program.cs @@ -308,7 +308,8 @@ static async Task ImportRemoteCommittedFactsAsy options.DaemonId, frame.SessionId, options.VerseId, - importedFactIds); + importedFactIds, + node.RuntimeCatalog().Latest()); var importedFrame = import.Frame; importedFrame.ImportedFactIds = import.AcceptedFactIds; diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index 50219f4e6..d7cf8de53 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -10055,6 +10055,7 @@ static void RequireDaemonVersePublication(string root) "startServer: true", "node.LatestFrame().ReadAsync()", "Catalog = node.RuntimeCatalog().Latest()", + "node.RuntimeCatalog().Latest());", "node.VerseAuthorityPolicy().ReadAsync()", "node.StarbridgeScenario().ReadAsync()", "node.StarbridgeSession().ReadAsync()", @@ -10115,6 +10116,21 @@ static void RequireDaemonVersePublication(string root) string.Join(", ", missingDaemonHostSymbols)); } + var committedFactImportStart = daemonHostSource.IndexOf( + "static async Task ImportRemoteCommittedFactsAsync", + StringComparison.Ordinal); + var committedFactImportEnd = committedFactImportStart >= 0 + ? daemonHostSource.IndexOf("static RudpCultNetSchemaServer StartRtsCultMeshHost", committedFactImportStart, StringComparison.Ordinal) + : -1; + var committedFactImportBlock = committedFactImportStart >= 0 && committedFactImportEnd > committedFactImportStart + ? daemonHostSource.Substring(committedFactImportStart, committedFactImportEnd - committedFactImportStart) + : ""; + if (!committedFactImportBlock.Contains("node.RuntimeCatalog().Latest())", StringComparison.Ordinal)) + { + throw new InvalidOperationException( + "Remote committed fact import must pass the managed runtime catalog document into the tick importer instead of reopening catalog storage."); + } + var apiPublicationStart = daemonHostSource.IndexOf( "static async Task PublishDaemonApiDocumentsAsync", StringComparison.Ordinal); diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCommittedFactImporter.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCommittedFactImporter.cs index 8e0253dda..6d238d54f 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCommittedFactImporter.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCommittedFactImporter.cs @@ -40,7 +40,8 @@ namespace GameCult.Aetheria.State.Verse string daemonId, string sessionId, string verseId, - IEnumerable? importedFactIds = null) + IEnumerable? importedFactIds = null, + AetheriaRuntimeCatalogSnapshot? catalog = null) { currentFrame ??= new AetheriaRuntimeDaemonFrameDocument { @@ -111,7 +112,7 @@ namespace GameCult.Aetheria.State.Verse AccountedCommandIds = currentFrame.AccountedCommandIds, CumulativeAppliedCommandIds = currentFrame.CumulativeAppliedCommandIds, CumulativeRejectedCommandIds = currentFrame.CumulativeRejectedCommandIds, - Catalog = AetheriaRuntimeCatalogStore.OpenReadOnly(stateFilePath), + Catalog = catalog ?? AetheriaRuntimeCatalogStore.OpenReadOnly(stateFilePath), BuildPublications = false });