fix(projects): resolve legacy mutation aliases

This commit is contained in:
Mohamed Boudra
2026-07-29 10:59:01 +00:00
parent 7e43d90aa5
commit 7b9787a75d
5 changed files with 31 additions and 12 deletions

View File

@@ -52,6 +52,19 @@ describe("project settings target", () => {
expect(first).not.toBe(second);
});
it("preserves whitespace in opaque project IDs", () => {
const withoutTrailingSpace = resolveHostProjectSettingsRouteKey({
serverId: "host-a",
projectId: "/repo/foo",
});
const withTrailingSpace = resolveHostProjectSettingsRouteKey({
serverId: "host-a",
projectId: "/repo/foo ",
});
expect(withTrailingSpace).not.toBe(withoutTrailingSpace);
});
it("prefers an online host for a generic grouped settings route", () => {
const groupedProject = {
projectKey: "remote:github.com/acme/app",

View File

@@ -9,8 +9,8 @@ export function resolveHostProjectSettingsRouteKey(host: {
serverId: string;
projectId?: string;
}): string | null {
const projectId = host.projectId?.trim();
if (!projectId) return null;
const projectId = host.projectId;
if (!projectId?.trim()) return null;
return frameHostProjectKey({ serverId: host.serverId, projectId });
}

View File

@@ -170,6 +170,7 @@ export function normalizeWorkspaceDescriptor(
return {
id: normalizeWorkspaceOpaqueId(payload.id) ?? payload.id,
projectId: payload.projectId,
// COMPAT(projectKey): added in v0.2.4 on 2026-07-29; remove after 2027-01-29.
projectKey: payload.projectKey ?? payload.project?.projectKey ?? null,
projectDisplayName: payload.projectDisplayName,
projectCustomName: payload.projectCustomName ?? null,