Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
8439026
chore(checks): ban named randomUUID imports from node:crypto in check…
waleedlatif1 Dec 4, 2026
b0cab16
chore(checks): ban snapshot matchers in check:test-patterns
waleedlatif1 Dec 4, 2026
9763320
chore(checks): ratchet LRU ceilings, v2 raw responses, non-barrel re-…
waleedlatif1 Dec 4, 2026
9efcf96
chore(checks): ban retired styling forms in check:source-text
waleedlatif1 Dec 4, 2026
e13e6b6
chore(checks): drop the @sim/emcn wildcard export so deep imports fail
waleedlatif1 Dec 4, 2026
4e44b4d
docs(agents): prune agent guidance to what checks cannot catch
waleedlatif1 Dec 4, 2026
f4b2c5a
chore(checks): point route-audit at projectAudit
waleedlatif1 Dec 4, 2026
823f3e7
chore(checks): make coerceValue exhaustive over column types
waleedlatif1 Dec 4, 2026
446a5e8
chore(checks): require clickLabel on activatable SettingsResourceRow
waleedlatif1 Dec 4, 2026
7928c59
chore(checks): make settings section registration exhaustive
waleedlatif1 Dec 4, 2026
75de649
chore(checks): pin the isolated-vm worker module and message boundary
waleedlatif1 Dec 4, 2026
9f62ffc
chore(checks): prove each capability rule declares exactly the keys i…
waleedlatif1 Dec 4, 2026
4e56992
chore(checks): enforce tool, enrichment, connector, and polling regis…
waleedlatif1 Dec 4, 2026
770e885
chore(checks): check block tool and trigger wiring and registry order
waleedlatif1 Dec 4, 2026
2ae9df7
chore(checks): fail on defaultValue-only operations and unreadable do…
waleedlatif1 Dec 4, 2026
d13400f
chore(checks): simplify the new checks
waleedlatif1 Dec 5, 2026
cf86246
chore(checks): tighten the new checks' tests and comments
waleedlatif1 Dec 5, 2026
efa3c0a
fix(agents): restore facts the guidance prune dropped and tighten rev…
waleedlatif1 Dec 5, 2026
3a409ec
chore(agents): keep agent guidance as on staging apart from lines the…
waleedlatif1 Dec 5, 2026
e376c10
fix(checks): catch spaced var(--divider) forms and scope the docs spr…
waleedlatif1 Dec 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .agents/skills/add-block/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,8 @@ Use `wandConfig` on fields that are hard to fill by hand — timestamps (`genera
**Write operation ids and tool ids as string literals** in the `operation` dropdown `options` and
`tools.access`, never through constants (`id: SEARCH`, `access: [SEARCH]`). `scripts/generate-docs.ts`
reads them from source with regexes, so a constant parses as empty: the docs page loses its whole
Actions section and the integration catalog ships blank operation descriptions, with no check failing.
Actions section and the integration catalog ships blank operation descriptions. `generate:docs` now
fails on an id it can't read (in `tools.access` only, a spread of a same-file `const` string array is resolved).

**Preferred:** Use tool names directly as dropdown option IDs to avoid switch cases:
```typescript
Expand Down
2 changes: 1 addition & 1 deletion .agents/skills/add-column-type/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Prefer set-based SQL. When the transform genuinely needs JS (`currency`'s separa
- **Import cycles.** `column-types/select.ts` imports `lib/table/select-values.ts`, so `select-values.ts` must **not** import the registry — that closes a cycle and fails at module init. Inside a type's own helper module the string literal is the implementation, not a config leak.
- **The client-safe boundary.** `registry.ts` and everything it imports must stay free of `@sim/db`, `drizzle-orm`, and `next/server` — the tables grid imports it directly. A React icon is fine (it's a component *reference*, never called server-side). Only `registry.server.ts` may touch drizzle.
- **Don't re-export the registry from `@/lib/table`.** Dozens of server modules import that barrel; routing this through it pulls `@sim/emcn/icons` into all of them. Deep-import `@/lib/table/column-types`.
- **`import.ts`'s `coerceValue` is a SECOND write path and is not opt-in.** Importing into a column of your type always hits it, and its `default` arm silently `String(value)`s — so a missing `case` stores text in a column whose `jsonbCast` is numeric, and then every filter and sort on that column errors in Postgres. Add a `case`, even though the switch compiles without one. (It is deliberately separate from the registry's `coerce`: an import wants an unparseable value to survive as its raw string so the row error can name it.)
- **`import.ts`'s `coerceValue` is a SECOND write path and is not opt-in.** Importing into a column of your type always hits it, and the switch is exhaustive (`colType satisfies never`), so a new type fails to compile until you add its `case`. Pick the arm deliberately: falling back to `String(value)` stores text in a column whose `jsonbCast` may be numeric, and then every filter and sort on that column errors in Postgres. (It is deliberately separate from the registry's `coerce`: an import wants an unparseable value to survive as its raw string so the row error can name it.)
- **CSV inference** is an ordered heuristic in `import.ts`, deliberately not registry-driven. A new type is not inferred from a CSV unless you extend `inferColumnType` — usually you should not, since inference cannot supply configuration (an option set, a currency code).

## If your type owns metadata, read this
Expand Down
2 changes: 1 addition & 1 deletion .agents/skills/v2-api-conventions/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Each rule below guards a caller-visible failure: a non-integer `limit` reaching

## Rule 1 — the envelope is produced by helpers, never by hand

`v2Data`, `v2Error`, and the typed error helpers in `response.ts` (`v2ValidationError`, `v2RateLimitError`, `v2HttpError`, `v2InsufficientScope`, `v2HeadNoEffect`, `v2UploadDataPlaneError`) are the only things that build a v2 body. They also set `Cache-Control: private, no-store`, which every v2 response needs because every v2 response is authed per-caller data.
`v2Data`, `v2Error`, and the typed error helpers in `response.ts` (`v2ValidationError`, `v2RateLimitError`, `v2HttpError`, `v2InsufficientScope`, `v2HeadNoEffect`, `v2NoContent`, `v2UploadDataPlaneError`) are the only things that build a v2 body. They also set `Cache-Control: private, no-store`, which every v2 response needs because every v2 response is authed per-caller data.

A route built with `defineV2JsonRoute` gets this for free: its `present` returns the *body shape* and the builder renders it. Never call `NextResponse.json` from a v2 route.

Expand Down
3 changes: 1 addition & 2 deletions .claude/rules/sim-settings-pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,7 @@ and — on activatable rows only — the hover band. Never hand-roll any of it,
overlay. Prefer `href` when the destination is a route, so the row keeps
prefetch, middle-click, and open-in-new-tab. Always pass `clickLabel` with
either — the overlay holds no text, so it is the control's *only* accessible
name. The prop is optional in the type (nothing enforces it), so omitting it
ships a nameless button rather than failing the build.
name. The props type requires it whenever `onClick` or `href` is set.
- `navigable` — appends the one canonical chevron. Set it on rows that open a
detail page; leave it off when `onClick` acts in place (revealing a folder).
Never import an arrow yourself: `lucide-react` and `@sim/emcn/icons` ship
Expand Down
3 changes: 1 addition & 2 deletions .cursor/rules/sim-settings-pages.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,7 @@ and — on activatable rows only — the hover band. Never hand-roll any of it,
overlay. Prefer `href` when the destination is a route, so the row keeps
prefetch, middle-click, and open-in-new-tab. Always pass `clickLabel` with
either — the overlay holds no text, so it is the control's *only* accessible
name. The prop is optional in the type (nothing enforces it), so omitting it
ships a nameless button rather than failing the build.
name. The props type requires it whenever `onClick` or `href` is set.
- `navigable` — appends the one canonical chevron. Set it on rows that open a
detail page; leave it off when `onClick` acts in place (revealing a folder).
Never import an arrow yourself: `lucide-react` and `@sim/emcn/icons` ship
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Build order **Tools** → **Block** → **Icon** → optional **Trigger**, from
- **Type coercions go in `tools.config.params`** (runs at execution), never `tools.config.tool` (runs at serialization, where `Number()` destroys `<Block.output>` references).
- **Requests made for a workspace use `outboundFetch`** (`@/lib/core/network/outbound-fetch.server`), never the global `fetch` or another imported `fetch`, so an organization with a dedicated egress gateway keeps its static IPs; `check:organization-egress` enforces this, and a request that rightly goes direct (Sim's own infrastructure, an operator-local server) takes `// egress-direct: <reason>`. AWS SDK clients signing with customer credentials take `organizationAwsRequestHandler()`: no audit catches a missing one, so reviewers check it.
- A surface listing integrations to a viewer reads `useIntegrationAccess`, never a raw catalog (`check:integration-access`).
- Table column types are registry entries in `apps/sim/lib/table/column-types/`; never add a per-type `case` elsewhere except the one documented import-path switch (`coerceValue` in `lib/table/import.ts`), which every new type extends: a missed arm fails silently. Use `/add-column-type`.
- Table column types are registry entries in `apps/sim/lib/table/column-types/`; never add a per-type `case` elsewhere except the one documented import-path switch (`coerceValue` in `lib/table/import.ts`), which every new type extends (its exhaustive `switch` fails to compile until it does). Use `/add-column-type`.

## How your work is checked

Expand Down
5 changes: 5 additions & 0 deletions apps/sim/app/api/v2/lib/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ export function v2HeadNoEffect(options: V2SuccessOptions = {}): NextResponse {
return new NextResponse(null, { status: options.status ?? 200, headers: successHeaders(options) })
}

/** A bodiless `204 No Content` (+ rate-limit headers), for a write with nothing to return. */
export function v2NoContent(options: Omit<V2SuccessOptions, 'status'> = {}): NextResponse {
return new NextResponse(null, { status: 204, headers: successHeaders(options) })
}

/** `{ data }` (+ rate-limit headers). */
export function v2Data<T>(data: T, options: V2SuccessOptions = {}): NextResponse {
return NextResponse.json(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createLogger } from '@sim/logger'
import { type NextRequest, NextResponse } from 'next/server'
import type { NextRequest, NextResponse } from 'next/server'
import { localUploadPartContract } from '@/lib/api/contracts/upload-sessions'
import { parseRequest } from '@/lib/api/server'
import { V2_PARSE_DEFAULTS } from '@/lib/api/server/routes'
Expand All @@ -18,6 +18,7 @@ import {
v2CaughtOrchestrationError,
v2Error,
v2HttpError,
v2NoContent,
v2UploadDataPlaneError,
} from '@/app/api/v2/lib/response'

Expand Down Expand Up @@ -116,7 +117,7 @@ export const PUT = withRouteHandler(
error,
})
}
return new NextResponse(null, { status: 204 })
return v2NoContent()
},
{
typedErrorResponse: ({ error }) => v2HttpError(error),
Expand Down
11 changes: 8 additions & 3 deletions apps/sim/app/api/v2/uploads/[uploadId]/route.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createLogger } from '@sim/logger'
import { type NextRequest, NextResponse } from 'next/server'
import type { NextRequest, NextResponse } from 'next/server'
import { localPutUploadContract } from '@/lib/api/contracts/upload-sessions'
import { parseRequest } from '@/lib/api/server'
import { V2_PARSE_DEFAULTS } from '@/lib/api/server/routes'
Expand All @@ -10,7 +10,12 @@ import {
getOwnedUploadSession,
uploadSessionObjectMetadata,
} from '@/lib/uploads/upload-session/service'
import { v2Error, v2HttpError, v2UploadDataPlaneError } from '@/app/api/v2/lib/response'
import {
v2Error,
v2HttpError,
v2NoContent,
v2UploadDataPlaneError,
} from '@/app/api/v2/lib/response'

