Skip to content

Commit 4e66d27

Browse files
committed
fix(release): zero-padded placeholder numbers, single-member output-schema unions, surface-neutral code-write hint
- The placeholder number scan matches a zero-padded run (0900000003) again, as the digit-run scan it replaced did. - An output schema field declared as a single-member anyOf/oneOf reads as that member instead of untyped, so dry-run samples keep it. - A dry run's code-write failure says which block to allow instead of naming a CLI flag that tests, the API and Copilot do not take.
1 parent 81ea2f9 commit 4e66d27

6 files changed

Lines changed: 22 additions & 7 deletions

File tree

‎apps/sim/lib/mcp/output-schema.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,15 @@ function reduceNode(node: unknown, depth: number, budget: { nodes: number }): Mc
107107
}
108108
}
109109

110-
/** `anyOf: [X, {type: 'null'}]`, the common encoding of an optional field, reads as X. */
110+
/**
111+
* `anyOf: [X, {type: 'null'}]`, the common encoding of an optional field, reads as X, as does a
112+
* union of X alone.
113+
*/
111114
function singleNonNullVariant(node: Record<string, unknown>): unknown {
112115
const variants = Array.isArray(node.anyOf) ? node.anyOf : node.oneOf
113116
if (!Array.isArray(variants)) return undefined
114117
const nonNull = variants.filter((variant) => !(isRecordLike(variant) && variant.type === 'null'))
115-
return nonNull.length === 1 && nonNull.length < variants.length ? nonNull[0] : undefined
118+
return nonNull.length === 1 ? nonNull[0] : undefined
116119
}
117120

118121
function declaredType(node: Record<string, unknown>): string | undefined {

‎apps/sim/lib/workflows/application/dry-run.integration.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2285,7 +2285,9 @@ return created.id.toString()`
22852285

22862286
expect(result.status).toBe('failed')
22872287
expect(JSON.stringify(result.error)).toContain(
2288-
"1 network write this code made got an empty stubbed response; --allow 'code' sends them"
2288+
JSON.stringify(
2289+
'1 network write this code made got an empty stubbed response; allowing block "code" sends them'
2290+
).slice(1, -1)
22892291
)
22902292
})
22912293

‎apps/sim/lib/workflows/dry-run/placeholders.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ describe('a dry run’s placeholder tokens', () => {
2626
['quoted in free text', 'Re: dry_run_title_2'],
2727
['as a number', 900_000_003],
2828
['as digits in a URL', 'https://api.github.com/repos/o/r/issues/900000003'],
29+
['as zero-padded digits', 'ticket 0900000003'],
2930
])('are found %s', (_, sent) => {
3031
expect(registered().occursIn({ sent })).toBe(true)
3132
})

‎apps/sim/lib/workflows/dry-run/placeholders.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@ const TOKEN_RUN = /^[a-z0-9_]+/
2020
const TOKEN_END = /_\d+/g
2121
/** Digits a placeholder number has: every one is above {@link DRY_RUN_NUMBER_BASE}. */
2222
const PLACEHOLDER_NUMBER_DIGITS = String(DRY_RUN_NUMBER_BASE).length
23-
/** A whole run of exactly that many digits, so a long string is scanned without listing every run. */
24-
const PLACEHOLDER_NUMBER_RUN = new RegExp(`(?<!\\d)\\d{${PLACEHOLDER_NUMBER_DIGITS}}(?!\\d)`, 'g')
23+
/**
24+
* A whole run of that many digits, zero-padded or not (`0900000003` is still the number), so a long
25+
* string is scanned without listing every run of digits it holds.
26+
*/
27+
const PLACEHOLDER_NUMBER_RUN = new RegExp(`(?<!\\d)0*\\d{${PLACEHOLDER_NUMBER_DIGITS}}(?!\\d)`, 'g')
2528
/** Longest token a scan reads at one `dry_run_`. */
2629
const MAX_TOKEN_LENGTH = 256
2730

‎apps/sim/tools/index.test.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7550,6 +7550,7 @@ describe('MCP Tool Execution', () => {
75507550
total: { type: 'integer' },
75517551
label: { type: ['null', 'string'] },
75527552
owner: { anyOf: [{ type: 'null' }, { type: 'string' }] },
7553+
alias: { oneOf: [{ type: 'string' }] },
75537554
untyped: {},
75547555
},
75557556
},
@@ -7569,7 +7570,12 @@ describe('MCP Tool Execution', () => {
75697570
)
75707571

75717572
expect(held.output).toEqual({
7572-
structuredContent: { total: 900_000_001, label: 'dry_run_label_1', owner: 'dry_run_owner_1' },
7573+
structuredContent: {
7574+
total: 900_000_001,
7575+
label: 'dry_run_label_1',
7576+
owner: 'dry_run_owner_1',
7577+
alias: 'dry_run_alias_1',
7578+
},
75737579
})
75747580
expect(dryRun.summary().stubbed).toMatchObject([
75757581
{ tool: 'mcp-123-count_files', reason: 'mcp-read-only' },

‎apps/sim/tools/side-effects.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,6 @@ export function codeNetworkFor(input: {
581581
failureHint: () =>
582582
stubbed === 0 || !site.blockName
583583
? null
584-
: `Dry run: ${stubbed} network write${stubbed === 1 ? '' : 's'} this code made got an empty stubbed response; --allow '${site.blockName}' sends them.`,
584+
: `Dry run: ${stubbed} network write${stubbed === 1 ? '' : 's'} this code made got an empty stubbed response; allowing block ${JSON.stringify(site.blockName)} sends them.`,
585585
}
586586
}

0 commit comments

Comments
 (0)