(workspaceId: string)
| 29 | |
| 30 | /** The parent lineage node for a fork, or null when it has no live parent. */ |
| 31 | export async function getForkParent(workspaceId: string): Promise<ForkLineageNode | null> { |
| 32 | const parentId = await getForkParentId(workspaceId) |
| 33 | if (!parentId) return null |
| 34 | const [row] = await db |
| 35 | .select({ |
| 36 | id: workspace.id, |
| 37 | name: workspace.name, |
| 38 | organizationId: workspace.organizationId, |
| 39 | }) |
| 40 | .from(workspace) |
| 41 | .where(and(eq(workspace.id, parentId), isNull(workspace.archivedAt))) |
| 42 | .limit(1) |
| 43 | return row ?? null |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Resolve the strict fork edge between two workspaces, identifying which is the |
no test coverage detected