Skip to content

Commit 4fbf1d6

Browse files
committed
fix(workspaces): reattach the lock helper's TSDoc and correct it
The new gate was inserted between `lockWorkspaceCreationContext`'s doc block and the function, orphaning the doc onto the gate and leaving the lock helper undocumented. The doc was also stale: it described serializing 'the final creation-policy check', which no longer happens there. It now states what the function does enforce — the membership invariant the hoisted gate's verdict depends on.
1 parent 54925ae commit 4fbf1d6

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

‎apps/sim/lib/workspaces/policy.ts‎

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,6 @@ export class WorkspaceCreationCapabilityWithheldError extends WorkspaceCreationC
121121
}
122122
}
123123

124-
/**
125-
* Serializes the final creation-policy check with membership/ownership
126-
* mutations and row-locks the paid entitlement used by organization mode.
127-
* Returns the live billing owner. The caller must invoke this in the same
128-
* transaction as the workspace insert.
129-
*/
130124
/**
131125
* permission-group-enforced: workspace.create — the creation gate, deliberately
132126
* OUTSIDE the creation transaction.
@@ -168,6 +162,19 @@ export async function assertWorkspaceCreationCapability({
168162
}
169163
}
170164

165+
/**
166+
* Serializes the membership/ownership context with the workspace insert and
167+
* row-locks the paid entitlement used by organization mode. Returns the live
168+
* billing owner. The caller must invoke this in the same transaction as the
169+
* insert.
170+
*
171+
* The permission-group gate is NOT here — see
172+
* {@link assertWorkspaceCreationCapability}, which the caller runs before
173+
* opening the transaction. This function still enforces the invariant that
174+
* verdict depends on: it throws {@link WorkspaceCreationContextChangedError}
175+
* unless live membership still equals the `observedOrganizationId` the gate
176+
* was evaluated against.
177+
*/
171178
export async function lockWorkspaceCreationContext(
172179
tx: DbOrTx,
173180
{

0 commit comments

Comments
 (0)