Skip to content

CHI-4039: Remove end-of-survey post survey save endpoints (5/5) - #4859

Draft
gpaoloni wants to merge 12 commits into
masterfrom
gian_CHI-4039-cleanup
Draft

gpaoloni wants to merge 12 commits into
masterfrom
gian_CHI-4039-cleanup

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 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 (this PR) Remove the end-of-survey save endpoints

Removes the endpoints that saved post surveys only when they ended, now that every channel records answers as they are given:

  • hrm/savePostSurvey (savePostSurveyHandler) — replaced by postSurvey/recordAnswers in the voice flows (PR 4).
  • hrm/voicePostSurveyAction (voicePostSurveyActionHandler) — a Sync-document based variant no flow in this repo calls.
  • hrm/savePostSurvey.ts (savePostSurvey) — no longer used by the chatbot (PR 3).
  • The hrm/savePostSurvey section of STUDIO_ROUTES.md.

Merge and deploy only after PR 4 has been applied in every environment (USNC staging + production, CA staging), so no deployed flow still calls hrm/savePostSurvey. After that, HRM's POST postSurveys is no longer used by the lambdas.

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/.
  • Datadog: no requests to hrm/savePostSurvey or hrm/voicePostSurveyAction in the week before merging.

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

gpaoloni and others added 12 commits November 18, 2026 16: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>
Add recordPostSurveyAnswers, which stores the answered questions on the
post survey control task (raw answers plus their Insights attributes)
and upserts the post survey in HRM with all the answers so far. Blank
surveys record nothing.

Expose it to Studio as postSurvey/recordAnswers, and create the control
task before triggering a post studio flow whose configuration sets
createSurveyControlTask, passing its SID to the flow. Flows without the
flag keep working as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep the post studio flow TaskRouter listener unaware of what the flow it
triggers does: instead of creating the control task there (behind the
createSurveyControlTask flag), expose postSurvey/createControlTask so a
post survey flow creates it as its first step and passes the returned
controlTaskSid to postSurvey/recordAnswers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The post studio flow listener now sends the task language (or the helpline
language, or en-US) to the flow it triggers: as taskLanguage on the
inProgressCall redirect, and as the taskLanguage execution parameter for
rest flows, which used to get an empty string when the task had none.
postSurvey/createControlTask accepts it as an optional language, stored on
the control task like the chatbot post survey does.

getTaskLanguage moves to task/taskLanguage.ts so both listeners share it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Post survey chatbots (post-chat and post-call SMS) now record the
answers after every helpseeker message instead of only when the bot
finishes, so a survey left halfway keeps the answers given. Finishing
the survey now only cancels the control task.

Lower the post survey control task TTL from 1 hour to 15 minutes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Matches the 15 minute lifetime of the post survey control task.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the final hrm/savePostSurvey call with a postSurvey/recordAnswers
call after each question, so answers survive a hang up mid-survey. The last
question also sends surveyComplete. Failures continue to the next question.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…iven

Replace the final hrm/savePostSurvey call with a postSurvey/recordAnswers
call after each valid answer, keeping the same question keys. The last
question, and the paths that used to save after repeated invalid answers,
send surveyComplete. Failures continue the survey; the closing message is
the thank-you message, since earlier answers are already recorded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…recording

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
USNC and KHP English post-call survey flows call postSurvey/createControlTask
as their first widget and pass its controlTaskSid to every recordAnswers call,
instead of relying on the post studio flow listener to create the task behind
the createSurveyControlTask service configuration flag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ontrol task

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Voice post surveys now record their answers through postSurvey/recordAnswers
as they are given, so hrm/savePostSurvey and the unused
hrm/voicePostSurveyAction (Sync document based) are no longer called.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gpaoloni
gpaoloni force-pushed the gian_CHI-4039-cleanup branch from 9d11518 to 368a14f Compare November 18, 2026 19:44

This branch has not been deployed

No deployments
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.

1 participant