Skip to content

Commit 5245be8

Browse files
committed
Merge branch 'wip/fix-gates' into wip/platform-org-wiring
2 parents 9df253f + 418cfa3 commit 5245be8

19 files changed

Lines changed: 975 additions & 83 deletions

‎.claude/rules/sim-platform-views.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ paths:
44
- "apps/sim/platform/embedded/app/(shell)/{settings,people,integrations,links,home}/**"
55
- "apps/sim/platform/design-system/components/{status,modal,picker,settings-section,search-field,activity-row}/**"
66
- "apps/sim/app/o/*/**"
7+
- "apps/sim/app/o/*/settings/**"
78
---
89

910
# Organization Views

‎.cursor/rules/sim-platform-views.mdc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
description: "One pattern per job across the organization views (Settings, People, Integrations, Links, Home)"
3-
globs: ["apps/sim/platform/embedded/app/(shell)/{settings,people,integrations,links,home}/**","apps/sim/platform/design-system/components/{status,modal,picker,settings-section,search-field,activity-row}/**","apps/sim/app/o/*/**"]
3+
globs: ["apps/sim/platform/embedded/app/(shell)/{settings,people,integrations,links,home}/**","apps/sim/platform/design-system/components/{status,modal,picker,settings-section,search-field,activity-row}/**","apps/sim/app/o/*/**","apps/sim/app/o/*/settings/**"]
44
---
55

66
<!-- Generated from .claude/rules/sim-platform-views.md by `bun run skills:sync`. Edit the source, not this file. -->

‎.github/CI.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,12 @@ WebKit acceptance on Blacksmith uses the matching, digest-pinned Playwright brow
4040

4141
HTTP and docs browser installation first asks the pinned Playwright driver to simulate its OS dependency installation. When the simulation requires no package changes, the runner avoids an apt update; missing dependencies, proposed upgrades, or an unsuccessful simulation use the normal dependency installer. Browser selection and downloads still use the pinned driver, including full native Chromium for extension acceptance.
4242

43+
`app/o` bundles `platform/embedded` and `platform/design-system`, so both are build and `ci:shared` inputs: an edit to either changes the build hash and selects every boundary. The Platform zone (`platform/{app,lib,fixtures,checks,docs,preview,public}` and its own configs) is a separate Next app that the embedded tree may not import, reached only through the `/org` rewrite, and is excluded by name so that a new `platform/` folder stays an input until it is declared zone-only. A zone-only edit selects `platform-design.yml` and the app's unit tests, and no main-app build or acceptance job.
44+
4345
Every HTTP and browser group consumes the same production build in an isolated job/database. Electron also uses that build and skips its development-route warm-up. Local HTTP and Electron development runs retain their dev-server behavior. Build inputs exclude test-only files so a harness edit can reuse an unchanged production build.
4446

47+
The Platform's fixture and live suites stay in `platform-design.yml`, outside `checks / ci`. The HTTP and production matrices consume one `next-build` artifact, built without `SIM_PLATFORM_ORIGIN`, while the `zone` topology bakes that origin into its rewrite and also builds the Platform app, so it needs its own job, gate flag and plan output rather than a suite entry. A task that depends on `ci:shared` would select two 16-vCPU jobs of up to 75 minutes for nearly every app PR and hold every staging push's deployment gate on them. The cost is that a red run is advisory, and a path-filtered workflow cannot be a required check: one that never starts never reports, so the status does not block a merge until the suite joins the aggregate.
48+
4549
Desktop inbox protocol, assistant actions UI, and organization search UI run as three parallel HTTP jobs with isolated databases, apps, and reports. Each harness owns its acceptance task, so an edit selects its own job. The inbox protocol task depends on server and realtime code; the browser tasks also depend on workspace UI. Desktop inbox needs no browser. The UI jobs and browser extension install Chromium while their app starts, waiting for both before executing assertions; browser-install failures still fail the job and preserve the install log. No acceptance assertions are removed by the split.
4650

4751
Live Electron acceptance tracks its live-app suite, fixtures, and Playwright configuration separately from shell-only smoke tests. Changing a shell-only smoke case runs the dedicated desktop workflow without starting the app's production build and live lease checks.

‎.github/scripts/http-e2e.sh‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,9 @@ start_platform() {
170170
# platform_live_environment: one hosted Enterprise organization, the deterministic seed its specs
171171
# read, and a scripted worker in place of the model. Hosted is decided by the app's hostname, which
172172
# the job maps to loopback. Google and Microsoft answer only to real credentials, so those clients
173-
# are fixtures, and what no fixture can reach is reported by the specs as a skip.
173+
# are fixtures, and what no fixture can reach is reported by the specs as a skip. Each group starts
174+
# the realtime server after its app, as org-redesign does, and holds the same tripwire and tool
175+
# permissions, so a route that passes one suite cannot fail on the same stack in the other.
174176
platform_live_environment() {
175177
app_server=start
176178
export REDIS_URL=redis://127.0.0.1:6379
@@ -186,6 +188,9 @@ platform_live_environment() {
186188
export NEXT_PUBLIC_ACCESS_CONTROL_ENABLED=true
187189
export SIM_LINKS=true PEOPLE=true
188190
export INTERNAL_API_SECRET=platform-live-ci-local-secret-at-least-32-characters
191+
export COPILOT_TOOL_PERMISSIONS_ENABLED=true
192+
export DB_TX_TRIPWIRE=throw
193+
export NEXT_PUBLIC_SOCKET_URL=http://127.0.0.1:3030 SOCKET_SERVER_URL=http://127.0.0.1:3030
189194
export COPILOT_API_KEY=platform-live-ci-local-copilot-key MOTHERSHIP_SIM_TRANSPORT=direct
190195
export SIM_AGENT_API_URL=http://127.0.0.1:3029
191196
export GOOGLE_CLIENT_ID=platform-live-google-client GOOGLE_CLIENT_SECRET=platform-live-google-secret
@@ -491,6 +496,7 @@ JS
491496
export SIM_PLATFORM_ORIGIN=http://127.0.0.1:3028
492497
start_browser_install platform-live --only-shell chromium
493498
PLATFORM_ORG_UI=true start_app platform-live 3027 'Platform main' record-http-status
499+
start_realtime platform-live 3030
494500
start_platform 3028
495501
bun --no-env-file platform/checks/live/support/scripted-agent.ts 3029 \
496502
> "$report_dir/platform-live-agent.log" 2>&1 &
@@ -510,6 +516,7 @@ JS
510516
export PLATFORM_ORG_UI=true
511517
start_browser_install platform-live --only-shell chromium
512518
start_app platform-live-flag-off 3027 'Main, no zone' record-http-status
519+
start_realtime platform-live-flag-off 3030
513520
wait_for_browsers
514521
run_platform_live flag-off platform-live-flag-off
515522
;;

‎.github/workflows/platform-design.yml‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,35 @@ name: platform-design
22

33
on:
44
pull_request:
5+
# The zone and the seam it reads through: the main app that mounts and proxies it, the contracts,
6+
# hooks and enterprise domains its data layer wraps, and the chat modules it drives unchanged.
7+
# A pattern's order matters: the ledger follows the docs exclusion so an edit to it still meets
8+
# the report-based parity check. `*` stands for `[workspaceId]`, which a filter would read as a
9+
# character class.
510
paths:
611
- 'apps/sim/platform/**'
712
- '!apps/sim/platform/docs/**'
813
- '!apps/sim/platform/README.md'
14+
- 'apps/sim/platform/docs/org-parity.md'
15+
- 'apps/sim/app/o/**'
16+
- 'apps/sim/lib/platform/**'
17+
- 'apps/sim/proxy.ts'
18+
- 'apps/sim/next.config.ts'
19+
- 'apps/sim/lib/api/contracts/**'
20+
- 'apps/sim/hooks/queries/**'
21+
- 'apps/sim/ee/**'
22+
- 'apps/sim/app/workspace/*/home/hooks/**'
23+
- 'apps/sim/app/workspace/*/home/types.ts'
24+
- 'apps/sim/app/workspace/*/home/search-params.ts'
25+
- 'apps/sim/app/workspace/*/home/components/message-content/**'
26+
- 'apps/sim/app/workspace/*/home/components/knowledge-search-results/utils.ts'
27+
- 'apps/sim/app/workspace/*/w/*/components/panel/components/copilot/components/user-input/hooks/**'
28+
- 'apps/sim/scripts/platform-live-seed.ts'
929
- 'apps/sim/package.json'
30+
- 'apps/realtime/**'
1031
- 'scripts/check-platform-design*'
32+
- 'scripts/check-platform-parity*'
33+
- 'scripts/platform-search-source-catalog.ts'
1134
- 'scripts/platform-variant-usage.ts'
1235
- 'scripts/sync-platform-*.ts'
1336
- '.github/workflows/platform-design.yml'

‎apps/sim/platform/AGENTS.md‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Platform design contract
22

3-
Applies to this independent Next.js application. In this tree “EMCN” means the Sim Platform design system in `design-system/`. The existing app and `packages/emcn` remain isolated. For new work or design drift, run the repository's `$implement-platform` skill. Its Paper companion is `$sim-paper-design`. Never import the legacy app, styles, chrome, business logic or providers across this boundary. Real data crosses only through the [data seam](#phase-3-data-seam).
3+
Applies to this independent Next.js application, the zone served at `/org`, and to `design-system/`. `embedded/` is not part of that application; it has [its own section](#embedded-in-the-organization-surface). In this tree “EMCN” means the Sim Platform design system in `design-system/`. The existing app and `packages/emcn` remain isolated. For new work or design drift, run the repository's `$implement-platform` skill. Its Paper companion is `$sim-paper-design`. Never import the legacy app, styles, chrome, business logic or providers across this boundary. Real data crosses only through the [data seam](#phase-3-data-seam).
44

55
## Ownership
66

@@ -74,7 +74,13 @@ Gates live on the server and arrive as data. Hiding an entry is navigation, not
7474

7575
## Embedded in the organization surface
7676

77-
The main app's `app/o/[organizationId]/` also mounts these views, on routes flag-off organizations still use. That route is the only legacy code that may import `@/platform/*`; `check:platform-css` holds every other entry out. Whatever needs legacy chrome (`WorkspaceChrome`, the legacy composer, Search's source cards) lives in `platform/embedded/`, which holds the organization surface's own views and data and which the zone never imports. A view shared by both takes what differs as props or slots. `lib/data` modules read `useOrganization()`, which the host's layout fills from the same surface read this app makes, with `routePrefix` set to `/o/<id>`, so `surfaceHref` and `legacyRoutes` serve both. Notices go through `usePlatformNotices`, which a host may redirect, and `PlatformSurface` collapses inside another, so a part can wrap itself when it alternates with legacy chrome.
77+
`embedded/` holds the organization views and their data (`embedded/app`, `embedded/lib`). It is not a Next app and has no pages: the main app's `app/o/[organizationId]/` routes mount it, for every organization, whatever the `platform-org-ui` flag says. An edit here ships in the main app's build. It is built on the host, not on this project: it imports the host's hooks, stores, providers and packages, legacy chrome included (`WorkspaceChrome`, the legacy composer, Search's source cards), and the data seam and seam closure do not apply to it. `check:boundaries` sets its own seam: views read data through `embedded/lib/data`, and that layer points away from views and routes.
78+
79+
The zone and `embedded/` share only `design-system/`. Neither imports the other, not even for a type (`check:platform-design` rule `zone-embedded`, `check:boundaries` rule 7), so a change to a view here does not change the zone, and a similar view in each is two views. `app/o` is the only legacy code that may import `@/platform/*`, and only those two trees; `check:platform-css` holds every other entry out, and `check:platform-design` holds `app/o` out of the zone.
80+
81+
Org context comes from a different place in each. A view here calls `useOrganization()` from `@/lib/organizations/provider`, which the `app/o` layout fills from `getOrganizationSurfaceContext`. The zone calls its own from `@/platform/lib/data/organization`. `surfaceHref`, `legacyRoutes` and `routePrefix` are the zone's and do not exist here: a link here is a host route (`@/lib/navigation/paths`). Each tree has its own `usePlatformNotices`. `PlatformSurface` collapses inside another, so a part can wrap itself when it alternates with legacy chrome.
82+
83+
The design rules in this contract hold here too. `check:platform-design` walks `embedded/`, excepting its imports of the host and the host tokens it names, and counts what predates that per file and rule in the shrink-only `scripts/check-platform-design.baseline.json`.
7884

7985
## Product UI and desktop
8086

‎apps/sim/tsconfig.json‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,17 @@
3232
"exclude": [
3333
"node_modules",
3434
".next",
35-
"platform",
35+
"platform/app",
36+
"platform/lib",
37+
"platform/fixtures",
38+
"platform/checks",
39+
"platform/preview",
40+
"platform/design-system",
41+
"platform/.next",
42+
"platform/node_modules",
43+
"platform/next-env.d.ts",
44+
"platform/next.config.ts",
45+
"platform/proxy.ts",
3646
"**/*.test.ts",
3747
"**/*.test.tsx",
3848
"vitest.config.ts",

‎apps/sim/tsconfig.tests.json‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
{
22
"extends": "./tsconfig.json",
3-
"exclude": ["node_modules", ".next", "platform", "vitest.config.ts", "vitest.setup.ts"]
3+
"exclude": [
4+
"node_modules",
5+
".next",
6+
"platform/app",
7+
"platform/lib",
8+
"platform/fixtures",
9+
"platform/checks",
10+
"platform/preview",
11+
"platform/design-system",
12+
"platform/.next",
13+
"platform/node_modules",
14+
"platform/next-env.d.ts",
15+
"platform/next.config.ts",
16+
"platform/proxy.ts",
17+
"vitest.config.ts",
18+
"vitest.setup.ts"
19+
]
420
}

‎apps/sim/turbo.json‎

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,26 @@
33
"tasks": {
44
"ci:shared": {
55
"dependsOn": ["^ci:runtime"],
6+
// The Platform zone is a separate Next app with its own workflow (platform-design.yml), so an
7+
// edit that touches only the zone selects no main-app job. `platform/embedded` and
8+
// `platform/design-system` ship inside `app/o`, so they stay inputs. Each zone path is named so
9+
// that a new `platform/` folder is an input until someone decides otherwise.
610
"inputs": [
711
"$TURBO_DEFAULT$",
12+
"!platform/app/**",
13+
"!platform/lib/**",
14+
"!platform/fixtures/**",
15+
"!platform/checks/**",
16+
"!platform/docs/**",
17+
"!platform/preview/**",
18+
"!platform/public/**",
19+
"!platform/next.config.ts",
20+
"!platform/proxy.ts",
21+
"!platform/postcss.config.mjs",
22+
"!platform/package.json",
23+
"!platform/tsconfig.json",
24+
"!platform/README.md",
25+
"!scripts/platform-live-*",
826
"!app/workspace/**",
927
"!app/(landing)/**",
1028
"!app/api/**",
@@ -214,13 +232,28 @@
214232
]
215233
},
216234
"build": {
217-
// next.config bakes the Platform rewrite from SIM_PLATFORM_ORIGIN, and the main app imports
218-
// nothing from its separate `platform/` zone or the seed of its live checks.
235+
// next.config bakes the Platform rewrite from SIM_PLATFORM_ORIGIN. `app/o` bundles
236+
// `platform/embedded` and `platform/design-system`, so those are inputs: leaving them out would
237+
// restore a stale `.next` and ship an old UI. The zone paths below are its own Next app, reached
238+
// only through that rewrite, and the embedded tree imports none of them
239+
// (check:platform-design rule `zone-embedded`, check:boundaries).
219240
"env": ["NEXT_BUILD_SKIP_TYPE_CHECK", "SIM_PLATFORM_ORIGIN"],
220241
"inputs": [
221242
"$TURBO_DEFAULT$",
222243
".env*",
223-
"!platform/**",
244+
"!platform/app/**",
245+
"!platform/lib/**",
246+
"!platform/fixtures/**",
247+
"!platform/checks/**",
248+
"!platform/docs/**",
249+
"!platform/preview/**",
250+
"!platform/public/**",
251+
"!platform/next.config.ts",
252+
"!platform/proxy.ts",
253+
"!platform/postcss.config.mjs",
254+
"!platform/package.json",
255+
"!platform/tsconfig.json",
256+
"!platform/README.md",
224257
"!scripts/platform-live-*",
225258
"!**/*.test.*",
226259
"!**/*.spec.*",

‎scripts/check-monorepo-boundaries.baseline.json‎

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,55 @@
4545
"apps/sim/platform/embedded/lib/data/chat-list.ts": 1,
4646
"apps/sim/platform/embedded/lib/data/organization-search.ts": 1,
4747
"apps/sim/platform/embedded/lib/data/settings-navigation.ts": 1
48+
},
49+
"viewsToWorkspace": {
50+
"apps/sim/platform/embedded/app/(shell)/_components/conversation/dialogs.tsx": 1,
51+
"apps/sim/platform/embedded/app/(shell)/_components/conversation/page-composer.tsx": 3,
52+
"apps/sim/platform/embedded/app/(shell)/_components/conversation/page-conversation.tsx": 5,
53+
"apps/sim/platform/embedded/app/(shell)/_components/conversation/response-actions.tsx": 1,
54+
"apps/sim/platform/embedded/app/(shell)/_components/conversation/search-input-bar.tsx": 2,
55+
"apps/sim/platform/embedded/app/(shell)/_components/conversation/share-dialog.tsx": 1,
56+
"apps/sim/platform/embedded/app/(shell)/_components/conversation/skeletons.tsx": 1,
57+
"apps/sim/platform/embedded/app/(shell)/_components/conversation/use-page-conversation-effects.ts": 2,
58+
"apps/sim/platform/embedded/app/(shell)/_components/search/search-results.tsx": 3,
59+
"apps/sim/platform/embedded/app/(shell)/_components/search/source-row.tsx": 4,
60+
"apps/sim/platform/embedded/app/(shell)/_components/sidebar/chats-section.tsx": 2,
61+
"apps/sim/platform/embedded/app/(shell)/_components/sidebar/rail-flyout.tsx": 1,
62+
"apps/sim/platform/embedded/app/(shell)/_components/sidebar/sidebar.tsx": 5,
63+
"apps/sim/platform/embedded/app/(shell)/home/_components/home-dashboard/home-dashboard.tsx": 1,
64+
"apps/sim/platform/embedded/app/(shell)/integrations/_components/integrations-page/integrations-route.tsx": 1,
65+
"apps/sim/platform/embedded/app/(shell)/integrations/_components/search-connection-request/search-connection-request.tsx": 1,
66+
"apps/sim/platform/embedded/app/(shell)/search/_components/search-surface/search-surface.tsx": 1,
67+
"apps/sim/platform/embedded/app/(shell)/settings/_components/sections/admin/add-user-modal.tsx": 1,
68+
"apps/sim/platform/embedded/app/(shell)/settings/_components/sections/admin/admin-section.tsx": 1,
69+
"apps/sim/platform/embedded/app/(shell)/settings/_components/sections/connected-accounts/group-providers.tsx": 1,
70+
"apps/sim/platform/embedded/app/(shell)/settings/_components/sections/integrations/api-key-field.tsx": 2,
71+
"apps/sim/platform/embedded/app/(shell)/settings/_components/sections/integrations/connector-access.tsx": 1,
72+
"apps/sim/platform/embedded/app/(shell)/settings/_components/sections/integrations/connector-config-fields.tsx": 3,
73+
"apps/sim/platform/embedded/app/(shell)/settings/_components/sections/integrations/connector-settings-fields.tsx": 3,
74+
"apps/sim/platform/embedded/app/(shell)/settings/_components/sections/integrations/source-detail.tsx": 3,
75+
"apps/sim/platform/embedded/app/(shell)/settings/_components/sections/integrations/source-setup.tsx": 3,
76+
"apps/sim/platform/embedded/app/(shell)/settings/_components/sections/mothership/mothership-section.tsx": 3
77+
},
78+
"zoneLibToViewTypes": {
79+
"apps/sim/platform/lib/data/admin.ts": 1,
80+
"apps/sim/platform/lib/data/chat-composer.ts": 2,
81+
"apps/sim/platform/lib/data/chat-credentials/rows.ts": 1,
82+
"apps/sim/platform/lib/data/chat-draft.ts": 1,
83+
"apps/sim/platform/lib/data/chat-list.ts": 1,
84+
"apps/sim/platform/lib/data/chat-model.ts": 2,
85+
"apps/sim/platform/lib/data/chat-panel.ts": 2,
86+
"apps/sim/platform/lib/data/chat-review.ts": 1,
87+
"apps/sim/platform/lib/data/chat.ts": 1,
88+
"apps/sim/platform/lib/data/credential-groups.ts": 1,
89+
"apps/sim/platform/lib/data/home-model.ts": 1,
90+
"apps/sim/platform/lib/data/home.ts": 2,
91+
"apps/sim/platform/lib/data/search.ts": 2,
92+
"apps/sim/platform/lib/data/settings-navigation.ts": 1,
93+
"apps/sim/platform/lib/data/shell-actions.ts": 1,
94+
"apps/sim/platform/lib/data/shell-context.ts": 1,
95+
"apps/sim/platform/lib/data/shell.ts": 1,
96+
"apps/sim/platform/lib/data/source-settings.ts": 1,
97+
"apps/sim/platform/lib/data/workspaces.ts": 1
4898
}
4999
}

0 commit comments

Comments
 (0)