Skip to content

Commit a6198f2

Browse files
authored
v0.9.6: search improvements, forking fixes, tables correctness
2 parents ae75043 + 3533353 commit a6198f2

234 files changed

Lines changed: 38668 additions & 9267 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/test-build.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ jobs:
377377
- name: Install ripgrep
378378
run: command -v rg || (sudo apt-get update && sudo apt-get install -y ripgrep)
379379

380-
# Runs the setup CLI's Bun tests plus each workspace's Vitest suite,
380+
# Runs the root scripts and each workspace's Vitest suite,
381381
# without `--coverage`.
382382
- name: Run tests
383383
env:

‎apps/docs/content/docs/platform/enterprise/forks.mdx‎

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ On Sim Cloud, your organization may also need the feature turned on for your acc
2929

3030
### 1. Open Forks
3131

32-
Go to **Settings → Organization → Workspace forks** in the workspace you want to fork from (or manage).
32+
Go to **Settings → Workspace → Workspace forks** in the workspace you want to fork from (or manage).
3333

3434
<Image src="/static/enterprise/forks-list.png" alt="Workspace Forks settings page showing Parent and Forks sections with Docs, See activity, and Create fork actions" width={900} height={369} />
3535

@@ -57,12 +57,12 @@ Everything under **Copy resources** starts **selected**. That is usually what yo
5757
Click **Fork**. The child workspace is created immediately. Deployed workflows land as **drafts** in the child. Large content (table rows, knowledge base files, file blobs) may finish copying in the background — watch **Activity** on the source workspace.
5858

