Skip to content

Commit 770e103

Browse files
committed
chore: trim restating comments and a dead coalesce
Cleanup-pass findings on this branch's own lines: comments that restated the code they sat on, a four-line note whose sibling said the same in one, and a `?? undefined` on a non-nullable value. The comment on the tool-picker filter now explains the clause that actually needed it (an empty option list is not a denied one) instead of narrating the filter. Left alone as pre-existing and out of scope: the inline `staleTime` literal in `useAllowedIntegrationsFromEnv`, and the Operation selector's raw label / plain `Combobox` — both byte-identical to staging and matching the convention of every sibling field in that panel.
1 parent 97fd577 commit 770e103

4 files changed

Lines changed: 5 additions & 17 deletions

File tree

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/tool-input.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -694,9 +694,8 @@ export const ToolInput = memo(function ToolInput({
694694
const customBlockOverlayVersion = useCustomBlockOverlayVersion()
695695
const toolBlocks = useMemo(() => {
696696
const allToolBlocks = getAllBlocks().filter(isAgentToolBlock)
697-
/* A multi-operation block whose every operation is denied has nothing the
698-
caller can run, so it leaves the picker alongside the blocks denied
699-
outright by `filterBlocks`. */
697+
/* An empty option list means the block declares no selectable operation, so
698+
there is nothing to gate — only a wholly denied one leaves the picker. */
700699
return filterBlocks(allToolBlocks).filter((block) => {
701700
if (!hasMultipleOperations(block)) return true
702701
const { options, denied } = getOperationChoices(block)
@@ -818,7 +817,7 @@ export const ToolInput = memo(function ToolInput({
818817
if (isPreview || disabled) return
819818

820819
const { options, denied } = hasMultipleOperations(toolBlock)
821-
? getOperationChoices(toolBlock ?? undefined)
820+
? getOperationChoices(toolBlock)
822821
: { options: [], denied: NO_DENIED_OPERATIONS }
823822
const defaultOperation = options.find((option) => !denied.has(option.id))?.id
824823

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -895,11 +895,6 @@ const WorkflowContent = React.memo(
895895
if (parentId) blockData.parentId = parentId
896896
if (extent) blockData.extent = extent
897897

898-
/**
899-
* `undefined` until the permission config has resolved, so a declared
900-
* default is never vetoed — or let through — on a guess. Blocks pre-fill
901-
* two fields the group can restrict; both go through the same gate.
902-
*/
903898
const operationGate = resolveOperationGate(getBlock(type))
904899
const seedGate = operationGate
905900
? (subBlockId: string, value: string) => {

apps/sim/hooks/use-permission-config.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,7 @@ export function usePermissionConfig(): PermissionConfigResult {
145145
}
146146
}, [isModelAllowed, isProviderAllowed])
147147

148-
/**
149-
* Indexed rather than scanned: the operation gate calls this once per option
150-
* of every block it offers, so a linear scan made the cost of a check scale
151-
* with the length of the denylist.
152-
*/
148+
/** Indexed so the per-tool check stays O(1) over a long denylist. */
153149
const deniedToolSet = useMemo(() => new Set(config.deniedTools), [config.deniedTools])
154150

155151
const isToolAllowed = useMemo(() => {

apps/sim/lib/permission-groups/operation-access.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import type { BlockConfig } from '@/blocks/types'
1010
*/
1111
export const OPERATION_SUBBLOCK_ID = 'operation'
1212

13-
/** The subblock id that carries a block's model. */
1413
export const MODEL_SUBBLOCK_ID = 'model'
1514

1615
/** Shared empty result, so a caller's memo sees a stable identity. */
@@ -56,8 +55,7 @@ export function resolveOperationToolId(
5655
const toolId = selectTool({ operation: operationId })
5756
if (toolId) return toolId
5857
} catch {
59-
/* Falls through rather than guessing a tool for an operation the
60-
selector could not resolve on its own. */
58+
/* Unresolvable from the operation alone; see the TSDoc above. */
6159
}
6260
}
6361

0 commit comments

Comments
 (0)