CHI-3737: Migrate adjustCapacity, janitor, and transfers task router listeners to lambdas/account-scoped#3951
CHI-3737: Migrate adjustCapacity, janitor, and transfers task router listeners to lambdas/account-scoped#3951
Conversation
Co-authored-by: stephenhand <1694716+stephenhand@users.noreply.github.com>
stephenhand
left a comment
There was a problem hiding this comment.
Convert console.log statements to ones that use the method appropriate to their severity level (console.warn, console.error etc.). Enhance these log statements with contextual data to aid debugging, making sure to include the accountSid and the relevant task SID as a minimum. Include any additional log statements that could aid debugging
Refer to https://github.com/techmatters/aselo-coding-standards/blob/sjh/log-levels/logging-levels.md for guidance on selecting appropriate logging levels
Add unit tests for the 3 migrated listeners. Unit test the listener logic separately from the modules they depend on (i.e. adjustChannelCapacity.ts, chatChannelJanitor.ts) - mocking them as required, but if those dependencies lack test coverage, add tests for those too
| Telegram = 'telegram', | ||
| } | ||
|
|
||
| export const isAseloCustomChannel = (channelType?: string): boolean => |
There was a problem hiding this comment.
Since this isn't related to converting custom channel messages to flex conversation messages, it should be moved to its own file
There was a problem hiding this comment.
Done in fddfe87. Moved AseloCustomChannel and isAseloCustomChannel to a new customChannels/aseloCustomChannels.ts file. customChannelToFlex.ts re-exports them for backward compatibility.
…add unit tests Co-authored-by: stephenhand <1694716+stephenhand@users.noreply.github.com>
Done in fddfe87:
|
stephenhand
left a comment
There was a problem hiding this comment.
Remove the adjustChatCapacityHandler function and associated route from adjustChatCapacity.ts
Add unit test coverage for the adjustChatCapacity and chatChannelJanitor methods
…apacity and chatChannelJanitor Co-authored-by: stephenhand <1694716+stephenhand@users.noreply.github.com>
Done in a92f529:
|
stephenhand
left a comment
There was a problem hiding this comment.
move the janitorTaskRouterListener from the transfer directory to the conversation directory. Do the same for the associated unit tests
…n directory Co-authored-by: stephenhand <1694716+stephenhand@users.noreply.github.com>
Done in 63bb692. Moved |
Migrates three remaining task router listeners from the serverless repo into the
lambdas/account-scopedlambda, each gated by ause_twilio_lambda_*feature flag that short-circuits the handler entirely when not set.Description
conversation/adjustCapacityTaskRouterListener.ts—RESERVATION_ACCEPTED/RESERVATION_REJECTED; reuses existingadjustChatCapacitymodule; also gates internally onenable_manual_pullingconversation/janitorTaskRouterListener.ts—TASK_CANCELED,TASK_WRAPUP,TASK_COMPLETED,TASK_DELETED,TASK_SYSTEM_DELETED; handles bot-capture cleanup, custom-channel cleanup, and conversation orchestration deactivation (respectingenable_post_survey); uses existingchatChannelJanitorandhasTaskControltransfer/transfersTaskRouterListener.ts—RESERVATION_ACCEPTED/REJECTED/TIMEOUT/WRAPUP,TASK_CANCELED,TASK_QUEUE_ENTERED; full chat + voice transfer state machine; implementstransitionAgentParticipantslocally against the Flex Interaction APIcustomChannels/aseloCustomChannels.ts— new file containingAseloCustomChannelenum andisAseloCustomChannel()helper (used by janitor to detect custom channel types); re-exported fromcustomChannelToFlex.tsfor backward compatibilitytaskrouter/index.ts— imported the three new listenersadjustChatCapacity.ts— removed the now-supersededadjustChatCapacityHandlerHTTP handler function and its associated unused importsrouter.ts— removed theconversation/adjustChatCapacityroute that was served by the removed handlerFeature flags:
use_twilio_lambda_adjust_capacityuse_twilio_lambda_janitoruse_twilio_lambda_transfersAll log statements use severity-appropriate methods (
console.info,console.debug,console.error) and includeaccountSidandtaskSidas context to aid debugging.Unit tests added for all 3 listeners (mocking their dependencies) as well as the underlying
adjustChatCapacityandchatChannelJanitormodules.Checklist
Other Related Issues
None
Verification steps
use_twilio_lambda_*flag in Flex service configuration.conversation/adjustChatCapacityHTTP endpoint is no longer available (requests should return a 404/unmatched route response).AFTER YOU MERGE
You are responsible for ensuring the above steps are completed. If you move a ticket into QA without advising what version to test, the QA team will assume the latest tag has the changes. If it does not, the following confusion is on you! :-P
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.