Skip to content

Commit 4a60d17

Browse files
committed
docs(github): record why an absent operation degrades to a no-op
1 parent 99badc4 commit 4a60d17

2 files changed

Lines changed: 35 additions & 1 deletion

File tree

‎apps/sim/blocks/blocks/github.param-wiring.test.ts‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,3 +219,27 @@ describe('a stale advanced field cannot leak onto another operation', () => {
219219
}
220220
})
221221
})
222+
223+
/**
224+
* `providers/utils.ts` builds the provider `paramsTransform` input from
225+
* `block.params` alone (`:776`), spreading `operation` in only for the
226+
* tool-selection call (`:736-739`). Without an operation every alias skips —
227+
* which must remain a no-op rather than a clobber, since that is exactly the
228+
* behaviour that existed before this mapper.
229+
*/
230+
describe('absent operation degrades to a no-op, never a clobber', () => {
231+
it.each([{}, { operation: undefined }, { operation: '' }, { operation: 123 }])(
232+
'emits nothing for %o',
233+
(opShape) => {
234+
expect(
235+
map({ ...opShape, milestone_title: 'x', reaction_content: 'heart', gist_public: 'true' })
236+
).toEqual({})
237+
}
238+
)
239+
240+
it('leaves every model-supplied value intact', () => {
241+
const modelArgs = { content: 'rocket', title: 'model title', sort: 'newest', public: true }
242+
const stale = { milestone_title: 'stale', fork_sort: 'oldest', gist_public: 'false' }
243+
expect({ ...modelArgs, ...map({ ...modelArgs, ...stale }) }).toEqual(modelArgs)
244+
})
245+
})

‎apps/sim/blocks/blocks/github.ts‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2342,7 +2342,17 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
23422342
* `providers/utils.ts` installs this as the provider `paramsTransform`,
23432343
* spreading over the model's tool-call arguments — so emitting a key the
23442344
* block did not supply would clobber a model-supplied value on the agent
2345-
* path, which is the one path these fields work on today.
2345+
* path.
2346+
*
2347+
* On the agent tool-calling path `operation` is not part of the params
2348+
* this receives: `providers/utils.ts` spreads it in for the tool-selection
2349+
* call (`:736-739`) but builds the transform's input from `block.params`
2350+
* alone (`:776`). Every alias therefore skips there, which is the same
2351+
* behaviour as before this mapper existed - the agent path already works
2352+
* because a model supplies `content`/`title`/`sort` by their real names.
2353+
* That gap is shared by every block whose mapper branches on
2354+
* `params.operation`, so closing it belongs in the provider layer rather
2355+
* than here.
23462356
*/
23472357
params: (params) => {
23482358
const result: Record<string, unknown> = {}

0 commit comments

Comments
 (0)