From e46bc84199c1ef252826f9cf479045b4cff6259a Mon Sep 17 00:00:00 2001 From: Waleed Date: Mon, 16 Nov 2026 22:00:33 -0800 Subject: [PATCH 1/5] improvement(resume): resolve a pause point's block from its loop-scoped context id (#10119) --- apps/sim/executor/utils/subflow-node-id-codec.ts | 7 +++++++ .../workflows/executor/human-in-the-loop-manager.ts | 3 ++- .../lib/workflows/executor/pause-block-names.test.ts | 12 ++++++++++++ apps/sim/lib/workflows/executor/pause-block-names.ts | 9 ++++++--- 4 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 apps/sim/lib/workflows/executor/pause-block-names.test.ts diff --git a/apps/sim/executor/utils/subflow-node-id-codec.ts b/apps/sim/executor/utils/subflow-node-id-codec.ts index 4a62d3d89d3..cba4d83a6d3 100644 --- a/apps/sim/executor/utils/subflow-node-id-codec.ts +++ b/apps/sim/executor/utils/subflow-node-id-codec.ts @@ -247,6 +247,13 @@ export function normalizeLookupId(id: string): string { return id.replace(BRANCH.SUFFIX_GLOBAL, '').replace(LOOP_DIGEST.STRIP, '') } +/** + * Strips loop digests (`_loopN`) from an ID, e.g. a pause context ID scoped to a loop iteration. + */ +export function stripLoopDigest(id: string): string { + return id.replace(LOOP_DIGEST.STRIP, '') +} + /** * Returns the leading branch subscript (`₍N₎`) of a node ID, or '' when absent. */ diff --git a/apps/sim/lib/workflows/executor/human-in-the-loop-manager.ts b/apps/sim/lib/workflows/executor/human-in-the-loop-manager.ts index 8ae64fe6d77..25ee2b67fbe 100644 --- a/apps/sim/lib/workflows/executor/human-in-the-loop-manager.ts +++ b/apps/sim/lib/workflows/executor/human-in-the-loop-manager.ts @@ -81,6 +81,7 @@ import type { import { hasExecutionResult } from '@/executor/utils/errors' import { filterOutputForLog } from '@/executor/utils/output-filter' import { projectResolvedSecretDiagnosticError } from '@/executor/utils/resolved-secret-content-projection' +import { stripLoopDigest } from '@/executor/utils/subflow-node-id-codec' import type { SerializedConnection } from '@/serializer/types' /** @@ -3920,7 +3921,7 @@ export class PauseResumeManager { return '' } - const normalized = id.replace(/_loop\d+/g, '') + const normalized = stripLoopDigest(id) return normalized || id } diff --git a/apps/sim/lib/workflows/executor/pause-block-names.test.ts b/apps/sim/lib/workflows/executor/pause-block-names.test.ts new file mode 100644 index 00000000000..8ad2965ea0d --- /dev/null +++ b/apps/sim/lib/workflows/executor/pause-block-names.test.ts @@ -0,0 +1,12 @@ +import { describe, expect, it } from 'vitest' +import { pauseBaseBlockId } from '@/lib/workflows/executor/pause-block-names' + +describe('pauseBaseBlockId', () => { + it.each([ + ['a loop iteration', 'approval_loop2', 'approval'], + ['a parallel branch inside a loop', 'approval₍1₎_loop2', 'approval'], + ['a cloned subflow branch inside a loop', 'approval__obranch-3₍0₎_loop4', 'approval'], + ])('resolves the workflow block of a point keyed only by %s context', (_, contextId, base) => { + expect(pauseBaseBlockId({ contextId })).toBe(base) + }) +}) diff --git a/apps/sim/lib/workflows/executor/pause-block-names.ts b/apps/sim/lib/workflows/executor/pause-block-names.ts index ea9bf3b2734..9af0ece71a6 100644 --- a/apps/sim/lib/workflows/executor/pause-block-names.ts +++ b/apps/sim/lib/workflows/executor/pause-block-names.ts @@ -2,13 +2,16 @@ import { db } from '@sim/db' import { workflowDeploymentVersion, workflowExecutionLogs } from '@sim/db/schema' import { and, eq, sql } from 'drizzle-orm' import type { PausePoint } from '@/executor/types' -import { stripCloneSuffixes } from '@/executor/utils/subflow-node-id-codec' +import { stripCloneSuffixes, stripLoopDigest } from '@/executor/utils/subflow-node-id-codec' type NameablePausePoint = Pick -/** The workflow block a pause point waits on, without any parallel branch or subflow clone suffix. */ +/** + * The workflow block a pause point waits on, without any loop iteration, parallel branch, or + * subflow clone suffix. The loop digest goes first: a context ID ends in it (`block₍N₎_loopK`). + */ export function pauseBaseBlockId(point: Pick): string { - return stripCloneSuffixes(point.blockId ?? point.contextId) + return stripCloneSuffixes(stripLoopDigest(point.blockId ?? point.contextId)) } /** From 9a8b002d70342d5c8086fc9046b9d29b5845a01c Mon Sep 17 00:00:00 2001 From: Waleed Date: Mon, 16 Nov 2026 22:43:41 -0800 Subject: [PATCH 2/5] improvement(ci): scope reviewed root audits to their checks (#10121) * improvement(ci): scope reviewed root audits to their checks * chore(ci): clarify audit-only runner allocation --- .github/CI.md | 2 + scripts/ci-changes.test.ts | 63 ++++++++++++++++++++++++++ scripts/ci-plan.ts | 93 ++++++++++++++++++++++---------------- 3 files changed, 119 insertions(+), 39 deletions(-) diff --git a/.github/CI.md b/.github/CI.md index bf04c91cf9d..a355fc71c6f 100644 --- a/.github/CI.md +++ b/.github/CI.md @@ -4,6 +4,8 @@ The `changes` job runs Turborepo 2.11.10's `affectedTasks` query before installi A PR compares the checked-out GitHub merge commit with its first parent: the actual target revision tested by that merge. The PR event's base SHA can become stale when the target advances. Scoping requires a matching GitHub merge ref and SHA, exactly two merge parents, and a usable target parent; otherwise every check runs. This works with the existing depth-two checkout without fetching older ancestry. Main/staging pushes execute all checks; the parent `ci` workflow skips checks on `dev` pushes, while PRs targeting `dev` still run checks. A manual `checks` run executes all checks unless supplied a full base commit SHA to reproduce a scoped plan. Missing history, an empty diff, unknown files outside the workspace graph, root script/CI changes, or a planner error run every check. Missing selection outputs fail the aggregate gate. The gate also rejects an omitted dependency, any failed/cancelled job, and any skip that its explicit selection flag did not authorize. +Changes exclusively to the reviewed library-content or utils-enforcement audit scripts and their adjacent tests run the always-on lint/audit job and a separate job for the complete root script test suite. The lint job defaults to Blacksmith; the root test job uses one GitHub runner. They do not change application runtime. Mixed changes, deleted inputs, unknown scripts, and CI or generator changes retain full fallback. The attribution artifact records this explicit audit-only owner. + Dedicated docs verification uses the same planner, comparing pushes with their previous commit and PRs with the tested merge's first parent. Site acceptance follows `docs#build` and its transitive package dependencies. The app's docs-consumer task depends on server runtime and that docs build: backend-only changes run the platform consumer against the docs app, while site changes also run corpus and browser checks. Standalone package and unit-only edits skip those production jobs. The required `docs HTTP` gate verifies explicit site/platform selections before accepting any skip. Docs production builds run once and publish an artifact to isolated HTTP, corpus, Chromium, and WebKit jobs. Source checks keep their own checkout because generator verification mutates inputs. Content caches use separate lint/source/build namespaces; generation validates every restore, repairs missing declarations, and removes obsolete modules. The Next build cache keeps its supported incremental behavior. Content and Next caches have size limits, and Next cache files expire after seven days; successful content eviction happens after all consumers finish. diff --git a/scripts/ci-changes.test.ts b/scripts/ci-changes.test.ts index a3db97fc1ea..961225c0932 100644 --- a/scripts/ci-changes.test.ts +++ b/scripts/ci-changes.test.ts @@ -172,6 +172,69 @@ afterEach(() => { for (const repo of fixtures.splice(0)) rmSync(repo, { recursive: true, force: true }) }) describe('CI task attribution through real Turborepo', () => { + describe('reviewed root audits', () => { + it.each([ + { files: ['scripts/check-library-content.ts', 'scripts/check-library-content.test.ts'] }, + { files: ['scripts/check-utils-enforcement.test.ts'] }, + ])('runs audits and script tests without app infrastructure for $files', ({ files }) => { + const plan = classifyFiles(files) + expect(plan.fallback).toBeUndefined() + expect(plan.flags).toEqual({ + docs: false, + docs_site: false, + docs_platform: false, + integration: false, + http: false, + production: false, + e2e_build: false, + desktop_live: false, + test: true, + test_app: false, + build: false, + }) + expect(groups(plan)).toEqual([]) + expect(plan.testPackages).toEqual([]) + expect(plan.typecheckPackages).toEqual([]) + expect(plan.docsGroups).toEqual([]) + }) + it.each(['apps/sim/lib/server.ts', 'scripts/check-example.ts', 'AGENTS.md'])( + 'runs everything when a reviewed audit changes alongside %s', + (file) => { + const plan = classifyFiles(['scripts/check-library-content.ts', file]) + expect(plan.fallback).toBeDefined() + expect(Object.values(plan.flags).every(Boolean)).toBe(true) + } + ) + it.each(['delete', 'move'])('runs everything for a reviewed audit %s', (operation) => { + const { repo } = fixture() + const file = 'scripts/check-library-content.ts' + write(repo, file, 'export const audit = true\n') + git(repo, 'add', '-A') + git(repo, 'commit', '--quiet', '-m', 'audit owner') + const base = git(repo, 'rev-parse', 'HEAD') + if (operation === 'delete') git(repo, 'rm', file) + else git(repo, 'mv', file, 'scripts/unknown-audit.ts') + git(repo, 'commit', '--quiet', '-am', 'remove audit owner') + const plan = classify(repo, base) + expect(plan.fallback).toBeDefined() + expect(Object.values(plan.flags).every(Boolean)).toBe(true) + }) + it('requires PR merge provenance even for a reviewed audit', () => { + const { repo, base, environment } = pullRequestFixture(['scripts/check-library-content.ts']) + const plan = classify(repo, base, { ...environment, GITHUB_REF: 'refs/heads/staging' }) + expect(plan.fallback).toBeDefined() + expect(Object.values(plan.flags).every(Boolean)).toBe(true) + }) + it('keeps unscoped pushes full even for a reviewed audit', () => { + const { repo } = fixture() + write(repo, 'scripts/check-library-content.ts', 'export const audit = true\n') + git(repo, 'add', '-A') + git(repo, 'commit', '--quiet', '-m', 'audit change') + const plan = classify(repo, '', { GITHUB_EVENT_NAME: 'push' }) + expect(plan.fallback).toBeDefined() + expect(Object.values(plan.flags).every(Boolean)).toBe(true) + }) + }) it('scopes a shallow multi-commit PR against its tested target after the event base goes stale', () => { const files = ['packages/sim-setup/src/index.ts', 'packages/sim-setup/src/second.ts'] const { repo, base, target, environment } = pullRequestFixture(files) diff --git a/scripts/ci-plan.ts b/scripts/ci-plan.ts index e4f89b78721..dbecc0b7151 100644 --- a/scripts/ci-plan.ts +++ b/scripts/ci-plan.ts @@ -1,5 +1,5 @@ import { spawnSync } from 'node:child_process' -import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs' +import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs' import { tmpdir } from 'node:os' import { join, resolve } from 'node:path' @@ -23,6 +23,13 @@ interface QueryResult { docsSite: { items: { fullName: string }[] } } } +/** These audit-only inputs belong to lint and test:scripts, rather than application runtime. */ +const ROOT_AUDIT_INPUTS = new Set([ + 'scripts/check-library-content.ts', + 'scripts/check-library-content.test.ts', + 'scripts/check-utils-enforcement.ts', + 'scripts/check-utils-enforcement.test.ts', +]) const root = process.cwd() const suites: { http: Suite[]; production: Suite[] } = JSON.parse( readFileSync(resolve(root, '.github/ci-suites.json'), 'utf8') @@ -31,6 +38,7 @@ const sourceBase = process.argv[2] let files: string[] = [] let tasks: ChangedTask[] = [] let docsSiteChanged = false +let rootAuditOnly = false let base = sourceBase let fallback: string | undefined @@ -66,42 +74,47 @@ try { .split('\0') .filter(Boolean) if (files.length === 0) throw new Error('Empty diff; verify the complete suite') - if (files.some((file) => /^(\.github\/|scripts\/)/.test(file))) - throw new Error('CI orchestration or root scripts changed') - const temp = mkdtempSync(join(tmpdir(), 'sim-ci-plan-')) - let result: QueryResult - try { - const variables = join(temp, 'variables.json') - writeFileSync(variables, JSON.stringify({ base, head: 'HEAD' })) - result = JSON.parse( - command('turbo', ['query', '.github/scripts/ci-plan.gql', '--variables', variables]) - ) - } finally { - rmSync(temp, { recursive: true, force: true }) - } - if ( - result.errors?.length || - !Array.isArray(result.data?.affectedTasks?.items) || - !Array.isArray(result.data?.docsSite?.items) || - !Array.isArray(result.data?.packages?.items) - ) - throw new Error('Turborepo did not return a complete task plan') - const workspacePaths = result.data.packages.items - .filter((pkg) => pkg.name !== '//') - .map((pkg) => `${pkg.path}/`) - const guidance = /^(\.agents|\.claude|\.cursor)\/|(^|\/)(AGENTS|CLAUDE)\.md$|^README\.md$/ - const unowned = files.find( - (file) => !guidance.test(file) && !workspacePaths.some((path) => file.startsWith(path)) + rootAuditOnly = files.every( + (file) => ROOT_AUDIT_INPUTS.has(file) && existsSync(resolve(root, file)) ) - if (unowned) throw new Error(`Changed file outside the workspace graph: ${unowned}`) - tasks = result.data.affectedTasks.items - if ( - tasks.some( - (task) => typeof task.fullName !== 'string' || typeof task.package?.name !== 'string' + if (!rootAuditOnly) { + if (files.some((file) => /^(\.github\/|scripts\/)/.test(file))) + throw new Error('CI orchestration or root scripts changed') + const temp = mkdtempSync(join(tmpdir(), 'sim-ci-plan-')) + let result: QueryResult + try { + const variables = join(temp, 'variables.json') + writeFileSync(variables, JSON.stringify({ base, head: 'HEAD' })) + result = JSON.parse( + command('turbo', ['query', '.github/scripts/ci-plan.gql', '--variables', variables]) + ) + } finally { + rmSync(temp, { recursive: true, force: true }) + } + if ( + result.errors?.length || + !Array.isArray(result.data?.affectedTasks?.items) || + !Array.isArray(result.data?.docsSite?.items) || + !Array.isArray(result.data?.packages?.items) ) - ) - throw new Error('Malformed task attribution') - docsSiteChanged = result.data.docsSite.items.some((task) => task.fullName === 'docs#build') + throw new Error('Turborepo did not return a complete task plan') + const workspacePaths = result.data.packages.items + .filter((pkg) => pkg.name !== '//') + .map((pkg) => `${pkg.path}/`) + const guidance = /^(\.agents|\.claude|\.cursor)\/|(^|\/)(AGENTS|CLAUDE)\.md$|^README\.md$/ + const unowned = files.find( + (file) => !guidance.test(file) && !workspacePaths.some((path) => file.startsWith(path)) + ) + if (unowned) throw new Error(`Changed file outside the workspace graph: ${unowned}`) + tasks = result.data.affectedTasks.items + if ( + tasks.some( + (task) => typeof task.fullName !== 'string' || typeof task.package?.name !== 'string' + ) + ) + throw new Error('Malformed task attribution') + docsSiteChanged = result.data.docsSite.items.some((task) => task.fullName === 'docs#build') + } } catch (error) { fallback = String(error) } @@ -141,7 +154,7 @@ const flags = { production: production.length > 0, e2e_build: http.length > 0 || production.length > 0 || desktopLive, desktop_live: desktopLive, - test: appTest || packages.length > 0, + test: rootAuditOnly || appTest || packages.length > 0, test_app: appTest, build: affected('build'), } @@ -159,6 +172,7 @@ const report = { head: command('git', ['rev-parse', 'HEAD']), files, fallback, + rootAuditOnly, tasks, flags, http, @@ -169,9 +183,10 @@ const report = { } if (process.env.CI_PLAN_PATH) writeFileSync(process.env.CI_PLAN_PATH, `${JSON.stringify(report, null, 2)}\n`) -process.stderr.write( - `${fallback ? `Full CI: ${fallback}` : `Affected CI: ${tasks.map((task) => task.fullName).join(', ') || 'no executable tasks'}`}\n` -) +const attribution = rootAuditOnly + ? 'reviewed root audits and script tests' + : tasks.map((task) => task.fullName).join(', ') || 'no executable tasks' +process.stderr.write(`${fallback ? `Full CI: ${fallback}` : `Affected CI: ${attribution}`}\n`) process.stdout.write( Object.entries(outputs) .map(([key, value]) => `${key}=${value}\n`) From cf81937e9cf4e7f3d68586b61be185aa80185a13 Mon Sep 17 00:00:00 2001 From: Waleed Date: Mon, 16 Nov 2026 22:54:43 -0800 Subject: [PATCH 3/5] improvement(search): describe Slack file hits and leave out GitLab sources that grant the reader nothing (#10120) * improvement(search): describe Slack file hits and leave out GitLab sources that grant the reader nothing * fix(search): keep oversized Slack files off the full-text promise and fail GitLab source filtering open * fix(search): redact the GitLab grant-check warning and describe empty Slack files --- .../gitlab-group.integration.ts | 35 ++++++- .../knowledge/connectors/permission-store.ts | 22 +++++ apps/sim/lib/sim-search/live/README.md | 4 +- apps/sim/lib/sim-search/live/accounts.test.ts | 1 + apps/sim/lib/sim-search/live/accounts.ts | 7 +- .../lib/sim-search/live/gitlab-admin.test.ts | 21 +++- apps/sim/lib/sim-search/live/gitlab-admin.ts | 96 +++++++++++++++---- .../sim/lib/sim-search/live/providers.test.ts | 63 ++++++++++++ apps/sim/lib/sim-search/live/slack.ts | 53 +++++++++- 9 files changed, 269 insertions(+), 33 deletions(-) diff --git a/apps/sim/lib/knowledge/__integration__/gitlab-group.integration.ts b/apps/sim/lib/knowledge/__integration__/gitlab-group.integration.ts index e0cbc42dc4c..375e6e7e43e 100644 --- a/apps/sim/lib/knowledge/__integration__/gitlab-group.integration.ts +++ b/apps/sim/lib/knowledge/__integration__/gitlab-group.integration.ts @@ -55,6 +55,7 @@ describe('GitLab group Search permission boundary', () => { let moved = false let failedDiscovery = false let added = false + let aliceLegacyResult: { documentId: string } | undefined let confidential = false let providerState = 'healthy' const checks: string[] = [] @@ -259,7 +260,7 @@ describe('GitLab group Search permission boundary', () => { boundary: 'Application use cases, real PostgreSQL and HTTP GitLab API fixture; TLS/SSRF transport substituted', checks, - passed: checks.length === 10, + passed: checks.length === 11, }, null, 2 @@ -433,9 +434,8 @@ describe('GitLab group Search permission boundary', () => { input: { organizationId: ids.organizationId, sourceId: legacyId }, }) expect(legacyRevision).toEqual({ revision: 1 }) - expect( - (await search(ids.aliceId, '11', undefined, 20, legacyId)).results.length - ).toBeGreaterThan(0) + aliceLegacyResult = (await search(ids.aliceId, '11', undefined, 20, legacyId)).results[0] + expect(aliceLegacyResult).toBeDefined() await replaceSearchSourcePermissions.execute({ principal: principal(ids.aliceId), input: { @@ -461,6 +461,33 @@ describe('GitLab group Search permission boundary', () => { checks.push('Atomic group refresh, revocation and existing source preservation') }) + it('leaves a source out of the searches of a reader its uploaded permissions no longer grant', async () => { + const accounts = async (userId: string) => + ( + await searchLiveKnowledge.execute({ + principal: principal(userId), + input: { + organizationId: ids.organizationId, + query: 'Atlas', + topK: 20, + filters: { source: 'gitlab' }, + resultSecretRegistry: new ResolvedSecretTraceRegistry(), + }, + }) + ).live?.accounts ?? [] + const alice = await accounts(ids.aliceId) + expect(alice.map((account) => account.accountId)).toEqual([`gitlab-source:${sourceId}`]) + expect(alice.every((account) => account.status === 'ok')).toBe(true) + expect(new Set((await accounts(ids.bobId)).map((account) => account.accountId))).toEqual( + new Set([`gitlab-source:${sourceId}`, `gitlab-source:${legacyId}`]) + ) + if (!aliceLegacyResult) throw new Error('Missing result found before revocation') + await expect(read(ids.aliceId, aliceLegacyResult.documentId)).rejects.toThrow( + 'This GitLab source is not available to your account.' + ) + checks.push('Sources granting the reader nothing are left out of their searches') + }) + it('preserves all grants on discovery failure and admits only one concurrent revision', async () => { failedDiscovery = true await expect(replace(2)).rejects.toMatchObject({ code: 'validation' }) diff --git a/apps/sim/lib/knowledge/connectors/permission-store.ts b/apps/sim/lib/knowledge/connectors/permission-store.ts index 88978b611ad..053c3feba25 100644 --- a/apps/sim/lib/knowledge/connectors/permission-store.ts +++ b/apps/sim/lib/knowledge/connectors/permission-store.ts @@ -37,6 +37,28 @@ export async function hasConnectorPermissionGrant( return Boolean(grant) } +/** The connectors among `connectorIds` that grant the reader's subject at least one collection. */ +export async function connectorsGrantingSubject( + connectorIds: readonly string[], + subjectToken: string +): Promise> { + const table = knowledgeConnectorPermissionGrant + const granted = new Set() + for (let offset = 0; offset < connectorIds.length; offset += 1000) { + const rows = await db + .selectDistinct({ connectorId: table.connectorId }) + .from(table) + .where( + and( + eq(table.subjectToken, subjectToken), + inArray(table.connectorId, connectorIds.slice(offset, offset + 1000)) + ) + ) + for (const row of rows) granted.add(row.connectorId) + } + return granted +} + /** Returns grants only for the bounded, canonical collections requested by the authorized caller. */ export async function readConnectorPermissionGrants( connectorId: string, diff --git a/apps/sim/lib/sim-search/live/README.md b/apps/sim/lib/sim-search/live/README.md index c91e5f7d98a..89a0609580b 100644 --- a/apps/sim/lib/sim-search/live/README.md +++ b/apps/sim/lib/sim-search/live/README.md @@ -7,7 +7,7 @@ This describes the live enterprise-search path. Credential Groups and ordinary k - **Sources** controls integration availability and account mode per integration. - **Member accounts** has no resource configuration. A member connects their own account under Integrations, and searches content that account can access through the provider API. A member can add several accounts of one provider, such as Google Drive in two tenants; each is searched and cited separately, and every search counts them toward its account limit. Old member resource filters are ignored and cleared when settings are saved. - **Service account** selects an admin-managed source. Its connection owns the resource settings; Sources does not duplicate them. GitHub uses one GitHub App source per repository instead of a single selected source. A member still connects their own account, except for GitLab. Search returns the intersection of the member's provider permissions and the source's current resource boundary. -- GitLab is always service-account mode. Slack and Jira currently support member mode only. +- GitLab is always service-account mode. A source whose uploaded CSV permissions grant the member no project is left out of their searches rather than reported unavailable on each one; a source checked against GitLab itself stays listed and its session decides. Slack and Jira currently support member mode only. - Removing a source integration prevents subsequent account resolution, searches, and reads. Paused, archived, deleted, wrong-organization, wrong-provider, and unapproved service sources cannot authorize search. The Search assistant exposes the dedicated search/read tools. It cannot discover or execute integration tools through `search_integration_tools`, `call_integration_tool`, or direct provider-tool names. The broader assistant outside Search retains its integration tools. @@ -58,7 +58,7 @@ Each event must exist under the source's delegated token, be in an allowed calen ### Slack -Member mode only. Search uses the connected user's Slack real-time search grant and provider search syntax. Date bounds are sent as numeric provider timestamps; date ordering selects keyword retrieval and timestamp sort, because Slack semantic retrieval uses relevance ordering. Channels, messages, direct messages, and files are limited by that grant and provider scopes; there is no admin channel filter in member mode. Missing required search scopes produce a reconnect status. Thread/file reads use the same connected identity. A file read downloads the full text of a canvas (HTML), text snippet, PDF or DOCX from `files.slack.com` only, using `url_private_download` when present (Slack redirects a PDF's `url_private` to a viewer on another domain), never a remote file's own URL (redirects are followed only within that host; a hop elsewhere, such as a sign-in page, keeps the preview), within the shared response-size limit; when Slack will not serve it, the read returns the `files.info` preview. Real-time Search returns at most 20 results a call and counts every page against the member's rate limit, so a search across every source reads one page; a Slack-scoped or native Slack search follows the cursor for up to three pages to fill its limit, and a later page that fails keeps the earlier pages and returns the unread cursor. +Member mode only. Search uses the connected user's Slack real-time search grant and provider search syntax. Date bounds are sent as numeric provider timestamps; date ordering selects keyword retrieval and timestamp sort, because Slack semantic retrieval uses relevance ordering. Channels, messages, direct messages, and files are limited by that grant and provider scopes; there is no admin channel filter in member mode. Missing required search scopes produce a reconnect status. Thread/file reads use the same connected identity. Real-time Search returns only a file's title for a file hit, so the hit names the file's type and size and whether a read returns its text. A file read downloads the full text of a canvas (HTML), text snippet, PDF or DOCX from `files.slack.com` only, using `url_private_download` when present (Slack redirects a PDF's `url_private` to a viewer on another domain), never a remote file's own URL (redirects are followed only within that host; a hop elsewhere, such as a sign-in page, keeps the preview), within the shared response-size limit; when Slack will not serve it, the read returns the `files.info` preview. Real-time Search returns at most 20 results a call and counts every page against the member's rate limit, so a search across every source reads one page; a Slack-scoped or native Slack search follows the cursor for up to three pages to fill its limit, and a later page that fails keeps the earlier pages and returns the unread cursor. ### GitHub diff --git a/apps/sim/lib/sim-search/live/accounts.test.ts b/apps/sim/lib/sim-search/live/accounts.test.ts index e0fd50ce09b..3b5f231c1a6 100644 --- a/apps/sim/lib/sim-search/live/accounts.test.ts +++ b/apps/sim/lib/sim-search/live/accounts.test.ts @@ -22,6 +22,7 @@ const hoisted = vi.hoisted(() => ({ })) vi.mock('@/lib/knowledge/search/integration-policy', () => knowledgeSearchIntegrationPolicyMock) vi.mock('@/lib/sim-search/live/gitlab-admin', () => ({ + isAdminGitLabAccountId: (accountId: string) => accountId.startsWith('gitlab-source:'), listAdminGitLabAccounts: hoisted.admin, resolveAdminGitLabAccount: hoisted.resolveAdmin, })) diff --git a/apps/sim/lib/sim-search/live/accounts.ts b/apps/sim/lib/sim-search/live/accounts.ts index 742700ff974..800cf45965a 100644 --- a/apps/sim/lib/sim-search/live/accounts.ts +++ b/apps/sim/lib/sim-search/live/accounts.ts @@ -20,6 +20,7 @@ import { resolveKnowledgeWorkspaceContext } from '@/lib/knowledge/application/co import { listOrganizationSearchApprovals } from '@/lib/knowledge/search/integration-policy' import { resolveCredentialTokenBundle } from '@/lib/oauth/credential-service' import { + isAdminGitLabAccountId, listAdminGitLabAccounts, resolveAdminGitLabAccount, } from '@/lib/sim-search/live/gitlab-admin' @@ -114,7 +115,7 @@ export async function listLiveAccounts( const [visible, mcp, admin] = await Promise.all([ workspaceContext ? filterWorkspaceAccountCredentials(workspaceContext, candidates) : candidates, listManagedMcpSearchAccounts(owner, userId, denied), - denied.has('gitlab') ? [] : listAdminGitLabAccounts(owner), + denied.has('gitlab') ? [] : listAdminGitLabAccounts(owner, userId), ]) if (visible.length === 0) return [...mcp, ...admin] // Metadata is fetched in one batch; a fresh binding check still precedes token resolution. @@ -162,7 +163,9 @@ export async function resolveLiveAccount( ) { const current = (await listLiveAccounts(owner, userId)).find((row) => row.id === accountId) if (!current) - throw new NativeSearchError('reconnect', 'This search connection is no longer available.') + throw isAdminGitLabAccountId(accountId) + ? new NativeSearchError('unavailable', 'This GitLab source is not available to your account.') + : new NativeSearchError('reconnect', 'This search connection is no longer available.') return resolveListedLiveAccount(owner, userId, current, signal) } diff --git a/apps/sim/lib/sim-search/live/gitlab-admin.test.ts b/apps/sim/lib/sim-search/live/gitlab-admin.test.ts index 0c3f73b1760..6fda990842d 100644 --- a/apps/sim/lib/sim-search/live/gitlab-admin.test.ts +++ b/apps/sim/lib/sim-search/live/gitlab-admin.test.ts @@ -1,10 +1,14 @@ +import { queueTableRows, schemaMock } from '@sim/testing' import { knowledgeAccessScopeMock, knowledgeAccessScopeMockFns, } from '@sim/testing/mocks/knowledge-access-scope.mock' import { beforeEach, describe, expect, it, vi } from 'vitest' import { groupToken } from '@/lib/knowledge/access/tokens' -import { createAdminGitLabSession } from '@/lib/sim-search/live/gitlab-admin' +import { + createAdminGitLabSession, + listAdminGitLabAccounts, +} from '@/lib/sim-search/live/gitlab-admin' import { gitLabCsvGroupToken, setGitLabCsvContext, @@ -19,6 +23,7 @@ const mocks = vi.hoisted(() => ({ search: vi.fn(), read: vi.fn(), grant: vi.fn(), + metadata: vi.fn(), })) vi.mock('@/lib/knowledge/access/scope', () => knowledgeAccessScopeMock) vi.mock('@/connectors/gitlab/permission-config/repository', () => ({ @@ -26,6 +31,7 @@ vi.mock('@/connectors/gitlab/permission-config/repository', () => ({ })) vi.mock('@/lib/knowledge/connectors/permission-store', () => ({ hasConnectorPermissionGrant: mocks.grant, + readConnectorPermissionMetadata: mocks.metadata, })) vi.mock('@/connectors/gitlab/permissions', () => ({ openGitLabDirectory: mocks.directory, @@ -236,3 +242,16 @@ describe('non-admin token and CSV permissions', () => { await expect(session()).rejects.toThrow('not available') }) }) + +describe('administrator-managed GitLab source listing', () => { + it('lists every source when its grants cannot be checked, leaving the session to refuse it', async () => { + queueTableRows(schemaMock.knowledgeConnector, [ + { id: 'source-a', config: source.config, encryptedApiKey: 'sealed' }, + ]) + mocks.metadata.mockRejectedValue(new Error('connection reset')) + + const accounts = await listAdminGitLabAccounts({ organizationId: 'org' }, 'reader') + + expect(accounts.map((account) => account.id)).toEqual(['gitlab-source:source-a']) + }) +}) diff --git a/apps/sim/lib/sim-search/live/gitlab-admin.ts b/apps/sim/lib/sim-search/live/gitlab-admin.ts index 8b95c69b2a6..e0e82df519b 100644 --- a/apps/sim/lib/sim-search/live/gitlab-admin.ts +++ b/apps/sim/lib/sim-search/live/gitlab-admin.ts @@ -1,5 +1,7 @@ import { db } from '@sim/db' import { knowledgeBase, knowledgeConnector } from '@sim/db/schema' +import { createLogger } from '@sim/logger' +import { describeError } from '@sim/utils/errors' import { and, eq, inArray, isNull } from 'drizzle-orm' import { decryptApiKey } from '@/lib/api-key/crypto' import { type ResourceOwner, resourceScopeFromOwner } from '@/lib/core/resource-scope' @@ -7,6 +9,7 @@ import { resourceScopeCondition } from '@/lib/core/resource-scope.server' import { createUserKnowledgeAccessProvider } from '@/lib/knowledge/access/scope' import { groupToken } from '@/lib/knowledge/access/tokens' import { + connectorsGrantingSubject, hasConnectorPermissionGrant, readConnectorPermissionGrants, readConnectorPermissionMetadata, @@ -44,6 +47,7 @@ import { } from '@/connectors/gitlab/permissions' import { normalizeGitLabHost } from '@/tools/gitlab/utils' +const logger = createLogger('SimSearchGitLabSources') const PREFIX = 'gitlab-source:' /** Canonical admin-managed sources only. Neither credentials nor indexed documents leave this module. */ @@ -72,20 +76,80 @@ async function sources(owner: ResourceOwner, connectorId?: string) { ) } -export async function listAdminGitLabAccounts(owner: ResourceOwner): Promise { - return (await sources(owner)).map((source) => ({ - id: `${PREFIX}${source.id}`, - provider: 'gitlab', - providerId: 'gitlab', - displayName: 'GitLab', - type: 'admin_source', - scopes: [], - })) +/** The viewer's own identity token, the subject every GitLab grant is checked against. */ +async function viewerToken(owner: ResourceOwner, userId: string): Promise { + const access = await createUserKnowledgeAccessProvider(userId, { + workspaceId: owner.workspaceId ?? undefined, + organizationId: owner.organizationId ?? undefined, + }).get() + return access.kind === 'user' ? access.tokens.find((value) => value.startsWith('u:')) : undefined +} + +function hasCsvPermissions(metadata: unknown): boolean { + try { + return readGitLabPermissionMetadata(metadata).mode === 'csv' + } catch { + return false + } +} + +/** The IDs of CSV-permission sources that grant the viewer no project. */ +async function ungrantedSources( + owner: ResourceOwner, + userId: string, + ids: string[] +): Promise> { + const csv = (await readConnectorPermissionMetadata(ids)) + .filter((row) => hasCsvPermissions(row.metadata)) + .map((row) => row.connectorId) + const own = csv.length ? await viewerToken(owner, userId) : undefined + if (!own) return new Set() + const granted = await connectorsGrantingSubject(csv, own) + return new Set(csv.filter((id) => !granted.has(id))) +} + +/** + * A source whose uploaded permissions grant the viewer nothing could never return a result, so it + * is left out rather than reported unavailable on every search. Sources that check permissions + * with GitLab, any whose stored permissions cannot be read, and every source when this check + * itself fails stay listed: their session decides. + */ +export async function listAdminGitLabAccounts( + owner: ResourceOwner, + userId: string +): Promise { + const rows = await sources(owner) + if (!rows.length) return [] + const hidden = await ungrantedSources( + owner, + userId, + rows.map((source) => source.id) + ).catch((error: unknown) => { + logger.warn('GitLab source grants could not be checked; listing every source', { + error: describeError(error), + }) + return new Set() + }) + return rows + .filter((source) => !hidden.has(source.id)) + .map((source) => ({ + id: `${PREFIX}${source.id}`, + provider: 'gitlab', + providerId: 'gitlab', + displayName: 'GitLab', + type: 'admin_source', + scopes: [], + })) +} + +/** Whether a live account ID names an administrator-managed GitLab source. */ +export function isAdminGitLabAccountId(accountId: string): boolean { + return accountId.startsWith(PREFIX) } export async function resolveAdminGitLabAccount(owner: ResourceOwner, account: LiveAccount) { const [source] = await sources(owner, account.id.slice(PREFIX.length)) - if (!account.id.startsWith(PREFIX) || !source?.encryptedApiKey) + if (!isAdminGitLabAccountId(account.id) || !source?.encryptedApiKey) throw new NativeSearchError( 'unavailable', 'Ask an organization admin to check the GitLab connection.' @@ -129,17 +193,7 @@ interface GitLabSessionInput { } export async function createAdminGitLabSession(input: GitLabSessionInput) { - const { owner, userId } = input - const access = await createUserKnowledgeAccessProvider(userId, { - workspaceId: owner.workspaceId ?? undefined, - organizationId: owner.organizationId ?? undefined, - }).get() - if (access.kind !== 'user') - throw new NativeSearchError( - 'unavailable', - 'GitLab search requires a verified organization identity.' - ) - const own = access.tokens.find((value) => value.startsWith('u:')) + const own = await viewerToken(input.owner, input.userId) if (!own) throw new NativeSearchError( 'unavailable', diff --git a/apps/sim/lib/sim-search/live/providers.test.ts b/apps/sim/lib/sim-search/live/providers.test.ts index c6bc58d8d76..fd4d8498fd2 100644 --- a/apps/sim/lib/sim-search/live/providers.test.ts +++ b/apps/sim/lib/sim-search/live/providers.test.ts @@ -195,6 +195,69 @@ describe('native search endpoints', () => { }) }) +describe('Slack file hits', () => { + const fileHits = async (files: Record[]) => { + const api = client() + api.json.mockResolvedValue({ ok: true, results: { files } }) + const { documents } = await searchSlack(api, { + ...input, + scopes: ['search:read.public', 'search:read.files'], + }) + return documents.map(({ content }) => content) + } + const hit = (fields: Record) => ({ + file_id: 'F1', + title: 'Q3 plan', + content: 'Q3 plan', + permalink: 'https://team.slack.com/files/U1/F1', + ...fields, + }) + + it('says what each file is and whether a read returns its text, instead of echoing its title', async () => { + expect( + await fileHits([ + hit({ file_type: 'application/pdf', size: 245760 }), + hit({ file_type: 'application/vnd.slack-docs' }), + hit({ file_type: 'text/csv; charset=utf-8' }), + hit({ file_type: 'image/png' }), + hit({ file_type: 'application/vnd.slack-list' }), + ]) + ).toEqual([ + 'PDF, 240 KB. Reading it returns its full text.', + 'Canvas. Reading it returns its full text.', + 'CSV. Reading it returns its full text.', + 'Image. Its contents cannot be read here; open the source.', + 'List. Its contents cannot be read here; open the source.', + ]) + }) + + it('keeps text Slack returns beyond the title and describes a file of unknown type plainly', async () => { + expect( + await fileHits([ + hit({ file_type: 'application/pdf', content: 'Revenue grew 12% in Q3' }), + hit({ content: '' }), + hit({ file_type: 'application/x-unknown', title: 'Plan v2.1 final', content: '' }), + ]) + ).toEqual([ + 'PDF. Reading it returns its full text.\nRevenue grew 12% in Q3', + 'File. Its contents cannot be read here; open the source.', + 'File. Its contents cannot be read here; open the source.', + ]) + }) + + it('offers no full text for a file above the read limit or an empty one', async () => { + expect( + await fileHits([ + hit({ file_type: 'application/pdf', size: 5 * 1024 * 1024 }), + hit({ file_type: 'text/plain', size: 0 }), + ]) + ).toEqual([ + 'PDF, 5 MB. Too large to read in full here; open the source.', + 'Text, 0 Bytes. The file is empty.', + ]) + }) +}) + describe('Slack RTS pages', () => { const scopes = ['search:read.public'] const slackPage = (first: number, count: number, nextCursor?: string) => ({ diff --git a/apps/sim/lib/sim-search/live/slack.ts b/apps/sim/lib/sim-search/live/slack.ts index c8502dd83f6..69b1b41a5cc 100644 --- a/apps/sim/lib/sim-search/live/slack.ts +++ b/apps/sim/lib/sim-search/live/slack.ts @@ -27,6 +27,9 @@ import type { NativePage, NativeSearchInput, } from '@/lib/sim-search/live/types' +import { formatFileSize } from '@/lib/uploads/utils/file' +import { normalizeMimeType } from '@/lib/uploads/utils/mime' +import { fileBrowserTypeLabel } from '@/lib/workspace-files/browser' /** Slack's own label for an account whose name is unavailable. */ const SLACK_MEMBER = 'Slack member' @@ -324,7 +327,7 @@ async function searchSlackPage( kind: 'file', title: string(file.title), url: string(file.permalink), - content: slackPlainText(string(file.content), users), + content: slackFileHitContent(file, users), author: string(file.author_name), ...(Number.isFinite(updated) && updated > 0 ? { modifiedAt: new Date(updated).toISOString() } @@ -352,7 +355,7 @@ type SlackFileFormat = 'html' | 'plain' | 'pdf' | 'docx' /** How a file's full text can be read, or undefined when Slack offers only its preview. */ function slackFileFormat(file: Record): SlackFileFormat | undefined { - const mimetype = string(file.mimetype).split(';')[0].trim().toLowerCase() + const mimetype = normalizeMimeType(string(file.mimetype)) if ( string(file.filetype) === 'quip' || mimetype === 'application/vnd.slack-docs' || @@ -363,6 +366,50 @@ function slackFileFormat(file: Record): SlackFileFormat | undef return documentExtension(mimetype) } +/** Whether a read downloads a file of this size; an unreported size is tried and capped while reading. */ +function withinDownloadLimit(format: SlackFileFormat, size: unknown): boolean { + return !(Number(size) > MAX_FILE_DOWNLOAD_BYTES[format]) +} + +const SLACK_FILE_LABELS: Readonly> = { + 'application/vnd.slack-docs': 'Canvas', + 'application/vnd.slack-list': 'List', +} + +/** The shared label for a known type; a title is not a filename, so it never supplies one. */ +function knownFileLabel(mimetype: string): string { + const label = fileBrowserTypeLabel(mimetype, '') + return label && label !== mimetype ? label : 'File' +} + +/** + * Slack search returns only a file's title, repeated as its content. A hit says what the file is + * and whether reading it returns its text, so a reader can tell which files to open. + */ +function slackFileHitContent(file: Record, users: Map): string { + const mimetype = normalizeMimeType(string(file.file_type)) + const summary = [ + SLACK_FILE_LABELS[mimetype] ?? knownFileLabel(mimetype), + typeof file.size === 'number' && file.size >= 0 + ? formatFileSize(file.size, { includeBytes: true }) + : '', + ] + .filter(Boolean) + .join(', ') + const format = slackFileFormat({ mimetype }) + const reading = !format + ? 'Its contents cannot be read here; open the source.' + : file.size === 0 + ? 'The file is empty.' + : withinDownloadLimit(format, file.size) + ? 'Reading it returns its full text.' + : 'Too large to read in full here; open the source.' + const text = slackPlainText(string(file.content), users) + return [`${summary}. ${reading}`, text === string(file.title) ? '' : text] + .filter(Boolean) + .join('\n') +} + const BYTE_ORDER_MARKS = [ [[0xef, 0xbb, 0xbf], 'utf-8'], [[0xff, 0xfe], 'utf-16le'], @@ -400,7 +447,7 @@ async function slackFileText( signal?: AbortSignal ): Promise<{ text: string } | { unavailable?: string }> { const format = slackFileFormat(file) - if (!format || Number(file.size) > MAX_FILE_DOWNLOAD_BYTES[format]) return {} + if (!format || !withinDownloadLimit(format, file.size)) return {} const source = slackFileDownloadUrl(file) if (!source) return {} const timeout = AbortSignal.timeout(FILE_DOWNLOAD_TIMEOUT_MS) From 263b3eb0884ca28d7d533a877ba17a8a95b2e63d Mon Sep 17 00:00:00 2001 From: Waleed Date: Mon, 16 Nov 2026 23:04:44 -0800 Subject: [PATCH 4/5] fix(search): say a Slack file hit can return its full text rather than promising it (#10123) --- apps/sim/lib/sim-search/live/README.md | 2 +- apps/sim/lib/sim-search/live/providers.test.ts | 10 +++++----- apps/sim/lib/sim-search/live/slack.ts | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/sim/lib/sim-search/live/README.md b/apps/sim/lib/sim-search/live/README.md index 89a0609580b..286729ced29 100644 --- a/apps/sim/lib/sim-search/live/README.md +++ b/apps/sim/lib/sim-search/live/README.md @@ -58,7 +58,7 @@ Each event must exist under the source's delegated token, be in an allowed calen ### Slack -Member mode only. Search uses the connected user's Slack real-time search grant and provider search syntax. Date bounds are sent as numeric provider timestamps; date ordering selects keyword retrieval and timestamp sort, because Slack semantic retrieval uses relevance ordering. Channels, messages, direct messages, and files are limited by that grant and provider scopes; there is no admin channel filter in member mode. Missing required search scopes produce a reconnect status. Thread/file reads use the same connected identity. Real-time Search returns only a file's title for a file hit, so the hit names the file's type and size and whether a read returns its text. A file read downloads the full text of a canvas (HTML), text snippet, PDF or DOCX from `files.slack.com` only, using `url_private_download` when present (Slack redirects a PDF's `url_private` to a viewer on another domain), never a remote file's own URL (redirects are followed only within that host; a hop elsewhere, such as a sign-in page, keeps the preview), within the shared response-size limit; when Slack will not serve it, the read returns the `files.info` preview. Real-time Search returns at most 20 results a call and counts every page against the member's rate limit, so a search across every source reads one page; a Slack-scoped or native Slack search follows the cursor for up to three pages to fill its limit, and a later page that fails keeps the earlier pages and returns the unread cursor. +Member mode only. Search uses the connected user's Slack real-time search grant and provider search syntax. Date bounds are sent as numeric provider timestamps; date ordering selects keyword retrieval and timestamp sort, because Slack semantic retrieval uses relevance ordering. Channels, messages, direct messages, and files are limited by that grant and provider scopes; there is no admin channel filter in member mode. Missing required search scopes produce a reconnect status. Thread/file reads use the same connected identity. Real-time Search returns only a file's title for a file hit, so the hit names the file's type and size and whether a read can return its text. A file read downloads the full text of a canvas (HTML), text snippet, PDF or DOCX from `files.slack.com` only, using `url_private_download` when present (Slack redirects a PDF's `url_private` to a viewer on another domain), never a remote file's own URL (redirects are followed only within that host; a hop elsewhere, such as a sign-in page, keeps the preview), within the shared response-size limit; when Slack will not serve it, the read returns the `files.info` preview. Real-time Search returns at most 20 results a call and counts every page against the member's rate limit, so a search across every source reads one page; a Slack-scoped or native Slack search follows the cursor for up to three pages to fill its limit, and a later page that fails keeps the earlier pages and returns the unread cursor. ### GitHub diff --git a/apps/sim/lib/sim-search/live/providers.test.ts b/apps/sim/lib/sim-search/live/providers.test.ts index fd4d8498fd2..027b25439e9 100644 --- a/apps/sim/lib/sim-search/live/providers.test.ts +++ b/apps/sim/lib/sim-search/live/providers.test.ts @@ -213,7 +213,7 @@ describe('Slack file hits', () => { ...fields, }) - it('says what each file is and whether a read returns its text, instead of echoing its title', async () => { + it('says what each file is and whether a read can return its text, instead of echoing its title', async () => { expect( await fileHits([ hit({ file_type: 'application/pdf', size: 245760 }), @@ -223,9 +223,9 @@ describe('Slack file hits', () => { hit({ file_type: 'application/vnd.slack-list' }), ]) ).toEqual([ - 'PDF, 240 KB. Reading it returns its full text.', - 'Canvas. Reading it returns its full text.', - 'CSV. Reading it returns its full text.', + 'PDF, 240 KB. Reading it can return its full text.', + 'Canvas. Reading it can return its full text.', + 'CSV. Reading it can return its full text.', 'Image. Its contents cannot be read here; open the source.', 'List. Its contents cannot be read here; open the source.', ]) @@ -239,7 +239,7 @@ describe('Slack file hits', () => { hit({ file_type: 'application/x-unknown', title: 'Plan v2.1 final', content: '' }), ]) ).toEqual([ - 'PDF. Reading it returns its full text.\nRevenue grew 12% in Q3', + 'PDF. Reading it can return its full text.\nRevenue grew 12% in Q3', 'File. Its contents cannot be read here; open the source.', 'File. Its contents cannot be read here; open the source.', ]) diff --git a/apps/sim/lib/sim-search/live/slack.ts b/apps/sim/lib/sim-search/live/slack.ts index 69b1b41a5cc..e72f6c0c56d 100644 --- a/apps/sim/lib/sim-search/live/slack.ts +++ b/apps/sim/lib/sim-search/live/slack.ts @@ -384,7 +384,7 @@ function knownFileLabel(mimetype: string): string { /** * Slack search returns only a file's title, repeated as its content. A hit says what the file is - * and whether reading it returns its text, so a reader can tell which files to open. + * and whether reading it can return its text, so a reader can tell which files to open. */ function slackFileHitContent(file: Record, users: Map): string { const mimetype = normalizeMimeType(string(file.file_type)) @@ -402,7 +402,7 @@ function slackFileHitContent(file: Record, users: Map Date: Mon, 16 Nov 2026 23:06:18 -0800 Subject: [PATCH 5/5] improvement(comparisons): add langchain migration steps and human approval channels (#10124) --- apps/sim/app/(landing)/comparisons/utils.ts | 2 +- apps/sim/lib/compare/data/competitors/langchain.ts | 2 ++ apps/sim/lib/compare/data/sim.ts | 4 ++-- apps/sim/lib/compare/data/types.ts | 5 +++++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/sim/app/(landing)/comparisons/utils.ts b/apps/sim/app/(landing)/comparisons/utils.ts index 73be8869189..7fa3fc55078 100644 --- a/apps/sim/app/(landing)/comparisons/utils.ts +++ b/apps/sim/app/(landing)/comparisons/utils.ts @@ -164,7 +164,7 @@ export function buildComparisonFaqs(competitor: CompetitorProfile): ComparisonFa }, { question: `Can I migrate from ${name} to Sim?`, - answer: `There is no automated one-click migration tool between ${name} and Sim. Workflows and automations need to be rebuilt in Sim's visual builder, natural-language Chat surface, or API. Most teams start by recreating their highest-value automation first to validate the switch before migrating the rest.`, + answer: `There is no automated one-click migration tool between ${name} and Sim. Workflows and automations need to be rebuilt in Sim's visual builder, natural-language Chat surface, or API. Most teams start by recreating their highest-value automation first to validate the switch before migrating the rest.${competitor.migrationSteps ? ` ${competitor.migrationSteps}` : ''}`, }, ] diff --git a/apps/sim/lib/compare/data/competitors/langchain.ts b/apps/sim/lib/compare/data/competitors/langchain.ts index a46cbcbe1f7..41ba610512e 100644 --- a/apps/sim/lib/compare/data/competitors/langchain.ts +++ b/apps/sim/lib/compare/data/competitors/langchain.ts @@ -8,6 +8,8 @@ export const langchainProfile: CompetitorProfile = { mentions: ['LangChain', 'LangGraph'], website: 'https://www.langchain.com', isWorkflowBuilder: false, + migrationSteps: + 'Start with one representative agent. Write down its inputs, model calls, tools, and decision points. Map the chain or agent logic into a Sim workflow, then compare its output with the existing prototype. Add a Human in the Loop block wherever a person must approve an action, use run logs to inspect each step, and choose Sim cloud or self-hosting once the workflow behaves as expected.', brand: { icon: LangChainIcon, selfFramed: false, diff --git a/apps/sim/lib/compare/data/sim.ts b/apps/sim/lib/compare/data/sim.ts index b685f1f627b..6e7fecfaca6 100644 --- a/apps/sim/lib/compare/data/sim.ts +++ b/apps/sim/lib/compare/data/sim.ts @@ -472,14 +472,14 @@ export const simProfile: CompetitorProfile = { }, humanInTheLoop: { value: - 'Yes: dedicated approval block that pauses a run and waits for a human-submitted "Resume Form," with durable pause/resume via persisted execution snapshots and notification hooks (e.g. Slack, email) carrying the resume link', + 'Yes: dedicated approval block that pauses a run and waits for a human-submitted "Resume Form," with durable pause/resume via persisted execution snapshots. Reviewers can be notified through Slack, Gmail, Microsoft Teams, Twilio SMS, or a webhook carrying the approval link, and approve in the Sim approval portal or through the resume API, after which the run continues', shortValue: 'Approval block with durable pause/resume and notifications', confidence: 'verified', sources: [ { url: 'https://docs.sim.ai/workflows/blocks/human-in-the-loop', label: 'Sim Docs: Human in the Loop Block', - asOf: '2026-07-02', + asOf: '2026-11-16', }, { url: 'https://github.com/simstudioai/sim/blob/main/apps/sim/executor/execution/snapshot.ts', diff --git a/apps/sim/lib/compare/data/types.ts b/apps/sim/lib/compare/data/types.ts index 68e82d57727..ababdb63161 100644 --- a/apps/sim/lib/compare/data/types.ts +++ b/apps/sim/lib/compare/data/types.ts @@ -305,6 +305,11 @@ export interface CompetitorProfile { * products so it can be quoted on its own. */ faqs?: Array<{ question: string; answer: string }> + /** + * Concrete evaluation steps appended to the generated "Can I migrate from {name} to Sim?" + * answer, for a competitor whose teams switch by rebuilding a prototype rather than importing it. + */ + migrationSteps?: string /** * Replaces the generated `Sim vs {name} | Sim, the AI Workspace` search title, at most 60 * characters. Set it when buyers search this competitor for one time-sensitive reason, such