const logger = createLogger('LocalUpload')

Expand Down Expand Up @@ -106,7 +111,7 @@ export const PUT = withRouteHandler(
error,
})
}
return new NextResponse(null, { status: 204 })
return v2NoContent()
},
{
typedErrorResponse: ({ error }) => v2HttpError(error),
Expand Down
162 changes: 107 additions & 55 deletions apps/sim/app/workspace/[workspaceId]/settings/[section]/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,76 +102,128 @@ function SettingsPageContent({ section }: SettingsPageProps) {

return (
<SettingsSectionProvider section={effectiveSection} meta={meta ?? undefined}>
{effectiveSection === 'general' && <General />}
{effectiveSection === 'desktop' && <Desktop />}
{effectiveSection === 'browser' && <Browser />}
{effectiveSection === 'terminal' && <Terminal />}
{effectiveSection === 'secrets' && <Secrets />}
{effectiveSection === 'connected-accounts' && organizationId && (
<SettingsSectionBody
section={effectiveSection}
organizationId={organizationId}
workspaceId={hostContext.workspace.id}
isHostOrganizationAdmin={hostContext.viewer.isHostOrganizationAdmin}
/>
</SettingsSectionProvider>
)
}

interface SettingsSectionBodyProps {
section: SettingsSection
organizationId: string | null
workspaceId: string
isHostOrganizationAdmin: boolean
}

/**
* The one place a section id becomes its page. Exhaustive over {@link SettingsSection}: a new
* section fails compilation here until it renders something.
*/
function SettingsSectionBody({
section,
organizationId,
workspaceId,
isHostOrganizationAdmin,
}: SettingsSectionBodyProps) {
switch (section) {
case 'general':
return <General />
case 'desktop':
return <Desktop />
case 'browser':
return <Browser />
case 'terminal':
return <Terminal />
case 'secrets':
return <Secrets />
case 'connected-accounts':
return organizationId ? (
<OrganizationConnectedAccounts organizationId={organizationId} />
)}
{effectiveSection === 'access-control' && organizationId && (
) : null
case 'access-control':
return organizationId ? (
<AccessControl
organizationId={organizationId}
isOrganizationAdmin={hostContext.viewer.isHostOrganizationAdmin}
requestsHref={`/workspace/${hostContext.workspace.id}/settings/requests`}
isOrganizationAdmin={isHostOrganizationAdmin}
requestsHref={`/workspace/${workspaceId}/settings/requests`}
/>
)}
{effectiveSection === 'requests' && organizationId && (
) : null
case 'requests':
return organizationId ? (
<AccessRequestsSettings
scope={{ kind: 'workspace', workspaceId: hostContext.workspace.id }}
reviewOrganizationId={
hostContext.viewer.isHostOrganizationAdmin ? organizationId : undefined
}
scope={{ kind: 'workspace', workspaceId }}
reviewOrganizationId={isHostOrganizationAdmin ? organizationId : undefined}
/>
)}
{effectiveSection === 'custom-blocks' && <CustomBlocks />}
{effectiveSection === 'audit-logs' && organizationId && (
<AuditLogs organizationId={organizationId} />
)}
{effectiveSection === 'usage' && organizationId && (
) : null
case 'custom-blocks':
return <CustomBlocks />
case 'audit-logs':
return organizationId ? <AuditLogs organizationId={organizationId} /> : null
case 'usage':
return organizationId ? (
<UsageMonitoring
organizationId={organizationId}
eventsHref={`/workspace/${hostContext.workspace.id}/settings/usage/events`}
auditLogsHref={`/workspace/${hostContext.workspace.id}/settings/audit-logs`}
eventsHref={`/workspace/${workspaceId}/settings/usage/events`}
auditLogsHref={`/workspace/${workspaceId}/settings/audit-logs`}
/>
)}
{effectiveSection === 'apikeys' && <ApiKeys scope='combined' />}
{billingEnabled && effectiveSection === 'billing' && (
) : null
case 'apikeys':
return <ApiKeys scope='combined' />
case 'billing':
return (
<Billing
scope={organizationId ? 'organization' : 'account'}
organizationId={organizationId ?? undefined}
creditUsageHref={`/workspace/${hostContext.workspace.id}/settings/billing/credit-usage`}
creditUsageHref={`/workspace/${workspaceId}/settings/billing/credit-usage`}
/>
)}
{effectiveSection === 'teammates' && <Teammates />}
{effectiveSection === 'organization' && organizationId && (
)
case 'teammates':
return <Teammates />
case 'organization':
return organizationId ? (
<TeamManagement
organizationId={organizationId}
billingHref={`/workspace/${hostContext.workspace.id}/settings/billing`}
billingHref={`/workspace/${workspaceId}/settings/billing`}
/>
)}
{effectiveSection === 'sso' && organizationId && <SSO organizationId={organizationId} />}
{effectiveSection === 'data-retention' && organizationId && (
<DataRetentionSettings organizationId={organizationId} />
)}
{effectiveSection === 'data-drains' && organizationId && (
<DataDrainsSettings organizationId={organizationId} />
)}
{effectiveSection === 'security' && organizationId && (
) : null
case 'sso':
return organizationId ? <SSO organizationId={organizationId} /> : null
case 'data-retention':
return organizationId ? <DataRetentionSettings organizationId={organizationId} /> : null
case 'data-drains':
return organizationId ? <DataDrainsSettings organizationId={organizationId} /> : null
case 'security':
return organizationId ? (
<OrganizationSecuritySettings organizationId={organizationId} />
)}
{effectiveSection === 'byok' && <BYOK />}
{effectiveSection === 'sandboxes' && <Sandboxes />}
{effectiveSection === 'mcp' && <MCP />}
{effectiveSection === 'forks' && <Forks />}
{effectiveSection === 'custom-tools' && <CustomTools />}
{effectiveSection === 'workflow-mcp-servers' && <WorkflowMcpServers />}
{effectiveSection === 'inbox' && <Inbox />}
{effectiveSection === 'recently-deleted' && <RecentlyDeleted />}
{effectiveSection === 'self-host' && <SelfHost />}
{effectiveSection === 'admin' && <Admin />}
{effectiveSection === 'mothership' && <Mothership />}
</SettingsSectionProvider>
)
) : null
case 'byok':
return <BYOK />
case 'sandboxes':
return <Sandboxes />
case 'mcp':
return <MCP />
case 'forks':
return <Forks />
case 'custom-tools':
return <CustomTools />
case 'workflow-mcp-servers':
return <WorkflowMcpServers />
case 'inbox':
return <Inbox />
case 'recently-deleted':
return <RecentlyDeleted />
case 'self-host':
return <SelfHost />
case 'admin':
return <Admin />
case 'mothership':
return <Mothership />
default:
section satisfies never
return null
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
* tile/text chrome per consumer. The tile force-sizes any `<svg>`/`<img>` it
* contains to 20px, so callers pass their raw icon node without pre-sizing it.
*/
interface SettingsResourceRowProps {
interface SettingsResourceRowBaseProps {
/**
* Icon node centered in the tile; a `<svg>` is normalized to 20px, an `<img>` to
* 20px (or the full tile when `iconFill`). Omit it for rows whose resource has no
Expand Down Expand Up @@ -63,21 +63,6 @@ interface SettingsResourceRowProps {
* edge into a dead zone.
*/
badge?: ReactNode
/**
* Makes the whole row activatable via a control with a stretched hit area. `trailing`
* stacks above it, so interactive trailing controls (menus, chips) keep
* working — never nest an interactive `trailing` inside a caller-supplied
* wrapper `<button>`, which is invalid HTML.
*/
onClick?: () => void
/**
* Navigates on activation instead of calling `onClick`. Prefer this over
* `onClick` + `router.push` so the row keeps real link semantics — prefetch,
* middle-click, open-in-new-tab.
*/
href?: string
/** Accessible name for the activatable cluster. Required alongside `onClick`/`href`. */
clickLabel?: string
/**
* Appends the canonical navigation chevron after `trailing`. Set it on rows that
* open a detail page; leave it off for rows whose `onClick` performs an action
Expand All @@ -96,6 +81,17 @@ interface SettingsResourceRowProps {
disabled?: boolean
}

/**
* How the row activates: `href` renders a real link (prefer it over `onClick` + `router.push`),
* `onClick` a button; either stretches its hit area under `trailing`, so never wrap the row in
* a `<button>`. An activatable row names its control with `clickLabel`.
*/
type SettingsResourceRowActivation =
| { clickLabel: string; onClick?: () => void; href?: string }
| { clickLabel?: undefined; onClick?: undefined; href?: undefined }
Comment thread
waleedlatif1 marked this conversation as resolved.
Resolved

type SettingsResourceRowProps = SettingsResourceRowBaseProps & SettingsResourceRowActivation

/** The one navigation chevron for every settings resource row. */
export const RESOURCE_ROW_ARROW_CLASSES = 'size-4 shrink-0 text-[var(--text-icon)]'

Expand Down
Loading
Loading