fix(foundry): migrate legacy grid settings safely

This commit is contained in:
Codex
2026-08-09 10:59:57 +03:00
parent 58800d9576
commit 7025fd20b5
2 changed files with 43 additions and 3 deletions
+26
View File
@@ -98,6 +98,32 @@ test("flat layouts migrate mode-aware extensions while explicit invalid hierarch
);
});
test("Robot2B legacy radius migrates per LOD without hiding the application", () => {
const legacyRobot2BSettings = {
gridHeightMeters: 500,
gridLod1MaxHeightKm: 10,
gridLod1StepKm: 1,
gridLod2MaxHeightKm: 50,
gridLod2StepKm: 5,
gridLod3StepKm: 25,
gridRadiusKm: 1_000,
gridLineWidth: 4,
gridColor: "#f5f5f5",
gridOpacity: 12,
gridDotsEnabled: true,
gridDotsSize: 7,
gridDotsColor: "#ffffff",
gridDotsOpacity: 58,
};
const migrated = structuredClone(serverGrid.validateGridLodProfiles(
serverGrid.promoteLegacyGridLodProfiles(legacyRobot2BSettings),
));
assert.deepEqual(migrated.map((profile) => profile.radiusKm), [50, 1_000, 1_000, 1_000, 100]);
assert.ok(migrated.every((profile) => profile.radiusKm / profile.stepKm <= 512));
assert.ok(migrated.every((profile) => profile.graticuleLineWidthPx === 3));
});
test("Foundry MCP exposes every persisted sector-v2 profile field", () => {
for (const key of extensionKeys) assert.match(mcpSource, new RegExp(`\\b${key}: \\{`));
});