Skip to content

Commit b9aeda4

Browse files
committed
fix(files): name folders in a workflow diff, and bound depth at the block
Two more from cubic, both correct. The workflow diff rendered every folder change as the same generic label. Adding sim-folder-tree-selector to SELECTOR_TYPES_HYDRATION_REQUIRED without a resolver makes each consumer of that list fall back to a semantic placeholder — the canvas card showed "-" for the same reason, which I fixed there and not here. The comparison path now calls the same resolveFolderPathLabel, so a diff between two folders shows which two. Max Depth and Limit were bounded only at the contract, so an out-of-range value was accepted while configuring and failed on the first run. They now carry the same ceilings in the block, where the mistake is made.
1 parent 35198ea commit b9aeda4

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

‎apps/sim/blocks/blocks/file.ts‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import { createLogger } from '@sim/logger'
22
import { DocumentIcon } from '@/components/icons'
3-
import { encodeFolderPathSegment, ROOT_FOLDER_PATH } from '@/lib/folders/paths'
3+
import { MAX_FILE_LIST_LIMIT } from '@/lib/api/contracts/tools/file'
4+
import {
5+
encodeFolderPathSegment,
6+
MAX_FOLDER_PATH_SEGMENTS,
7+
ROOT_FOLDER_PATH,
8+
} from '@/lib/folders/paths'
49
import { inferContextFromKey } from '@/lib/uploads/utils/file-utils'
510
import { readFolderPath } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/sim-folder-tree-selector/selection'
611
import type { BlockConfig, SubBlockType } from '@/blocks/types'
@@ -1656,14 +1661,18 @@ export const FileV5Block: BlockConfig<FileParserV3Output> = {
16561661
return {
16571662
path: optionalText(params.folderRef),
16581663
recursive: switchValue(params.folderRecursive),
1664+
/* Bounded here as well as at the contract, so a typo fails while
1665+
configuring rather than on the first run. */
16591666
depth: parseOptionalNumberInput(params.folderDepth, 'Max Depth', {
16601667
integer: true,
16611668
min: 1,
1669+
max: MAX_FOLDER_PATH_SEGMENTS,
16621670
}),
16631671
search: optionalText(params.folderSearch),
16641672
limit: parseOptionalNumberInput(params.folderLimit, 'Limit', {
16651673
integer: true,
16661674
min: 1,
1675+
max: MAX_FILE_LIST_LIMIT,
16671676
}),
16681677
workspaceId: params._context?.workspaceId,
16691678
}

‎apps/sim/lib/workflows/comparison/resolve-values.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { buildSelectorRawContext, projectSelectorContext } from '@/lib/selectors
88
import { getSelectorManifestEntry, type SelectorKey } from '@/lib/selectors/manifest'
99
import type { SelectorContext, SelectorScope } from '@/lib/selectors/types'
1010
import { getDependsOnFields } from '@/lib/workflows/subblocks/dependencies'
11+
import { resolveFolderPathLabel } from '@/lib/workflows/subblocks/display'
1112
import { getBlock } from '@/blocks/registry'
1213
import { SELECTOR_TYPES_HYDRATION_REQUIRED, type SubBlockConfig } from '@/blocks/types'
1314
import { isUuid } from '@/executor/constants'
@@ -263,6 +264,17 @@ export async function resolveValueForDisplay(
263264
}
264265
}
265266

267+
/*
268+
* A folder picker is in the hydration list but has no selector manifest entry,
269+
* so without this it falls through to the generic semantic fallback and a diff
270+
* renders both the old and the new path as the same word — hiding the change
271+
* it exists to show. Same resolver the canvas card uses, so the two agree.
272+
*/
273+
const folderPathLabel = resolveFolderPathLabel(subBlockConfig, value)
274+
if (folderPathLabel) {
275+
return { original: value, displayLabel: folderPathLabel, resolved: true }
276+
}
277+
266278
if (SELECTOR_TYPES_HYDRATION_REQUIRED.includes(subBlockConfig.type)) {
267279
const selectorKey = subBlockConfig.selectorKey
268280
const scope: SelectorScope | undefined = context.workflowId

0 commit comments

Comments
 (0)