feat(cdclient): servers open master's fdb copy, never the client's file

Worlds, the UGC server and the dashboard open the pair named in
resServer/cdclient-current (CDServer.sqlite without an fdb when there is
none). Worlds switch to a new pair on CDCLIENT_RELOAD between frames.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-29 23:19:55 -05:00
parent b05b84ff30
commit 1f87b2557d
6 changed files with 70 additions and 6 deletions

View File

@@ -168,3 +168,19 @@ TEST_F(FdbSnapshotTest, DescribeChangesNamesChangedTables) {
ASSERT_EQ(lines.size(), 1u);
EXPECT_EQ(lines[0], "Objects: 1 -> 1 rows (values changed)");
}
TEST_F(FdbSnapshotTest, ResolveNeverNamesTheClientsFile) {
auto resolved = FdbSnapshot::Resolve(Server());
EXPECT_EQ(resolved.sqlite, Server() / "CDServer.sqlite");
EXPECT_TRUE(resolved.fdb.empty());
// Named but not there yet: still the defaults
ASSERT_TRUE(FdbSnapshot::WriteCurrent(Server(), { FdbSnapshot::FdbName(7), FdbSnapshot::SqliteName(7) }));
EXPECT_TRUE(FdbSnapshot::Resolve(Server()).fdb.empty());
FdbTestWriter::WriteFile(Server() / FdbSnapshot::FdbName(7), { 1 });
FdbTestWriter::WriteFile(Server() / FdbSnapshot::SqliteName(7), { 1 });
resolved = FdbSnapshot::Resolve(Server());
EXPECT_EQ(resolved.sqlite, Server() / FdbSnapshot::SqliteName(7));
EXPECT_EQ(resolved.fdb, Server() / FdbSnapshot::FdbName(7));
}