Skip to content

Commit aefd69d

Browse files
committed
fix(google-vault): isolate stale-value-prone subblocks per operation
Cursor Bugbot: consolidating shared subblocks across operations left two cross-contamination risks since a stale value from one operation stays in block state until overwritten: - accountEmails/orgUnitId are checked emails-first with silent either/or priority; sharing them across update_matters_holds and create_saved_query meant a leftover value from a different operation could silently override the intended scope. Gave both operations dedicated fields (updateHoldAccountEmails/updateHoldOrgUnitId, savedQueryAccountEmails/ savedQueryOrgUnitId), remapped in tools.config.params. - matterId presence alone switches google_vault_list_matters between list-all and single-get. Sharing it with every other operation meant a leftover matterId could silently turn "List Matters" into a single-matter fetch. Gave list_matters its own optional listMatterId field. create_matters_holds/create_matters_export keep sharing accountEmails/ orgUnitId as before this PR (pre-existing behavior, not introduced here).
1 parent 89021f5 commit aefd69d

1 file changed

Lines changed: 78 additions & 13 deletions

File tree

apps/sim/blocks/blocks/google_vault.ts

Lines changed: 78 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ export const GoogleVaultBlock: BlockConfig = {
8888
'delete_matters_holds',
8989
'add_held_accounts',
9090
'remove_held_accounts',
91-
'list_matters',
9291
'update_matters',
9392
'close_matters',
9493
'reopen_matters',
@@ -127,6 +126,16 @@ export const GoogleVaultBlock: BlockConfig = {
127126
],
128127
}),
129128
},
129+
// Dedicated optional matter-id filter for list_matters — kept separate from the
130+
// required matterId above so a value left over from another operation can never
131+
// silently turn "List Matters" into a single-matter get.
132+
{
133+
id: 'listMatterId',
134+
title: 'Matter ID',
135+
type: 'short-input',
136+
placeholder: 'Enter Matter ID (optional to fetch a specific matter)',
137+
condition: { field: 'operation', value: 'list_matters' },
138+
},
130139
// Download Export File inputs
131140
{
132141
id: 'bucketName',
@@ -228,12 +237,7 @@ Return ONLY the hold name - no explanations, no quotes, no extra text.`,
228237
placeholder: 'Comma-separated emails (alternative to Org Unit)',
229238
condition: {
230239
field: 'operation',
231-
value: [
232-
'create_matters_holds',
233-
'update_matters_holds',
234-
'create_matters_export',
235-
'create_saved_query',
236-
],
240+
value: ['create_matters_holds', 'create_matters_export'],
237241
},
238242
},
239243
{
@@ -243,14 +247,42 @@ Return ONLY the hold name - no explanations, no quotes, no extra text.`,
243247
placeholder: 'Org Unit ID (alternative to emails)',
244248
condition: {
245249
field: 'operation',
246-
value: [
247-
'create_matters_holds',
248-
'update_matters_holds',
249-
'create_matters_export',
250-
'create_saved_query',
251-
],
250+
value: ['create_matters_holds', 'create_matters_export'],
252251
},
253252
},
253+
// Dedicated scope fields for update_matters_holds and create_saved_query — kept
254+
// separate from the create_matters_holds/create_matters_export accountEmails/orgUnitId
255+
// above so a stale value left over from a different operation can never silently win
256+
// in the accountEmails-before-orgUnitId scope priority (each field is only ever
257+
// populated by the user while its own operation is selected).
258+
{
259+
id: 'updateHoldAccountEmails',
260+
title: 'Account Emails',
261+
type: 'long-input',
262+
placeholder: 'Comma-separated emails (alternative to Org Unit)',
263+
condition: { field: 'operation', value: 'update_matters_holds' },
264+
},
265+
{
266+
id: 'updateHoldOrgUnitId',
267+
title: 'Org Unit ID',
268+
type: 'short-input',
269+
placeholder: 'Org Unit ID (alternative to emails)',
270+
condition: { field: 'operation', value: 'update_matters_holds' },
271+
},
272+
{
273+
id: 'savedQueryAccountEmails',
274+
title: 'Account Emails',
275+
type: 'long-input',
276+
placeholder: 'Comma-separated emails (alternative to Org Unit)',
277+
condition: { field: 'operation', value: 'create_saved_query' },
278+
},
279+
{
280+
id: 'savedQueryOrgUnitId',
281+
title: 'Org Unit ID',
282+
type: 'short-input',
283+
placeholder: 'Org Unit ID (alternative to emails)',
284+
condition: { field: 'operation', value: 'create_saved_query' },
285+
},
254286
// Date filtering for exports (works with all corpus types)
255287
{
256288
id: 'startTime',
@@ -665,6 +697,11 @@ Return ONLY the description text - no explanations, no quotes, no extra text.`,
665697
holdTerms,
666698
heldAccountEmails,
667699
heldAccountIds,
700+
listMatterId,
701+
updateHoldAccountEmails,
702+
updateHoldOrgUnitId,
703+
savedQueryAccountEmails,
704+
savedQueryOrgUnitId,
668705
...rest
669706
} = params
670707
return {
@@ -676,6 +713,13 @@ Return ONLY the description text - no explanations, no quotes, no extra text.`,
676713
...(holdTerms && { terms: holdTerms }),
677714
...(heldAccountEmails && { accountEmails: heldAccountEmails }),
678715
...(heldAccountIds && { accountIds: heldAccountIds }),
716+
// Map operation-scoped fields (kept separate in the UI so a stale value from
717+
// another operation can never silently override these) to their tool parameter names
718+
...(listMatterId && { matterId: listMatterId }),
719+
...(updateHoldAccountEmails && { accountEmails: updateHoldAccountEmails }),
720+
...(updateHoldOrgUnitId && { orgUnitId: updateHoldOrgUnitId }),
721+
...(savedQueryAccountEmails && { accountEmails: savedQueryAccountEmails }),
722+
...(savedQueryOrgUnitId && { orgUnitId: savedQueryOrgUnitId }),
679723
}
680724
},
681725
},
@@ -745,6 +789,27 @@ Return ONLY the description text - no explanations, no quotes, no extra text.`,
745789
// Saved query inputs
746790
displayName: { type: 'string', description: 'Name for the saved query' },
747791
savedQueryId: { type: 'string', description: 'Specific saved query ID to fetch or delete' },
792+
793+
// Operation-scoped fields kept separate from their shared counterparts above so a
794+
// stale value from another operation can never silently carry over
795+
listMatterId: { type: 'string', description: 'Specific matter ID to fetch (list_matters)' },
796+
updateHoldAccountEmails: {
797+
type: 'string',
798+
description: 'Comma-separated emails covered by the hold (update_matters_holds)',
799+
},
800+
updateHoldOrgUnitId: {
801+
type: 'string',
802+
description: 'Org unit ID covered by the hold (update_matters_holds, alternative to emails)',
803+
},
804+
savedQueryAccountEmails: {
805+
type: 'string',
806+
description: 'Comma-separated emails to scope the saved query (create_saved_query)',
807+
},
808+
savedQueryOrgUnitId: {
809+
type: 'string',
810+
description:
811+
'Org unit ID to scope the saved query (create_saved_query, alternative to emails)',
812+
},
748813
},
749814
outputs: {
750815
matters: {

0 commit comments

Comments
 (0)