Files
paseo/packages/app/src/projects/project-key.ts
T
Mohamed Boudra 649592fe73 fix(projects): restore project key as grouping identity
Random host-local project IDs had replaced the persisted cross-host value carried by projectKey. Keep projectId for routing while reconciliation owns and persists projectKey for grouping.
2026-07-29 09:12:08 +00:00

16 lines
712 B
TypeScript

export function resolveProjectKey(input: {
serverId: string;
projectId: string;
projectKey?: string | null;
}): string {
if (input.projectKey) return input.projectKey;
// COMPAT(projectKey): added in v0.2.4 on 2026-07-28; remove after 2027-01-28.
// Older daemons used remote/path-shaped project IDs as their grouping key. New opaque IDs
// must remain host-local when the new field is absent.
return input.projectId.startsWith("prj_") ? frameHostProjectKey(input) : input.projectId;
}
export function frameHostProjectKey(input: { serverId: string; projectId: string }): string {
return `host:${input.serverId.length}:${input.serverId}:project:${input.projectId.length}:${input.projectId}`;
}