Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/sim/lib/copilot/chat/process-contents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import type { ColumnDefinition } from '@/lib/table/types'
import { workflowDelegationPolicy } from '@/lib/workflows/application/authorization'
import { readWorkflowMetadata } from '@/lib/workflows/application/read-workflow'
import { readWorkspaceFileMetadata } from '@/lib/workspace-files/application/read-workspace-file-metadata'
import { getBlockRegistry } from '@/blocks/registry'
Comment thread
waleedlatif1 marked this conversation as resolved.
import { escapeRegExp } from '@/executor/constants'
import type { ResolvedSecretTraceRegistry } from '@/executor/utils/resolved-secret-trace-registry'
import type { BrowserTextSelection, ChatContext, TerminalTextSelection } from '@/stores/panel'
Expand Down Expand Up @@ -582,7 +583,6 @@ async function processBlockMetadata(
return null
}

const { getBlockRegistry } = await import('@/blocks/registry')
const blockRegistry = getBlockRegistry()
if (!blockRegistry[blockId]) {
return null
Expand Down
15 changes: 7 additions & 8 deletions scripts/check-application-graph.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,22 +122,21 @@ describe('a deferred edge into a forbidden tree', () => {
it('is reported when a root defers the load of a forbidden module', () => {
/**
* Walked from a module that defers the block registry — `const
* { getBlockRegistry } = await import('@/blocks/registry')` — and nothing
* else about it matters here. Before the deferred pass this root was green
* on `blocks/`, which is the whole evasion in one line.
* { getBlockRegistry } = await import('@/blocks/registry')`. A root's own
* deferred edges are checked before its static imports, so the reported chain
* is that single deferred hop, whatever else the root reaches.
*/
const root =
'app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/hooks/use-mention-data.ts'
const violations = findViolations({
root: 'lib/copilot/chat/process-contents.ts',
root,
forbidden: { 'blocks/': FORBIDDEN_PREFIXES['blocks/'] },
})

expect(violations).toHaveLength(1)
expect(violations[0].forbidden).toBe('blocks/registry.ts')
expect(violations[0].reason).toContain('deferred')
expect(violations[0].path).toEqual([
'lib/copilot/chat/process-contents.ts',
'blocks/registry.ts',
])
expect(violations[0].path).toEqual([root, 'blocks/registry.ts'])
})

/**
Expand Down
Loading