Repository navigation
fix(integrations): address release review findings on the integration sweep #10039
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+631
−367
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
1bfb23f
fix(integrations): validate Asana limits, Intercom snooze times, and …
waleedlatif1 18c2ea8
fix(integrations): resolve the tool-call operation in the QuickBooks,…
waleedlatif1 d0715d2
refactor(integrations): share the Intercom params mapper, reuse the b…
waleedlatif1 82792b3
fix(mailchimp): leave the email type option unchanged when its stored…
waleedlatif1 0ff6ce7
fix(integrations): seed the Mailchimp email type option per operation…
waleedlatif1 9c97d3b
fix(integrations): seed the Mailchimp email type option from the oper…
waleedlatif1 541acc1
fix(mailchimp): seed the email type option per operation, keep Keep c…
waleedlatif1 6a58f81
fix(integrations): lead the Intercom role and Pipedrive deal status w…
waleedlatif1 a529562
fix(integrations): parse the Mailchimp update email type option like …
waleedlatif1 39b9358
fix(asana): treat a whitespace-only limit field as blank on tool calls
waleedlatif1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import { triggersMock } from '@sim/testing/mocks/triggers.mock' | ||
| import { describe, expect, it, vi } from 'vitest' | ||
|
|
||
| vi.mock('@/triggers', () => triggersMock) | ||
|
|
||
| import { AttioBlock } from '@/blocks/blocks/attio' | ||
|
|
||
| describe('Attio agent operation resolution', () => { | ||
| it('maps the selected list when the operation arrives only in the tool-call context', () => { | ||
| const mapper = AttioBlock.tools.config?.params | ||
| if (!mapper) throw new Error('Attio block has no params mapper') | ||
|
|
||
| const mapped = mapper( | ||
| { oauthCredential: 'cred', listIdOrSlug: 'list-1' }, | ||
| { operation: 'get_list' } | ||
| ) | ||
|
|
||
| expect(mapped.list).toBe('list-1') | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import { triggersMock } from '@sim/testing/mocks/triggers.mock' | ||
| import { describe, expect, it, vi } from 'vitest' | ||
|
|
||
| vi.mock('@/triggers', () => triggersMock) | ||
|
|
||
| import { DropboxBlock } from '@/blocks/blocks/dropbox' | ||
|
|
||
| function requiredFor(subBlockId: string, values: Record<string, unknown>) { | ||
| const subBlock = DropboxBlock.subBlocks.find( | ||
| (candidate) => candidate.id === subBlockId && typeof candidate.required === 'function' | ||
| ) | ||
| if (!subBlock || typeof subBlock.required !== 'function') { | ||
| throw new Error(`${subBlockId} has no dynamic required condition`) | ||
| } | ||
| return subBlock.required(values) | ||
| } | ||
|
|
||
| describe('Dropbox cursor continuation', () => { | ||
| it('requires a folder path only until a list folder cursor is set', () => { | ||
| expect(requiredFor('path', {})).toEqual({ field: 'operation', value: 'dropbox_list_folder' }) | ||
| expect(requiredFor('path', { listFolderCursor: ' ' })).toEqual({ | ||
| field: 'operation', | ||
| value: 'dropbox_list_folder', | ||
| }) | ||
| expect(requiredFor('path', { listFolderCursor: 'cursor-1' })).toEqual({ | ||
| field: 'operation', | ||
| value: [], | ||
| }) | ||
| }) | ||
|
|
||
| it('requires a search query only until a search cursor is set', () => { | ||
| expect(requiredFor('query', {})).toEqual({ field: 'operation', value: 'dropbox_search' }) | ||
| expect(requiredFor('query', { searchCursor: 'cursor-1' })).toEqual({ | ||
| field: 'operation', | ||
| value: [], | ||
| }) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| import { describe, expect, it } from 'vitest' | ||
| import { IntercomV2Block } from '@/blocks/blocks/intercom' | ||
| import type { BlockToolParamsContext } from '@/blocks/types' | ||
|
|
||
| function mapParams(params: Record<string, unknown>, context?: BlockToolParamsContext) { | ||
| const mapper = IntercomV2Block.tools.config?.params | ||
| if (!mapper) throw new Error('Intercom block has no params mapper') | ||
| return mapper(params, context) | ||
| } | ||
|
|
||
| describe('Intercom snooze timestamps', () => { | ||
| it('sends a positive whole Unix timestamp as a number', () => { | ||
| expect( | ||
| mapParams({ | ||
| operation: 'snooze_conversation', | ||
| conversationId: 'c1', | ||
| admin_id: 'a1', | ||
| snoozed_until: '1767225600', | ||
| }).snoozed_until | ||
| ).toBe(1767225600) | ||
| }) | ||
|
|
||
| it.each(['0', '-5', ' ', '1.5', 0])('rejects %j as a snooze time', (snoozedUntil) => { | ||
| expect(() => | ||
| mapParams({ | ||
| operation: 'snooze_conversation', | ||
| conversationId: 'c1', | ||
| admin_id: 'a1', | ||
| snoozed_until: snoozedUntil, | ||
| }) | ||
| ).toThrow('positive whole Unix timestamp') | ||
| }) | ||
| }) | ||
|
|
||
| describe('Intercom agent operation resolution', () => { | ||
| it('keeps a boolean disable_notifications when the operation arrives only in the context', () => { | ||
| const mapped = mapParams( | ||
| { ticket_type_id: 't1', disable_notifications: true }, | ||
| { operation: 'create_ticket' } | ||
| ) | ||
|
|
||
| expect(mapped.disable_notifications).toBe(true) | ||
| }) | ||
| }) | ||
|
|
||
| describe('Intercom ticket snooze', () => { | ||
| it('validates the model snoozed_until on an update_ticket tool call', () => { | ||
| const mapped = mapParams( | ||
| { ticket_id: 't1', snoozed_until: '1767225600' }, | ||
| { operation: 'update_ticket' } | ||
| ) | ||
| expect(mapped.snoozed_until).toBe(1767225600) | ||
| expect(() => | ||
| mapParams({ ticket_id: 't1', snoozed_until: '-1' }, { operation: 'update_ticket' }) | ||
| ).toThrow('positive whole Unix timestamp') | ||
| }) | ||
|
|
||
| it('does not send a stale conversation snooze value with a canvas ticket update', () => { | ||
| const inputs = { operation: 'update_ticket', ticket_id: 't1', snoozed_until: '5' } | ||
| const sent = { ...inputs, ...mapParams(inputs) } | ||
| expect(sent.snoozed_until).toBeUndefined() | ||
| }) | ||
| }) | ||
|
|
||
| describe('Intercom role defaults', () => { | ||
| const role = IntercomV2Block.subBlocks.find((subBlock) => subBlock.id === 'role') | ||
|
|
||
| it('leads with No change everywhere except a known Create Contact', () => { | ||
| const options = role?.options | ||
| if (typeof options !== 'function') throw new Error('role options are static') | ||
| expect(options({ values: {} })[0]?.id).toBe('') | ||
| expect(options({ values: { operation: 'update_contact' } })[0]?.id).toBe('') | ||
| expect(options({ values: { operation: 'create_contact' } })[0]?.id).toBe('lead') | ||
| expect(options()[0]?.id).toBe('lead') | ||
| }) | ||
| }) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.