From ba5021b436ca37ebf133b3356c1ea2f741a8af56 Mon Sep 17 00:00:00 2001 From: fy59 Date: Sun, 20 Sep 2026 14:40:59 +0200 Subject: [PATCH] fix(sync): retain strict V3 fallback publication --- .../main/java/com/labfytools/trainlog/ui/SyncScreen.kt | 10 ++++++++++ tests/test_syncd_routing.py | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/android/app/src/main/java/com/labfytools/trainlog/ui/SyncScreen.kt b/android/app/src/main/java/com/labfytools/trainlog/ui/SyncScreen.kt index e925e3c..f830f1d 100644 --- a/android/app/src/main/java/com/labfytools/trainlog/ui/SyncScreen.kt +++ b/android/app/src/main/java/com/labfytools/trainlog/ui/SyncScreen.kt @@ -55,6 +55,16 @@ internal suspend fun publishBundleAndRequest( return@withContext SyncRequestResult.Error("prepare:${opened.message}") } val snapshot = (opened as com.labfytools.trainlog.data.DirectExchangeSnapshotResult.Ready).snapshot + /* CONTRACT: the request signal remains compatible with an unconfigured + * desktop, so publish the strict standalone V3 snapshot before admission. + * A configured daemon still routes the signal exclusively to the complete + * generation below; this compatibility publication never selects V3. */ + when (val publication = exporter.exportMobileBundle(snapshot)) { + SyncExportResult.Unsupported -> return@withContext SyncRequestResult.Unsupported + is SyncExportResult.Error -> + return@withContext SyncRequestResult.Error("prepare:${publication.message}") + is SyncExportResult.Exported -> Unit + } return@withContext when ( val result = SyncGenerationForegroundCoordinator(repository).run( canonicalExchangeDirectory(), diff --git a/tests/test_syncd_routing.py b/tests/test_syncd_routing.py index cdd7209..70c72de 100644 --- a/tests/test_syncd_routing.py +++ b/tests/test_syncd_routing.py @@ -81,7 +81,8 @@ class SyncdRoutingTest(unittest.TestCase): )[0] self.assertIn("SyncGenerationForegroundCoordinator(repository).run", production) self.assertNotIn("generation-opt-in", production) - self.assertNotIn("exportMobileBundle", production) + self.assertIn("exportMobileBundle", production) + self.assertIn("generation below", production) if __name__ == "__main__":