5959
<Callout type="info">
60-
Only **deployed** workflows are forked. Drafts and undeployed work stay in the parent. If the parent has nothing deployed, the child starts with a blank starter workflow.
60+
Only **deployed** workflows are forked, and only the ones that are [synced](#synced-workflows). Drafts and undeployed work stay in the parent. If there is nothing to copy, the child starts with a blank starter workflow.
6161
</Callout>
6262

6363
### 3. Open the parent edge (from the child)
6464

65-
Open the **child** workspace → **Settings → Organization → Workspace forks**. On the **Parent** row, open the menu and choose **Edit mappings**.
65+
Open the **child** workspace → **Settings → Workspace → Workspace forks**. On the **Parent** row, open the menu and choose **Edit mappings**.
6666

6767
Child rows (when you are on the parent) only offer **Open workspace** and **Disconnect** — mapping and sync are owned by the child configuring how it relates to its parent.
6868

@@ -117,16 +117,35 @@ On success you will see a toast such as **Pushed to "…"** or **Pulled from "
117117

118118
---
119119

120-
## Excluded workflows
120+
## Synced workflows
121121

122-
The **Excluded workflows** section on the Forks page lists this workspace's deployed workflows in their sidebar folder structure. Check a workflow — or a whole folder at once — to keep it out of forking entirely. Think of it as a `.gitignore` for syncs:
122+
The **Synced workflows** section on the Forks page lists this workspace's deployed workflows in their sidebar folder structure, each with a checkbox. **Checked means the workflow syncs.** Uncheck one — or a whole folder at once — to keep it out of forking entirely. Think of an unchecked workflow as `.gitignore`d:
123123

124124
- **Never sent** — pushes from this workspace do not carry it, the other side pulling from this workspace does not receive it, and creating a new fork does not copy it
125-
- **Never touched** — a sync into this workspace will not overwrite or archive it, even if its counterpart was deleted on the other side
125+
- **Never touched** — a sync into this workspace will not overwrite or archive it, even if its counterpart was deleted on the other side. It stays deployed and keeps serving, and a previously-synced counterpart on the other side keeps running on its last deployed version.
126126

127-
The setting belongs to **this workspace's copy** only. Excluding a workflow here does not exclude its counterpart in the parent or a fork — each workspace manages its own list. If the pair has synced before, the link between them is kept, so un-excluding later resumes updating the same counterpart instead of creating a duplicate.
127+
The checkbox list belongs to **this workspace's copy** only. Unchecking a workflow here does not unsync its counterpart in the parent or a fork — each workspace manages its own list. If the pair has synced before, the link between them is kept, so re-checking later resumes updating the same counterpart instead of creating a duplicate.
128128

129-
**Example:** a staging fork excludes `Scratch experiment` so it can never reach production, and production excludes `Billing hotfix` so no push from staging can ever overwrite it.
129+
On the sync page, unsynced workflows still appear in the **Deployed workflows** list, greyed out, with a tooltip naming which workspace they are unsynced in. The sync will not touch them.
130+
131+
**Example:** a staging fork leaves `Scratch experiment` unchecked so it can never reach production, and production leaves `Billing hotfix` unchecked so no push from staging can ever overwrite it.
132+
133+
### Sync new workflows by default
134+
135+
Above the list, **Sync new workflows by default** decides where a **newly created** workflow starts:
136+
137+
| Setting | A new workflow… |
138+
|---------|-----------------|
139+
| **Sync** (default) | joins fork sync — it arrives checked and syncs as soon as you deploy it |
140+
| **Don't sync** | starts outside fork sync — it arrives unchecked and only syncs after you check it |
141+
142+
Three things to know:
143+
144+
- **It applies to the whole fork lineage.** The toggle writes every workspace in the lineage — the root, every ancestor, every descendant — so a parent and its forks can never disagree about what "new" means. Any workspace admin in the lineage can change it, and each workspace whose value changes gets its own audit entry naming the workspace the change came from. A new fork inherits the value at creation.
145+
- **It is forward-only.** Flipping it never moves an existing workflow in or out of sync. The checkbox list above stays the record of what syncs.
146+
- **"New" means genuinely new.** Creating, duplicating, or importing a workflow takes this setting, as does the blank starter workflow a fork gets when there is nothing to copy. A workflow that arrives as a **copy** — from a fork, or from a push or pull — ignores this setting. Only synced workflows are copied, and they always arrive synced, so a workflow you deliberately synced never lands unsynced on the other side.
147+
148+
**Example:** a template workspace turns this off so every scratch workflow the team creates stays local, then checks only the handful meant to reach the forks.
130149

131150
---
132151

@@ -155,6 +174,8 @@ Expand a row for names of workflows and resources that were created, updated, or
155174
|--------|-----|
156175
| See Forks / create a fork | Admin on this workspace (+ feature available) |
157176
| Sync / edit mappings | Admin on **both** sides of the edge |
177+
| Check / uncheck **Synced workflows** | Admin on the workspace those workflows live in |
178+
| Change **Sync new workflows by default** | Admin on any one workspace in the lineage — the change applies to every member |
158179
| Rollback | Admin on the workspace the sync landed in |
159180
| Disconnect | Admin on **this** side only (you can disconnect even without access to the other workspace) |
160181
| Open the other workspace | You must be a member of that workspace |
@@ -169,9 +190,9 @@ How each resource behaves at **fork** time vs **sync** time. Use this when you a
169190

170191
| Resource | Fork | Sync |
171192
|----------|------|------|
172-
| Deployed workflows | Copied as drafts (unless excluded) | Updated / created / archived (force overwrite) |
193+
| Deployed workflows | Copied as drafts when [synced](#synced-workflows) | Updated / created / archived (force overwrite) |
173194
| Undeployed workflows | Not copied | Not synced |
174-
| [Excluded workflows](#excluded-workflows) | Never | Never — not sent, not overwritten, not archived |
195+
| [Unsynced workflows](#synced-workflows) | Never | Never — not sent, not overwritten, not archived |
175196
| Files | Optional copy (default on) | Map or copy |
176197
| File folders referenced by workflows | Mirrored with their ancestor folders, even when empty | Map by canonical path |
177198
| Tables | Optional copy (default on) | Map or copy |
@@ -191,11 +212,11 @@ How each resource behaves at **fork** time vs **sync** time. Use this when you a
191212

192213
### Workflows
193214

194-
Only **deployed** workflows move. Deploy is the commit; sync is the force push/pull of those commits. Workflows marked [excluded](#excluded-workflows) never move in either direction.
215+
Only **deployed** workflows move, and only the ones checked under [Synced workflows](#synced-workflows). An unsynced workflow never moves in either direction.
195216

196217
| Feature | Behavior |
197218
|---|----------|
198-
| **Fork** | Each deployed workflow becomes a **draft** in the child. Run history is not copied. Only folders that contain a copied workflow are kept. |
219+
| **Fork** | Each synced deployed workflow becomes a **draft** in the child. Run history is not copied. Only folders that contain a copied workflow are kept. |
199220
| **Sync** | The change list shows what will be updated, created, or archived. The target is overwritten for those workflows. |
200221

201222
**Example:** Parent has `Support triage` deployed and `WIP experiment` as a draft. The fork gets only `Support triage` as a draft. A later push updates the child from the parent’s latest deploy of `Support triage`.
@@ -370,13 +391,16 @@ Schedules, webhooks, and triggers are not live in the child until you **deploy**
370391
- **Rollback ≠ undo copies** — Workflow versions roll back; copied resources can remain as orphans.
371392
- **Disconnect is permanent** — You cannot “reconnect” the same edge; you would fork again into a new workspace.
372393
- **No grandparent sync** — Only the direct parent↔child pair.
394+
- **The sync default is lineage-wide** — **Sync new workflows by default** is one shared setting for the whole lineage, so changing it from a fork also changes it in the parent and every sibling fork.
373395

374396
---
375397

376398
<FAQ items={[
377399
{ question: "Why is Sync greyed out?", answer: "Usually a blocking reference, an unmapped credential or secret, or a required dependent field (label, channel, document, …) still empty. Open Blocking sync and the mapping sections — each row explains what to fix. Sync also stays disabled while details are loading or if loading failed (reload the page)." },
378400
{ question: "Is sync a merge?", answer: "No. Deploy is like a commit; sync is a force push or force pull of deployed workflows onto the target. Use Rollback only for the last sync into a workspace, and remember copied resources may remain." },
379-
{ question: "Who can disconnect a fork I cannot open?", answer: "Any admin on your side of the edge. Disconnect does not require access to the other workspace — so you are not stuck if the other side lost membership." }
401+
{ question: "Who can disconnect a fork I cannot open?", answer: "Any admin on your side of the edge. Disconnect does not require access to the other workspace — so you are not stuck if the other side lost membership." },
402+
{ question: "I deployed a new workflow and sync ignored it. Why?", answer: "Sync new workflows by default is off for this fork lineage, so the workflow was created outside fork sync. Open Settings → Workspace → Workspace forks and check it under Synced workflows. Turning the toggle back on only affects workflows created after that — it never moves an existing one." },
403+
{ question: "Does turning Sync new workflows by default off stop my current syncs?", answer: "No. It is forward-only and never rewrites an existing workflow's checkbox, so everything already synced keeps syncing. It also applies to every workspace in the fork lineage, not just the one you changed it from." }
380404
]} />
381405

382406
---
@@ -389,4 +413,4 @@ Self-hosted deployments turn Forks on with an environment variable instead of th
389413
|----------|-------------|
390414
| `FORKING_ENABLED`, `NEXT_PUBLIC_FORKING_ENABLED` | Enables workspace forking when billing is not used as the entitlement gate |
391415

392-
Once enabled, use the same **Settings → Organization → Workspace forks** UI as Sim Cloud. Only workspace admins can manage forks.
416+
Once enabled, use the same **Settings → Workspace → Workspace forks** UI as Sim Cloud. Only workspace admins can manage forks.

‎apps/sim/app/api/superuser/import-workflow/route.ts‎

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { loadCopilotChatMessages } from '@/lib/mothership/chat/lifecycle'
1212
import { appendCopilotChatMessages } from '@/lib/mothership/chat/messages-store'
1313
import { verifyEffectiveSuperUser } from '@/lib/permissions/super-user'
1414
import { parseWorkflowJson } from '@/lib/workflows/operations/import-export'
15+
import { buildNewWorkflowRow } from '@/lib/workflows/persistence/new-workflow-row'
1516
import {
1617
loadWorkflowFromNormalizedTables,
1718
saveWorkflowToNormalizedTables,
@@ -129,27 +130,23 @@ export const POST = withRouteHandler(async (request: NextRequest) => {
129130

130131
// Create new workflow record
131132
const newWorkflowId = generateId()
132-
const now = new Date()
133133
const dedupedName = await deduplicateWorkflowName(
134134
`[Debug Import] ${sourceWorkflow.name}`,
135135
targetWorkspaceId,
136136
null
137137
)
138138

139-
await db.insert(workflow).values({
140-
id: newWorkflowId,
141-
userId: session.user.id,
142-
workspaceId: targetWorkspaceId,
143-
folderId: null,
144-
name: dedupedName,
145-
description: sourceWorkflow.description,
146-
lastSynced: now,
147-
createdAt: now,
148-
updatedAt: now,
149-
isDeployed: false, // Never copy deployment status
150-
runCount: 0,
151-
variables: sourceWorkflow.variables || {},
152-
})
139+
await db.insert(workflow).values(
140+
await buildNewWorkflowRow(db, {
141+
id: newWorkflowId,
142+
userId: session.user.id,
143+
workspaceId: targetWorkspaceId,
144+
folderId: null,
145+
name: dedupedName,
146+
description: sourceWorkflow.description,
147+
variables: sourceWorkflow.variables || {},
148+
})
149+
)
153150

154151
// Save using existing persistence logic
155152
const saveResult = await saveWorkflowToNormalizedTables(newWorkflowId, importedData, {

‎apps/sim/app/api/v1/admin/workflows/import/route.ts‎

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { adminV1ImportWorkflowContract } from '@/lib/api/contracts/v1/admin'
3030
import { parseRequest } from '@/lib/api/server'
3131
import { withRouteHandler } from '@/lib/core/utils/with-route-handler'
3232
import { parseWorkflowJson } from '@/lib/workflows/operations/import-export'
33+
import { buildNewWorkflowRow } from '@/lib/workflows/persistence/new-workflow-row'
3334
import { prepareWorkflowStateForPersistence } from '@/lib/workflows/persistence/prepare-state'
3435
import { saveWorkflowToNormalizedTables } from '@/lib/workflows/persistence/utils'
3536
import { deduplicateWorkflowName } from '@/lib/workflows/utils'
@@ -112,23 +113,18 @@ export const POST = withRouteHandler(
112113
)
113114

114115
const workflowId = generateId()
115-
const now = new Date()
116116
const dedupedName = await deduplicateWorkflowName(workflowName, workspaceId, folderId || null)
117117

118-
await db.insert(workflow).values({
119-
id: workflowId,
120-
userId: workspaceData.ownerId,
121-
workspaceId,
122-
folderId: folderId || null,
123-
name: dedupedName,
124-
description: workflowDescription,
125-
lastSynced: now,
126-
createdAt: now,
127-
updatedAt: now,
128-
isDeployed: false,
129-
runCount: 0,
130-
variables: {},
131-
})
118+
await db.insert(workflow).values(
119+
await buildNewWorkflowRow(db, {
120+
id: workflowId,
121+
userId: workspaceData.ownerId,
122+
workspaceId,
123+
folderId: folderId || null,
124+
name: dedupedName,
125+
description: workflowDescription,
126+
})
127+
)
132128

133129
/**
134130
* Same normalization the editor and the v1 import API run, via the one

‎apps/sim/app/api/v1/admin/workspaces/[id]/import/route.ts‎

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import {
4545
extractWorkflowsFromZip,
4646
parseWorkflowJson,
4747
} from '@/lib/workflows/operations/import-export'
48+
import { buildNewWorkflowRow } from '@/lib/workflows/persistence/new-workflow-row'
4849
import { prepareWorkflowStateForPersistence } from '@/lib/workflows/persistence/prepare-state'
4950
import { saveWorkflowToNormalizedTables } from '@/lib/workflows/persistence/utils'
5051
import { deduplicateWorkflowName } from '@/lib/workflows/utils'
@@ -347,23 +348,18 @@ async function importSingleWorkflow(
347348
}
348349

349350
const workflowId = generateId()
350-
const now = new Date()
351351
const dedupedName = await deduplicateWorkflowName(workflowName, workspaceId, targetFolderId)
352352

353-
await db.insert(workflow).values({
354-
id: workflowId,
355-
userId: ownerId,
356-
workspaceId,
357-
folderId: targetFolderId,
358-
name: dedupedName,
359-
description: workflowData.metadata?.description || 'Imported via Admin API',
360-
lastSynced: now,
361-
createdAt: now,
362-
updatedAt: now,
363-
isDeployed: false,
364-
runCount: 0,
365-
variables: {},
366-
})
353+
await db.insert(workflow).values(
354+
await buildNewWorkflowRow(db, {
355+
id: workflowId,
356+
userId: ownerId,
357+
workspaceId,
358+
folderId: targetFolderId,
359+
name: dedupedName,
360+
description: workflowData.metadata?.description || 'Imported via Admin API',
361+
})
362+
)
367363

368364
/**
369365
* Same normalization the editor, the v1 import API and the single-workflow
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { updateForkSyncDefaultContract } from '@/lib/api/contracts/workspace-fork'
2+
import {
3+
defineInternalJsonRoute,
4+
internalRateLimits,
5+
internalSessionAuth,
6+
} from '@/lib/api/server/routes'
7+
import { internalForkErrorPolicy } from '@/ee/workspace-forking/api/route-policies'
8+
import { forkOperations } from '@/ee/workspace-forking/application/operations'
9+
import { setForkSyncDefault } from '@/ee/workspace-forking/application/sync-default'
10+
11+
export const PUT = defineInternalJsonRoute({
12+
contract: updateForkSyncDefaultContract,
13+
auth: internalSessionAuth,
14+
operation: forkOperations.syncDefault,
15+
/**
16+
* Rate-limited, unlike sibling fork routes: it writes the whole lineage under the coarsest
17+
* fork lock, so looping it could starve fork creation lineage-wide.
18+
*/
19+
rateLimit: internalRateLimits.user({ bucketName: 'workspace-fork-sync-default' }),
20+
errorPolicy: internalForkErrorPolicy,
21+
mapInput: ({ params, body }) => ({ workspaceId: params.id, ...body }),
22+
present: ({ excludeNewWorkflows, changedWorkspaces }) => ({
23+
excludeNewWorkflows,
24+
workspacesUpdated: changedWorkspaces.length,
25+
}),
26+
useCase: setForkSyncDefault,
27+
})

0 commit comments

Comments
 (0)