From c9a96633b0bb41f25bd1a337364f41efad30d970 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Fri, 25 Sep 2026 14:46:05 -0700 Subject: [PATCH 1/4] =?UTF-8?q?chore(tests):=20consolidate=20test=20patter?= =?UTF-8?q?ns=20=E2=80=94=20shared=20Vitest=20base,=20central=20@sim/testi?= =?UTF-8?q?ng=20mocks,=20check:test-patterns,=20lean=20agent=20docs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .agents/skills/add-block/SKILL.md | 4 +- .agents/skills/add-column-type/SKILL.md | 6 +- .agents/skills/add-feature-flag/SKILL.md | 4 +- .agents/skills/add-managed-cli/SKILL.md | 6 +- .../skills/add-permission-group-item/SKILL.md | 2 +- .agents/skills/add-selector/SKILL.md | 2 +- .../skills/add-settings-page/SKILL.md | 0 .agents/skills/add-tools/SKILL.md | 2 +- .agents/skills/babysit/SKILL.md | 10 +- .agents/skills/cleanup/SKILL.md | 10 +- .../migrate-application-operation/SKILL.md | 22 +- .../react-query-best-practices/SKILL.md | 4 +- .agents/skills/ship/SKILL.md | 15 +- .agents/skills/test-audit/SKILL.md | 7 +- .agents/skills/v2-api-conventions/SKILL.md | 6 +- .../validate-permission-group-item/SKILL.md | 3 +- .../you-might-not-need-a-comment/SKILL.md | 2 +- .claude/rules/emcn-components.md | 5 +- .claude/rules/global.md | 91 - .claude/rules/landing-seo-geo.md | 26 +- .claude/rules/sim-api-contracts.md | 117 + .claude/rules/sim-architecture.md | 65 +- .claude/rules/sim-components.md | 26 +- .claude/rules/sim-hooks.md | 16 +- .claude/rules/sim-integrations.md | 10 +- .claude/rules/sim-queries.md | 3 +- .claude/rules/sim-stores.md | 36 +- .claude/rules/sim-styling.md | 5 +- .claude/rules/sim-testing.md | 102 +- .claude/rules/sim-typescript.md | 22 - .claude/rules/sim-ui-copy.md | 2 +- .claude/skills/add-settings-page | 1 + .cursor/rules/emcn-components.mdc | 5 +- .cursor/rules/global.mdc | 94 - .cursor/rules/landing-seo-geo.mdc | 26 +- .cursor/rules/sim-api-contracts.mdc | 114 + .cursor/rules/sim-architecture.mdc | 65 +- .cursor/rules/sim-components.mdc | 26 +- .cursor/rules/sim-hooks.mdc | 16 +- .cursor/rules/sim-integrations.mdc | 10 +- .cursor/rules/sim-queries.mdc | 3 +- .cursor/rules/sim-stores.mdc | 36 +- .cursor/rules/sim-styling.mdc | 5 +- .cursor/rules/sim-testing.mdc | 102 +- .cursor/rules/sim-typescript.mdc | 22 - .cursor/rules/sim-ui-copy.mdc | 2 +- .github/workflows/test-build.yml | 6 +- CLAUDE.md | 494 +--- .../src/main/browser-agent/driver.test.ts | 4 +- .../main/browser-credentials/os-auth.test.ts | 34 +- apps/desktop/src/main/handoff.test.ts | 6 +- apps/desktop/src/main/window.test.ts | 1 - .../desktop/src/preload/browser/index.test.ts | 13 +- apps/desktop/src/renderer/shell.test.ts | 6 +- apps/desktop/src/test/electron-mock.ts | 94 + apps/desktop/vitest.config.ts | 39 +- apps/docs/vitest.config.ts | 18 +- apps/realtime/src/database/operations.test.ts | 34 +- apps/realtime/src/database/preflight.test.ts | 43 +- apps/realtime/src/handlers/connection.test.ts | 1 - ...s.test.ts => file-doc.redis-store.test.ts} | 0 apps/realtime/src/handlers/file-doc.test.ts | 43 +- apps/realtime/src/handlers/operations.test.ts | 14 +- apps/realtime/src/handlers/tables.test.ts | 6 +- apps/realtime/src/handlers/workflow.test.ts | 6 +- .../workspace-invalidation-room.test.ts | 6 +- .../src/middleware/permissions.test.ts | 28 +- apps/realtime/vitest.config.ts | 50 +- apps/sim/AGENTS.md | 253 +- .../oauth/consent/consent-view.test.tsx | 12 +- .../app/(auth)/oauth/sign-in/route.test.ts | 45 +- .../sso/launch/[providerId]/route.test.ts | 21 +- .../(auth)/verify/use-verification.test.tsx | 28 +- .../message/components/file-download.test.tsx | 2 - .../chat/hooks/use-chat-streaming.test.tsx | 10 +- .../[workflowId]/[executionId]/page.test.tsx | 24 +- .../[executionId]/resume-page-client.test.tsx | 8 +- apps/sim/app/(landing)/CLAUDE.md | 25 +- .../landing-cta-link.test.tsx | 1 - .../app/(landing)/content-routing.test.tsx | 7 +- .../sim/app/(landing)/customers/page.test.tsx | 16 +- .../demo-scheduler/demo-scheduler.test.tsx | 1 - .../api/mcp/route.test.ts | 16 +- .../api/mcp/serve/[serverId]/route.test.ts | 31 +- .../_shell/consent/consent-banner.test.tsx | 1 - .../desktop-title-bar-controller.test.tsx | 7 +- .../app/_shell/paste-admission-guard.test.tsx | 10 +- .../providers/browser-telemetry.test.tsx | 6 +- .../providers/posthog-provider.test.tsx | 11 +- .../providers/session-provider.test.tsx | 46 +- apps/sim/app/access-requests/page.test.tsx | 15 +- .../account/settings/[section]/page.test.tsx | 24 +- apps/sim/app/api/auth/[...all]/route.test.ts | 4 - .../api/auth/forget-password/route.test.ts | 42 +- .../auth/instagram/authorize/route.test.ts | 21 +- .../api/auth/oauth/credentials/route.test.ts | 17 +- .../app/api/auth/oauth/token/route.test.ts | 14 +- apps/sim/app/api/auth/oauth/utils.test.ts | 17 +- .../api/auth/oauth2/authorize/route.test.ts | 22 +- .../oauth2/callback/quickbooks/route.test.ts | 17 +- .../oauth2/callback/shopify/route.test.ts | 17 +- .../api/auth/oauth2/register/route.test.ts | 24 +- .../app/api/auth/oauth2/revoke/route.test.ts | 4 +- .../auth/oauth2/token/route.integration.ts | 17 +- .../app/api/auth/oauth2/token/route.test.ts | 21 +- .../app/api/auth/reset-password/route.test.ts | 42 +- .../api/auth/shopify/authorize/route.test.ts | 22 +- .../sso/providers/[providerId]/route.test.ts | 13 +- .../app/api/auth/sso/providers/route.test.ts | 12 +- .../app/api/auth/sso/register/route.test.ts | 43 +- .../app/api/auth/sso/resolve/route.test.ts | 9 +- .../app/api/billing/invoices/route.test.ts | 9 +- apps/sim/app/api/billing/route.test.ts | 38 +- .../app/api/billing/switch-plan/route.test.ts | 44 +- .../billing/update-cost/replay.live.test.ts | 116 +- .../app/api/billing/update-cost/route.test.ts | 69 +- .../billing/update-cost/worker.live.test.ts | 116 +- .../app/api/blocks/visibility/route.test.ts | 31 +- .../api/chat/[identifier]/otp/route.test.ts | 102 +- .../app/api/chat/[identifier]/route.test.ts | 63 +- .../api/chat/[identifier]/sso/route.test.ts | 24 +- .../app/api/chat/manage/[id]/route.test.ts | 107 +- apps/sim/app/api/chat/route.test.ts | 82 +- apps/sim/app/api/chat/utils.test.ts | 12 +- apps/sim/app/api/chat/validate/route.test.ts | 19 +- .../app/api/cli/auth/approve/route.test.ts | 60 +- apps/sim/app/api/cli/auth/poll/route.test.ts | 9 +- .../app/api/copilot/api-keys/route.test.ts | 13 +- .../copilot/api-keys/validate/route.test.ts | 92 +- .../app/api/copilot/chat/abort/route.test.ts | 83 +- .../app/api/copilot/chat/steer/route.test.ts | 46 +- .../app/api/copilot/chat/stop/route.test.ts | 51 +- .../sim/app/api/copilot/confirm/route.test.ts | 59 +- .../app/api/copilot/feedback/route.test.ts | 6 +- .../api/copilot/tool-permission/route.test.ts | 61 +- .../api/copilot/tools/execute/route.test.ts | 37 +- .../credential-groups/oauth-callback.test.ts | 57 +- .../credentials/[id]/members/route.test.ts | 26 +- apps/sim/app/api/credentials/route.test.ts | 73 +- .../cleanup-stale-executions/route.test.ts | 15 +- .../cron/cleanup-table-row-ttl/route.test.ts | 29 +- .../cron/renew-subscriptions/route.test.ts | 11 +- .../custom-blocks/[id]/usages/route.test.ts | 52 +- .../api/desktop/auth/handoff/route.test.ts | 32 +- .../api/desktop/tool/authorize/route.test.ts | 30 +- .../api/desktop/update/download/route.test.ts | 6 +- .../update/latest-mac.yml/route.test.ts | 6 +- apps/sim/app/api/files/authorization.test.ts | 48 +- apps/sim/app/api/files/delete/route.test.ts | 69 +- .../app/api/files/export/[id]/route.test.ts | 58 +- .../public/[token]/content/route.test.ts | 41 +- .../files/public/[token]/inline/route.test.ts | 34 +- .../files/public/[token]/otp/route.test.ts | 52 +- .../api/files/public/[token]/route.test.ts | 24 +- .../files/public/[token]/sso/route.test.ts | 37 +- .../api/files/serve/[...path]/route.test.ts | 144 +- .../app/api/files/uploads/finalizers.test.ts | 131 +- apps/sim/app/api/files/uploads/route.test.ts | 106 +- .../api/folders/[id]/duplicate/route.test.ts | 30 +- apps/sim/app/api/folders/[id]/route.test.ts | 21 - apps/sim/app/api/folders/route.test.ts | 21 - .../api/internal/file-doc/seed/route.test.ts | 14 +- .../api/invitations/[id]/resend/route.test.ts | 116 +- apps/sim/app/api/invitations/route.test.ts | 25 +- .../api/knowledge/[id]/export/route.test.ts | 28 +- .../connectors/directory-sync/route.test.ts | 38 +- .../connectors/member-sync/route.test.ts | 70 +- .../knowledge/connectors/sync/route.test.ts | 38 +- .../github/installations/route.test.ts | 44 +- .../knowledge/github/setup/redirects.test.ts | 17 +- .../app/api/knowledge/migrated-routes.test.ts | 56 +- .../app/api/knowledge/search/utils.test.ts | 20 +- .../sim-search/sources/route.test.ts | 5 +- .../slack/oauth/callback/route.test.ts | 30 +- apps/sim/app/api/knowledge/utils.test.ts | 11 +- apps/sim/app/api/link-preview/route.test.ts | 11 +- apps/sim/app/api/logs/export/route.test.ts | 48 +- apps/sim/app/api/logs/stats/route.test.ts | 23 +- apps/sim/app/api/mcp/discover/route.test.ts | 14 +- .../app/api/mcp/oauth/callback/route.test.ts | 9 +- .../api/mcp/serve/[serverId]/route.test.ts | 204 +- .../mcp/servers/[id]/refresh/route.test.ts | 15 +- .../mcp/servers/test-connection/route.test.ts | 9 +- .../chats/[chatId]/fork/route.test.ts | 152 +- .../chats/[chatId]/restore/route.test.ts | 68 +- .../mothership/chats/[chatId]/route.test.ts | 114 +- .../api/mothership/chats/read/route.test.ts | 16 +- .../app/api/mothership/chats/route.test.ts | 53 +- .../app/api/mothership/events/route.test.ts | 21 +- .../app/api/mothership/execute/route.test.ts | 95 +- .../integrations/catalog/route.test.ts | 38 +- .../api/mothership/runs/control/route.test.ts | 55 +- .../slack-managed-users/route.test.ts | 12 +- .../[id]/domains/[domainId]/route.test.ts | 47 +- .../domains/[domainId]/verify/route.test.ts | 50 +- .../organizations/[id]/domains/route.test.ts | 47 +- .../[memberId]/usage-limit/route.test.ts | 46 +- .../organizations/[id]/members/route.test.ts | 42 +- .../permission-groups/[groupId]/route.test.ts | 63 +- .../organizations/[id]/roster/route.test.ts | 51 +- .../[id]/secret-source/route.test.ts | 8 +- .../[id]/session-policy/route.test.ts | 48 +- apps/sim/app/api/organizations/route.test.ts | 17 +- .../api/permission-groups/user/route.test.ts | 76 +- apps/sim/app/api/pinned-items/route.test.ts | 27 +- .../providers/baseten/models/route.test.ts | 52 +- .../ollama-cloud/models/route.test.ts | 37 +- .../api/providers/ollama/models/route.test.ts | 34 +- .../providers/together/models/route.test.ts | 48 +- .../api/providers/vllm/models/route.test.ts | 19 +- .../app/api/public-api-route-handler.test.ts | 70 +- .../[executionId]/[contextId]/route.test.ts | 90 +- .../[workflowId]/[executionId]/route.test.ts | 19 +- apps/sim/app/api/resume/poll/route.test.ts | 84 +- apps/sim/app/api/schedules/[id]/route.test.ts | 6 +- .../app/api/schedules/execute/route.test.ts | 83 +- apps/sim/app/api/schedules/route.test.ts | 6 +- .../app/api/secrets/references/route.test.ts | 25 +- .../app/api/selectors/execute/route.test.ts | 86 +- .../allowed-integrations/route.test.ts | 45 +- apps/sim/app/api/skills/route.test.ts | 104 +- apps/sim/app/api/speech/token/route.test.ts | 78 +- .../api/table/[tableId]/columns/route.test.ts | 85 +- .../[tableId]/delete-async/route.test.ts | 83 +- .../api/table/[tableId]/export/route.test.ts | 49 +- .../api/table/[tableId]/groups/route.test.ts | 36 +- .../api/table/[tableId]/import/route.test.ts | 96 +- .../api/table/[tableId]/query/route.test.ts | 32 +- .../api/table/[tableId]/restore/route.test.ts | 8 +- .../sim/app/api/table/[tableId]/route.test.ts | 115 +- .../enrichment/[groupId]/route.test.ts | 31 +- .../[tableId]/rows/[rowId]/route.test.ts | 37 +- .../table/[tableId]/rows/find/route.test.ts | 36 +- .../api/table/[tableId]/rows/route.test.ts | 38 +- .../sim/app/api/table/capability-gate.test.ts | 56 +- .../executor-capability-exemption.test.ts | 70 +- .../app/api/table/import-csv/route.test.ts | 82 +- apps/sim/app/api/table/route.test.ts | 64 +- .../api/table/table-transfer-routes.test.ts | 76 +- apps/sim/app/api/usage/route.test.ts | 17 +- .../app/api/users/me/deletion/route.test.ts | 37 +- .../app/api/users/me/settings/route.test.ts | 15 +- .../subscription/[id]/transfer/route.test.ts | 39 +- .../api/users/me/usage-limits/route.test.ts | 37 +- .../users/me/usage-logs/export/route.test.ts | 17 +- .../app/api/users/me/usage-logs/route.test.ts | 16 +- .../v1/admin/organizations/[id]/route.test.ts | 17 +- .../workspaces/[id]/import/route.test.ts | 45 +- .../app/api/v1/audit-logs/[id]/route.test.ts | 36 +- apps/sim/app/api/v1/audit-logs/auth.test.ts | 22 +- apps/sim/app/api/v1/audit-logs/route.test.ts | 23 +- apps/sim/app/api/v1/auth.test.ts | 19 +- apps/sim/app/api/v1/capability-gate.test.ts | 125 +- .../app/api/v1/files/[fileId]/route.test.ts | 51 +- .../v1/knowledge/[id]/documents/route.test.ts | 79 +- .../app/api/v1/knowledge/search/route.test.ts | 107 +- apps/sim/app/api/v1/knowledge/utils.test.ts | 18 +- .../executions/[executionId]/route.test.ts | 96 +- apps/sim/app/api/v1/logs/projection.test.ts | 92 +- apps/sim/app/api/v1/middleware.test.ts | 66 +- .../app/api/v1/tables/[tableId]/route.test.ts | 88 +- .../app/api/v1/tables/capability-gate.test.ts | 64 +- apps/sim/app/api/v1/tables/route.test.ts | 78 +- .../v1/workflows/[id]/deploy/route.test.ts | 62 +- .../v1/workflows/[id]/export/route.test.ts | 90 +- .../v1/workflows/[id]/rollback/route.test.ts | 68 +- .../app/api/v1/workflows/import/route.test.ts | 112 +- ...routes.test.ts => access-requests.test.ts} | 0 .../app/api/v2/chat-deployments/route.test.ts | 91 +- apps/sim/app/api/v2/chat/route.test.ts | 138 +- .../custom-tools/[customToolId]/route.test.ts | 75 +- .../sim/app/api/v2/custom-tools/route.test.ts | 112 +- .../v2/files/[fileId]/content/route.test.ts | 11 +- .../v2/files/[fileId]/metadata/route.test.ts | 11 +- .../app/api/v2/files/[fileId]/route.test.ts | 11 +- .../api/v2/files/[fileId]/share/route.test.ts | 26 +- .../versions/[version]/revert/route.test.ts | 15 +- .../api/v2/files/bulk-download/route.test.ts | 29 +- .../app/api/v2/files/folders/route.test.ts | 25 +- apps/sim/app/api/v2/files/move/route.test.ts | 22 +- apps/sim/app/api/v2/files/route.test.ts | 43 +- apps/sim/app/api/v2/files/utils.test.ts | 11 +- .../documents/[documentId]/route.test.ts | 39 +- .../documents/collection.test.ts | 22 +- .../[knowledgeBaseId]/documents/route.test.ts | 66 +- .../uploads/[uploadId]/complete/route.test.ts | 73 +- .../documents/uploads/concealment.test.ts | 42 +- .../documents/uploads/route.test.ts | 48 +- .../[knowledgeBaseId]/restore/route.test.ts | 26 +- apps/sim/app/api/v2/knowledge/route.test.ts | 137 +- ...ance.test.ts => route.application.test.ts} | 154 +- .../app/api/v2/knowledge/search/route.test.ts | 14 +- .../mcp-servers/[mcpServerId]/route.test.ts | 58 +- .../[mcpServerId]/tools/route.test.ts | 77 +- apps/sim/app/api/v2/mcp-servers/route.test.ts | 47 +- .../[invitationId]/workspaces/route.test.ts | 39 +- .../permission-groups/route.test.ts | 75 +- .../[organizationId]/usage/route.test.ts | 251 +- .../app/api/v2/organizations/route.test.ts | 82 +- .../v2/sandboxes/[sandboxId]/route.test.ts | 73 +- apps/sim/app/api/v2/sandboxes/route.test.ts | 68 +- .../app/api/v2/secrets/[name]/route.test.ts | 84 +- apps/sim/app/api/v2/secrets/route.test.ts | 110 +- .../v2/skills/[skillId]/editors/route.test.ts | 12 +- .../app/api/v2/skills/[skillId]/route.test.ts | 79 +- apps/sim/app/api/v2/skills/route.test.ts | 74 +- .../[tableId]/cancel-runs/route.test.ts | 17 +- .../tables/[tableId]/dispatches/route.test.ts | 13 +- .../[tableId]/query/count/route.test.ts | 39 +- .../v2/tables/[tableId]/query/route.test.ts | 42 +- .../v2/tables/[tableId]/restore/route.test.ts | 35 +- .../app/api/v2/tables/[tableId]/route.test.ts | 68 +- .../enrichment/[groupId]/route.test.ts | 35 +- .../[tableId]/rows/[rowId]/route.test.ts | 37 +- .../[tableId]/rows/bulk-update/route.test.ts | 25 +- .../v2/tables/[tableId]/rows/route.test.ts | 58 +- .../[tableId]/rows/search/route.test.ts | 25 +- .../[tableId]/rows/upsert/route.test.ts | 25 +- .../[tableId]/views/[viewId]/route.test.ts | 8 +- apps/sim/app/api/v2/tables/route.test.ts | 51 +- .../parts/[partNumber]/route.test.ts | 18 +- .../api/v2/uploads/[uploadId]/route.test.ts | 26 +- .../[serverId]/route.test.ts | 87 +- .../[serverId]/tools/route.test.ts | 82 +- .../api/v2/workflow-mcp-servers/route.test.ts | 89 +- .../[workflowId]/deployment/route.test.ts | 159 +- .../deployments/chat/route.test.ts | 165 +- .../[workflowId]/execute/route.test.ts | 136 +- .../[workflowId]/export/route.test.ts | 14 +- .../runs/[runId]/resume/route.test.ts | 74 +- .../versions/[version]/activate/route.test.ts | 97 +- .../versions/[version]/revert/route.test.ts | 129 +- .../versions/[version]/route.test.ts | 173 +- .../app/api/v2/workflows/import/route.test.ts | 14 +- .../app/api/webhooks/agentmail/route.test.ts | 57 +- .../webhooks/poll/[provider]/route.test.ts | 17 +- .../quickbooks/[appKey]/route.test.ts | 13 +- .../slack/custom/[credentialId]/route.test.ts | 43 +- apps/sim/app/api/webhooks/slack/route.test.ts | 25 +- .../sim/app/api/webhooks/tiktok/route.test.ts | 30 +- .../api/webhooks/trigger/[path]/route.test.ts | 134 +- .../workflows/[id]/chat/status/route.test.ts | 51 +- .../api/workflows/[id]/deployed/route.test.ts | 35 +- .../[id]/deployments/[version]/route.test.ts | 31 +- .../[id]/execute/response-block.test.ts | 36 +- .../{route.async.test.ts => route.test.ts} | 432 ++-- .../app/api/workflows/[id]/log/route.test.ts | 84 +- apps/sim/app/api/workflows/[id]/route.test.ts | 52 +- apps/sim/app/api/workflows/route.test.ts | 12 +- .../api/workspace-events/poll/route.test.ts | 17 +- .../[id]/api-keys/[keyId]/route.test.ts | 62 +- .../workspaces/[id]/api-keys/route.test.ts | 52 +- .../workspaces/[id]/byok-keys/route.test.ts | 65 +- .../[groupId]/access/route.test.ts | 16 +- .../[groupId]/enrollments/route.test.ts | 25 +- .../[id]/credential-groups/route.test.ts | 16 +- .../[id]/environment/capability-gate.test.ts | 36 +- .../workspaces/[id]/environment/route.test.ts | 36 +- .../[id]/files/[fileId]/export/route.test.ts | 34 +- .../[id]/files/[fileId]/extract/route.test.ts | 19 +- .../[id]/files/[fileId]/route.test.ts | 44 +- .../[id]/files/[fileId]/share/route.test.ts | 22 +- .../[id]/files/download/route-archive.test.ts | 70 +- .../api/workspaces/[id]/files/route.test.ts | 32 +- .../fork/excluded-workflows/route.test.ts | 52 +- .../[id]/fork/lineage/route.test.ts | 59 +- .../[id]/fork/promote/route.test.ts | 71 +- .../api/workspaces/[id]/fork/route.test.ts | 66 +- .../api/workspaces/[id]/inbox/route.test.ts | 55 +- ...ability.test.ts => sibling-routes.test.ts} | 28 +- .../workspaces/[id]/permissions/route.test.ts | 64 +- .../[id]/sandboxes/[sandboxId]/route.test.ts | 12 +- .../[id]/sandboxes/error-policy.test.ts | 10 +- .../api/workspaces/[id]/visit/route.test.ts | 33 +- .../api/workspaces/invitations/route.test.ts | 142 +- apps/sim/app/api/workspaces/route.test.ts | 42 +- apps/sim/app/cli/auth/cli-auth-view.test.tsx | 9 +- apps/sim/app/cli/auth/page.test.tsx | 20 +- .../complete/completion-handoff.test.tsx | 7 +- apps/sim/app/desktop/auth/page.test.tsx | 19 +- apps/sim/app/desktop/connect/page.test.tsx | 35 +- apps/sim/app/home/page.test.tsx | 12 +- apps/sim/app/invite/[id]/invite.test.tsx | 157 +- .../components/composer/composer.test.tsx | 32 +- .../home/organization-home.test.tsx | 66 +- .../app/o/[organizationId]/home/page.test.tsx | 45 +- .../integrations/integrations.test.tsx | 142 +- .../live-member-integrations.test.tsx | 45 +- .../integrations/page.test.tsx | 33 +- .../app/o/[organizationId]/layout.test.tsx | 26 +- .../app/o/[organizationId]/prefetch.test.ts | 27 +- .../providers/organization-provider.test.tsx | 10 +- .../settings/[section]/layout.test.tsx | 12 +- .../settings/[section]/page.test.tsx | 20 +- .../live-search-settings.test.tsx | 76 +- ...rganization-integrations-settings.test.tsx | 123 +- .../integrations/search-source-setup.test.tsx | 139 +- .../integrations/slack-account-setup.test.tsx | 60 +- .../components/search-mcp-connection.test.tsx | 1 - .../providers/[connectorType]/page.test.tsx | 30 +- .../sources/[connectorId]/page.test.tsx | 32 +- .../[connectorId]/source-detail.test.tsx | 79 +- .../connect/[token]/page.test.tsx | 14 +- .../install/[teamId]/page.test.tsx | 22 +- .../file-viewer/file-category.test.ts | 8 +- ...apply-streamed-markdown.concurrent.test.ts | 186 -- .../apply-streamed-markdown.test.ts | 184 ++ .../collab-streaming-integration.test.ts | 2 +- .../editor-lifecycle.test.tsx | 17 +- .../field-lifecycle.test.tsx | 1 - .../field-upload.test.tsx | 2 - .../image-collaboration.test.tsx | 1 - .../image-resize.test.tsx | 1 - .../menus/bubble-menu-collaboration.test.tsx | 2 - .../rich-markdown-field.test.tsx | 1 - ...de.test.ts => table-serialization.test.ts} | 0 .../use-editable-file-conflicts.test.tsx | 1 - .../file-viewer/xlsx-preview-data.test.ts | 6 +- .../search-transitions.test.tsx | 72 +- .../chat-content/external-link.test.tsx | 1 - .../components/scaling-test-helpers.ts | 17 +- .../personal-credential-card.test.tsx | 19 +- .../special-tags/special-tags.test.ts | 5 +- .../special-tags/special-tags.test.tsx | 45 +- .../message-content/message-content.test.ts | 5 +- .../browser-panel-occlusion.test.ts | 2 - .../browser-session/browser-session.test.ts | 1 - .../prompt-editor/use-prompt-editor.test.tsx | 6 +- .../mothership-context-event.test.ts | 4 +- ...nt-send.test.tsx => use-chat.dom.test.tsx} | 35 +- .../[workspaceId]/home/hooks/use-chat.test.ts | 12 +- .../connector-selector-field.test.tsx | 8 +- .../use-connector-settings-form.test.tsx | 37 +- .../use-connector-config-fields.test.tsx | 11 +- .../[id]/hooks/use-connector-scope.test.ts | 16 +- .../hooks/use-knowledge-upload.test.tsx | 16 +- .../workspace/[workspaceId]/layout.test.tsx | 27 +- .../[workspaceId]/lib/prefetch.test.ts | 128 +- .../lib/seed-workspace-files.test.ts | 5 +- .../[workspaceId]/prefetch-access.test.tsx | 36 +- .../workspace-host-provider.test.tsx | 1 - .../providers/workspace-scope-sync.test.tsx | 19 +- .../settings/[section]/page.test.tsx | 39 +- .../password-detail/password-detail.test.tsx | 6 +- .../passwords-view/passwords-view.test.tsx | 6 +- .../settings/components/byok/byok.test.tsx | 8 +- .../components/cookie-preferences.test.tsx | 20 +- .../general/components/privacy-view.test.tsx | 6 +- .../components/row-modal/row-modal.test.tsx | 8 +- .../tables/[tableId]/hooks/use-table.test.ts | 11 +- .../sub-block/components/code/code.test.tsx | 14 +- .../components/long-input/long-input.test.tsx | 6 +- .../model-fallback-list.test.tsx | 17 +- .../slack-setup-wizard.test.tsx | 8 +- .../sub-block/components/table/table.test.tsx | 15 +- .../sub-block/sub-block-password.test.tsx | 17 +- .../hooks/use-workflow-execution.test.tsx | 102 +- .../utils/workflow-execution-utils.test.ts | 6 +- .../view-invitations-modal.test.tsx | 18 +- .../async-preprocessing-correlation.test.ts | 86 +- .../sim/background/cleanup-logs-files.test.ts | 40 +- apps/sim/background/cleanup-logs.test.ts | 57 +- .../background/cleanup-oauth-tokens.test.ts | 22 +- .../background/cleanup-soft-deletes.test.ts | 71 +- ...nup-table-row-ttl-predicate.integration.ts | 3 +- .../background/cleanup-table-row-ttl.test.ts | 58 +- .../background/dispatch-cancel-guard.test.ts | 65 +- .../background/drain-governed-subject.test.ts | 94 +- .../enrichment-capability-subject.test.ts | 131 +- .../knowledge-connector-member-sync.test.ts | 19 +- .../knowledge-connector-sync.test.ts | 14 +- .../background/knowledge-processing.test.ts | 89 +- .../quickbooks-webhook-ingress.test.ts | 29 +- apps/sim/background/resume-execution.test.ts | 49 +- .../resume-governed-subject.test.ts | 78 +- .../sim/background/schedule-execution.test.ts | 3 +- apps/sim/background/webhook-execution.test.ts | 129 +- .../workflow-column-execution.test.ts | 8 +- .../workflow-group-governed-subject.test.ts | 139 +- apps/sim/blocks/AGENTS.md | 21 +- apps/sim/blocks/CLAUDE.md | 1 + apps/sim/blocks/blocks/airtable.test.ts | 5 +- apps/sim/blocks/blocks/cloudflare.test.ts | 17 +- apps/sim/blocks/blocks/confluence.test.ts | 17 +- apps/sim/blocks/blocks/google_drive.test.ts | 5 +- apps/sim/blocks/blocks/okta.test.ts | 17 +- apps/sim/blocks/blocks/servicenow.test.ts | 17 +- apps/sim/blocks/blocks/splunk.test.ts | 5 +- apps/sim/blocks/blocks/table.test.ts | 5 +- apps/sim/blocks/blocks/table_v2.test.ts | 5 +- apps/sim/blocks/utils.test.ts | 15 +- .../mcp/mcp-mode-switching.test.tsx | 18 +- .../secrets/secrets-editor.test.tsx | 12 +- .../settings/settings-header-shell.test.tsx | 1 - ...standalone-settings-shell-seeding.test.tsx | 7 +- .../ui/generated-password-input.test.tsx | 1 - apps/sim/connectors/all-selection.test.ts | 4 +- apps/sim/connectors/asana/asana.test.ts | 25 +- apps/sim/connectors/ashby/ashby.test.ts | 4 +- .../connectors/bitbucket/bitbucket.test.ts | 14 +- apps/sim/connectors/box/box.test.ts | 16 +- .../connectors/circleback/circleback.test.ts | 16 +- apps/sim/connectors/coda/README.md | 6 +- apps/sim/connectors/coda/coda.test.ts | 4 +- apps/sim/connectors/coda/permissions.test.ts | 1 - .../connectors/confluence/attachments.test.ts | 3 +- .../connectors/confluence/bulk-spaces.test.ts | 4 +- .../connectors/confluence/confluence.test.ts | 24 +- .../connectors/confluence/permissions.test.ts | 8 +- .../connectors/confluence/preflight.test.ts | 7 +- .../connectors/databricks/databricks.test.ts | 9 +- .../connectors/fireflies/fireflies.test.ts | 4 - apps/sim/connectors/github/github.test.ts | 10 +- apps/sim/connectors/github/pacing.test.ts | 1 - apps/sim/connectors/github/request.test.ts | 2 - apps/sim/connectors/gitlab/gitlab.test.ts | 14 +- .../gitlab/permission-policy.test.ts | 14 +- .../sim/connectors/gitlab/permissions.test.ts | 14 +- .../connectors/gmail/company-crawl.test.ts | 19 +- apps/sim/connectors/gmail/gmail.test.ts | 35 +- apps/sim/connectors/gmail/mailbox.test.ts | 14 +- .../google-calendar/company-crawl.test.ts | 1 - .../google-calendar/google-calendar.test.ts | 9 +- .../google-chat/google-chat.test.ts | 14 +- .../google-docs/google-docs.test.ts | 11 +- .../google-drive/company-crawl.test.ts | 5 +- .../connectors/google-drive/directory.test.ts | 8 +- .../google-drive/google-drive.test.ts | 11 +- .../connectors/google-drive/shortcuts.test.ts | 3 - .../google-drive/workspace-drives.test.ts | 1 - .../google-meet/google-meet.test.ts | 14 +- .../google-sheets/google-sheets.test.ts | 11 +- .../google-workspace/api-errors.test.ts | 1 - .../google-workspace/company-crawl.test.ts | 1 - apps/sim/connectors/granola/granola.test.ts | 16 +- .../connectors/greenhouse/greenhouse.test.ts | 20 +- .../connectors/incidentio/incidentio.test.ts | 18 +- apps/sim/connectors/intercom/intercom.test.ts | 14 +- apps/sim/connectors/jira/jira.test.ts | 6 +- apps/sim/connectors/jsm/jsm.test.ts | 16 +- apps/sim/connectors/linear/linear.test.ts | 17 +- .../microsoft-teams/microsoft-teams.test.ts | 16 +- apps/sim/connectors/monday/monday.test.ts | 16 +- apps/sim/connectors/notion/notion.test.ts | 27 +- apps/sim/connectors/onedrive/onedrive.test.ts | 19 +- apps/sim/connectors/outlook/outlook.test.ts | 18 +- apps/sim/connectors/reddit/reddit.test.ts | 14 +- .../connectors/salesforce/salesforce.test.ts | 16 +- apps/sim/connectors/sentry/sentry.test.ts | 22 +- .../connectors/servicenow/servicenow.test.ts | 19 +- apps/sim/connectors/sftp/sftp.test.ts | 15 +- .../connectors/sharepoint/sharepoint.test.ts | 19 +- apps/sim/connectors/slack/slack.test.ts | 1 - apps/sim/connectors/typeform/typeform.test.ts | 18 +- apps/sim/connectors/utils.test.ts | 6 +- apps/sim/connectors/webflow/webflow.test.ts | 18 +- .../connectors/wordpress/wordpress.test.ts | 14 +- apps/sim/connectors/workday/workday.test.ts | 18 +- apps/sim/connectors/youtube/youtube.test.ts | 10 +- apps/sim/connectors/zendesk/zendesk.test.ts | 12 +- apps/sim/connectors/zoom/zoom.test.ts | 15 +- .../hooks/permission-groups.test.tsx | 20 +- .../utils/permission-check.test.ts | 52 +- .../utils/permission-gate-subject.test.ts | 37 +- apps/sim/ee/access-requests/README.md | 2 +- .../permission-access-boundary.test.tsx | 20 +- .../lib/application/authorization.test.ts | 43 +- .../application/authorized-use-case.test.ts | 46 +- .../lib/application/requests.test.ts | 90 +- .../lib/application/review.test.ts | 98 +- .../ee/access-requests/lib/catalog.test.ts | 159 +- .../access-requests/lib/notifications.test.ts | 29 +- .../organization-account-providers.test.tsx | 67 +- ...nization-account-workspace-access.test.tsx | 37 +- ...rganization-workspace-grant-modal.test.tsx | 1 - apps/sim/ee/scim/TESTING.md | 6 +- .../application/groups/manage-groups.test.ts | 36 +- .../users/deprovision-user.test.ts | 32 +- .../application/users/provision-user.test.ts | 85 +- .../lib/application/users/update-user.test.ts | 40 +- apps/sim/ee/scim/lib/entitlement.test.ts | 12 +- .../lib/managed-membership.integration.ts | 5 +- .../ee/scim/lib/projection/auto-map.test.ts | 9 +- .../lib/projection/reconcile-user.test.ts | 30 +- apps/sim/ee/scim/lib/reconcile/job.test.ts | 35 +- apps/sim/ee/sso/components/sso-form.test.tsx | 34 +- .../ee/sso/components/sso-settings.test.tsx | 10 +- .../authorized-fork-use-case.test.ts | 30 +- .../application/content-outbox.test.ts | 11 +- .../application/discovery.test.ts | 44 +- .../application/preview-sync.test.ts | 14 +- .../application/recovery-and-mappings.test.ts | 70 +- .../application/revision.integration.ts | 10 +- .../fork-sync/use-fork-sync.test.tsx | 14 +- .../lib/copy/cleanup-failed.test.ts | 16 +- .../lib/copy/content-copy-runner.test.ts | 4 +- .../lib/copy/copy-files.test.ts | 88 +- .../lib/copy/copy-resources.test.ts | 51 +- .../lib/copy/copy-workflows.test.ts | 16 +- .../lib/copy/storage-quota.test.ts | 51 +- .../lib/copy/workflow-mcp-attachments.test.ts | 13 +- .../workspace-forking/lib/create-fork.test.ts | 31 +- .../lib/lineage/unlink.test.ts | 16 +- .../lib/promote/copy-unmapped.test.ts | 14 +- .../lib/promote/promote.test.ts | 32 +- .../lib/promote/rollback.test.ts | 42 +- apps/sim/enrichments/run.test.ts | 6 +- .../execution/block-executor.retry.test.ts | 274 -- .../executor/execution/block-executor.test.ts | 284 ++- .../execution/executor.run-from-block.test.ts | 212 -- apps/sim/executor/execution/executor.test.ts | 209 +- .../executor/execution/failure-trace.test.ts | 5 +- .../handlers/agent/agent-handler.test.ts | 120 +- .../agent/memory-harness.integration.ts | 901 ++++--- .../executor/handlers/agent/memory.test.ts | 42 +- ...ility.test.ts => memory.use-cases.test.ts} | 35 +- .../executor/handlers/api/api-handler.test.ts | 3 - .../condition/condition-handler.test.ts | 74 +- .../credential/credential-handler.test.ts | 22 +- .../evaluator/evaluator-handler.test.ts | 47 +- .../function/function-handler.test.ts | 8 +- .../handlers/generic/file-write.test.ts | 6 +- .../handlers/generic/generic-handler.test.ts | 3 - .../generic/keyed-invocation-identity.test.ts | 10 +- .../notification-params.test.ts | 37 +- .../mothership/mothership-handler.test.ts | 44 +- .../pi/cloud/authoring/backend.test.ts | 38 +- .../handlers/pi/cloud/babysit/backend.test.ts | 9 +- .../handlers/pi/cloud/babysit/github.test.ts | 6 +- .../handlers/pi/cloud/github-pr.test.ts | 11 +- .../handlers/pi/cloud/plan/backend.test.ts | 29 +- .../handlers/pi/cloud/review/backend.test.ts | 18 +- .../executor/handlers/pi/core/keys.test.ts | 31 +- .../handlers/pi/local/sim-tools.test.ts | 22 +- .../executor/handlers/pi/pi-handler.test.ts | 31 +- .../pi/search/extension-source.test.ts | 10 +- .../handlers/pi/search/parity.test.ts | 1 - .../executor/handlers/pi/search/tool.test.ts | 12 +- .../handlers/router/router-handler.test.ts | 48 +- .../variables/variables-handler.test.ts | 12 +- .../workflow/workflow-handler.test.ts | 119 +- .../workflow/workflow-tool-runner.test.ts | 26 +- apps/sim/executor/orchestrators/loop.test.ts | 13 +- apps/sim/executor/utils.test.ts | 6 +- .../executor/utils/credential-token.test.ts | 14 +- .../executor/utils/errors.classify.test.ts | 126 - apps/sim/executor/utils/errors.test.ts | 127 +- .../utils/file-tool-processor.aliases.test.ts | 104 - .../utils/file-tool-processor.context.test.ts | 164 -- .../utils/file-tool-processor.test.ts | 288 ++- .../utils/model-fallback-request.test.ts | 27 +- .../reference-validation.differential.test.ts | 107 - .../utils/reference-validation.test.ts | 106 +- ...resolved-secret-projection-refusal.test.ts | 14 +- .../resolved-secret-trace-registry.test.ts | 18 +- .../utils/tool-binding-labels.test.ts | 13 +- .../executor/utils/vertex-credential.test.ts | 29 +- apps/sim/executor/variables/resolver.test.ts | 18 +- .../variables/resolvers/block.test.ts | 51 +- .../variables/resolvers/workflow.test.ts | 24 +- apps/sim/hooks/AGENTS.md | 4 +- .../hooks/mcp/use-mcp-oauth-popup.test.tsx | 11 +- apps/sim/hooks/queries/admin-users.test.ts | 32 +- .../hooks/queries/credential-groups.test.tsx | 22 +- apps/sim/hooks/queries/environment.test.tsx | 6 +- apps/sim/hooks/queries/folders.test.ts | 18 +- .../general-settings-timezone.test.tsx | 13 +- .../queries/github-search-setup.test.tsx | 25 +- .../queries/kb/connectors-cache.test.tsx | 14 +- apps/sim/hooks/queries/kb/connectors.test.ts | 61 +- apps/sim/hooks/queries/kb/knowledge.test.ts | 61 +- apps/sim/hooks/queries/logs.test.tsx | 15 +- apps/sim/hooks/queries/mcp.test.tsx | 16 +- .../hooks/queries/mothership-chats.test.ts | 36 +- .../sim/hooks/queries/oauth-provider.test.tsx | 25 +- .../microsoft-dataverse-connections.test.ts | 27 +- .../queries/oauth/oauth-connections.test.tsx | 24 +- .../queries/oauth/oauth-credentials.test.ts | 17 +- .../queries/organization-accounts.test.tsx | 30 +- apps/sim/hooks/queries/organization.test.tsx | 72 +- .../scoped-credentials-mutations.test.ts | 15 +- .../hooks/queries/scoped-credentials.test.ts | 44 +- .../queries/search-integrations.test.tsx | 24 +- apps/sim/hooks/queries/selectors.test.tsx | 12 +- apps/sim/hooks/queries/session.test.ts | 13 +- apps/sim/hooks/queries/tables.test.ts | 67 +- .../queries/workflow-mcp-servers.test.tsx | 16 +- .../hooks/queries/workspace-files.test.tsx | 13 +- apps/sim/hooks/queries/workspace.test.tsx | 15 +- apps/sim/hooks/use-autosave.test.tsx | 1 - .../hooks/use-desktop-update-state.test.tsx | 12 +- apps/sim/hooks/use-execution-stream.test.tsx | 8 +- .../use-github-installation-setup.test.tsx | 13 +- apps/sim/hooks/use-member-enrollment.test.tsx | 39 +- ...-mothership-chat-events-lifecycle.test.tsx | 6 +- .../sim/hooks/use-oauth-return-hooks.test.tsx | 56 +- apps/sim/hooks/use-oauth-return.test.ts | 26 +- apps/sim/hooks/use-permission-config.test.tsx | 16 +- .../use-personal-source-account.test.tsx | 13 +- .../use-resource-list-preferences.test.tsx | 1 - ...use-search-integration-connection.test.tsx | 12 +- .../sim/hooks/use-settings-navigation.test.ts | 5 +- apps/sim/hooks/use-table-undo.test.ts | 5 +- apps/sim/hooks/use-voice-input.test.tsx | 1 - apps/sim/lib/a2a/client.test.ts | 6 +- .../lib/admin/dashboard-credit-grant.test.ts | 84 +- .../lib/admin/dashboard-organizations.test.ts | 52 +- .../lib/admin/external-collaborators.test.ts | 35 +- .../lib/admin/invitation-operation.test.ts | 39 +- apps/sim/lib/admin/member-operation.test.ts | 87 +- .../lib/admin/subscription-lifecycle.test.ts | 66 +- .../organization-byok-keys.test.ts | 56 +- .../application/personal-api-keys.test.ts | 29 +- .../application/workspace-api-keys.test.ts | 50 +- .../application/workspace-byok-keys.test.ts | 54 +- apps/sim/lib/api-key/byok-entitlement.test.ts | 30 +- apps/sim/lib/api-key/byok.test.ts | 84 +- apps/sim/lib/api-key/service.test.ts | 52 +- apps/sim/lib/api/client/request.test.ts | 6 +- .../{chats.password.test.ts => chats.test.ts} | 0 ...password.test.ts => public-shares.test.ts} | 0 apps/sim/lib/api/contracts/tables.ts | 2 +- apps/sim/lib/api/contracts/types.ts | 4 +- .../contracts/v2/__tests__/contract-sweep.ts | 84 - .../v2/{__tests__ => }/cross-cutting.test.ts | 0 .../files-search-scope.test.ts | 0 .../{__tests__ => }/list-pagination.test.ts | 3 +- .../v2/{__tests__ => }/logs-stats.test.ts | 0 .../lib/api/contracts/v2/openapi/shared.ts | 2 +- .../{__tests__ => }/pagination-limit.test.ts | 0 .../{__tests__ => }/permission-groups.test.ts | 0 .../{__tests__ => }/query-declaration.test.ts | 4 +- .../v2/{__tests__ => }/shared.test.ts | 0 apps/sim/lib/api/contracts/v2/shared.ts | 4 +- .../v2/{__tests__ => }/tables.test.ts | 2 +- .../schema-introspection.ts => test-utils.ts} | 88 + .../workflow-graph-variables.test.ts | 0 .../v2/{__tests__ => }/workflow-graph.test.ts | 0 apps/sim/lib/api/cursor-binding.test.ts | 2 +- apps/sim/lib/api/list-convention.test.ts | 39 +- apps/sim/lib/api/mcp/dispatch.test.ts | 18 +- apps/sim/lib/api/mcp/host-routing.test.ts | 25 +- .../api/server/routes/copilot-request.test.ts | 25 +- .../routes/in-process-transport.test.ts | 7 +- .../server/routes/internal-json-route.test.ts | 10 +- .../lib/api/server/routes/scim-route.test.ts | 38 +- .../api/server/routes/v2-api-key-auth.test.ts | 53 +- apps/sim/lib/atlassian/assistant.test.ts | 4 +- apps/sim/lib/atlassian/discovery.test.ts | 7 +- .../application/audit-log-use-cases.test.ts | 70 +- apps/sim/lib/audit-logs/authorization.test.ts | 6 +- apps/sim/lib/auth/ban.test.ts | 3 - .../lib/auth/connectors/managed-oauth.test.ts | 14 +- apps/sim/lib/auth/credential-access.test.ts | 24 +- apps/sim/lib/auth/hybrid.test.ts | 17 +- apps/sim/lib/auth/internal-delegation.test.ts | 29 +- .../auth/oauth-provider-adapter-guard.test.ts | 28 +- .../oauth-provider-lifecycle.integration.ts | 8 +- apps/sim/lib/auth/oauth-resource.test.ts | 9 +- .../auth/oauth-token-family.integration.ts | 5 +- apps/sim/lib/auth/oauth-token-family.test.ts | 27 +- apps/sim/lib/auth/session-hooks.test.ts | 1 - apps/sim/lib/auth/sign-out.test.ts | 14 +- .../lib/auth/sim-auth-adapter.integration.ts | 7 +- apps/sim/lib/auth/sim-auth-adapter.test.ts | 27 +- apps/sim/lib/auth/sso-policy.test.ts | 13 +- .../application/admit-sso-user.integration.ts | 5 +- .../sso/application/admit-sso-user.test.ts | 52 +- .../application/set-primary-provider.test.ts | 39 +- .../sso/application/sso-requirement.test.ts | 48 +- .../lib/auth/sso/idp-initiated-login.test.ts | 7 +- .../auth/sso/primary-provider.integration.ts | 5 +- .../application/billing-use-cases.test.ts | 134 +- ...anization-billing-summary-use-case.test.ts | 36 +- .../get-organization-billing-summary.test.ts | 102 +- .../organization-settings-actor.test.ts | 10 +- .../get-organization-activity.test.ts | 47 +- .../get-organization-usage-overview.test.ts | 57 +- .../organization-usage-use-cases.test.ts | 43 +- .../billing/application/usage-limits.test.ts | 90 +- apps/sim/lib/billing/authorization.test.ts | 42 +- .../calculations/usage-monitor.test.ts | 48 +- .../lib/billing/cleanup-dispatcher.test.ts | 51 +- .../core/account-billing-snapshot.test.ts | 25 +- .../billing/core/billing-attribution.test.ts | 50 +- apps/sim/lib/billing/core/billing.test.ts | 55 +- .../billing/core/inbox-entitlement.test.ts | 58 +- .../billing/core/limit-notifications.test.ts | 44 +- .../core/organization-activity.integration.ts | 33 +- ...ganization-usage-pagination.integration.ts | 31 +- .../billing/core/organization-usage.test.ts | 23 +- apps/sim/lib/billing/core/plan.test.ts | 15 +- .../core/reporting-usage-cache.test.ts | 19 +- .../sim/lib/billing/core/subscription.test.ts | 99 +- .../usage-analytics-queries.integration.ts | 30 +- .../lib/billing/core/usage-gate-cache.test.ts | 25 +- .../lib/billing/core/usage-log.integration.ts | 44 +- apps/sim/lib/billing/core/usage-log.test.ts | 20 +- .../billing/core/usage-segment-cache.test.ts | 11 +- apps/sim/lib/billing/core/usage.test.ts | 123 +- .../lib/billing/core/workspace-access.test.ts | 27 +- .../billing/core/workspace-usage-gate.test.ts | 16 +- .../billing/credits/weekly-refresh.test.ts | 19 +- apps/sim/lib/billing/cycle-close.test.ts | 99 +- .../sim/lib/billing/enterprise-outbox.test.ts | 19 +- .../billing/enterprise-owner-claim.test.ts | 85 +- .../billing/enterprise-provisioning.test.ts | 103 +- apps/sim/lib/billing/organization.test.ts | 63 +- .../billing/organizations/lock-order.test.ts | 5 +- .../member-limits.integration.ts | 50 +- .../organizations/member-limits.test.ts | 87 +- .../membership-external-removal.test.ts | 14 +- .../membership-reconciliation.test.ts | 24 +- .../pause-pro-for-coverage.test.ts | 11 +- .../organizations/provision-seat.test.ts | 47 +- .../billing/organizations/seat-drift.test.ts | 14 +- .../lib/billing/organizations/seats.test.ts | 17 +- apps/sim/lib/billing/storage/context.test.ts | 14 +- apps/sim/lib/billing/storage/limits.test.ts | 43 +- .../billing/storage/payer-transfer.test.ts | 20 +- apps/sim/lib/billing/storage/tracking.test.ts | 47 +- .../sim/lib/billing/threshold-billing.test.ts | 124 +- .../validation/seat-management.test.ts | 47 +- .../lib/billing/webhooks/enterprise.test.ts | 78 +- .../sim/lib/billing/webhooks/invoices.test.ts | 71 +- .../billing/webhooks/outbox-handlers.test.ts | 45 +- .../application/browser-file-transfer.test.ts | 88 +- apps/sim/lib/browser-agent/transport.test.ts | 82 +- .../catalog/application/catalog-reads.test.ts | 104 +- .../application/list-registries.test.ts | 37 +- .../catalog/application/operations.test.ts | 25 +- .../projection/projection-invariants.test.ts | 39 +- apps/sim/lib/chunkers/docs-chunker.test.ts | 12 +- apps/sim/lib/cli-auth/approval-store.test.ts | 18 +- apps/sim/lib/collab-doc/collab-state.test.ts | 42 +- apps/sim/lib/collab-doc/persist.test.ts | 48 +- apps/sim/lib/collab-doc/seed.test.ts | 27 +- .../{__tests__ => }/leader-lock.test.ts | 0 .../{__tests__ => }/singleflight.test.ts | 1 - apps/sim/lib/consent/storage.test.ts | 1 - .../authorized-workspace-use-case.test.ts | 70 +- .../locked-credential-authorization.test.ts | 66 +- .../organization-authorization.test.ts | 22 +- .../workspace-authorization.test.ts | 93 +- .../core/async-jobs/backends/database.test.ts | 14 +- .../async-jobs/backends/trigger-dev.test.ts | 86 +- apps/sim/lib/core/async-jobs/region.test.ts | 11 +- .../core/config/deployment-shape.dom.test.tsx | 7 +- .../sim/lib/core/config/feature-flags.test.ts | 44 +- apps/sim/lib/core/config/redis.test.ts | 32 +- .../core/config/trigger-availability.test.ts | 22 +- .../lib/core/config/trigger-runtime.test.ts | 15 +- .../lib/core/execution-limits/types.test.ts | 15 +- apps/sim/lib/core/idempotency/cleanup.test.ts | 3 +- apps/sim/lib/core/idempotency/service.test.ts | 11 +- .../read-organization-network.test.ts | 22 +- .../lib/core/network/context.server.test.ts | 17 +- .../lib/core/network/gateway.server.test.ts | 26 +- .../network/resource-scope.server.test.ts | 27 +- apps/sim/lib/core/outbox/enqueue.test.ts | 23 +- apps/sim/lib/core/outbox/processor.test.ts | 15 +- .../lib/core/outbox/service.integration.ts | 6 +- apps/sim/lib/core/outbox/service.test.ts | 7 +- .../rate-limiter/provider-admission.test.ts | 1 - .../provider-capacity-store.test.ts | 14 +- .../provider-capacity.integration.ts | 14 +- .../rate-limiter/provider-capacity.test.ts | 1 - .../route-helpers-client-ip.test.ts | 14 +- .../storage/db-token-bucket.test.ts | 1 - apps/sim/lib/core/rate-limiter/types.test.ts | 17 +- .../core/security/csp-socket-fallback.test.ts | 14 +- apps/sim/lib/core/security/csp.test.ts | 8 +- apps/sim/lib/core/security/deployment.test.ts | 6 +- apps/sim/lib/core/security/encryption.test.ts | 20 +- .../security/input-validation.server.test.ts | 23 +- .../linear-regex.differential.test.ts | 248 -- .../lib/core/security/linear-regex.test.ts | 247 ++ apps/sim/lib/core/security/linear-regex.ts | 2 +- .../pinned-redirect-replay.server.test.ts | 8 - ...ecure-fetch-connection-pool.server.test.ts | 8 - ...ecure-fetch-request-framing.server.test.ts | 8 - .../secure-fetch-response-cap.server.test.ts | 9 - apps/sim/lib/core/utils.test.ts | 6 +- apps/sim/lib/core/utils/background.test.ts | 8 +- apps/sim/lib/core/utils/theme.test.ts | 1 - apps/sim/lib/core/utils/urls.test.ts | 22 +- .../application/authorization.test.ts | 52 +- .../configure-organization-mcp.test.ts | 69 +- .../application/create-invite-link.test.ts | 64 +- .../application/enrollment-auth.test.ts | 21 +- .../application/list-credentials.test.ts | 126 +- .../application/list-mcp-connections.test.ts | 106 +- .../application/manage-access.test.ts | 51 +- .../application/manage-enrollments.test.ts | 55 +- .../application/manage-groups.test.ts | 96 +- .../application/organization-access.test.ts | 88 +- .../organization-account-indexing.test.ts | 81 +- .../organization-account-management.test.ts | 90 +- .../organization-settings-delegation.test.ts | 13 +- .../personal-organization-accounts.test.ts | 38 +- .../application/public-enrollment.test.ts | 75 +- .../application/send-invite.test.ts | 61 +- .../application/slack-managed-users.test.ts | 77 +- .../workspace-organization-accounts.test.ts | 35 +- .../credential-groups/availability.test.ts | 19 +- .../lib/credential-groups/enrollments.test.ts | 43 +- .../credential-groups/mcp-oauth-state.test.ts | 21 +- .../lib/credential-groups/oauth-state.test.ts | 28 +- apps/sim/lib/credential-groups/oauth.test.ts | 31 +- .../organization-provider-setup.test.ts | 25 +- .../organization-setup.test.ts | 12 +- .../provider-configuration.test.ts | 50 +- .../lib/credential-groups/rate-limit.test.ts | 13 +- .../scoped-availability.test.ts | 54 +- .../search-connection-completion.test.ts | 3 +- .../self-enrollment-oauth.test.ts | 26 +- .../credential-groups/self-enrollment.test.ts | 28 +- .../sim/lib/credential-groups/service.test.ts | 12 +- .../slack-managed-users.test.ts | 83 +- .../credential-groups/slack-provider.test.ts | 7 +- .../standard-oauth-provider.test.ts | 10 +- .../sim/lib/credential-groups/trigger.test.ts | 32 +- .../credentials/__tests__/deletion.test.ts | 120 - apps/sim/lib/credentials/access.test.ts | 18 +- .../authorized-credential-use-case.test.ts | 41 +- .../application/capability-gate.test.ts | 25 +- .../complete-quickbooks-connection.test.ts | 57 +- .../application/connection-target.test.ts | 32 +- .../create-credential-connection.test.ts | 44 +- .../application/credential-crud.test.ts | 81 +- .../delete-many-credentials.test.ts | 54 +- .../discover-managed-mcp-tools.test.ts | 128 +- .../launch-credential-connection.test.ts | 34 +- .../list-credential-providers.test.ts | 35 +- .../list-workspace-credentials.test.ts | 66 +- .../managed-oauth-delegation.test.ts | 23 +- .../application/membership-projection.test.ts | 42 +- .../application/oauth-accounts.test.ts | 7 +- .../organization-credentials.test.ts | 72 +- .../application/personal-connection.test.ts | 110 +- .../application/personal-credentials.test.ts | 51 +- .../prepare-credential-connection.test.ts | 59 +- .../application/provider-catalog.test.ts | 62 +- .../resolve-managed-oauth-token.test.ts | 58 +- ...esolve-organization-personal-token.test.ts | 76 +- .../resolve-personal-token.test.ts | 60 +- .../application/save-credential-draft.test.ts | 42 +- .../application/service-account.test.ts | 78 +- .../workspace-account-visibility.test.ts | 20 +- .../atlassian-service-account.test.ts | 3 +- .../minters/box.test.ts | 38 +- .../minters/netsuite.test.ts | 15 +- .../minters/salesforce.test.ts | 65 +- .../minters/zoho-desk.test.ts | 48 +- .../minters/zoom.test.ts | 23 +- .../sim/lib/credentials/connect-draft.test.ts | 8 +- apps/sim/lib/credentials/deletion.test.ts | 135 +- apps/sim/lib/credentials/draft-hooks.test.ts | 3 +- apps/sim/lib/credentials/environment.test.ts | 14 +- .../credentials/gitlab-personal-token.test.ts | 21 +- .../credentials/managed-mcp-runtime.test.ts | 14 +- apps/sim/lib/credentials/managed-mcp.test.ts | 31 +- .../sim/lib/credentials/managed-oauth.test.ts | 40 +- apps/sim/lib/credentials/members.test.ts | 10 +- .../credentials/orchestration/index.test.ts | 50 +- .../credentials/organization-draft.test.ts | 30 +- .../lib/credentials/personal-tokens.test.ts | 40 +- apps/sim/lib/credentials/personal.test.ts | 9 +- .../sim/lib/credentials/secret-values.test.ts | 40 +- .../service-account-secret.test.ts | 7 +- .../token-service-accounts/errors.test.ts | 6 +- .../validators/attio.test.ts | 14 +- .../validators/harmonic.test.ts | 6 +- .../validators/hubspot.test.ts | 27 +- .../validators/linear.test.ts | 61 +- .../validators/monday.test.ts | 24 +- .../validators/shopify.test.ts | 25 +- .../validators/snowflake.test.ts | 17 +- .../validators/trello.test.ts | 23 +- .../validators/wealthbox.test.ts | 25 +- .../webhook-deactivation.test.ts | 15 +- .../application/use-cases.test.ts | 57 +- .../data-drains/application/routes.test.ts | 36 +- .../data-drains/application/use-cases.test.ts | 75 +- .../data-drains/destinations/bigquery.test.ts | 28 +- apps/sim/lib/data-drains/dispatcher.test.ts | 24 +- apps/sim/lib/desktop/index.test.ts | 6 +- .../lib/desktop/preferences-loading.test.ts | 4 +- apps/sim/lib/embeddings/client.test.ts | 29 +- .../embeddings/configuration-error.test.ts | 18 +- apps/sim/lib/environment/utils.test.ts | 53 +- .../lib/events/rotating-event-source.test.ts | 6 +- .../{__tests__ => }/call-chain.test.ts | 0 .../cancel-workflow-execution.test.ts | 77 +- ...scan.differential.test.ts => scan.test.ts} | 0 ...urable-secret-provenance-telemetry.test.ts | 9 +- apps/sim/lib/execution/event-buffer.test.ts | 27 +- .../lib/execution/execution-signal.test.ts | 16 +- apps/sim/lib/execution/files.test.ts | 99 +- apps/sim/lib/execution/isolated-vm.test.ts | 52 +- .../execution/model-input-provenance.test.ts | 12 +- .../payloads/file-secret-provenance.test.ts | 13 +- .../lib/execution/payloads/hydration.test.ts | 14 +- .../payloads/large-array-manifest.test.ts | 16 +- .../payloads/materialization.server.test.ts | 67 +- .../lib/execution/payloads/serializer.test.ts | 30 +- apps/sim/lib/execution/payloads/store.test.ts | 67 +- apps/sim/lib/execution/preprocessing.test.ts | 150 +- .../preprocessing.webhook-correlation.test.ts | 95 - .../remote-sandbox/conformance.test.ts | 39 +- .../remote-sandbox/e2b-session.test.ts | 6 +- .../e2b-system-packages.test.ts | 18 +- .../remote-sandbox/entitlement.test.ts | 14 +- ...eptance.test.ts => fellows-digest.test.ts} | 0 .../remote-sandbox/image-registry.test.ts | 116 +- .../remote-sandbox/pi-lifetime.test.ts | 23 +- .../execution/remote-sandbox/resolve.test.ts | 102 +- .../session-file-provenance.test.ts | 5 +- .../session-file-snapshot.test.ts | 13 +- .../session-file-uploads.test.ts | 13 +- .../remote-sandbox/session-files.test.ts | 19 +- .../remote-sandbox/session-lock.test.ts | 19 +- .../remote-sandbox/session-sandbox.test.ts | 24 +- .../remote-sandbox/wand-enricher.test.ts | 40 +- .../workspace-sandboxes.test.ts | 74 +- .../sandbox/brokers/workspace-file.test.ts | 19 +- .../file-parsers/csv-preview-slice.test.ts | 11 +- apps/sim/lib/file-parsers/json-parser.test.ts | 6 +- apps/sim/lib/file-parsers/odf-text.test.ts | 6 +- .../file-parsers/ooxml-presentation.test.ts | 6 +- .../file-parsers/xlsx-preview-bound.test.ts | 6 +- .../folders/application-folder-caps.test.ts | 99 +- apps/sim/lib/folders/bulk.test.ts | 23 +- apps/sim/lib/folders/orchestration.test.ts | 28 +- .../application/execute-chat-function.test.ts | 19 +- .../application/execute-function.test.ts | 27 +- .../execute-request.test.ts | 85 +- .../function-execution/sandbox-mounts.test.ts | 44 +- apps/sim/lib/guardrails/mask-client.test.ts | 20 +- .../guardrails/validate_hallucination.test.ts | 28 +- apps/sim/lib/guardrails/validate_pii.test.ts | 4 +- .../lib/guardrails/validation-client.test.ts | 13 +- apps/sim/lib/imap/connection.server.test.ts | 13 +- ...ilability.server.oauth-configured.test.ts} | 16 +- .../integrations/availability.server.test.ts | 5 +- .../credential-visibility.server.test.ts | 24 +- apps/sim/lib/internal/a2a/operations.test.ts | 53 +- apps/sim/lib/internal/agiloft/client.test.ts | 16 +- .../lib/internal/agiloft/file-input.test.ts | 37 +- .../lib/internal/agiloft/operations.test.ts | 19 +- .../sim/lib/internal/asana/operations.test.ts | 6 +- .../sim/lib/internal/ashby/operations.test.ts | 58 +- .../azure-data-explorer/client.test.ts | 22 +- apps/sim/lib/internal/box/operations.test.ts | 38 +- apps/sim/lib/internal/brex/client.test.ts | 41 +- apps/sim/lib/internal/brex/operations.test.ts | 38 +- .../browser-use/operations/run-task.test.ts | 12 +- .../lib/internal/buffer/operations.test.ts | 22 +- .../lib/internal/clickhouse/client.test.ts | 21 +- .../lib/internal/clickup/operations.test.ts | 38 +- .../internal/confluence/operations.test.ts | 42 +- .../internal/crowdstrike/operations.test.ts | 8 +- .../lib/internal/cursor/operations.test.ts | 21 +- .../read-available-by-id-or-title.test.ts | 17 +- .../internal/deployments/execute-tool.test.ts | 15 +- .../lib/internal/discord/operations.test.ts | 27 +- .../lib/internal/docusign/operations.test.ts | 63 +- .../lib/internal/dropbox/operations.test.ts | 38 +- .../internal/elevenlabs/operations.test.ts | 79 +- .../internal/embeddings/operations.test.ts | 22 +- apps/sim/lib/internal/extend/client.test.ts | 32 +- .../lib/internal/file/execute-tool.test.ts | 29 +- .../file/materialization-context.test.ts | 12 +- .../file/operations.provenance.test.ts | 146 +- apps/sim/lib/internal/file/operations.test.ts | 263 +- apps/sim/lib/internal/file/parser.test.ts | 165 +- .../lib/internal/firecrawl/operations.test.ts | 48 +- .../lib/internal/fireflies/operations.test.ts | 12 +- .../sim/lib/internal/function/execute.test.ts | 20 +- .../sim/lib/internal/gmail/operations.test.ts | 40 +- .../lib/internal/google-drive/client.test.ts | 27 +- .../internal/google-drive/file-input.test.ts | 42 +- .../internal/google-slides/operations.test.ts | 43 +- .../internal/google-vault/operations.test.ts | 20 +- apps/sim/lib/internal/grafana/client.test.ts | 27 +- .../internal/guardrails/operations.test.ts | 52 +- apps/sim/lib/internal/image/fetch.test.ts | 14 +- .../sim/lib/internal/image/operations.test.ts | 66 +- .../internal/instagram/execute-tool.test.ts | 64 +- .../lib/internal/instagram/publishing.test.ts | 25 +- apps/sim/lib/internal/jira/client.test.ts | 6 +- apps/sim/lib/internal/jira/operations.test.ts | 40 +- apps/sim/lib/internal/jupyter/client.test.ts | 29 +- .../lib/internal/jupyter/file-input.test.ts | 38 +- .../internal/knowledge/execute-tool.test.ts | 15 +- .../lib/internal/knowledge/operations.test.ts | 32 +- .../sim/lib/internal/latex/operations.test.ts | 20 +- apps/sim/lib/internal/llm/operations.test.ts | 57 +- .../lib/internal/logs/execute-tool.test.ts | 16 +- .../mail/attachment-materialization.test.ts | 35 +- .../sim/lib/internal/mcp/execute-tool.test.ts | 32 +- .../lib/internal/memory/execute-tool.test.ts | 17 +- .../lib/internal/memory/operations.test.ts | 25 +- .../add-user-app-role-assignment.test.ts | 4 +- .../sim/lib/internal/mistral/capacity.test.ts | 65 +- apps/sim/lib/internal/mistral/client.test.ts | 42 +- .../lib/internal/mistral/operations.test.ts | 60 +- apps/sim/lib/internal/mongodb/client.test.ts | 38 +- apps/sim/lib/internal/mysql/client.test.ts | 28 +- .../lib/internal/onedrive/operations.test.ts | 52 +- .../lib/internal/onepassword/client.test.ts | 17 +- .../lib/internal/outlook/operations.test.ts | 39 +- .../lib/internal/persona/operations.test.ts | 27 +- .../lib/internal/postgresql/client.test.ts | 13 +- .../lib/internal/principals/executor.test.ts | 14 +- .../internal/quickbooks/operations.test.ts | 50 +- .../quickbooks/provider-operations.test.ts | 11 +- .../lib/internal/quiver/operations.test.ts | 67 +- .../sim/lib/internal/redis/operations.test.ts | 20 +- apps/sim/lib/internal/s3/operations.test.ts | 36 +- .../sim/lib/internal/sailpoint/client.test.ts | 1 - .../internal/sailpoint/execute-tool.test.ts | 43 +- .../operations/update-custom-field.test.ts | 6 +- .../lib/internal/sap-concur/client.test.ts | 16 +- .../internal/sap-concur/operations.test.ts | 37 +- .../internal/sap-concur/response-body.test.ts | 10 +- .../lib/internal/sap-s4hana/client.test.ts | 15 +- apps/sim/lib/internal/sftp/client.test.ts | 13 +- apps/sim/lib/internal/sftp/operations.test.ts | 43 +- .../lib/internal/sharepoint/client.test.ts | 24 +- .../internal/sharepoint/operations.test.ts | 38 +- .../sim/lib/internal/slack/file-input.test.ts | 40 +- .../sim/lib/internal/slack/operations.test.ts | 26 +- apps/sim/lib/internal/smtp/operations.test.ts | 16 +- .../lib/internal/square/operations.test.ts | 32 +- .../sim/lib/internal/stagehand/client.test.ts | 10 +- .../sim/lib/internal/stt/execute-tool.test.ts | 51 +- .../lib/internal/supabase/operations.test.ts | 32 +- .../operations/storage-update-bucket.test.ts | 6 +- .../lib/internal/table/execute-tool.test.ts | 17 +- .../sim/lib/internal/table/operations.test.ts | 44 +- .../lib/internal/table/read-schema.test.ts | 32 +- .../lib/internal/telegram/operations.test.ts | 27 +- .../lib/internal/tiktok/operations.test.ts | 15 +- apps/sim/lib/internal/tiktok/upload.test.ts | 19 +- .../file-result.server.test.ts | 119 +- apps/sim/lib/internal/tts/client.test.ts | 4 +- apps/sim/lib/internal/tts/operations.test.ts | 35 +- .../internal/twilio-voice/operations.test.ts | 24 +- apps/sim/lib/internal/vanta/client.test.ts | 6 +- .../sim/lib/internal/vanta/file-input.test.ts | 48 +- apps/sim/lib/internal/video/client.test.ts | 15 +- .../sim/lib/internal/video/operations.test.ts | 58 +- apps/sim/lib/internal/vision/client.test.ts | 24 +- .../lib/internal/vision/operations.test.ts | 76 +- .../lib/internal/whatsapp/operations.test.ts | 57 +- apps/sim/lib/internal/whatsapp/upload.test.ts | 47 +- .../internal/windchill/execute-tool.test.ts | 13 +- .../lib/internal/windchill/operations.test.ts | 85 +- apps/sim/lib/internal/workday/client.test.ts | 6 +- .../workflows/read-definition.test.ts | 14 +- .../lib/internal/zoho-desk/operations.test.ts | 18 +- apps/sim/lib/internal/zoom/operations.test.ts | 24 +- .../list-workspace-invitations.test.ts | 36 +- .../application/manage-invitation.test.ts | 115 +- .../invitations/application/mutations.test.ts | 66 +- .../application/send-invitation-batch.test.ts | 76 +- apps/sim/lib/invitations/core.test.ts | 86 +- apps/sim/lib/invitations/direct-grant.test.ts | 90 +- .../organization-invitations.test.ts | 69 +- .../sim/lib/invitations/resend-policy.test.ts | 96 +- apps/sim/lib/invitations/send-resend.test.ts | 15 +- .../invitations/workspace-invitations.test.ts | 113 +- .../github-member.integration.ts | 15 +- .../provider-admission.integration.ts | 14 +- .../storage-accounting.integration.ts | 6 +- .../lib/knowledge/access/availability.test.ts | 56 +- .../knowledge/access/confluence-site.test.ts | 23 +- .../access/github-installation.test.ts | 41 +- .../access/group-membership.integration.ts | 3 +- .../knowledge/access/predicate.integration.ts | 9 +- apps/sim/lib/knowledge/access/scope.test.ts | 55 +- .../lib/knowledge/api/internal-route.test.ts | 12 +- .../application/add-workspace-files.test.ts | 194 +- .../authorized-knowledge-use-case.test.ts | 46 +- .../lib/knowledge/application/billing.test.ts | 79 +- .../lib/knowledge/application/bulk.test.ts | 103 +- .../lib/knowledge/application/chat.test.ts | 95 +- .../lib/knowledge/application/chunks.test.ts | 38 +- ...onnect-personal-search-integration.test.ts | 71 +- .../application/connector-access.test.ts | 186 +- .../application/connector-credential.test.ts | 59 +- .../knowledge/application/connectors.test.ts | 314 +-- .../knowledge/application/contexts.test.ts | 106 +- .../knowledge/application/documents.test.ts | 289 +-- .../lib/knowledge/application/exports.test.ts | 61 +- .../lib/knowledge/application/folders.test.ts | 102 +- .../github-installation-source.test.ts | 35 +- .../github-installations.integration.ts | 128 +- .../application/github-installations.test.ts | 110 +- .../application/github-setup.test.ts | 105 +- .../application/knowledge-bases.test.ts | 220 +- .../organization-search-overview.test.ts | 62 +- .../organization-search-stats.test.ts | 54 +- .../personal-search-account.test.ts | 64 +- .../personal-search-integrations.test.ts | 96 +- .../application/personal-source-setup.test.ts | 95 +- .../read-original-document.test.ts | 57 +- .../application/read-search-document.test.ts | 69 +- .../application/search-index.integration.ts | 7 +- .../application/search-integrations.test.ts | 103 +- .../application/search-sources.test.ts | 103 +- .../lib/knowledge/application/search.test.ts | 242 +- .../knowledge/application/sim-search.test.ts | 179 +- .../slack-search/assistant.test.ts | 104 +- .../slack-search/authorization.test.ts | 22 +- .../application/slack-search/commands.test.ts | 6 +- .../application/slack-search/home.test.ts | 28 +- .../application/slack-search/identity.test.ts | 5 +- .../slack-search/installations.test.ts | 54 +- .../slack-search/onboarding.test.ts | 25 +- .../application/slack-search/setup.test.ts | 86 +- .../application/slack-search/stop.test.ts | 17 +- .../application/slack-search/turns.test.ts | 17 +- .../lib/knowledge/application/tags.test.ts | 103 +- .../application/upload-sessions.test.ts | 143 +- .../workspace-search.activity.test.ts | 96 +- .../application/workspace-search.test.ts | 58 +- apps/sim/lib/knowledge/chunks/service.test.ts | 5 +- .../knowledge/connectors/access-token.test.ts | 25 +- .../lib/knowledge/connectors/deletion.test.ts | 24 +- .../knowledge/connectors/detachment.test.ts | 46 +- .../connectors/directory-queue.test.ts | 8 +- .../external-directory.integration.ts | 7 +- .../connectors/external-group-sync.test.ts | 22 +- .../connectors/member-access.test.ts | 80 +- .../connectors/member-observations.test.ts | 6 +- .../connectors/member-provisioning.test.ts | 51 +- .../knowledge/connectors/member-queue.test.ts | 52 +- ...ber-sync-engine-content-credential.test.ts | 119 +- .../connectors/member-sync-engine.test.ts | 19 +- .../connectors/mirrored-access.test.ts | 15 +- .../organization-account-indexing.test.ts | 11 +- .../lib/knowledge/connectors/queue.test.ts | 41 +- .../connectors/sync-content-pass.test.ts | 80 +- .../connectors/sync-database-retry.test.ts | 12 +- .../knowledge/connectors/sync-engine.test.ts | 75 +- .../connectors/sync-log-retention.test.ts | 6 +- .../connectors/sync-persistence.test.ts | 38 +- .../connectors/sync-primitives.test.ts | 38 +- .../documents/document-indexing-usage.test.ts | 66 +- .../document-processing-source.test.ts | 73 +- .../document-processor-chunk-limit.test.ts | 17 +- ...cument-processor-secret-provenance.test.ts | 46 +- .../documents/embedding-checkpoints.test.ts | 42 +- .../documents/ocr-checkpoints.test.ts | 74 +- .../documents/pdf-ocr-chunking.test.ts | 1 - .../documents/pdf-ocr-triage.test.ts | 44 +- .../processing-continuation-dispatch.test.ts | 14 +- .../documents/processing-dispatch.test.ts | 15 +- .../processing-outbox-handler.test.ts | 50 +- .../documents/processing-queue.test.ts | 23 +- ...rocessing-recovery-queue-transport.test.ts | 1 - .../processing-recovery-queue.test.ts | 1 - .../documents/retry-processing-grace.test.ts | 5 +- .../documents/secure-fetch.server.test.ts | 16 +- .../documents/storage-billing.test.ts | 53 +- .../documents/storage-cleanup.test.ts | 21 +- .../documents/storage-upload.test.ts | 52 +- .../stored-artifact-extension.test.ts | 10 +- .../documents/unreadable-document.test.ts | 23 +- .../sim/lib/knowledge/documents/utils.test.ts | 15 +- .../workspace-source-provenance.test.ts | 70 +- .../embeddings-configuration.test.ts | 40 +- apps/sim/lib/knowledge/embeddings.test.ts | 38 +- apps/sim/lib/knowledge/folders.test.ts | 51 +- .../lib/knowledge/github-setup-urls.test.ts | 5 +- apps/sim/lib/knowledge/mcp/activity.test.ts | 5 +- .../lib/knowledge/mcp/oauth-metadata.test.ts | 23 +- .../lib/knowledge/mcp/route-handler.test.ts | 142 +- .../lib/knowledge/mcp/server.protocol.test.ts | 29 +- apps/sim/lib/knowledge/mcp/server.test.ts | 69 +- .../knowledge/model-input-provenance.test.ts | 11 +- .../orchestration/connector-access.test.ts | 112 +- .../orchestration/connectors.test.ts | 99 +- .../knowledge/orchestration/documents.test.ts | 77 +- .../orchestration/knowledge-bases.test.ts | 55 +- .../projection/enqueue-inline.test.ts | 13 +- .../lib/knowledge/projection/enqueue.test.ts | 54 +- apps/sim/lib/knowledge/projection/run.test.ts | 30 +- apps/sim/lib/knowledge/reranker.test.ts | 7 +- .../sim/lib/knowledge/search/activity.test.ts | 5 +- apps/sim/lib/knowledge/search/budget.test.ts | 4 +- .../sim/lib/knowledge/search/defaults.test.ts | 12 +- .../lib/knowledge/search/diagnostics.test.ts | 7 +- apps/sim/lib/knowledge/search/queries.test.ts | 3 - .../search/tin-keyword-readiness.test.ts | 7 +- .../lib/knowledge/search/tin-keyword.test.ts | 11 +- .../lib/knowledge/secret-provenance.test.ts | 10 +- apps/sim/lib/knowledge/service.test.ts | 22 +- .../knowledge/tags/filter-resolution.test.ts | 26 +- apps/sim/lib/knowledge/tags/service.test.ts | 9 +- .../knowledge/transfer/export-archive.test.ts | 20 +- .../lib/link-preview/fetch-preview.test.ts | 10 +- apps/sim/lib/logs/api/route-policies.test.ts | 20 +- .../lib/logs/application/list-logs.test.ts | 49 +- .../log-analytics-use-cases.test.ts | 45 +- .../application/public-log-projection.test.ts | 69 +- .../application/public-log-use-cases.test.ts | 145 +- .../read-execution-snapshot.test.ts | 52 +- .../logs/application/read-log-detail.test.ts | 32 +- .../execution/hydrate-child-traces.test.ts | 63 +- apps/sim/lib/logs/execution/logger.test.ts | 149 +- .../logs/execution/logging-session.test.ts | 80 +- .../logs/execution/pii-large-values.test.ts | 16 +- .../logs/execution/progress-markers.test.ts | 10 +- .../logs/execution/snapshot/service.test.ts | 12 +- .../execution/trace-secret-projection.test.ts | 30 +- .../execution/trace-store-storage.test.ts | 27 +- .../lib/logs/execution/trace-store.test.ts | 40 +- apps/sim/lib/logs/fetch-log-detail.test.ts | 14 +- apps/sim/lib/logs/list-logs.test.ts | 48 +- apps/sim/lib/logs/log-views.test.ts | 12 +- .../lib/managed-agents/run-session.test.ts | 10 +- .../application/execute-managed-tool.test.ts | 61 +- .../lib/mcp/application/execute-tool.test.ts | 76 +- .../application/managed-connections.test.ts | 61 +- .../lib/mcp/application/operations.test.ts | 17 +- .../sim/lib/mcp/application/use-cases.test.ts | 77 +- .../application/workflow-deployments.test.ts | 70 +- apps/sim/lib/mcp/client.test.ts | 27 +- apps/sim/lib/mcp/connection-manager.test.ts | 43 +- apps/sim/lib/mcp/connection-pool.test.ts | 7 +- apps/sim/lib/mcp/middleware.test.ts | 50 +- .../lib/mcp/oauth/coordinated-fetch.test.ts | 30 +- apps/sim/lib/mcp/oauth/probe.test.ts | 48 +- apps/sim/lib/mcp/oauth/revoke.test.ts | 23 +- .../orchestration/server-lifecycle.test.ts | 45 +- .../workflow-mcp-lifecycle.test.ts | 33 +- apps/sim/lib/mcp/pinned-fetch.test.ts | 24 +- apps/sim/lib/mcp/resolve-config.test.ts | 13 +- apps/sim/lib/mcp/service-pool.test.ts | 8 +- apps/sim/lib/mcp/service.test.ts | 8 +- apps/sim/lib/mcp/workflow-mcp-sync.test.ts | 31 +- .../sim/lib/memory/agent-turn-session.test.ts | 36 +- .../memory/application/agent-turns.test.ts | 42 +- .../lib/memory/application/retrieval.test.ts | 29 +- .../lib/memory/application/use-cases.test.ts | 42 +- apps/sim/lib/memory/artifacts.test.ts | 15 +- apps/sim/lib/memory/checkpoint-codec.test.ts | 6 +- apps/sim/lib/memory/context-tokens.test.ts | 8 +- .../memory/conversation-store.integration.ts | 101 +- apps/sim/lib/memory/history-window.test.ts | 31 +- .../memory/message-provenance.integration.ts | 25 +- .../sim/lib/memory/message-provenance.test.ts | 73 +- apps/sim/lib/memory/read-budget.test.ts | 5 +- apps/sim/lib/memory/replay-provenance.test.ts | 43 +- apps/sim/lib/memory/retrieval-tool.test.ts | 17 +- apps/sim/lib/memory/retrieval.test.ts | 20 +- apps/sim/lib/memory/secret-provenance.test.ts | 14 +- .../lib/memory/summary-store.integration.ts | 44 +- apps/sim/lib/messaging/email/mailer.test.ts | 40 +- .../messaging/email/providers/gmail.test.ts | 7 +- .../lib/messaging/email/unsubscribe.test.ts | 4 - .../lib/messaging/email/verification.test.ts | 11 +- apps/sim/lib/model-router/resolve.test.ts | 82 +- .../lib/mothership/agent-cli/curation.test.ts | 20 +- .../agent-cli/engines/file-read.test.ts | 59 +- .../agent-cli/engines/lint-scope.test.ts | 62 +- .../agent-cli/engines/workflow-api.test.ts | 3 +- .../agent-cli/file-provenance.test.ts | 103 +- .../file-round-trip-provenance.test.ts | 159 +- .../agent-cli/file-upload-origin.test.ts | 57 +- .../agent-cli/file-upload-transport.test.ts | 15 +- .../agent-cli/resource-owner.test.ts | 15 +- .../agent-cli/run-cli-files.test.ts | 3 +- .../agent-cli/saved-run-read.live.test.ts | 18 +- .../agent-cli/scope-routing.test.ts | 18 +- .../agent-cli/scoped-fork-transport.test.ts | 27 +- .../lib/mothership/agent-cli/services.test.ts | 34 +- .../agent-cli/table-read-transport.test.ts | 27 +- .../workbench-file-provenance.test.ts | 4 +- .../authorize-chat-callback.test.ts | 62 +- .../application/execute-file-use-case.test.ts | 18 +- ...ecute-organization-secret-use-case.test.ts | 14 +- .../execute-workflow-use-case.test.ts | 1 - .../load-search-integrations.test.ts | 13 +- ...esolve-organization-personal-token.test.ts | 17 +- .../application/settings-context.test.ts | 26 +- .../application/workspace-target.test.ts | 7 +- .../browser-download-claim.integration.ts | 20 +- .../async-runs/tool-identity.integration.ts | 25 +- apps/sim/lib/mothership/auth/internal.test.ts | 6 +- .../billing/service-store.integration.ts | 8 +- .../lib/mothership/block-visibility.test.ts | 15 +- .../chat/application/admit-turn.test.ts | 46 +- .../chat/application/change-resources.test.ts | 22 +- .../application/inline-images-scratch.test.ts | 40 +- .../chat/application/inline-images.test.ts | 79 +- .../chat/application/read-attachment.test.ts | 38 +- .../application/read-sandbox-file.test.ts | 35 +- .../chat/application/use-cases.test.ts | 49 +- .../chat/child-failure-transcript.test.ts | 5 +- .../lib/mothership/chat/delegation.test.ts | 18 +- .../mothership/chat/fork-chat-files.test.ts | 43 +- .../chat/fork-inline-images.test.ts | 6 +- .../lib/mothership/chat/fork-worker.test.ts | 19 +- .../sim/lib/mothership/chat/lifecycle.test.ts | 26 +- .../chat/organization-chats.test.ts | 47 +- apps/sim/lib/mothership/chat/payload.test.ts | 133 +- apps/sim/lib/mothership/chat/post.test.ts | 142 +- .../mothership/chat/process-contents.test.ts | 109 +- .../mothership/chat/terminal-state.test.ts | 25 +- .../chat/workspace-inventory.test.ts | 67 +- .../lib/mothership/docs/docs-corpus.test.ts | 21 +- .../lib/mothership/docs/docs-search.test.ts | 70 +- .../mothership/inbox/agentmail-client.test.ts | 1 - .../mothership/inbox/cleanup-outbox.test.ts | 4 +- .../sim/lib/mothership/inbox/executor.test.ts | 118 +- .../lib/mothership/inbox/lifecycle.test.ts | 4 +- .../integration-tool-projection.test.ts | 28 +- .../lib/mothership/integration-tools.test.ts | 15 +- .../application/catalog-registry.test.ts | 6 +- .../integrations/application/catalog.test.ts | 59 +- apps/sim/lib/mothership/mcp-tools.test.ts | 43 +- .../mothership/observability/timing.test.ts | 4 +- .../tool-confirm/tool-confirm.test.ts | 19 +- .../application/controls-boundary.test.ts | 48 +- .../request/application/read-control.test.ts | 36 +- .../application/recover-stream.test.ts | 71 +- .../request/go/file-preview-adapter.test.ts | 10 +- .../lib/mothership/request/go/stream.test.ts | 54 +- .../request/handlers/handlers.test.ts | 43 +- .../request/lifecycle/headless.test.ts | 6 +- .../mothership/request/lifecycle/run.test.ts | 76 +- .../request/lifecycle/start.test.ts | 66 +- .../mothership/request/session/abort.test.ts | 6 +- .../request/session/buffer.redis.test.ts | 130 - .../mothership/request/session/buffer.test.ts | 132 +- .../request/session/explicit-abort.test.ts | 27 +- .../mothership/request/tools/billing.test.ts | 11 +- .../mothership/request/tools/client.test.ts | 37 +- .../request/tools/execution-lifetime.test.ts | 38 +- .../mothership/request/tools/executor.test.ts | 107 +- .../mothership/request/tools/files.test.ts | 19 +- .../request/tools/resources.test.ts | 10 +- .../mothership/request/tools/tables.test.ts | 37 +- .../tools/workflow-client-fallback.test.ts | 21 +- .../request/tools/workflow-context.test.ts | 41 +- .../mothership/resources/persistence.test.ts | 17 +- .../lib/mothership/server/agent-url.test.ts | 23 +- .../tasks/application/tasks.test.ts | 86 +- apps/sim/lib/mothership/tasks/wake.test.ts | 53 +- .../mothership/tool-executor/executor.test.ts | 39 +- .../settings-entry-boundary.test.ts | 24 +- .../client/browser-tool-execution.test.ts | 6 +- .../tools/client/completion.test.ts | 2 - .../tools/client/native-files.test.ts | 23 +- .../tools/client/run-tool-execution.test.ts | 90 +- .../function-execute-file-mounts.test.ts | 88 +- .../function-execute-provenance.test.ts | 18 +- .../handlers/function-execute-session.test.ts | 18 +- .../function-execute-table-mounts.test.ts | 89 +- .../mothership/tools/handlers/oauth.test.ts | 11 +- .../tools/handlers/sim-cli-bridge.test.ts | 17 +- .../tools/handlers/workflow/mutations.test.ts | 11 +- .../workflow/withheld-run-result.test.ts | 9 +- .../registry/server-tool-adapter.test.ts | 12 +- .../tools/sandbox-resource-transport.test.ts | 34 +- .../tools/sandbox-resources.test.ts | 17 +- .../mothership/tools/sandbox-session.test.ts | 29 +- .../secret-mount-materializer.server.test.ts | 12 +- .../tools/server/files/doc-compile.test.ts | 12 +- .../server/files/doc-compiled-store.test.ts | 13 +- .../tools/server/files/doc-servable.test.ts | 10 +- .../tools/server/image/generate-image.test.ts | 53 +- .../server/knowledge/workspace-search.test.ts | 28 +- .../tools/server/media/ffmpeg.test.ts | 53 +- .../server/media/model-boundaries.test.ts | 30 +- .../tools/server/model-input.test.ts | 17 +- .../tools/server/search-sources.test.ts | 24 +- .../server/settings-custom-blocks.test.ts | 52 +- .../settings-management-boundary.test.ts | 1 - .../mothership/tools/server/settings.test.ts | 13 +- .../tools/server/user/get-credentials.test.ts | 48 +- .../tools/server/workspaces.test.ts | 40 +- .../lib/mothership/transport/receiver.test.ts | 28 +- .../mothership/vfs/resource-writer.test.ts | 94 +- .../navigation/organization-rollout.test.ts | 24 +- .../lib/navigation/resolve-app-entry.test.ts | 13 +- apps/sim/lib/oauth/atlassian-token.test.ts | 4 +- apps/sim/lib/oauth/credential-service.test.ts | 67 +- .../github-installation-credential.test.ts | 24 +- .../sim/lib/oauth/github-installation.test.ts | 1 - .../sim/lib/oauth/github-repositories.test.ts | 1 - .../google-service-account-transport.test.ts | 7 +- apps/sim/lib/oauth/monday.test.ts | 6 +- .../oauth/quickbooks-client-config.test.ts | 13 +- apps/sim/lib/oauth/quickbooks-state.test.ts | 6 +- apps/sim/lib/oauth/quickbooks.test.ts | 10 +- apps/sim/lib/oauth/shopify-state.test.ts | 6 +- .../{__tests__ => }/terminal-errors.test.ts | 0 apps/sim/lib/oauth/token-resolution.test.ts | 74 +- .../application/use-cases.test.ts | 39 +- .../application/configuration.test.ts | 62 +- .../application/member-removal.test.ts | 84 +- .../application/member-role.test.ts | 49 +- .../application/security-settings.test.ts | 55 +- .../application/settings.test.ts | 25 +- .../application/use-cases.test.ts | 50 +- .../lib/organizations/instance-org.test.ts | 38 +- .../lib/organizations/member-manager.test.ts | 33 +- .../organizations/members/lifecycle.test.ts | 13 +- .../organizations/resource-cleanup.test.ts | 31 +- apps/sim/lib/organizations/surface.test.ts | 48 +- .../application/group-membership.test.ts | 14 +- .../application/management.test.ts | 58 +- .../application/read-user-config.test.ts | 59 +- .../application/use-cases.test.ts | 50 +- .../config-scope.server.test.ts | 19 +- .../permission-groups/group-manager.test.ts | 39 +- .../permission-groups/member-manager.test.ts | 18 +- .../lib/permission-groups/mutation.test.ts | 29 +- .../permission-groups/resolve.server.test.ts | 21 +- apps/sim/lib/pinned-items/resources.test.ts | 11 +- .../platform-context-use-cases.test.ts | 68 +- apps/sim/lib/posthog/server.test.ts | 10 +- apps/sim/lib/public-shares/rate-limit.test.ts | 12 +- apps/sim/lib/realtime/event-log.test.ts | 29 +- apps/sim/lib/realtime/notify.test.ts | 23 +- .../sandboxes/application/operations.test.ts | 25 +- .../sandboxes/application/use-cases.test.ts | 93 +- .../lib/secrets/application/use-cases.test.ts | 91 +- apps/sim/lib/secrets/usage/record.test.ts | 10 +- .../application/execute-selector.test.ts | 69 +- .../selectors/client/execute-selector.test.ts | 12 +- .../lib/selectors/server/credentials.test.ts | 41 +- .../server/providers/atlassian.test.ts | 14 +- .../server/providers/bigquery.test.ts | 14 +- .../server/providers/bitbucket.test.ts | 14 +- .../server/providers/clickup.test.ts | 14 +- .../selectors/server/providers/coda.test.ts | 14 +- .../server/providers/confluence.test.ts | 14 +- .../providers/credential-bundle.test.ts | 19 +- .../selectors/server/providers/github.test.ts | 33 +- .../selectors/server/providers/google.test.ts | 14 +- .../server/providers/harmonic.test.ts | 14 +- .../server/providers/hubspot.test.ts | 14 +- .../selectors/server/providers/jira.test.ts | 21 +- .../selectors/server/providers/jsm.test.ts | 13 +- .../selectors/server/providers/linear.test.ts | 53 +- .../selectors/server/providers/mcp.test.ts | 10 +- .../server/providers/microsoft.test.ts | 14 +- .../selectors/server/providers/monday.test.ts | 14 +- .../selectors/server/providers/notion.test.ts | 14 +- .../server/providers/pipedrive.test.ts | 14 +- .../server/providers/sharepoint.test.ts | 14 +- .../selectors/server/providers/slack.test.ts | 14 +- .../server/providers/snowflake.test.ts | 22 +- .../server/providers/webflow.test.ts | 14 +- .../server/providers/zoho-desk.test.ts | 29 +- .../selectors/server/providers/zoom.test.ts | 14 +- .../organization-section-access.test.ts | 41 +- .../workspace-section-access.test.ts | 136 +- apps/sim/lib/sim-search/live/accounts.test.ts | 62 +- .../lib/sim-search/live/application.test.ts | 50 +- apps/sim/lib/sim-search/live/coda-mcp.test.ts | 21 +- .../sim-search/live/github-service.test.ts | 30 +- .../lib/sim-search/live/gitlab-admin.test.ts | 11 +- apps/sim/lib/sim-search/live/http.test.ts | 45 +- .../lib/sim-search/live/mcp-accounts.test.ts | 17 +- .../sim-search/live/service-sources.test.ts | 65 +- apps/sim/lib/skills/access.test.ts | 82 +- .../application/editor-use-cases.test.ts | 62 +- .../lib/skills/application/operations.test.ts | 25 +- .../lib/skills/application/use-cases.test.ts | 72 +- .../slack-search/app-configuration.test.ts | 32 +- apps/sim/lib/slack-search/connections.test.ts | 6 +- apps/sim/lib/slack-search/oauth-state.test.ts | 7 +- .../lib/slack-search/onboarding-state.test.ts | 4 +- apps/sim/lib/slack-search/onboarding.test.ts | 14 +- .../slack-search/public-install-auth.test.ts | 12 +- apps/sim/lib/slack-search/queue.test.ts | 19 +- apps/sim/lib/slack-search/shared-app.test.ts | 33 +- .../lib/table/__tests__/select-values.test.ts | 104 - .../lib/table/__tests__/validation.test.ts | 386 --- apps/sim/lib/table/admission-retry.test.ts | 11 +- apps/sim/lib/table/api/route-policies.test.ts | 27 +- .../table/application/authorization.test.ts | 59 +- apps/sim/lib/table/application/bulk.test.ts | 92 +- .../sim/lib/table/application/columns.test.ts | 69 +- .../sim/lib/table/application/context.test.ts | 19 +- .../application/copilot-bulk-rows.test.ts | 114 +- .../copilot-table-lifecycle.test.ts | 63 +- .../sim/lib/table/application/exports.test.ts | 63 +- .../sim/lib/table/application/folders.test.ts | 77 +- apps/sim/lib/table/application/groups.test.ts | 108 +- .../sim/lib/table/application/imports.test.ts | 113 +- apps/sim/lib/table/application/rows.test.ts | 238 +- apps/sim/lib/table/application/runs.test.ts | 99 +- apps/sim/lib/table/application/tables.test.ts | 90 +- .../workspace-file-imports.test.ts | 175 +- .../table/backfill-governed-subject.test.ts | 31 +- apps/sim/lib/table/backfill-runner.test.ts | 11 +- apps/sim/lib/table/billing.test.ts | 30 +- .../bulk-update-concurrency.test.ts | 34 +- .../table/{__tests__ => }/cell-format.test.ts | 0 apps/sim/lib/table/cell-write.test.ts | 32 +- .../{__tests__ => }/column-conversion.test.ts | 0 .../table/{__tests__ => }/column-keys.test.ts | 11 +- .../column-type-registry.test.ts | 0 .../lib/table/columns/option-locks.test.ts | 7 +- apps/sim/lib/table/columns/ttl-limit.test.ts | 24 +- apps/sim/lib/table/constants.test.ts | 64 +- .../table/{__tests__ => }/currency.test.ts | 0 apps/sim/lib/table/currency.ts | 2 +- apps/sim/lib/table/delete-runner.test.ts | 63 +- .../table/dispatch-governed-subject.test.ts | 10 +- apps/sim/lib/table/dispatcher.test.ts | 45 +- apps/sim/lib/table/export-runner.test.ts | 59 +- .../{__tests__ => }/find-row-matches.test.ts | 11 +- apps/sim/lib/table/import-runner.test.ts | 77 +- .../table/{__tests__ => }/lock-order.test.ts | 5 +- .../{__tests__ => }/name-pattern.test.ts | 0 .../lib/table/orchestration/columns.test.ts | 11 +- .../orchestration/import-resource.test.ts | 72 +- .../lib/table/orchestration/import.test.ts | 68 +- .../lib/table/orchestration/tables.test.ts | 42 +- .../table/prestamp-governed-subject.test.ts | 35 +- .../{__tests__ => }/cell-filter.test.ts | 0 .../{__tests__ => }/converters.test.ts | 0 .../{__tests__ => }/validate.test.ts | 0 .../lib/table/rows/__tests__/cursor.test.ts | 93 - .../bounded-fetch-projection.test.ts | 0 .../bulk-update-patch-validation.test.ts | 30 +- apps/sim/lib/table/rows/cursor.test.ts | 91 + .../{__tests__ => }/ordering-anchor.test.ts | 0 .../{__tests__ => }/ordering-delete.test.ts | 14 +- .../rows/secret-provenance.integration.ts | 31 +- .../lib/table/rows/secret-provenance.test.ts | 12 +- .../table/run-column-governed-subject.test.ts | 23 +- apps/sim/lib/table/select-values.test.ts | 103 +- .../service-filter-threading.test.ts | 17 +- apps/sim/lib/table/service.test.ts | 25 +- apps/sim/lib/table/snapshot-cache.test.ts | 25 +- .../sim/lib/table/{__tests__ => }/sql.test.ts | 0 .../lib/table/stale-dispatch-recovery.test.ts | 18 +- .../lib/table/{__tests__ => }/trigger.test.ts | 13 +- apps/sim/lib/table/ttl-availability.test.ts | 9 +- .../table/{__tests__ => }/update-row.test.ts | 13 +- apps/sim/lib/table/update-runner.test.ts | 45 +- apps/sim/lib/table/validation.test.ts | 378 +++ apps/sim/lib/table/views/service.test.ts | 10 +- apps/sim/lib/table/workflow-columns.test.ts | 51 +- .../table/workflow-group-cancellation.test.ts | 11 +- .../lib/table/workflow-groups/service.test.ts | 36 +- apps/sim/lib/telemetry/browser.test.ts | 2 - apps/sim/lib/terminal/transport.test.ts | 8 +- .../application/execute-tool.test.ts | 213 +- apps/sim/lib/tools/falai-pricing.test.ts | 6 +- apps/sim/lib/uploads/archive.test.ts | 63 +- apps/sim/lib/uploads/client/download.test.ts | 5 +- .../lib/uploads/client/session-upload.test.ts | 13 +- .../lib/uploads/client/upload-session.test.ts | 2 - .../copilot/copilot-file-manager.test.ts | 13 +- .../execution/execution-file-manager.test.ts | 15 +- .../application.test.ts | 34 +- .../application.integration.ts | 3 +- .../organization-logo/application.test.ts | 55 +- .../workspace/fetch-external-url.test.ts | 26 +- .../workspace/track-chat-upload.test.ts | 66 +- .../workspace-file-live-doc-outbox.test.ts | 24 +- .../workspace-file-manager-download.test.ts | 55 +- .../workspace-file-manager-page.test.ts | 65 +- .../workspace/workspace-file-query.test.ts | 45 +- .../workspace-file-reference.test.ts | 43 +- .../workspace-file-storage-accounting.test.ts | 154 +- .../workspace-file-storage-billing.test.ts | 70 +- ...kspace-file-storage-cleanup-outbox.test.ts | 10 +- .../lib/uploads/core/storage-client.test.ts | 26 +- .../core/storage-service-create-only.test.ts | 29 +- ...age-service.blob-connection-string.test.ts | 15 +- .../storage-service.local-download.test.ts | 17 +- .../core/storage-service.local.test.ts | 37 +- .../lib/uploads/core/storage-service.test.ts | 35 +- .../lib/uploads/providers/blob/client.test.ts | 21 +- .../google-cloud-storage/client.test.ts | 40 +- .../lib/uploads/providers/s3/client.test.ts | 55 +- .../uploads/server/image-derivative.test.ts | 13 +- .../lib/uploads/server/inline-image.test.ts | 18 +- .../uploads/server/markdown-export.test.ts | 3 +- .../upload-session/application.test.ts | 63 +- .../uploads/upload-session/cleanup.test.ts | 11 +- .../uploads/upload-session/provider.test.ts | 19 +- .../uploads/upload-session/service.test.ts | 115 +- .../uploads/utils/file-utils.server.test.ts | 40 +- .../utils/user-file-base64.server.test.ts | 59 +- .../account-deletion-attachments.test.ts | 65 +- ...count-deletion-cancel-announcement.test.ts | 42 +- .../account-deletion-dispatch-cancel.test.ts | 36 +- .../account-deletion-marker-cancel.test.ts | 36 +- .../users/application/authorized-apps.test.ts | 43 +- .../users/application/delete-account.test.ts | 16 +- .../preferences-authorization.test.ts | 50 +- .../lib/users/application/preferences.test.ts | 5 +- .../application/read-current-user.test.ts | 16 +- apps/sim/lib/webhooks/deploy.test.ts | 41 +- apps/sim/lib/webhooks/env-resolver.test.ts | 15 +- apps/sim/lib/webhooks/path-claims.test.ts | 18 +- apps/sim/lib/webhooks/polling/imap.test.ts | 14 +- apps/sim/lib/webhooks/polling/rss.test.ts | 26 +- apps/sim/lib/webhooks/polling/utils.test.ts | 45 +- apps/sim/lib/webhooks/processor.test.ts | 69 +- .../webhooks/provider-subscriptions.test.ts | 14 +- .../lib/webhooks/providers/bitbucket.test.ts | 53 +- .../lib/webhooks/providers/clickup.test.ts | 30 +- .../sim/lib/webhooks/providers/github.test.ts | 12 +- apps/sim/lib/webhooks/providers/grain.test.ts | 23 +- .../lib/webhooks/providers/granola.test.ts | 6 +- apps/sim/lib/webhooks/providers/imap.test.ts | 21 +- apps/sim/lib/webhooks/providers/jira.test.ts | 14 +- .../lib/webhooks/providers/jotform.test.ts | 4 +- .../lib/webhooks/providers/revenuecat.test.ts | 6 +- .../lib/webhooks/providers/whatsapp.test.ts | 7 +- .../lib/webhooks/providers/zoho-desk.test.ts | 6 +- apps/sim/lib/webhooks/providers/zoom.test.ts | 8 +- .../webhooks/quickbooks-credentials.test.ts | 10 +- .../lib/webhooks/registration-store.test.ts | 45 +- apps/sim/lib/webhooks/slack-agent-api.test.ts | 6 +- .../lib/webhooks/slack-custom-ingress.test.ts | 8 +- apps/sim/lib/webhooks/slack-dispatch.test.ts | 14 +- .../webhooks/slack-execution-stream.test.ts | 9 +- .../apply-workflow-operations.test.ts | 196 +- .../lib/workflows/application/context.test.ts | 35 +- .../download-workflow-run-file.test.ts | 70 +- .../execute-manual-workflow.test.ts | 64 +- .../application/execute-workflow.test.ts | 58 +- .../application/import-export.test.ts | 93 +- .../inspect-workflow-tools.test.ts | 103 +- .../application/list-workflow-runs.test.ts | 47 +- .../application/move-workflows-bulk.test.ts | 102 +- .../read-paused-workflow-execution.test.ts | 89 +- .../read-workflow-copilot-metadata.test.ts | 57 +- .../read-workflow-definition.test.ts | 75 +- .../read-workflow-deployment-overview.test.ts | 60 +- .../application/read-workflow-graph.test.ts | 65 +- .../read-workflow-lint-agent-tools.test.ts | 89 +- .../read-workflow-lint-refs.test.ts | 180 +- .../read-workflow-lint-tables.test.ts | 83 +- .../application/read-workflow-run.test.ts | 57 +- .../replace-workflow-state.test.ts | 110 +- .../resolve-workflow-outputs.test.ts | 69 +- .../application/restore-workflow.test.ts | 65 +- .../run-workflow-from-copilot.test.ts | 82 +- .../update-workflow-content.test.ts | 78 +- .../application/workflow-crud.test.ts | 191 +- .../workflow-custom-block-authoring.test.ts | 119 +- .../application/workflow-deployments.test.ts | 172 +- .../application/workflow-folders.test.ts | 115 +- .../application/workflow-run-control.test.ts | 74 +- .../application/workflow-runs.test.ts | 53 +- .../application/workflow-vfs.test.ts | 153 +- .../blocks/block-reference-tags.test.ts | 18 +- .../workflows/blocks/fallback-models.test.ts | 83 +- .../comparison/format-description.test.ts | 14 +- .../credentials/credential-extractor.test.ts | 38 +- .../application/settings.test.ts | 76 +- .../custom-blocks/child-execution.test.ts | 13 +- .../custom-blocks/operations.test.ts | 40 +- .../custom-tools/available-lookup.test.ts | 14 +- .../lib/workflows/deployment-outbox.test.ts | 44 +- .../lib/workflows/diff/diff-engine.test.ts | 23 +- .../lib/workflows/editing/builders.test.ts | 45 +- .../workflows/editing/dangling-refs.test.ts | 21 +- .../lib/workflows/editing/lint-report.test.ts | 18 +- apps/sim/lib/workflows/editing/lint.test.ts | 54 +- .../lib/workflows/editing/operations.test.ts | 238 +- .../editing/selector-validator.test.ts | 28 +- .../lib/workflows/editing/validation.test.ts | 68 +- .../executor/execute-workflow.test.ts | 77 +- .../workflows/executor/execution-core.test.ts | 92 +- .../executor/execution-id-claim.test.ts | 11 +- .../executor/execution-queries.test.ts | 14 +- .../executor/execution-run-files.test.ts | 29 +- .../executor/execution-state.test.ts | 16 +- .../execution-status-projection.test.ts | 20 +- .../executor/execution-status.test.ts | 19 +- .../human-in-the-loop-manager.test.ts | 33 +- .../executor/start-run-identity.test.ts | 11 +- apps/sim/lib/workflows/lifecycle.test.ts | 16 +- .../migrations/subblock-migrations.test.ts | 7 +- .../whatsapp-interactive-type.test.ts | 7 +- .../operations/export-workflow.test.ts | 130 +- .../operations/import-export.test.ts | 10 +- .../operations/import-workflow.test.ts | 58 +- .../orchestration/chat-deploy.test.ts | 20 +- .../workflows/orchestration/deploy.test.ts | 50 +- .../persistence/block-access-guard.test.ts | 20 +- .../persistence/deployment-operations.test.ts | 20 +- .../workflows/persistence/duplicate.test.ts | 3 - .../replace-normalized-state.test.ts | 31 +- .../save-workflow-normalized-state.test.ts | 28 +- .../lib/workflows/persistence/utils.test.ts | 2 - .../references/custom-block-reconfigs.test.ts | 12 +- .../references/dependent-reconfigs.test.ts | 14 +- .../references/import-configuration.test.ts | 5 +- .../workflows/references/import-plan.test.ts | 5 +- .../lib/workflows/references/manifest.test.ts | 5 +- .../sanitization/json-sanitizer.test.ts | 30 +- .../lib/workflows/schedules/deploy.test.ts | 31 +- .../schedules/disable-notifications.test.ts | 30 +- .../lib/workflows/skills/operations.test.ts | 15 +- .../lib/workflows/streaming/streaming.test.ts | 14 +- .../lib/workflows/subblocks/context.test.ts | 7 +- apps/sim/lib/workspace-events/emitter.test.ts | 29 +- .../api/route-policies.test.ts | 27 +- .../archive-workspace-file-items.test.ts | 91 +- .../application/authorization.test.ts | 42 +- .../download-workspace-file-items.test.ts | 110 +- .../download-workspace-file.test.ts | 61 +- .../edit-workspace-file-content.test.ts | 111 +- .../export-workspace-file-snapshot.test.ts | 87 +- .../extract-workspace-file.test.ts | 111 +- .../application/file-versions.test.ts | 80 +- .../application/list-workspace-files.test.ts | 51 +- .../move-workspace-file-items.test.ts | 71 +- ...tored-workspace-file-record-by-key.test.ts | 41 +- .../read-workspace-file-artifact.test.ts | 46 +- ...read-workspace-file-content-by-key.test.ts | 56 +- .../read-workspace-file-content.test.ts | 56 +- .../read-workspace-file-metadata.test.ts | 44 +- .../read-workspace-file-record.test.ts | 34 +- .../read-workspace-file-text.test.ts | 77 +- .../read-workspace-inline-file.test.ts | 46 +- .../application/rename-workspace-file.test.ts | 46 +- .../resolve-workspace-file-reference.test.ts | 36 +- .../restore-workspace-file.test.ts | 47 +- .../search-workspace-file-content.test.ts | 29 +- .../application/share-workspace-file.test.ts | 60 +- .../update-workspace-file-content.test.ts | 101 +- .../update-workspace-file-dimensions.test.ts | 30 +- .../workspace-file-folders.test.ts | 112 +- .../orchestration/create.test.ts | 40 +- .../file-folder-lifecycle.test.ts | 69 +- .../page-document.server.test.ts | 21 +- .../prepare-image-for-vision.test.ts | 7 +- apps/sim/lib/workspace-files/queries.test.ts | 22 +- .../render-document-for-vision.test.ts | 6 +- apps/sim/lib/workspace-files/search/README.md | 2 +- .../workspace-files/search/dispatcher.test.ts | 42 +- .../search/enqueue-dispatch.test.ts | 31 +- .../workspace-files/search/extract.test.ts | 30 +- .../workspace-files/search/indexing.test.ts | 26 +- .../admin-move-source-impact.test.ts | 11 +- apps/sim/lib/workspaces/admin-move.test.ts | 94 +- .../application/inbox-settings.test.ts | 59 +- .../list-organization-workspaces.test.ts | 42 +- .../list-public-workspaces.test.ts | 50 +- .../application/manage-permissions.test.ts | 98 +- .../public-workspace-reads.test.ts | 50 +- .../record-workspace-visit.test.ts | 32 +- .../application/remove-member.test.ts | 66 +- apps/sim/lib/workspaces/create.test.ts | 30 +- apps/sim/lib/workspaces/host-context.test.ts | 44 +- .../lib/workspaces/operations/refresh.test.ts | 13 +- .../organization-workspaces.integration.ts | 46 +- .../organization-workspaces.test.ts | 62 +- apps/sim/lib/workspaces/policy.test.ts | 80 +- .../anthropic/core.streaming.test.ts | 217 -- .../{core.request.test.ts => core.test.ts} | 298 ++- .../providers/anthropic/core.thinking.test.ts | 78 - .../anthropic/streaming-tool-loop.test.ts | 51 +- apps/sim/providers/anthropic/utils.test.ts | 25 +- .../providers/azure-anthropic/index.test.ts | 34 +- apps/sim/providers/azure-openai/index.test.ts | 106 +- apps/sim/providers/baseten/index.test.ts | 69 +- apps/sim/providers/bedrock/index.test.ts | 92 +- .../bedrock/streaming-tool-loop.test.ts | 58 +- .../providers/bedrock/utils.stream.test.ts | 174 -- apps/sim/providers/bedrock/utils.test.ts | 178 +- .../conversation-attachments.test.ts | 5 +- .../conversation-continuation.test.ts | 16 +- .../providers/conversation-generation.test.ts | 46 +- .../providers/conversation-history.test.ts | 14 +- apps/sim/providers/conversation-model.test.ts | 30 +- .../conversation-prompt-identity.test.ts | 16 +- apps/sim/providers/conversation-smoke.test.ts | 10 +- .../providers/conversation-summary.test.ts | 20 +- apps/sim/providers/deepseek/index.test.ts | 57 +- .../file-attachments-authorization.test.ts | 48 +- .../providers/file-attachments.server.test.ts | 57 +- apps/sim/providers/fireworks/index.test.ts | 70 +- apps/sim/providers/gemini/core.cost.test.ts | 156 -- .../providers/gemini/core.streaming.test.ts | 16 +- .../{core.request.test.ts => core.test.ts} | 167 +- .../gemini/streaming-tool-loop.test.ts | 77 +- .../sim/providers/google/utils.stream.test.ts | 91 - apps/sim/providers/google/utils.test.ts | 92 +- apps/sim/providers/groq/index.test.ts | 69 +- apps/sim/providers/index.test.ts | 51 +- apps/sim/providers/litellm/index.test.ts | 77 +- apps/sim/providers/mistral/index.test.ts | 70 +- apps/sim/providers/ollama-cloud/index.test.ts | 96 +- apps/sim/providers/ollama/index.test.ts | 90 +- .../openai-compat/streaming-tool-loop.test.ts | 103 +- .../providers/openai/core.cache-key.test.ts | 40 +- .../providers/openai/core.reasoning.test.ts | 50 +- .../openai/core.response-status.test.ts | 72 +- .../openai/core.transport-phase.test.ts | 40 +- .../sim/providers/openai/utils.stream.test.ts | 205 -- apps/sim/providers/openai/utils.test.ts | 206 +- apps/sim/providers/openrouter/index.test.ts | 121 +- apps/sim/providers/openrouter/utils.test.ts | 11 +- apps/sim/providers/runtime-context.test.ts | 12 +- .../providers/settled-tool-streams.test.ts | 91 +- .../providers/specialist-reasoning.test.ts | 29 +- apps/sim/providers/together/index.test.ts | 86 +- apps/sim/providers/typesafe/typesafe.test.ts | 2 - apps/sim/providers/utils.test.ts | 4 - apps/sim/providers/vertex/index.test.ts | 7 +- apps/sim/providers/vllm/index.test.ts | 138 +- apps/sim/providers/xai/index.test.ts | 80 +- apps/sim/proxy.test.ts | 18 +- apps/sim/scripts/backfill-trace-spans.test.ts | 40 +- apps/sim/serializer/checkbox-list.test.ts | 5 +- .../serializer/custom-block-lifecycle.test.ts | 5 +- apps/sim/serializer/field-analysis.test.ts | 5 +- ...test.ts => index.edge-case-blocks.test.ts} | 0 apps/sim/serializer/index.test.ts | 6 +- apps/sim/serializer/mcp-operations.test.ts | 6 +- apps/sim/serializer/private-inputs.test.ts | 4 - apps/sim/stores/AGENTS.md | 38 +- apps/sim/stores/connector-setup/store.test.ts | 1 - apps/sim/stores/execution/store.test.ts | 8 +- apps/sim/stores/index.test.ts | 6 +- apps/sim/stores/reset-all-stores.test.ts | 32 +- .../resource-list-preferences/store.test.ts | 6 +- .../stores/workflows/registry/store.test.ts | 14 +- .../stores/workflows/sync-local-draft.test.ts | 14 +- apps/sim/tools/AGENTS.md | 12 +- apps/sim/tools/ashby/ashby.live.test.ts | 2 +- apps/sim/tools/assistant-execution.test.ts | 45 +- apps/sim/tools/binary-downloads.test.ts | 1 - .../tools/bitbucket/repository-source.test.ts | 6 +- apps/sim/tools/bitbucket/utils.server.test.ts | 26 +- apps/sim/tools/brex/idempotency.test.ts | 26 +- apps/sim/tools/cbinsights/cbinsights.test.ts | 6 +- apps/sim/tools/circleback/circleback.test.ts | 20 +- apps/sim/tools/cloudflare/cloudflare.test.ts | 6 +- apps/sim/tools/crunchbase/crunchbase.test.ts | 4 +- apps/sim/tools/datadog/datadog.test.ts | 13 +- apps/sim/tools/datagma-hosting.test.ts | 1 - apps/sim/tools/dropcontact-hosting.test.ts | 1 - .../sim/tools/elasticsearch/responses.test.ts | 8 +- apps/sim/tools/enrichment-hosting.test.ts | 1 - apps/sim/tools/enrow-hosting.test.ts | 1 - apps/sim/tools/enrow/find_email.test.ts | 45 +- apps/sim/tools/falai-hosting.test.ts | 1 - .../file-message-operation-security.test.ts | 82 +- .../file-message-provider-clients.test.ts | 36 +- apps/sim/tools/github/pr.test.ts | 6 +- apps/sim/tools/github/utils.server.test.ts | 8 - apps/sim/tools/gmail/read.test.ts | 5 +- .../sim/tools/google_calendar/respond.test.ts | 14 +- .../google_slides/export_presentation.test.ts | 21 +- apps/sim/tools/harmonic/harmonic.test.ts | 7 +- .../tools/http/request.stringified.test.ts | 110 - apps/sim/tools/http/request.test.ts | 110 +- apps/sim/tools/icypeas-hosting.test.ts | 1 - .../identity_center/describe_user.test.ts | 8 +- apps/sim/tools/index.test.ts | 139 +- .../tools/jira/attachment-downloads.test.ts | 17 +- apps/sim/tools/jotform/jotform.test.ts | 8 +- apps/sim/tools/linkedin/share_post.test.ts | 6 +- .../tools/managed_agent/get_session.test.ts | 6 +- .../tools/managed_agent/run_session.test.ts | 7 +- apps/sim/tools/manageengine_sdp/utils.test.ts | 8 +- .../add_user_app_role_assignment.test.ts | 19 +- .../attachment-downloads.test.ts | 5 +- apps/sim/tools/netsuite/netsuite.test.ts | 6 +- apps/sim/tools/netsuite/utils.test.ts | 28 +- apps/sim/tools/okta/tools.test.ts | 6 +- .../outlook/calendar-idempotency.test.ts | 26 +- apps/sim/tools/outlook/read.test.ts | 5 +- apps/sim/tools/parallel/parallel.test.ts | 19 +- apps/sim/tools/params.test.ts | 91 +- apps/sim/tools/quickbooks/full_update.test.ts | 11 +- apps/sim/tools/quickbooks/sales_utils.test.ts | 11 +- apps/sim/tools/slack/list_channels.test.ts | 6 +- apps/sim/tools/snowflake/utils.test.ts | 32 +- apps/sim/tools/square/idempotency.test.ts | 26 +- apps/sim/tools/stripe/idempotency.test.ts | 26 +- apps/sim/tools/tinyfish/tinyfish.test.ts | 9 +- apps/sim/tools/typeform/files.test.ts | 41 +- apps/sim/tools/utils.test.ts | 22 +- apps/sim/tools/whatsapp/whatsapp.test.ts | 5 +- apps/sim/tools/windchill/windchill.test.ts | 15 +- apps/sim/triggers/AGENTS.md | 9 +- apps/sim/vitest.config.ts | 202 +- apps/sim/vitest.setup.ts | 23 +- bun.lock | 3 +- package.json | 2 + packages/audit/src/log.test.ts | 55 +- packages/audit/vitest.config.ts | 16 +- packages/db/dev-push.test.ts | 4 +- ...cript-migrations-provenance-repair.test.ts | 6 +- .../0016_backfill_search_vectors.test.ts | 4 +- .../db/script-migrations/database-url.test.ts | 4 +- ...tor-sync-schedule-precision.integration.ts | 8 +- ...base-failure-classification.integration.ts | 12 +- packages/db/scripts/migration-fixture.ts | 9 +- packages/db/scripts/push.integration.ts | 9 +- packages/db/scripts/push.test.ts | 2 - .../db/scripts/retired-columns.integration.ts | 8 +- packages/db/testing/test-infrastructure.ts | 9 +- packages/db/tx-tripwire.test.ts | 1 - packages/db/vitest.config.ts | 33 +- .../deployment-config/src/integrations.json | 8 +- packages/emcn/src/AGENTS.md | 12 +- .../emcn/src/components/modal/modal.test.tsx | 1 - .../src/hooks/use-copy-to-clipboard.test.ts | 6 +- packages/emcn/vitest.config.ts | 16 +- packages/logger/src/index.test.ts | 1 - packages/logger/vitest.config.ts | 16 +- packages/realtime-protocol/vitest.config.ts | 16 +- packages/runtime-secrets/vitest.config.ts | 11 + packages/security/vitest.config.ts | 16 +- packages/sim-cli/src/auth/device-flow.test.ts | 1 - packages/sim-cli/src/auth/oauth-flow.test.ts | 7 +- .../sim-cli/src/auth/refresh.process.test.ts | 224 -- packages/sim-cli/src/auth/refresh.test.ts | 233 +- .../sim-cli/src/commands/configure.test.ts | 1 - .../sim-cli/src/commands/credentials.test.ts | 2 - .../src/commands/protocol/chat.test.ts | 6 +- .../src/commands/protocol/files-get.test.ts | 2 - .../commands/protocol/files-upload.test.ts | 2 - .../knowledge-document-upload.test.ts | 2 - .../protocol/knowledge-export.test.ts | 1 - .../src/commands/protocol/logs-follow.test.ts | 25 +- .../protocol/resource-directory.test.ts | 1 - .../commands/protocol/tables-import.test.ts | 1 - .../protocol/workflow-run-follow.test.ts | 8 +- .../protocol/workflow-run-get.test.ts | 27 +- .../protocol/workflow-run-wait.test.ts | 2 - .../protocol/workspace-operation-wait.test.ts | 1 - .../sim-cli/src/commands/telemetry.test.ts | 2 - packages/sim-cli/src/embed-isolation.test.ts | 3 +- packages/sim-cli/src/embed-output.test.ts | 3 +- packages/sim-cli/src/embed.test.ts | 6 +- packages/sim-cli/src/http/client.test.ts | 2 - packages/sim-cli/src/output/render.test.ts | 6 +- packages/sim-cli/src/runtime/build.test.ts | 1 - packages/sim-cli/src/runtime/execute.test.ts | 17 +- packages/sim-cli/src/runtime/result.test.ts | 6 +- .../sim-cli/src/telemetry/client-info.test.ts | 1 - .../sim-cli/src/telemetry/invocation.test.ts | 1 - .../sim-cli/src/telemetry/transport.test.ts | 6 +- packages/sim-cli/src/test/context-mock.ts | 55 + .../src/transfer/streaming-upload.test.ts | 4 +- .../sim-cli/src/update/check.process.test.ts | 260 -- packages/sim-cli/src/update/check.test.ts | 275 +- .../src/update/install.process.test.ts | 103 - packages/sim-cli/src/update/install.test.ts | 113 +- packages/sim-cli/vitest.config.ts | 16 +- packages/sim-setup/src/cli-auth.test.ts | 6 +- .../sim-setup/src/compose-database.test.ts | 6 +- packages/sim-setup/vitest.config.ts | 11 + packages/terminal-protocol/vitest.config.ts | 16 +- packages/testing/package.json | 13 + packages/testing/src/factories/index.ts | 10 + .../src/factories/principal.factory.ts | 101 + packages/testing/src/helpers/async.ts | 53 + .../testing/src/{ => helpers}/deferred.ts | 0 packages/testing/src/helpers/http.ts | 34 + packages/testing/src/helpers/index.ts | 3 + packages/testing/src/index.ts | 3 +- .../testing/src/mocks/admission-gate.mock.ts | 50 + .../src/mocks/api-client-request.mock.ts | 94 + .../testing/src/mocks/api-key-byok.mock.ts | 38 + .../src/mocks/api-server-routes.mock.ts | 291 +++ .../src/mocks/async-jobs-region.mock.ts | 32 + packages/testing/src/mocks/async-jobs.mock.ts | 106 + packages/testing/src/mocks/audit.mock.ts | 499 ++-- packages/testing/src/mocks/auth-ban.mock.ts | 53 + .../testing/src/mocks/auth-client.mock.ts | 94 + .../mocks/auth-internal-delegation.mock.ts | 41 + .../testing/src/mocks/auth-internal.mock.ts | 59 + .../src/mocks/auth-oauth-utils.mock.ts | 23 +- packages/testing/src/mocks/auth.mock.ts | 35 + .../authorized-workspace-use-case.mock.ts | 47 + .../testing/src/mocks/background-task.mock.ts | 30 + .../testing/src/mocks/billing-access.mock.ts | 35 + .../src/mocks/billing-attribution.mock.ts | 215 ++ .../testing/src/mocks/billing-core.mock.ts | 63 + .../src/mocks/billing-identity-lock.mock.ts | 32 + .../src/mocks/billing-organization.mock.ts | 39 + .../src/mocks/billing-outbox-handlers.mock.ts | 57 + .../src/mocks/billing-plan-helpers.mock.ts | 165 ++ .../testing/src/mocks/billing-plan.mock.ts | 33 + .../testing/src/mocks/billing-storage.mock.ts | 76 + .../mocks/billing-subscription-utils.mock.ts | 229 ++ .../src/mocks/billing-subscription.mock.ts | 112 + .../mocks/billing-usage-gate-cache.mock.ts | 40 + .../src/mocks/billing-usage-log.mock.ts | 125 + .../src/mocks/billing-usage-monitor.mock.ts | 41 + .../mocks/billing-usage-reservation.mock.ts | 75 + .../testing/src/mocks/billing-usage.mock.ts | 55 + .../mocks/billing-workspace-access.mock.ts | 31 + .../src/mocks/block-visibility.mock.ts | 45 + packages/testing/src/mocks/blocks.mock.ts | 9 +- .../credential-groups-availability.mock.ts | 30 + .../credential-groups-credentials.mock.ts | 84 + .../credential-groups-enrollments.mock.ts | 92 + ...edential-groups-organization-setup.mock.ts | 29 + .../mocks/credential-groups-providers.mock.ts | 32 + .../credential-groups-self-enrollment.mock.ts | 30 + .../mocks/credential-groups-service.mock.ts | 38 + .../src/mocks/credentials-access.mock.ts | 94 + .../src/mocks/credentials-environment.mock.ts | 58 + .../mocks/credentials-managed-oauth.mock.ts | 53 + .../src/mocks/custom-block-operations.mock.ts | 80 + packages/testing/src/mocks/database.mock.ts | 61 +- .../src/mocks/deployment-shape.mock.ts | 107 + .../testing/src/mocks/email-mailer.mock.ts | 32 + .../testing/src/mocks/email-templates.mock.ts | 450 ++++ packages/testing/src/mocks/embeddings.mock.ts | 136 + packages/testing/src/mocks/emcn-icons.mock.ts | 38 + packages/testing/src/mocks/emcn.mock.ts | 67 + packages/testing/src/mocks/encryption.mock.ts | 28 +- .../src/mocks/execute-workflow.mock.ts | 28 + .../src/mocks/execution-limits.mock.ts | 231 ++ .../src/mocks/execution-payload-store.mock.ts | 32 + .../src/mocks/executor-principal.mock.ts | 36 + .../testing/src/mocks/feature-flags.mock.ts | 33 + .../testing/src/mocks/file-parsers.mock.ts | 66 + .../src/mocks/file-utils-server.mock.ts | 41 + packages/testing/src/mocks/file-utils.mock.ts | 763 ++++++ .../src/mocks/files-authorization.mock.ts | 48 + .../testing/src/mocks/folder-queries.mock.ts | 95 + .../src/mocks/folders-orchestration.mock.ts | 17 +- .../src/mocks/github-installation.mock.ts | 62 + .../mocks/human-in-the-loop-manager.mock.ts | 229 ++ packages/testing/src/mocks/id.mock.ts | 62 + packages/testing/src/mocks/index.ts | 842 ++++++- .../src/mocks/input-validation.mock.ts | 142 +- .../mocks/integrations-availability.mock.ts | 61 + .../src/mocks/invitations-core.mock.ts | 71 + .../src/mocks/invitations-send.mock.ts | 88 + .../src/mocks/kb-connectors-queries.mock.ts | 137 + .../src/mocks/knowledge-access-scope.mock.ts | 40 + .../src/mocks/knowledge-availability.mock.ts | 120 + .../mocks/knowledge-base-use-cases.mock.ts | 111 + .../src/mocks/knowledge-contexts.mock.ts | 96 + .../mocks/knowledge-documents-service.mock.ts | 95 + .../mocks/knowledge-documents-utils.mock.ts | 53 + .../src/mocks/knowledge-embeddings.mock.ts | 41 + .../src/mocks/knowledge-member-access.mock.ts | 106 + .../src/mocks/knowledge-member-queue.mock.ts | 34 + ...nowledge-search-integration-policy.mock.ts | 35 + .../mocks/knowledge-search-use-case.mock.ts | 65 + .../src/mocks/knowledge-secure-fetch.mock.ts | 31 + .../src/mocks/knowledge-service.mock.ts | 97 + .../src/mocks/knowledge-tags-service.mock.ts | 89 + .../src/mocks/large-value-metadata.mock.ts | 61 + .../testing/src/mocks/lib-desktop.mock.ts | 79 + packages/testing/src/mocks/logger.mock.ts | 72 +- .../testing/src/mocks/logging-session.mock.ts | 63 +- packages/testing/src/mocks/mcp-oauth.mock.ts | 4 + packages/testing/src/mocks/mcp-pubsub.mock.ts | 45 + .../testing/src/mocks/mcp-service.mock.ts | 52 + .../testing/src/mocks/mcp-use-cases.mock.ts | 191 ++ .../src/mocks/mothership-agent-url.mock.ts | 42 + .../src/mocks/mothership-async-runs.mock.ts | 127 + .../mocks/mothership-chat-lifecycle.mock.ts | 40 + .../mocks/mothership-chat-messages.mock.ts | 33 + .../src/mocks/mothership-chat-payload.mock.ts | 35 + .../src/mocks/mothership-chat-status.mock.ts | 42 + .../mothership-environment-context.mock.ts | 45 + .../src/mocks/mothership-go-fetch.mock.ts | 28 + .../mothership-organization-chats.mock.ts | 146 ++ .../testing/src/mocks/mothership-otel.mock.ts | 156 ++ .../mocks/mothership-workspace-target.mock.ts | 33 + .../testing/src/mocks/network-config.mock.ts | 39 + .../testing/src/mocks/next-navigation.mock.ts | 122 + .../testing/src/mocks/oauth-utils.mock.ts | 111 + packages/testing/src/mocks/openai.mock.ts | 120 + .../organization-accounts-queries.mock.ts | 106 + .../mocks/organization-authorization.mock.ts | 49 + .../mocks/organization-member-limits.mock.ts | 40 + .../src/mocks/organization-membership.mock.ts | 86 + .../src/mocks/organization-provider.mock.ts | 43 + .../src/mocks/organization-seats.mock.ts | 30 + .../testing/src/mocks/outbox-service.mock.ts | 102 + .../src/mocks/permission-check.mock.ts | 141 ++ .../src/mocks/permission-group-locks.mock.ts | 36 + .../mocks/permission-groups-resolve.mock.ts | 80 + .../testing/src/mocks/permissions.mock.ts | 66 +- .../testing/src/mocks/pii-redaction.mock.ts | 47 + .../testing/src/mocks/posthog-server.mock.ts | 26 +- .../src/mocks/providers-attachments.mock.ts | 140 ++ .../providers-conversation-history.mock.ts | 60 + .../src/mocks/providers-models.mock.ts | 219 ++ .../mocks/providers-trace-enrichment.mock.ts | 48 + .../testing/src/mocks/providers-utils.mock.ts | 230 ++ packages/testing/src/mocks/providers.mock.ts | 42 + .../testing/src/mocks/public-shares.mock.ts | 66 + .../testing/src/mocks/rate-limiter.mock.ts | 268 ++ .../testing/src/mocks/react-query.mock.ts | 212 ++ .../testing/src/mocks/realtime-notify.mock.ts | 52 + .../src/mocks/remote-sandbox-provider.mock.ts | 34 + .../testing/src/mocks/remote-sandbox.mock.ts | 36 + packages/testing/src/mocks/request.mock.ts | 77 +- .../mocks/resource-policy-repository.mock.ts | 59 + .../src/mocks/schema-tables.generated.ts | 2191 ++++++++++++++++ packages/testing/src/mocks/schema.mock.ts | 2201 +---------------- .../src/mocks/search-replace-indexer.mock.ts | 34 + .../src/mocks/secrets-use-cases.mock.ts | 71 + .../mocks/selector-credential-bundle.mock.ts | 29 + .../src/mocks/selector-credentials.mock.ts | 63 + .../src/mocks/sim-search-connectors.mock.ts | 128 + .../testing/src/mocks/storage-service.mock.ts | 58 +- packages/testing/src/mocks/table-api.mock.ts | 63 + .../mocks/table-application-context.mock.ts | 37 + .../src/mocks/table-application-rows.mock.ts | 175 ++ .../mocks/table-application-tables.mock.ts | 93 + .../testing/src/mocks/table-billing.mock.ts | 61 + .../testing/src/mocks/table-constants.mock.ts | 134 + .../testing/src/mocks/table-events.mock.ts | 56 + .../src/mocks/table-jobs-service.mock.ts | 102 + .../src/mocks/table-route-utils.mock.ts | 202 ++ .../table-rows-secret-provenance.mock.ts | 106 + .../src/mocks/table-rows-service.mock.ts | 65 + .../testing/src/mocks/table-service.mock.ts | 76 + .../testing/src/mocks/table-trigger.mock.ts | 29 + .../src/mocks/table-ttl-availability.mock.ts | 33 + packages/testing/src/mocks/table-wire.mock.ts | 81 + .../src/mocks/table-workflow-columns.mock.ts | 107 + packages/testing/src/mocks/table.mock.ts | 514 ++++ packages/testing/src/mocks/telemetry.mock.ts | 44 +- .../src/mocks/terminal-console.mock.ts | 83 +- .../src/mocks/tokenization-accurate.mock.ts | 41 + packages/testing/src/mocks/tools.mock.ts | 52 + .../testing/src/mocks/trace-store.mock.ts | 116 + .../src/mocks/trigger-availability.mock.ts | 30 + .../testing/src/mocks/trigger-sdk.mock.ts | 179 ++ packages/testing/src/mocks/triggers.mock.ts | 109 + .../testing/src/mocks/upload-session.mock.ts | 134 + .../testing/src/mocks/uploads-config.mock.ts | 328 +++ .../testing/src/mocks/uploads-copilot.mock.ts | 29 + .../src/mocks/uploads-execution.mock.ts | 97 + .../src/mocks/uploads-metadata.mock.ts | 62 + .../testing/src/mocks/uploads-setup.mock.ts | 45 + packages/testing/src/mocks/uploads.mock.ts | 54 + .../testing/src/mocks/users-queries.mock.ts | 70 + .../testing/src/mocks/utils-helpers.mock.ts | 48 + .../testing/src/mocks/v1-logs-meta.mock.ts | 65 + .../testing/src/mocks/v1-middleware.mock.ts | 189 ++ packages/testing/src/mocks/v2-route.mock.ts | 23 +- .../src/mocks/webhooks-processor.mock.ts | 55 + .../src/mocks/workflow-context.mock.ts | 45 + .../mocks/workflow-deployment-status.mock.ts | 28 + .../src/mocks/workflow-registry-store.mock.ts | 128 + .../src/mocks/workflows-orchestration.mock.ts | 53 + .../mocks/workflows-persistence-utils.mock.ts | 45 +- .../src/mocks/workflows-queries.mock.ts | 32 + .../src/mocks/workspace-authorization.mock.ts | 168 ++ .../testing/src/mocks/workspace-authz.mock.ts | 79 + .../src/mocks/workspace-context.mock.ts | 99 + .../src/mocks/workspace-file-folders.mock.ts | 136 + .../src/mocks/workspace-file-manager.mock.ts | 229 ++ .../mocks/workspace-file-reference.mock.ts | 37 + .../workspace-file-secret-provenance.mock.ts | 156 ++ .../src/mocks/workspace-files-list.mock.ts | 77 + .../src/mocks/workspace-forking-authz.mock.ts | 62 + .../mocks/workspace-forking-lineage.mock.ts | 47 + .../workspace-forking-mapping-store.mock.ts | 179 ++ .../src/mocks/workspace-uploads.mock.ts | 168 ++ .../src/mocks/workspaces-policy.mock.ts | 131 + .../src/mocks/workspaces-utils.mock.ts | 87 + packages/ts-sdk/src/index.test.ts | 5 +- packages/ts-sdk/vitest.config.ts | 24 +- packages/utils/src/random.test.ts | 6 +- packages/utils/vitest.config.ts | 16 +- .../workflow-persistence/vitest.config.ts | 16 +- packages/workflow-renderer/vitest.config.ts | 18 +- patches/README.md | 8 +- scripts/check-import-specifiers.ts | 6 +- scripts/check-openapi-specs.ts | 6 +- scripts/check-test-patterns.ts | 279 +++ scripts/generate-docs.ts | 3 +- scripts/generate-schema-mock.ts | 167 ++ scripts/openapi/vitest.config.ts | 38 +- scripts/test-patterns-baseline.json | 147 ++ scripts/vitest.config.ts | 24 +- turbo.json | 1 + vitest.shared.ts | 42 + 2296 files changed, 60711 insertions(+), 46984 deletions(-) rename {.claude => .agents}/skills/add-settings-page/SKILL.md (100%) delete mode 100644 .claude/rules/global.md create mode 100644 .claude/rules/sim-api-contracts.md delete mode 100644 .claude/rules/sim-typescript.md create mode 120000 .claude/skills/add-settings-page delete mode 100644 .cursor/rules/global.mdc create mode 100644 .cursor/rules/sim-api-contracts.mdc delete mode 100644 .cursor/rules/sim-typescript.mdc rename apps/realtime/src/handlers/{file-doc.join-readiness.test.ts => file-doc.redis-store.test.ts} (100%) rename apps/sim/app/api/v2/{access-requests.routes.test.ts => access-requests.test.ts} (100%) rename apps/sim/app/api/v2/knowledge/search/{route.provenance.test.ts => route.application.test.ts} (65%) rename apps/sim/app/api/workflows/[id]/execute/{route.async.test.ts => route.test.ts} (87%) rename apps/sim/app/api/workspaces/[id]/inbox/{siblings.capability.test.ts => sibling-routes.test.ts} (81%) delete mode 100644 apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/collaboration/apply-streamed-markdown.concurrent.test.ts rename apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/{table-serialization.node.test.ts => table-serialization.test.ts} (100%) rename apps/sim/app/workspace/[workspaceId]/home/hooks/{use-chat.mount-send.test.tsx => use-chat.dom.test.tsx} (98%) create mode 120000 apps/sim/blocks/CLAUDE.md delete mode 100644 apps/sim/executor/execution/block-executor.retry.test.ts delete mode 100644 apps/sim/executor/execution/executor.run-from-block.test.ts rename apps/sim/executor/handlers/agent/{memory.durability.test.ts => memory.use-cases.test.ts} (89%) delete mode 100644 apps/sim/executor/utils/errors.classify.test.ts delete mode 100644 apps/sim/executor/utils/file-tool-processor.aliases.test.ts delete mode 100644 apps/sim/executor/utils/file-tool-processor.context.test.ts delete mode 100644 apps/sim/executor/utils/reference-validation.differential.test.ts rename apps/sim/lib/api/contracts/{chats.password.test.ts => chats.test.ts} (100%) rename apps/sim/lib/api/contracts/{public-shares.password.test.ts => public-shares.test.ts} (100%) delete mode 100644 apps/sim/lib/api/contracts/v2/__tests__/contract-sweep.ts rename apps/sim/lib/api/contracts/v2/{__tests__ => }/cross-cutting.test.ts (100%) rename apps/sim/lib/api/contracts/v2/{__tests__ => }/files-search-scope.test.ts (100%) rename apps/sim/lib/api/contracts/v2/{__tests__ => }/list-pagination.test.ts (99%) rename apps/sim/lib/api/contracts/v2/{__tests__ => }/logs-stats.test.ts (100%) rename apps/sim/lib/api/contracts/v2/{__tests__ => }/pagination-limit.test.ts (100%) rename apps/sim/lib/api/contracts/v2/{__tests__ => }/permission-groups.test.ts (100%) rename apps/sim/lib/api/contracts/v2/{__tests__ => }/query-declaration.test.ts (95%) rename apps/sim/lib/api/contracts/v2/{__tests__ => }/shared.test.ts (100%) rename apps/sim/lib/api/contracts/v2/{__tests__ => }/tables.test.ts (98%) rename apps/sim/lib/api/contracts/v2/{__tests__/schema-introspection.ts => test-utils.ts} (59%) rename apps/sim/lib/api/contracts/v2/{__tests__ => }/workflow-graph-variables.test.ts (100%) rename apps/sim/lib/api/contracts/v2/{__tests__ => }/workflow-graph.test.ts (100%) rename apps/sim/lib/concurrency/{__tests__ => }/leader-lock.test.ts (100%) rename apps/sim/lib/concurrency/{__tests__ => }/singleflight.test.ts (99%) delete mode 100644 apps/sim/lib/core/security/linear-regex.differential.test.ts delete mode 100644 apps/sim/lib/credentials/__tests__/deletion.test.ts rename apps/sim/lib/credentials/{__tests__ => }/webhook-deactivation.test.ts (84%) rename apps/sim/lib/execution/{__tests__ => }/call-chain.test.ts (100%) rename apps/sim/lib/execution/code-placeholders/{scan.differential.test.ts => scan.test.ts} (100%) delete mode 100644 apps/sim/lib/execution/preprocessing.webhook-correlation.test.ts rename apps/sim/lib/execution/remote-sandbox/{fellows-digest.acceptance.test.ts => fellows-digest.test.ts} (100%) rename apps/sim/lib/integrations/{oauth-service-availability.server.test.ts => availability.server.oauth-configured.test.ts} (87%) delete mode 100644 apps/sim/lib/mothership/request/session/buffer.redis.test.ts rename apps/sim/lib/oauth/{__tests__ => }/terminal-errors.test.ts (100%) delete mode 100644 apps/sim/lib/table/__tests__/select-values.test.ts delete mode 100644 apps/sim/lib/table/__tests__/validation.test.ts rename apps/sim/lib/table/{__tests__ => }/bulk-update-concurrency.test.ts (82%) rename apps/sim/lib/table/{__tests__ => }/cell-format.test.ts (100%) rename apps/sim/lib/table/{__tests__ => }/column-conversion.test.ts (100%) rename apps/sim/lib/table/{__tests__ => }/column-keys.test.ts (97%) rename apps/sim/lib/table/{__tests__ => }/column-type-registry.test.ts (100%) rename apps/sim/lib/table/{__tests__ => }/currency.test.ts (100%) rename apps/sim/lib/table/{__tests__ => }/find-row-matches.test.ts (94%) rename apps/sim/lib/table/{__tests__ => }/lock-order.test.ts (96%) rename apps/sim/lib/table/{__tests__ => }/name-pattern.test.ts (100%) rename apps/sim/lib/table/query-builder/{__tests__ => }/cell-filter.test.ts (100%) rename apps/sim/lib/table/query-builder/{__tests__ => }/converters.test.ts (100%) rename apps/sim/lib/table/query-builder/{__tests__ => }/validate.test.ts (100%) delete mode 100644 apps/sim/lib/table/rows/__tests__/cursor.test.ts rename apps/sim/lib/table/rows/{__tests__ => }/bounded-fetch-projection.test.ts (100%) rename apps/sim/lib/table/rows/{__tests__ => }/bulk-update-patch-validation.test.ts (82%) rename apps/sim/lib/table/rows/{__tests__ => }/ordering-anchor.test.ts (100%) rename apps/sim/lib/table/rows/{__tests__ => }/ordering-delete.test.ts (94%) rename apps/sim/lib/table/{__tests__ => }/service-filter-threading.test.ts (97%) rename apps/sim/lib/table/{__tests__ => }/sql.test.ts (100%) rename apps/sim/lib/table/{__tests__ => }/trigger.test.ts (95%) rename apps/sim/lib/table/{__tests__ => }/update-row.test.ts (97%) delete mode 100644 apps/sim/providers/anthropic/core.streaming.test.ts rename apps/sim/providers/anthropic/{core.request.test.ts => core.test.ts} (63%) delete mode 100644 apps/sim/providers/anthropic/core.thinking.test.ts delete mode 100644 apps/sim/providers/bedrock/utils.stream.test.ts delete mode 100644 apps/sim/providers/gemini/core.cost.test.ts rename apps/sim/providers/gemini/{core.request.test.ts => core.test.ts} (60%) delete mode 100644 apps/sim/providers/google/utils.stream.test.ts delete mode 100644 apps/sim/providers/openai/utils.stream.test.ts rename apps/sim/serializer/{tests/serializer.extended.test.ts => index.edge-case-blocks.test.ts} (100%) delete mode 100644 apps/sim/tools/http/request.stringified.test.ts create mode 100644 packages/runtime-secrets/vitest.config.ts delete mode 100644 packages/sim-cli/src/auth/refresh.process.test.ts create mode 100644 packages/sim-cli/src/test/context-mock.ts delete mode 100644 packages/sim-cli/src/update/check.process.test.ts delete mode 100644 packages/sim-cli/src/update/install.process.test.ts create mode 100644 packages/sim-setup/vitest.config.ts create mode 100644 packages/testing/src/factories/principal.factory.ts create mode 100644 packages/testing/src/helpers/async.ts rename packages/testing/src/{ => helpers}/deferred.ts (100%) create mode 100644 packages/testing/src/helpers/http.ts create mode 100644 packages/testing/src/helpers/index.ts create mode 100644 packages/testing/src/mocks/admission-gate.mock.ts create mode 100644 packages/testing/src/mocks/api-client-request.mock.ts create mode 100644 packages/testing/src/mocks/api-key-byok.mock.ts create mode 100644 packages/testing/src/mocks/api-server-routes.mock.ts create mode 100644 packages/testing/src/mocks/async-jobs-region.mock.ts create mode 100644 packages/testing/src/mocks/async-jobs.mock.ts create mode 100644 packages/testing/src/mocks/auth-ban.mock.ts create mode 100644 packages/testing/src/mocks/auth-client.mock.ts create mode 100644 packages/testing/src/mocks/auth-internal-delegation.mock.ts create mode 100644 packages/testing/src/mocks/auth-internal.mock.ts create mode 100644 packages/testing/src/mocks/authorized-workspace-use-case.mock.ts create mode 100644 packages/testing/src/mocks/background-task.mock.ts create mode 100644 packages/testing/src/mocks/billing-access.mock.ts create mode 100644 packages/testing/src/mocks/billing-attribution.mock.ts create mode 100644 packages/testing/src/mocks/billing-core.mock.ts create mode 100644 packages/testing/src/mocks/billing-identity-lock.mock.ts create mode 100644 packages/testing/src/mocks/billing-organization.mock.ts create mode 100644 packages/testing/src/mocks/billing-outbox-handlers.mock.ts create mode 100644 packages/testing/src/mocks/billing-plan-helpers.mock.ts create mode 100644 packages/testing/src/mocks/billing-plan.mock.ts create mode 100644 packages/testing/src/mocks/billing-storage.mock.ts create mode 100644 packages/testing/src/mocks/billing-subscription-utils.mock.ts create mode 100644 packages/testing/src/mocks/billing-subscription.mock.ts create mode 100644 packages/testing/src/mocks/billing-usage-gate-cache.mock.ts create mode 100644 packages/testing/src/mocks/billing-usage-log.mock.ts create mode 100644 packages/testing/src/mocks/billing-usage-monitor.mock.ts create mode 100644 packages/testing/src/mocks/billing-usage-reservation.mock.ts create mode 100644 packages/testing/src/mocks/billing-usage.mock.ts create mode 100644 packages/testing/src/mocks/billing-workspace-access.mock.ts create mode 100644 packages/testing/src/mocks/block-visibility.mock.ts create mode 100644 packages/testing/src/mocks/credential-groups-availability.mock.ts create mode 100644 packages/testing/src/mocks/credential-groups-credentials.mock.ts create mode 100644 packages/testing/src/mocks/credential-groups-enrollments.mock.ts create mode 100644 packages/testing/src/mocks/credential-groups-organization-setup.mock.ts create mode 100644 packages/testing/src/mocks/credential-groups-providers.mock.ts create mode 100644 packages/testing/src/mocks/credential-groups-self-enrollment.mock.ts create mode 100644 packages/testing/src/mocks/credential-groups-service.mock.ts create mode 100644 packages/testing/src/mocks/credentials-access.mock.ts create mode 100644 packages/testing/src/mocks/credentials-environment.mock.ts create mode 100644 packages/testing/src/mocks/credentials-managed-oauth.mock.ts create mode 100644 packages/testing/src/mocks/custom-block-operations.mock.ts create mode 100644 packages/testing/src/mocks/deployment-shape.mock.ts create mode 100644 packages/testing/src/mocks/email-mailer.mock.ts create mode 100644 packages/testing/src/mocks/email-templates.mock.ts create mode 100644 packages/testing/src/mocks/embeddings.mock.ts create mode 100644 packages/testing/src/mocks/emcn-icons.mock.ts create mode 100644 packages/testing/src/mocks/emcn.mock.ts create mode 100644 packages/testing/src/mocks/execute-workflow.mock.ts create mode 100644 packages/testing/src/mocks/execution-limits.mock.ts create mode 100644 packages/testing/src/mocks/execution-payload-store.mock.ts create mode 100644 packages/testing/src/mocks/executor-principal.mock.ts create mode 100644 packages/testing/src/mocks/feature-flags.mock.ts create mode 100644 packages/testing/src/mocks/file-parsers.mock.ts create mode 100644 packages/testing/src/mocks/file-utils-server.mock.ts create mode 100644 packages/testing/src/mocks/file-utils.mock.ts create mode 100644 packages/testing/src/mocks/files-authorization.mock.ts create mode 100644 packages/testing/src/mocks/folder-queries.mock.ts create mode 100644 packages/testing/src/mocks/github-installation.mock.ts create mode 100644 packages/testing/src/mocks/human-in-the-loop-manager.mock.ts create mode 100644 packages/testing/src/mocks/id.mock.ts create mode 100644 packages/testing/src/mocks/integrations-availability.mock.ts create mode 100644 packages/testing/src/mocks/invitations-core.mock.ts create mode 100644 packages/testing/src/mocks/invitations-send.mock.ts create mode 100644 packages/testing/src/mocks/kb-connectors-queries.mock.ts create mode 100644 packages/testing/src/mocks/knowledge-access-scope.mock.ts create mode 100644 packages/testing/src/mocks/knowledge-availability.mock.ts create mode 100644 packages/testing/src/mocks/knowledge-base-use-cases.mock.ts create mode 100644 packages/testing/src/mocks/knowledge-contexts.mock.ts create mode 100644 packages/testing/src/mocks/knowledge-documents-service.mock.ts create mode 100644 packages/testing/src/mocks/knowledge-documents-utils.mock.ts create mode 100644 packages/testing/src/mocks/knowledge-embeddings.mock.ts create mode 100644 packages/testing/src/mocks/knowledge-member-access.mock.ts create mode 100644 packages/testing/src/mocks/knowledge-member-queue.mock.ts create mode 100644 packages/testing/src/mocks/knowledge-search-integration-policy.mock.ts create mode 100644 packages/testing/src/mocks/knowledge-search-use-case.mock.ts create mode 100644 packages/testing/src/mocks/knowledge-secure-fetch.mock.ts create mode 100644 packages/testing/src/mocks/knowledge-service.mock.ts create mode 100644 packages/testing/src/mocks/knowledge-tags-service.mock.ts create mode 100644 packages/testing/src/mocks/large-value-metadata.mock.ts create mode 100644 packages/testing/src/mocks/lib-desktop.mock.ts create mode 100644 packages/testing/src/mocks/mcp-pubsub.mock.ts create mode 100644 packages/testing/src/mocks/mcp-service.mock.ts create mode 100644 packages/testing/src/mocks/mcp-use-cases.mock.ts create mode 100644 packages/testing/src/mocks/mothership-agent-url.mock.ts create mode 100644 packages/testing/src/mocks/mothership-async-runs.mock.ts create mode 100644 packages/testing/src/mocks/mothership-chat-lifecycle.mock.ts create mode 100644 packages/testing/src/mocks/mothership-chat-messages.mock.ts create mode 100644 packages/testing/src/mocks/mothership-chat-payload.mock.ts create mode 100644 packages/testing/src/mocks/mothership-chat-status.mock.ts create mode 100644 packages/testing/src/mocks/mothership-environment-context.mock.ts create mode 100644 packages/testing/src/mocks/mothership-go-fetch.mock.ts create mode 100644 packages/testing/src/mocks/mothership-organization-chats.mock.ts create mode 100644 packages/testing/src/mocks/mothership-otel.mock.ts create mode 100644 packages/testing/src/mocks/mothership-workspace-target.mock.ts create mode 100644 packages/testing/src/mocks/network-config.mock.ts create mode 100644 packages/testing/src/mocks/next-navigation.mock.ts create mode 100644 packages/testing/src/mocks/oauth-utils.mock.ts create mode 100644 packages/testing/src/mocks/openai.mock.ts create mode 100644 packages/testing/src/mocks/organization-accounts-queries.mock.ts create mode 100644 packages/testing/src/mocks/organization-authorization.mock.ts create mode 100644 packages/testing/src/mocks/organization-member-limits.mock.ts create mode 100644 packages/testing/src/mocks/organization-membership.mock.ts create mode 100644 packages/testing/src/mocks/organization-provider.mock.ts create mode 100644 packages/testing/src/mocks/organization-seats.mock.ts create mode 100644 packages/testing/src/mocks/outbox-service.mock.ts create mode 100644 packages/testing/src/mocks/permission-check.mock.ts create mode 100644 packages/testing/src/mocks/permission-group-locks.mock.ts create mode 100644 packages/testing/src/mocks/permission-groups-resolve.mock.ts create mode 100644 packages/testing/src/mocks/pii-redaction.mock.ts create mode 100644 packages/testing/src/mocks/providers-attachments.mock.ts create mode 100644 packages/testing/src/mocks/providers-conversation-history.mock.ts create mode 100644 packages/testing/src/mocks/providers-models.mock.ts create mode 100644 packages/testing/src/mocks/providers-trace-enrichment.mock.ts create mode 100644 packages/testing/src/mocks/providers-utils.mock.ts create mode 100644 packages/testing/src/mocks/providers.mock.ts create mode 100644 packages/testing/src/mocks/public-shares.mock.ts create mode 100644 packages/testing/src/mocks/rate-limiter.mock.ts create mode 100644 packages/testing/src/mocks/react-query.mock.ts create mode 100644 packages/testing/src/mocks/realtime-notify.mock.ts create mode 100644 packages/testing/src/mocks/remote-sandbox-provider.mock.ts create mode 100644 packages/testing/src/mocks/remote-sandbox.mock.ts create mode 100644 packages/testing/src/mocks/resource-policy-repository.mock.ts create mode 100644 packages/testing/src/mocks/schema-tables.generated.ts create mode 100644 packages/testing/src/mocks/search-replace-indexer.mock.ts create mode 100644 packages/testing/src/mocks/secrets-use-cases.mock.ts create mode 100644 packages/testing/src/mocks/selector-credential-bundle.mock.ts create mode 100644 packages/testing/src/mocks/selector-credentials.mock.ts create mode 100644 packages/testing/src/mocks/sim-search-connectors.mock.ts create mode 100644 packages/testing/src/mocks/table-api.mock.ts create mode 100644 packages/testing/src/mocks/table-application-context.mock.ts create mode 100644 packages/testing/src/mocks/table-application-rows.mock.ts create mode 100644 packages/testing/src/mocks/table-application-tables.mock.ts create mode 100644 packages/testing/src/mocks/table-billing.mock.ts create mode 100644 packages/testing/src/mocks/table-constants.mock.ts create mode 100644 packages/testing/src/mocks/table-events.mock.ts create mode 100644 packages/testing/src/mocks/table-jobs-service.mock.ts create mode 100644 packages/testing/src/mocks/table-route-utils.mock.ts create mode 100644 packages/testing/src/mocks/table-rows-secret-provenance.mock.ts create mode 100644 packages/testing/src/mocks/table-rows-service.mock.ts create mode 100644 packages/testing/src/mocks/table-service.mock.ts create mode 100644 packages/testing/src/mocks/table-trigger.mock.ts create mode 100644 packages/testing/src/mocks/table-ttl-availability.mock.ts create mode 100644 packages/testing/src/mocks/table-wire.mock.ts create mode 100644 packages/testing/src/mocks/table-workflow-columns.mock.ts create mode 100644 packages/testing/src/mocks/table.mock.ts create mode 100644 packages/testing/src/mocks/tokenization-accurate.mock.ts create mode 100644 packages/testing/src/mocks/tools.mock.ts create mode 100644 packages/testing/src/mocks/trace-store.mock.ts create mode 100644 packages/testing/src/mocks/trigger-availability.mock.ts create mode 100644 packages/testing/src/mocks/trigger-sdk.mock.ts create mode 100644 packages/testing/src/mocks/triggers.mock.ts create mode 100644 packages/testing/src/mocks/upload-session.mock.ts create mode 100644 packages/testing/src/mocks/uploads-config.mock.ts create mode 100644 packages/testing/src/mocks/uploads-copilot.mock.ts create mode 100644 packages/testing/src/mocks/uploads-execution.mock.ts create mode 100644 packages/testing/src/mocks/uploads-metadata.mock.ts create mode 100644 packages/testing/src/mocks/uploads-setup.mock.ts create mode 100644 packages/testing/src/mocks/uploads.mock.ts create mode 100644 packages/testing/src/mocks/users-queries.mock.ts create mode 100644 packages/testing/src/mocks/utils-helpers.mock.ts create mode 100644 packages/testing/src/mocks/v1-logs-meta.mock.ts create mode 100644 packages/testing/src/mocks/v1-middleware.mock.ts create mode 100644 packages/testing/src/mocks/webhooks-processor.mock.ts create mode 100644 packages/testing/src/mocks/workflow-context.mock.ts create mode 100644 packages/testing/src/mocks/workflow-deployment-status.mock.ts create mode 100644 packages/testing/src/mocks/workflow-registry-store.mock.ts create mode 100644 packages/testing/src/mocks/workflows-orchestration.mock.ts create mode 100644 packages/testing/src/mocks/workflows-queries.mock.ts create mode 100644 packages/testing/src/mocks/workspace-authorization.mock.ts create mode 100644 packages/testing/src/mocks/workspace-authz.mock.ts create mode 100644 packages/testing/src/mocks/workspace-context.mock.ts create mode 100644 packages/testing/src/mocks/workspace-file-folders.mock.ts create mode 100644 packages/testing/src/mocks/workspace-file-manager.mock.ts create mode 100644 packages/testing/src/mocks/workspace-file-reference.mock.ts create mode 100644 packages/testing/src/mocks/workspace-file-secret-provenance.mock.ts create mode 100644 packages/testing/src/mocks/workspace-files-list.mock.ts create mode 100644 packages/testing/src/mocks/workspace-forking-authz.mock.ts create mode 100644 packages/testing/src/mocks/workspace-forking-lineage.mock.ts create mode 100644 packages/testing/src/mocks/workspace-forking-mapping-store.mock.ts create mode 100644 packages/testing/src/mocks/workspace-uploads.mock.ts create mode 100644 packages/testing/src/mocks/workspaces-policy.mock.ts create mode 100644 packages/testing/src/mocks/workspaces-utils.mock.ts create mode 100644 scripts/check-test-patterns.ts create mode 100644 scripts/generate-schema-mock.ts create mode 100644 scripts/test-patterns-baseline.json create mode 100644 vitest.shared.ts diff --git a/.agents/skills/add-block/SKILL.md b/.agents/skills/add-block/SKILL.md index 2361233e08a..73a6de2455b 100644 --- a/.agents/skills/add-block/SKILL.md +++ b/.agents/skills/add-block/SKILL.md @@ -902,13 +902,13 @@ Every block declares a one-line prose summary that replaces its card's field row ``` Slack ← header (already names the block) -Posts ⟨Ship it 🚀⟩ to ⟨#eng⟩ ← the sentence; ⟨…⟩ are live value chips +Post ⟨Ship it 🚀⟩ to ⟨#eng⟩ ← the sentence; ⟨…⟩ are live value chips ``` Write one `byOperation` entry per operation dropdown option (or a single `default` when the block has no operation dropdown). -**The full authoring contract — voice, structure, and the two mistakes that break +**The full authoring contract — voice, structure, and the four mistakes that break cards silently — is `apps/sim/blocks/AGENTS.md` → "Canvas sentences". Read it before writing any.** The two failures worth repeating here, because both are invisible at runtime: diff --git a/.agents/skills/add-column-type/SKILL.md b/.agents/skills/add-column-type/SKILL.md index 4462dacb060..1ac05a8c9ec 100644 --- a/.agents/skills/add-column-type/SKILL.md +++ b/.agents/skills/add-column-type/SKILL.md @@ -148,13 +148,13 @@ Registering the *type* is compiler-enforced. Registering its *metadata* is not, - [ ] Icon added, centered on the family's optical center, exported alphabetically - [ ] `migrateCellsTo` / `migrateCellsFrom` added if the stored bytes change - [ ] New metadata keys added to `TYPE_SPECIFIC_COLUMN_KEYS` + `FOREIGN_METADATA_VERB` -- [ ] Unit tests for `coerce` / `isCompatibleWith` round-trips, verified to fail without the code +- [ ] Unit tests for `coerce` / `isCompatibleWith` round-trips only if they pass the `test-audit` authoring gate, verified to fail without the code - [ ] Docs row added to `apps/docs/content/docs/tables/index.mdx` ## Final Validation (Required) 1. **`cd apps/sim && bun run type-check`** — must be clean. If any file *outside* `column-types/` errors, that file has a hardcoded type list; fix it to read the registry. 2. **Grep for leaks** — `grep -rnE "(===|!==) '{id}'|case '{id}':" apps/sim --include='*.ts' --include='*.tsx' | grep -v column-types/`. (All three forms: a plain `!==` and a `case` are how half of `currency`'s real branches are written.) Hits are expected; judge each. A hit is fine when it mounts a specific React component or encodes a genuinely one-off behavior (`json`'s mono textarea, `date`'s timezone-aware parsing). A hit is a **leak** when it restates something the registry could answer — an icon, a label, a colour, an operator set, a cast, a coercion. Leaks get a registry field, not a new branch. -3. **Run the suite** — `bunx vitest run lib/table 'app/workspace/[workspaceId]/tables' lib/api app/api/table app/api/v1 lib/copilot/tools/server/table`. Existing tests must pass **unchanged**; needing to edit one means you changed behavior for the other types. -4. **`bun run lint:check`, `bun run check:api-validation`, `bun run check:client-boundary`** from the repo root. +3. **Run the suite** — `bun run --cwd apps/sim test lib/table 'app/workspace/[workspaceId]/tables' lib/api app/api/table app/api/v1 lib/copilot/tools/server/table`. Existing tests must pass **unchanged**; needing to edit one means you changed behavior for the other types. +4. **`bun run lint`, `bun run check:api-validation`, `bun run check:client-boundary`** from the repo root. 5. **Exercise it in the running app** on a table with one column of every type: create, edit inline / in the expanded popover / in the row modal, paste from a spreadsheet, filter, sort, convert to and from other types, export CSV, undo a column delete. diff --git a/.agents/skills/add-feature-flag/SKILL.md b/.agents/skills/add-feature-flag/SKILL.md index bb415d8585f..a5e1abf0e41 100644 --- a/.agents/skills/add-feature-flag/SKILL.md +++ b/.agents/skills/add-feature-flag/SKILL.md @@ -83,9 +83,9 @@ Critically, **none of this is expressible in code** — gating (especially `admi 4. **(Prod) configure in AppConfig.** The infra `feature-flags` profile schema is permissive, so a new flag needs **no infra change**. Operators add the flag to the hosted `feature-flags` document using `enabled` for global rollout or only the selected `workspaceIds`/`orgIds`/`userIds`/`adminEnabled` clauses for scoped rollout, then start a `sim--fast` deployment (see the AppConfig runbook in the infra README — same flow as `access-control`). The fallback secret only applies when AppConfig is disabled. -5. **Test.** Add a case to `apps/sim/lib/core/config/feature-flags.test.ts` that matches the chosen granularity. For a global flag, exercise `isFeatureEnabled('')` with an AppConfig `enabled` rule and toggle the fallback secret for the off-AppConfig path. For scoped rollout, cover only the selected clauses and mock `isPlatformAdmin` when testing `adminEnabled`. +5. **Test only new evaluation logic.** A flag that reuses the existing clauses is already covered by `apps/sim/lib/core/config/feature-flags.test.ts`; add no per-flag case. When you change how flags evaluate (a new clause kind, a new fallback path), add a case there that passes the `test-audit` authoring gate. -6. **Clean up after rollout.** When the feature ships to everyone, delete the flag's entry from `FEATURE_FLAGS`, the `` env entry, the AppConfig document, the call sites, and the test. Leaving dead flags around is the main failure mode of flag systems. +6. **Clean up after rollout.** When the feature ships to everyone, delete the flag's entry from `FEATURE_FLAGS`, the `` env entry, the AppConfig document, and the call sites. Leaving dead flags around is the main failure mode of flag systems. ## Notes diff --git a/.agents/skills/add-managed-cli/SKILL.md b/.agents/skills/add-managed-cli/SKILL.md index 906d99e5257..87e2095b583 100644 --- a/.agents/skills/add-managed-cli/SKILL.md +++ b/.agents/skills/add-managed-cli/SKILL.md @@ -99,7 +99,7 @@ Do not special-case a CLI in those layers unless the registry contract cannot ex ## 6. Test the Addition -Extend tests when the new entry introduces behavior not already covered: +Extend tests only when the new entry introduces behavior not already covered and the test passes the `test-audit` authoring gate: - For every upgrade, add a regression proving the old ID and recipe remain resolvable but non-selectable, while the replacement ID is selectable. - Add important executable aliases to the table-driven search assertion. @@ -110,10 +110,8 @@ Never commit downloaded artifacts or credentials. ## Required Validation -From `apps/sim`: - ```bash -bunx vitest run \ +bun run --cwd apps/sim test \ lib/execution/remote-sandbox/cli-tools.test.ts \ lib/execution/remote-sandbox/cli-tools-boundary.test.ts \ lib/execution/remote-sandbox/sandbox-spec.test.ts \ diff --git a/.agents/skills/add-permission-group-item/SKILL.md b/.agents/skills/add-permission-group-item/SKILL.md index e413adcd70f..43ff11e4106 100644 --- a/.agents/skills/add-permission-group-item/SKILL.md +++ b/.agents/skills/add-permission-group-item/SKILL.md @@ -210,7 +210,7 @@ bun run check:permission-group-enforcement bun run check:application-graph bun run check:capability-subject cd apps/sim && bun run type-check -cd apps/sim && bunx vitest run lib/permission-groups +bun run --cwd apps/sim test lib/permission-groups ``` Also `bun run check:api-validation` if you touched a contract or the group routes. `bun run check:audits` runs all of these; it derives its list from the `check:*` scripts in `package.json`, so a new audit is opted *out* deliberately rather than opted in. diff --git a/.agents/skills/add-selector/SKILL.md b/.agents/skills/add-selector/SKILL.md index ec5fc589737..3c4f0099f9d 100644 --- a/.agents/skills/add-selector/SKILL.md +++ b/.agents/skills/add-selector/SKILL.md @@ -122,7 +122,7 @@ list, manifest/registry exhaustiveness plus an existing provider primitive test Run the smallest relevant set, then: ```bash -bunx vitest run +bun run --cwd apps/sim test bun run --cwd apps/sim type-check bun run check:fork-dependent-coverage bun run check:client-boundary diff --git a/.claude/skills/add-settings-page/SKILL.md b/.agents/skills/add-settings-page/SKILL.md similarity index 100% rename from .claude/skills/add-settings-page/SKILL.md rename to .agents/skills/add-settings-page/SKILL.md diff --git a/.agents/skills/add-tools/SKILL.md b/.agents/skills/add-tools/SKILL.md index 85d34b491cd..39fbb963050 100644 --- a/.agents/skills/add-tools/SKILL.md +++ b/.agents/skills/add-tools/SKILL.md @@ -256,7 +256,7 @@ Hard rules: provider responses, filenames, URLs, and errors remain unchanged when Sim did not resolve a secret into them. -Add focused tests covering named projection, ordinary identical text without provenance, nested and +Run the `test-audit` authoring gate, then cover these risks at the boundary that owns them: named projection, ordinary identical text without provenance, nested and serialized shape handling, unchanged ordinary external inputs, malformed/incomplete private metadata failing closed, headerless legacy requests, and absence of private metadata in the public tool result. For durable sinks, also cover legacy `NULL` markers, exact-empty new writes, tracked secret writes, diff --git a/.agents/skills/babysit/SKILL.md b/.agents/skills/babysit/SKILL.md index d7bf60a75e4..83204194548 100644 --- a/.agents/skills/babysit/SKILL.md +++ b/.agents/skills/babysit/SKILL.md @@ -121,15 +121,13 @@ conditions freshly after every push. ``` 6. **Before pushing, re-run the full sync check from `/ship` step 2** — not just the log command, - the whole check-and-recover flow (stash WIP if needed, rebase, verify the rebase didn't just + the whole check-and-recover flow (stash WIP pinned by SHA as `/ship` step 2 shows, rebase, verify the rebase didn't just cleanly replay stray commits, cherry-pick rebuild if it did or if it conflicted). A babysit loop spanning a long session is exactly the scenario where a branch can drift, and pushing review fixes on top of undetected drift is how an oversized PR happens even after the branch - was fixed once. Then run the repo's pre-ship checks the same way `/ship` does before - committing — not just lint/typecheck/boundary-validation, but also the conditional `/cleanup` - (if this round's fix touched UI code) and `/db-migrate` (if it touched schema/migrations) - gates from `/ship` steps 4 and 5. A review-fix round is still a code change and can trip - either gate just as easily as the original commit did. + was fixed once. Then run `/ship` steps 4–6 on this round's diff — the cleanup and test gates, + migration safety, and the regenerate + audit phases. A review-fix round is still a code change + and can trip any of them just as easily as the original commit did. 7. **Commit and push** the round's fixes as one commit — `--force-with-lease` whenever step 6's sync check rewrote history, which includes a plain `git rebase origin/staging` that completed diff --git a/.agents/skills/cleanup/SKILL.md b/.agents/skills/cleanup/SKILL.md index ddd4aa7ef9c..e957a1a64f7 100644 --- a/.agents/skills/cleanup/SKILL.md +++ b/.agents/skills/cleanup/SKILL.md @@ -16,9 +16,9 @@ User arguments: $ARGUMENTS Parse `$ARGUMENTS` into `scope` and `fix`: extract the `fix=true|false` token wherever it appears in the string and strip it from `scope`; defaults are the current changes and `fix=true`. `fix` is consumed by Step 3 only — the passes below always run `fix=false`. -Spawn all nine passes concurrently as subagents in a **single message** (multiple Agent tool calls). Each runs its skill on the parsed `scope` with `fix=false` — analysis and proposals ONLY, no edits. Instruct each agent to return its findings as a structured list: for every proposed change, the file path, line range, a one-line description of the change, and the exact before/after so the orchestrator can apply it without re-deriving. +Spawn up to nine passes concurrently as subagents in a **single message** (multiple Agent tool calls); pass 9 runs only when its condition holds. Each runs its skill on the parsed `scope` with `fix=false` — analysis and proposals ONLY, no edits. Instruct each agent to return its findings as a structured list: for every proposed change, the file path, line range, a one-line description of the change, and the exact before/after so the orchestrator can apply it without re-deriving. -Run these nine in parallel on the parsed `scope`: +Run these in parallel on the parsed `scope`: 1. `/you-might-not-need-an-effect fix=false` 2. `/you-might-not-need-a-memo fix=false` @@ -28,7 +28,7 @@ Run these nine in parallel on the parsed `scope`: 6. `/emcn-design-review fix=false` 7. `/you-might-not-need-url-state fix=false` 8. `/you-might-not-need-a-comment fix=false` -9. `/test-audit audit ` — read-only; only when the scope adds or changes test files (`*.test.ts(x)`, `*.integration.ts`, `e2e/**`). It applies the authoring gate to every new or changed test and proposes deleting the ones that fail it. +9. `/test-audit audit ` — read-only; only when the scope adds or changes test files (`*.test.ts(x)`, `*.integration.ts`, `**/e2e/**`, `apps/sim/scripts/test-*-e2e.ts`). First resolve a free-form scope to the concrete list of added or changed test paths (`git diff --name-only` against the scope's base) and pass those paths. It applies the authoring gate to every new or changed test and proposes deleting the ones that fail it. ## Step 2 — Converge @@ -52,7 +52,7 @@ Comments apply after every structural pass, on purpose: that pass operates on wh 2. If the `old_string` still matches verbatim, apply it — a content-anchored edit is safe even if its line moved. 3. If it no longer matches (an earlier pass altered that region), do **not** force the stale patch. Re-derive the change from the current code by re-applying that pass's rule to the construct, or drop it if a prior pass already made it moot. Never apply a proposal against text it wasn't computed from. -After all edits, run `bun run lint:check` (it runs `turbo run lint:check` across the repo — there is no per-file target, so run the full check). +After all edits, run `bun run lint` from the repo root (it autofixes formatting across the repo; there is no per-file target). ## Step 4 — Summary @@ -60,4 +60,4 @@ Output a summary across all passes that ran: what each found, what was applied v ## Boundary findings -Never resolve a boundary finding by adding a `// boundary-raw-fetch` / `// double-cast-allowed` annotation — fix the call (adopt the contract + `requestJson`, or narrow the type). Annotations are only for the documented exceptions in CLAUDE.md → Boundary annotations. +Never resolve a boundary finding by adding a `// boundary-raw-fetch` / `// double-cast-allowed` annotation — fix the call (adopt the contract + `requestJson`, or narrow the type). Annotations are only for the documented exceptions in `.claude/rules/sim-api-contracts.md` → Boundary annotations. diff --git a/.agents/skills/migrate-application-operation/SKILL.md b/.agents/skills/migrate-application-operation/SKILL.md index d8be0eaf32c..21d2a962666 100644 --- a/.agents/skills/migrate-application-operation/SKILL.md +++ b/.agents/skills/migrate-application-operation/SKILL.md @@ -80,7 +80,7 @@ Preserve behavior unless the task explicitly changes it. Stop and report a decis ## Freeze observable behavior before editing -Treat the legacy route or tool as an ordered program, not merely a bag of business logic. Before moving code, write a compact baseline for every in-scope entry point and add focused characterization tests for behavior not already pinned down. +Treat the legacy route or tool as an ordered program, not merely a bag of business logic. Before moving code, write a compact baseline for every in-scope entry point. Pin behavior no existing test covers with a characterization test only where it passes the `test-audit` gate; otherwise record it in the baseline and verify it by hand after the move. Capture all of these when they apply: @@ -315,18 +315,16 @@ Do not force these through an ordinary JSON migration: Stop and report a missing design rather than weakening identity, authorization, limits, or errors. -## Test the complete matrix +## Test each risk at one boundary -Add focused tests for every migrated surface and principal kind allowed by the operation: +Run the `test-audit` authoring gate before writing any test. Own each risk at exactly one boundary: + +- Application use-case tests own authorization, principal-kind rejection before canonical loading, workspace assertion mismatch, delegated scope, not found, conflict, no-op, and audit derived from authoritative results. +- One `*.integration.ts` owns repository semantics: canonical active lookup, workspace-predicated writes, archived resources, authoritative affected rows, and database error propagation. +- Add a surface test only for a surface-specific risk (for example, a v2 envelope or rate header, a Copilot forged-scope rejection, or a legacy redirect/cookie behavior the characterization baseline pinned). Do not restate the operation registry or the shared builders' auth-before-parse behavior per surface. + +Risks that usually earn a test when the change introduces them: -- Application: allowed and disallowed roles, principal-kind rejection before canonical loading, workspace assertion mismatch, delegated scope, not found, conflict, no-op, and infrastructure propagation. -- Operation registry: role/workspace-key/principal-kind/delegated-service consistency and fail-fast rejection of invalid definitions. -- Repository: canonical active lookup, workspace-predicated writes, archived resources, authoritative affected rows, and database error propagation. -- Internal API: authentication before parsing, exact contract, typed errors, and surface analytics only after success. -- Public API: personal and workspace keys, rate behavior, concealment, exact external envelope, and rate headers. -- Copilot or tools: trusted context, exact registered operation membership, rejected forged scope, aliases and resume paths, permission re-check, safe errors, and unchanged tool result shapes. -- Side effects: audit derives from authoritative results; shared notifications follow audit; neither occurs for rejection or no-op. -- Compatibility characterization: legacy normalization, exact response/redirect/cookie behavior, concealment, error subclass precedence, and branch-specific output. - Failure sequencing: inject a failure after each independently committing step and assert persisted state plus audit, analytics, and notification effects. - Concurrency: overlap stateful browser or provider flows and prove each callback consumes only its own state and return destination. - Rendering boundaries: exercise hostile values for every newly connected input that reaches HTML, inline JavaScript, URLs, logs, or provider requests. @@ -334,7 +332,7 @@ Add focused tests for every migrated surface and principal kind allowed by the o Run at minimum: ```bash -bunx vitest run +bun run --cwd apps/sim test bunx biome check bunx turbo run type-check --filter=@sim/app --filter=@sim/auth bun run check:api-validation:strict diff --git a/.agents/skills/react-query-best-practices/SKILL.md b/.agents/skills/react-query-best-practices/SKILL.md index 99f96b259ce..0e426b8bd34 100644 --- a/.agents/skills/react-query-best-practices/SKILL.md +++ b/.agents/skills/react-query-best-practices/SKILL.md @@ -26,7 +26,7 @@ Read these before analyzing: ## Rules to enforce ### Query keys and hooks -Enforce CLAUDE.md "React Query" and `.claude/rules/sim-queries.md` (key factory with `all` + plural prefixes, `signal` forwarding, named `staleTime` constants reused by prefetches, `keepPreviousData` only on variable keys, `requestJson` boundary). Additionally: +Enforce `.claude/rules/sim-queries.md` (key factory with `all` + plural prefixes, `signal` forwarding, named `staleTime` constants reused by prefetches, `keepPreviousData` only on variable keys, `requestJson` boundary). Additionally: - Key factories live next to their hooks — except a factory, standalone fetcher/mapper, or `staleTime` constant that a server module (a `prefetch.ts`, route, block, trigger) imports, which must live in a non-`'use client'` module under `hooks/queries/utils/` per `.claude/rules/sim-queries.md` (a `'use client'` export called from the server crashes SSR) - Use `enabled` to prevent queries from running without required params - Warm data for hover/focus intent with `queryClient.prefetchQuery` and shared `queryOptions`; never temporarily enable a mounted hidden observer, which can remain active after focus restoration and refetch data for closed UI @@ -37,7 +37,7 @@ Enforce CLAUDE.md "React Query" and `.claude/rules/sim-queries.md` (key factory - Server prefetches must call the authorized use case, apply the route presenter/response schema, and reuse the client's exact key, mapper, and stale time. Keep all fallible auth/read/parse work inside `queryFn` so an optional warm cannot fail the page, and never bypass a route that redacts fields. ### Mutations -Enforce CLAUDE.md "Mutation Hooks" (targeted invalidation, `onMutate`/`onError` rollback, mutation objects out of `useCallback` deps). Additionally: +Enforce `.claude/rules/sim-queries.md` "Mutation Hook" (targeted invalidation, `onMutate`/`onError` rollback, mutation objects out of `useCallback` deps). Additionally: - Plain mutations invalidate in `onSuccess`; optimistic mutations reconcile in `onSettled` (fires on success and error) with rollback in `onError` — see `.claude/rules/sim-queries.md` "Mutation Hook" / "Optimistic Updates" ### Server state ownership diff --git a/.agents/skills/ship/SKILL.md b/.agents/skills/ship/SKILL.md index b866ee9a149..e904fdac7cc 100644 --- a/.agents/skills/ship/SKILL.md +++ b/.agents/skills/ship/SKILL.md @@ -15,7 +15,13 @@ When the user runs `/ship`: 1. **Check git status** - See what files have changed 2. **Sync check**: `git fetch origin staging && git log --oneline origin/staging..HEAD`. The list must contain ONLY commits you can attribute to this session (recognizable subjects/SHAs) — a worktree/branch cut from a stale local `staging` silently drags in unrelated commits. - If it shows commits you don't recognize, fix it now, **before** staging/committing any new work (step 7 hasn't run yet): - - If the working tree has uncommitted changes, stash them first — `git stash push -u -m ship-sync-fix` — so the rebase below isn't blocked by dirty state. Restore with `git stash pop` once the branch is fixed. + - If the working tree has uncommitted changes, stash them first so the rebase below isn't blocked by dirty state, and pin the entry by SHA — the stash list is shared across every worktree of the repo, so `stash@{0}` and `git stash pop` can grab another session's entry: + ```bash + git stash push -u -m ship-sync-fix && SHIP_STASH=$(git rev-parse 'stash@{0}') + # once the branch is fixed: + git stash apply "$SHIP_STASH" && + git stash list --format='%gd %H' | awk -v s="$SHIP_STASH" '$2==s{print $1}' | xargs git stash drop + ``` - Try `git rebase origin/staging` first. - **A rebase finishing without conflicts does NOT by itself mean the branch is clean** — it can replay stray commits onto the new base with no conflict at all. After the rebase (clean or not), re-run `git log --oneline origin/staging..HEAD` and re-check the commit list against what you recognize. - If the rebase conflicted on unrecognized commits, OR finished cleanly but the log still shows them, abandon it (`git rebase --abort` if mid-rebase) and rebuild, in this exact order: @@ -32,7 +38,8 @@ When the user runs `/ship`: - Keep it concise 4. **Run the cleanup and test gates** - If the diff modifies UI code (any non-test `.tsx` file, or anything under `apps/sim/components/`, `apps/sim/hooks/`, or `apps/sim/stores/`), run `/cleanup`. It fans out the React/UI passes (effects, memo, callbacks, state, React Query, emcn, url-state), the comment pass, and the test-audit pass, and applies fixes so they land in this commit. - - Otherwise, if the diff adds or changes tests (`*.test.ts(x)`, `*.integration.ts`, `e2e/**`), run `/test-audit audit ` on its own. Every new or changed test must pass the authoring gate; delete the ones that don't rather than shipping them. + - Otherwise, if the diff adds or changes tests (`*.test.ts(x)`, `*.integration.ts`, `**/e2e/**`, `apps/sim/scripts/test-*-e2e.ts`), run `/test-audit audit ` on its own. Every new or changed test must pass the authoring gate; delete the ones that don't rather than shipping them. + - Then run the test files the diff adds or changes, plus the existing tests beside changed source files, with `bun run --cwd test ` (`bun run --cwd apps/sim test ` for the app; `*.integration.ts` needs the setup in `.claude/rules/sim-testing.md`). A failing test aborts ship. 5. **Run migration safety** — only if the diff touches `packages/db/migrations/**` or `packages/db/schema.ts`: - Run `/db-migrate` to review the migration for zero-downtime safety (expand/contract phasing, backward-compatibility with the deployed app version). - `bun run check:migrations origin/staging` must pass (staging is the PR base). Do not silence a flagged statement with a `-- migration-safe:` annotation unless `/db-migrate` confirmed the old code no longer depends on it; otherwise split the destructive change into a later deploy. @@ -139,7 +146,7 @@ Use this exact template in the user's voice (concise, bullet points): - [x] Bug fix (or appropriate type) ## Testing -Tested manually (or describe testing) +Describe the checks, tests, and E2E artifacts run ## Checklist - [x] Code follows project style guidelines @@ -169,6 +176,6 @@ gh pr create --base staging --title "COMMIT_MESSAGE" --body "PR_BODY" - Short, direct bullet points - No unnecessary explanation -- "Tested manually" is acceptable for testing section; include lint, boundary validation, and (when migrations changed) `check:migrations` results when run +- Testing section names what actually ran: the test files, lint, `check:audits`, (when migrations changed) `check:migrations`, and any E2E artifacts - Checkboxes filled in appropriately - No screenshots section unless UI changes diff --git a/.agents/skills/test-audit/SKILL.md b/.agents/skills/test-audit/SKILL.md index bd685aa6f20..31c3f924a03 100644 --- a/.agents/skills/test-audit/SKILL.md +++ b/.agents/skills/test-audit/SKILL.md @@ -73,6 +73,8 @@ boundary covers the bug; do not replay it at every layer it crosses. - negative controls that pass for an unrelated reason (a different guard short-circuits first); - names or fixtures that promise more than the input exercises; - dead production code or exports whose only callers are tests. +- a hand-rolled `vi.mock` factory for a module `vitest.setup.ts` or `@sim/testing` already mocks, or a + local copy of a `@sim/testing` helper (`bun run check:test-patterns` fails on these). ## Retention bar @@ -133,10 +135,7 @@ For a whole subsystem or the whole repo: Never edit source or tests while Vitest is running in the same checkout. -1. Run the touched and sibling test files. From `apps/sim`: - `../../node_modules/.bin/vitest run ` (never `bunx vitest`, which fetches a different - Vitest). Other workspaces: run from the workspace directory. Never pipe the runner through - `grep`/`tail` where the pipe hides its exit code. +1. Run the touched and sibling test files (`.claude/rules/sim-testing.md` → Running). 2. If production code changed: `bun run type-check` in that workspace. 3. `bun run check:audits` from the repo root (some audits list test files by path). 4. `bun run lint`, then `git diff --check`. diff --git a/.agents/skills/v2-api-conventions/SKILL.md b/.agents/skills/v2-api-conventions/SKILL.md index 0b77773666a..b177330a771 100644 --- a/.agents/skills/v2-api-conventions/SKILL.md +++ b/.agents/skills/v2-api-conventions/SKILL.md @@ -87,7 +87,7 @@ Use the shared sets in `contracts/v2/openapi/shared.ts` — `RESOURCE_ERRORS`, ` ## Rule 3 — a collection that returns `nextCursor` must accept `limit` + `cursor`, and must apply them -Every list returns `{ data, nextCursor }`. Whether it *pages* is a separate, pinned decision — see `lib/api/contracts/v2/__tests__/list-pagination.test.ts`, which enumerates both sets and fails when a new list is in neither. +Every list returns `{ data, nextCursor }`. Whether it *pages* is a separate, pinned decision — see `lib/api/contracts/v2/list-pagination.test.ts`, which enumerates both sets and fails when a new list is in neither. Build the query slice from the shared helper, never by hand: @@ -106,13 +106,13 @@ Both take the same two stamps: `cursorSortKey(sortBy, sortOrder)` for the orderi The third is **per-domain**: a list whose read predates the shared codecs, or whose page boundary is not expressible as one, mints its own — a bare `encodeCursor({ version })` on `GET /workflows/{id}/versions` and `encodeCursor({ email })` on the workspace member list, the local codecs in `lib/audit-logs/query.ts`, `lib/logs/list-logs.ts`, and `lib/table/rows/cursor.ts`, and a usage-event id passed straight through by `GET /billing/logs`. Those tokens stay opaque and untouched, but a domain-minted cursor on a list a caller can re-filter is wrapped at the surface with `encodeScopedCursor(cursorScopeKey(cursorRoute(contract, pathParams), {...}), token)` and unwrapped with `readScopedCursor`, so it carries the same binding as the shared schemes. **A new list picks one of the two shared schemes.** Do not add a fourth. -Every paged list's binding is declared in `lib/api/contracts/v2/__tests__/list-pagination.test.ts` and checked against what the contract actually accepts, in both directions. A new list, or a new filter on an existing one, fails that test until its binding is declared or the param is explicitly recorded as unable to change the sequence. +Every paged list's binding is declared in `lib/api/contracts/v2/list-pagination.test.ts` and checked against what the contract actually accepts, in both directions. A new list, or a new filter on an existing one, fails that test until its binding is declared or the param is explicitly recorded as unable to change the sequence. **A keyset's key list must end in a unique column (`id`).** A non-unique trailing key cannot separate tied rows, so the page boundary either repeats or drops them. `lib/api/list-keyset-paging.test.ts` demonstrates the failure. Return `nextCursor: null` on the last page and only then. Never construct a cursor client-side. -**Ordering is `sortBy` + `sortOrder`, except where there is nothing to sort by.** Nearly every paged list takes the pair; `CURSOR_BINDINGS` in `contracts/v2/__tests__/list-pagination.test.ts` is the authoritative set. Exactly one — `GET /workflows/{workflowId}/runs` — has a single sortable column (start time), so there is no `sortBy` to pair with and the direction rides on a single `order` param; `sortBy`/`sortOrder` are not accepted there. That is the *only* sanctioned deviation, and it is documented in its contract. A new list picks the pair. Do not "fix" it by accepting `sortOrder` as an alias: an alias is a second spelling of one thing with undefined precedence when both arrive, which is its own inconsistency. +**Ordering is `sortBy` + `sortOrder`, except where there is nothing to sort by.** Nearly every paged list takes the pair; `CURSOR_BINDINGS` in `contracts/v2/list-pagination.test.ts` is the authoritative set. Exactly one — `GET /workflows/{workflowId}/runs` — has a single sortable column (start time), so there is no `sortBy` to pair with and the direction rides on a single `order` param; `sortBy`/`sortOrder` are not accepted there. That is the *only* sanctioned deviation, and it is documented in its contract. A new list picks the pair. Do not "fix" it by accepting `sortOrder` as an alias: an alias is a second spelling of one thing with undefined precedence when both arrive, which is its own inconsistency. Before documenting a second `order`-style exception, check every other endpoint on the same collection: if one of them already sorts those rows more than one way, the "exactly one sortable column" premise is false — fix the premise rather than documenting the exception. diff --git a/.agents/skills/validate-permission-group-item/SKILL.md b/.agents/skills/validate-permission-group-item/SKILL.md index 3488765cdf2..9422ddbe6c5 100644 --- a/.agents/skills/validate-permission-group-item/SKILL.md +++ b/.agents/skills/validate-permission-group-item/SKILL.md @@ -109,7 +109,8 @@ For an allowlist the three states must be tested separately — `null` permits e bun run check:permission-group-enforcement bun run check:application-graph bun run check:capability-subject -cd apps/sim && bun run type-check && bunx vitest run lib/permission-groups +cd apps/sim && bun run type-check +bun run --cwd apps/sim test lib/permission-groups ``` All three are inside `check:audits`, which derives its list from the `check:*` scripts in `package.json` — a new audit is opted *out* deliberately. Read the output, not the exit codes. Success-line shapes (the counts must include the item under audit): diff --git a/.agents/skills/you-might-not-need-a-comment/SKILL.md b/.agents/skills/you-might-not-need-a-comment/SKILL.md index 788bbbda174..602ba36cb49 100644 --- a/.agents/skills/you-might-not-need-a-comment/SKILL.md +++ b/.agents/skills/you-might-not-need-a-comment/SKILL.md @@ -16,7 +16,7 @@ User arguments: $ARGUMENTS A comment must add information the code cannot express itself. Code says *what* and *how*; a comment earns its place only by explaining *why* — a non-obvious constraint, a workaround, a decision, a gotcha. If deleting the comment loses no information a competent reader wouldn't recover from the code in seconds, delete it. -This codebase's convention: **TSDoc for documentation, no non-TSDoc comments, no `====` separators.** Genuine documentation belongs in a `/** ... */` block on the declaration; everything that survives as an inline `//` comment must be a real *why*, kept terse. +This codebase's convention: **TSDoc for documentation; an inline `//` only for a terse non-obvious why or a script-enforced annotation; no `====` separators.** Genuine documentation belongs in a `/** ... */` block on the declaration; everything that survives as an inline `//` comment must be a real *why*, kept terse. ## Anti-patterns to detect diff --git a/.claude/rules/emcn-components.md b/.claude/rules/emcn-components.md index f02ff3946e5..92f95238590 100644 --- a/.claude/rules/emcn-components.md +++ b/.claude/rules/emcn-components.md @@ -15,7 +15,7 @@ Never hand-roll the chip pill from raw class strings (they go stale). Compose fr - **Surface, typography + content tokens:** `chip/chip-chrome.ts` — `chipFilledSurfaceTokens`, `chipFieldSurfaceClass`, `chipFieldTextClass` (text fields and the dropdown search box build on these), plus the chip-content chrome `chipContentGap`, `chipGeometryClass`, `chipContentIconClass`, `chipContentLabelClass`, `cellIconNodeClass` (non-chip surfaces that must visually match chip content, e.g. resource table cells), and the row-state pair `chipHoverSurfaceClass` / `chipActiveSurfaceClass` (hover vs. selected — mutually exclusive, so a selected row holds its surface through hover; every hand-rolled row imports these rather than restating the literals). All are re-exported from the `@sim/emcn` barrel — no subpath import needed. - **Pill geometry:** `chip/chip.tsx` — `chipVariants` (30px tall, `rounded-lg`, `px-2`, icon↔text `gap-1.5`). Every pill-shaped trigger (`ChipDropdown`, `ChipSelect`, `ChipSwitch`) reuses it for visual parity. -Canonical look: normal font-weight (never `font-medium`/`font-semibold`), value text `--text-body`, icons `--text-icon` at `size-[14px]`, placeholder `--text-muted`, `transition-colors`, **no focus ring** (the caret marks focus). Filled surface is `--surface-5` light / `--surface-4` dark with a `--border-1` border. +Canonical look: normal font-weight (never `font-medium`/`font-semibold`), value text `--text-body`, icons `--text-icon` at `size-[14px]`, placeholder `--text-muted`, `transition-colors`, **no focus ring** (the caret marks focus). Filled surface is `--surface-5` light / `--surface-4` dark with a `--border` border (`chip-chrome.ts` still spells it through the legacy alias `--border-1`; new code writes `--border`). The menu surface intentionally diverges from the pill: `dropdown-menu.tsx` items use `text-small` and `gap-2` (a menu convention, not the chip pill). Keep them distinct. @@ -27,7 +27,7 @@ The menu surface intentionally diverges from the pill: `dropdown-menu.tsx` items - **`ChipTextarea`** — multi-line sibling. `error`, `resizable` (off by default), `viewOnly` (read-only at full opacity with the default cursor — the multi-line counterpart of `ChipCopyInput`). - **`ChipDropdown`** — pill that opens a menu. Single OR multi-select via the discriminated `multiple` prop (one component, not two). Owns its trailing chevron — no `rightIcon`. - **`ChipSelect` / `ChipCombobox`** — `Combobox`-backed pickers with search, groups, multi-select; for richer lists than `ChipDropdown`. -- **`ChipModal` + `ChipModalField`** — declarative compact modal. The field's `type` (`input` | `email` | `textarea` | `dropdown` | `copy` | `file` | `emails` | `custom`) picks the control and **owns all chrome** — consumers describe intent, never pass `variant`/`className`/`id` to the inner control. `custom` is the escape hatch. **Every body field MUST be a `ChipModalField`** — never hand-roll a field row (raw `
` + hand-rolled `

`/`

` per page, in Hero only — never add another. -- Strict heading hierarchy: H1 (Hero) → H2 (section titles) → H3 (feature names). -- Every section: `
`. +- One `

` per page, in the hero only — never add another. The brand carries in the title tag, the meta description, and the hero's `sr-only` summary, so the H1 is free to lead with the non-brand keywords people search ("AI workspace", "AI agents") rather than "Sim is the". +- Strict heading hierarchy: H1 (hero) → H2 (section titles) → H3 (items within a section). Never skip a level. +- Semantic landmarks: `
`, `
`, `