Skip to content

Commit 03649e9

Browse files
authored
refactor(dev): remove the minimal-registry escape hatch (#6163)
* refactor(dev): remove the minimal-registry escape hatch `dev:minimal` existed because the tool registry was 71-82% of every workspace route's module graph and aliasing it away was the only way to make dev bearable. The metadata work removed that reason, so the hatch now buys almost nothing: before this stack 31.7s -> 20.0s cold (-37%) after this stack 22.9s -> 20.7s cold (-10%) A 10% cold-compile win, on the run that happens once — restarts are ~4.2s either way — is not worth what it costs. `tools/registry.minimal.ts` and `blocks/registry-maps.minimal.ts` are 283 lines of hand-curated duplicates of the real registries that **nothing keeps in sync** (no lint, no CI check, no test); they are correct today only because someone remembered. And the mode is actively misleading: it silently drops ~250 services and ~280 blocks, so anything reproduced under it may not reproduce for real. Removes both files, the `SIM_DEV_MINIMAL_REGISTRY` branch from `next.config.ts` (including the whole `webpack()` hook, which existed only for this), and the `dev:minimal` / `dev:full:minimal-registry` scripts. Verified after removal: `tsc` clean, boundary + metadata + skills + monorepo gates pass, and `next dev` starts and serves the canvas at 22.6s cold / HTTP 200. * fix(setup): stop the wizard offering the removed minimal-registry mode The setup wizard prompted for a dev server on machines under 16GB and **defaulted** to `dev:full:minimal-registry` — a script this stack deletes. Anyone running `bun run setup` on a low-RAM machine would have accepted the default and hit "Script not found", which is exactly the contributor the mode existed to help. Repointed at `dev:full:capped`, which still exists and caps Node at 4GB without dropping ~250 integrations — a strictly better answer to the same question. The hints were also stale: they warned the full registry "can use 4-5GB+ on its own", which was true when a dev server sat at 11.5GB. It now sits at ~4GB, so they say that instead. Missed by an earlier sweep because the pattern searched for `dev:minimal` and `registry.minimal`, and this string is `dev:full:minimal-registry` — the two halves reversed. Re-swept across every file type for all spellings: zero references remain. Also audited every script value the wizard can return, so the class of bug is checked, not just this instance.
1 parent e8894a8 commit 03649e9

6 files changed

Lines changed: 6 additions & 333 deletions

File tree

apps/sim/blocks/registry-maps.minimal.ts

Lines changed: 0 additions & 93 deletions
This file was deleted.

apps/sim/next.config.ts

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,6 @@ import {
88
getWorkflowExecutionCSPPolicy,
99
} from './lib/core/security/csp'
1010

11-
/**
12-
* Dev-only escape hatch: when `SIM_DEV_MINIMAL_REGISTRY=1` (`bun run dev:minimal`),
13-
* swap the heavy block and tool registries for tiny curated variants via a
14-
* Turbopack/webpack resolve alias.
15-
*
16-
* The tool registry (4,351 entries across 261 service dirs) pulls ~5,907 modules
17-
* and is 68-78% of every workspace route's module graph; aliasing it away takes
18-
* `app/workspace/layout.tsx` from 5,916 modules to 1,255. Blocks are NOT a
19-
* co-equal cost - `blocks/registry-maps` alone accounts for ~349 modules and
20-
* mostly rides in behind the tool registry.
21-
*
22-
* It is reached through ONE choke point (`tools/utils.ts` → `@/tools/registry`)
23-
* fed by four redundant client-reachable edges: providers/utils → tools/params,
24-
* lib/workflows/blocks/block-outputs, lib/workflows/sanitization/validation, and
25-
* serializer/index. All four must be severed for any of them to matter, which is
26-
* why cutting only the providers/utils edge buys a single module.
27-
*
28-
* Only the curated core blocks/tools work in this mode. Never enabled in
29-
* production - the minimal variants genuinely drop ~250 services and ~280 blocks.
30-
*/
31-
const useMinimalRegistry = isDev && process.env.SIM_DEV_MINIMAL_REGISTRY === '1'
32-
const minimalRegistryAlias: Record<string, string> = useMinimalRegistry
33-
? {
34-
'@/tools/registry': './tools/registry.minimal.ts',
35-
'@/blocks/registry-maps': './blocks/registry-maps.minimal.ts',
36-
}
37-
: {}
38-
3911
/**
4012
* Marketing routes (`app/(landing)/**`, plus the root) exempted from COEP.
4113
*
@@ -77,20 +49,6 @@ const nextConfig: NextConfig = {
7749
productionBrowserSourceMaps: true,
7850
turbopack: {
7951
root: path.join(import.meta.dirname, '../..'),
80-
resolveAlias: minimalRegistryAlias,
81-
},
82-
webpack: (config) => {
83-
if (useMinimalRegistry) {
84-
config.resolve.alias = {
85-
...config.resolve.alias,
86-
'@/tools/registry$': path.resolve(import.meta.dirname, 'tools/registry.minimal.ts'),
87-
'@/blocks/registry-maps$': path.resolve(
88-
import.meta.dirname,
89-
'blocks/registry-maps.minimal.ts'
90-
),
91-
}
92-
}
93-
return config
9452
},
9553
images: {
9654
formats: ['image/avif', 'image/webp'],

apps/sim/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
},
1010
"scripts": {
1111
"dev": "bun run dev:cache:cap && next dev --port 3000",
12-
"dev:minimal": "bun run dev:cache:cap && SIM_DEV_MINIMAL_REGISTRY=1 next dev --port 3000",
1312
"dev:capped": "bun run dev:cache:cap && NODE_OPTIONS='--max-old-space-size=4096' next dev --port 3000",
1413
"dev:cache:cap": "bun run ../../scripts/prune-turbopack-cache.ts",
1514
"dev:clean": "rm -rf .next/dev/cache",

apps/sim/tools/registry.minimal.ts

Lines changed: 0 additions & 190 deletions
This file was deleted.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
"dev": "turbo run dev",
1717
"dev:sockets": "cd apps/realtime && bun run dev",
1818
"dev:full": "bunx concurrently -n \"App,Realtime\" -c \"cyan,magenta\" \"cd apps/sim && bun run dev\" \"cd apps/realtime && bun run dev\"",
19-
"dev:full:minimal-registry": "bunx concurrently -n \"App,Realtime\" -c \"cyan,magenta\" \"cd apps/sim && bun run dev:minimal\" \"cd apps/realtime && bun run dev\"",
2019
"dev:full:capped": "bunx concurrently -n \"App,Realtime\" -c \"cyan,magenta\" \"cd apps/sim && bun run dev:capped\" \"cd apps/realtime && bun run dev\"",
2120
"test": "turbo run test",
2221
"format": "turbo run format",

scripts/setup/modes/dev.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,17 +163,17 @@ export async function runDevMode(
163163
message: `Low RAM detected (${detection.specs.hostMemGb}GB) — which dev server?`,
164164
options: [
165165
{
166-
value: 'dev:full:minimal-registry',
167-
label: 'Minimal block registry (recommended)',
168-
hint: 'much lower memory — loads fewer integration blocks in dev',
166+
value: 'dev:full:capped',
167+
label: 'Capped heap (recommended)',
168+
hint: 'caps Node at 4GB — every integration still available',
169169
},
170170
{
171171
value: 'dev:full',
172-
label: 'Full registry',
173-
hint: 'every block available — can use 4-5GB+ on its own',
172+
label: 'Uncapped',
173+
hint: 'lets the dev server take what it needs (~4GB typical)',
174174
},
175175
],
176-
initialValue: 'dev:full:minimal-registry',
176+
initialValue: 'dev:full:capped',
177177
})
178178
}
179179
return {

0 commit comments

Comments
 (0)