Skip to content

Commit bd119a6

Browse files
icecrasher321claude
andcommitted
fix(mistral): align MistralParseV3Block on the tool's file parameter
`check-block-registry.ts` requires every required `user-only` tool parameter to have a subBlock whose `id` or `canonicalParamId` matches it, because the serializer resolves those by direct lookup and a mismatch false-flags the field as missing at submit time. V3's subBlocks carried `canonicalParamId: 'document'` against a tool parameter named `file`, bridged by the block's params mapper. Aligning them needs no migration. Saved state is keyed by subBlock id (`fileUpload`, `fileReference`), which is unchanged; `canonicalParamId` is a config-derived index rather than a storage key. `data.canonicalModes` is keyed by canonical id, but `backfillCanonicalModes` re-derives a missing entry from whichever value is populated, so a workflow using the advanced file-reference field still resolves to `advanced` on open. V2 keeps `document`: only V3's `file` parameter is `required`, so only V3 is under the contract. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 85cec3a commit bd119a6

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

apps/sim/blocks/blocks/mistral_parse.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ export const MistralParseV3Block: BlockConfig<MistralParserOutput> = {
330330
id: 'fileUpload',
331331
title: 'PDF Document',
332332
type: 'file-upload' as SubBlockType,
333-
canonicalParamId: 'document',
333+
canonicalParamId: 'file',
334334
acceptedTypes: 'application/pdf',
335335
placeholder: 'Upload a PDF document',
336336
mode: 'basic',
@@ -341,7 +341,7 @@ export const MistralParseV3Block: BlockConfig<MistralParserOutput> = {
341341
id: 'fileReference',
342342
title: 'File Reference',
343343
type: 'short-input' as SubBlockType,
344-
canonicalParamId: 'document',
344+
canonicalParamId: 'file',
345345
placeholder: 'File reference from previous block',
346346
mode: 'advanced',
347347
required: true,
@@ -386,7 +386,7 @@ export const MistralParseV3Block: BlockConfig<MistralParserOutput> = {
386386
}
387387

388388
// V3 pattern: use canonical document param directly
389-
const documentInput = normalizeFileInput(params.document, { single: true })
389+
const documentInput = normalizeFileInput(params.file, { single: true })
390390
if (!documentInput) {
391391
throw new Error('PDF document is required')
392392
}
@@ -425,7 +425,7 @@ export const MistralParseV3Block: BlockConfig<MistralParserOutput> = {
425425
},
426426
},
427427
inputs: {
428-
document: { type: 'json', description: 'Document input (file upload or file reference)' },
428+
file: { type: 'json', description: 'Document input (file upload or file reference)' },
429429
apiKey: { type: 'string', description: 'Mistral API key' },
430430
resultType: { type: 'string', description: 'Output format type' },
431431
pages: { type: 'string', description: 'Page selection' },

scripts/check-tool-param-reachability.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@
3535
* merge validation still sees a value — and a direct caller sends the object
3636
* itself.
3737
*
38+
* Choosing `user-only` carries an obligation: `check-block-registry.ts` requires
39+
* every required `user-only` parameter to have a subBlock whose `id` or
40+
* `canonicalParamId` equals the parameter id, because the serializer resolves it
41+
* by direct lookup. A block whose canonical key differs has to be aligned on the
42+
* parameter id — safe to do, because canonical ids are config-derived rather
43+
* than stored, and `backfillCanonicalModes` re-derives a renamed pair's mode
44+
* from whichever value is populated.
45+
*
3846
* There is deliberately no allowlist. All three answers leave the parameter
3947
* reachable, so a parameter needing an exemption is one no caller can supply —
4048
* exactly what this audit exists to reject.

0 commit comments

Comments
 (0)