Skip to content

CHI-4039: Extract post survey helpers (1/5) - #4855

Merged
gpaoloni merged 1 commit into
masterfrom
gian_CHI-4039
Nov 19, 2026
Merged

gpaoloni merged 1 commit into
masterfrom
gian_CHI-4039

Conversation

@gpaoloni

@gpaoloni gpaoloni commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Stacked PRs for CHI-4039 (save partial post-survey answers). Review and merge in order:

  1. CHI-4039: Extract post survey helpers (1/5) #4855 (this PR) Refactor: extract the post survey helpers
  2. CHI-4039: Record post survey answers as they are given (2/5) #4856 Record post survey answers as they are given (lambda service + Studio route)
  3. CHI-4039: Chatbot post surveys record answers on every turn (3/5) #4857 Chatbot post surveys record answers on every turn
  4. CHI-4039: Voice post surveys record each answer, Lex idle TTL to 15 min (4/5) #4858 twilio-iac: voice flows create their control task and record each answer, Lex idle TTL
  5. CHI-4039: Remove end-of-survey post survey save endpoints (5/5) #4859 Remove the end-of-survey save endpoints

First step towards saving partial post-survey answers (CHI-4039). Refactor only, no behaviour change.

  • Move buildDataObject / PostSurveyData from hrm/savePostSurvey.ts into a new postSurvey/postSurveyData.ts, so the new per-answer recording (next PR) can use it, and the old save endpoint can later be deleted without touching it.
  • Extract the post survey control task attributes and TTL into postSurvey/postSurveyControlTask.ts, so chat and voice post surveys create identical control tasks.

Checklist

  • Corresponding issue has been opened
  • New tests added
  • Feature flags added
  • Strings are localized
  • Tested for chat contacts
  • Tested for call contacts

Other Related Issues

None

Verification steps

  • Unit tests: npm run test:unit in lambdas/.
  • No functional change: a post-chat survey still runs and saves at the end as before.

AFTER YOU MERGE

  1. Cut a release tag using the Github workflow. Wait for it to complete and notify in the #aselo-deploys Slack channel.
  2. Comment on the ticket with the release tag version AND any additional instructions required to configure an environment to test the changes.
  3. Only then move the ticket into the QA column in JIRA

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

🤖 Generated with Claude Code

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the refactor extracting shared survey-answer and control-task helpers.

No open issues 🎉

What changed in this PR

This refactor prepares the account-scoped lambdas for partial post-survey saving in CHI-4039. It extracts reusable helpers while preserving the existing end-of-survey save behavior and one-hour control-task lifetime.

Changes:

  • Extract survey-answer formatting and its data type into a shared module.
  • Centralize survey control-task attributes and lifetime, and update existing callers.
  • Add unit tests for answer formatting and control-task attributes.
File Description
lambdas/​account-scoped/​tests/​unit/​postSurvey/​postSurveyData.test.ts Tests answer mapping, missing answers, and unconfigured questions.
lambdas/​account-scoped/​tests/​unit/​postSurvey/​postSurveyControlTask.test.ts Tests contact linkage and language attributes.
lambdas/​account-scoped/​src/​postSurvey/​postSurveyData.ts Houses the extracted answer-formatting helper and data type.
lambdas/​account-scoped/​src/​postSurvey/​postSurveyControlTask.ts Defines shared task attributes and the one-hour lifetime.
lambdas/​account-scoped/​src/​hrm/​savePostSurvey.ts Imports the extracted answer-formatting helper.
lambdas/​account-scoped/​src/​channelCapture/​postSurveyListener.ts Uses the shared control-task builder and lifetime constant.

Review effort: Balanced

@gpaoloni
gpaoloni force-pushed the gian_CHI-4039 branch 2 times, most recently from f0cbe71 to 2abcaca Compare November 18, 2026 19:41
…ilder

Move buildDataObject into a postSurvey module and share the post survey
control task attributes, so the upcoming partial post survey saving can
reuse them. No behaviour change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gpaoloni
gpaoloni merged commit 22703b2 into master Nov 19, 2026
25 checks passed
@gpaoloni
gpaoloni deleted the gian_CHI-4039 branch November 19, 2026 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants