Skip to content

fix(headless): fix insight generated answer stream end not using the right analytics actions - #8085

Merged
erocheleau merged 7 commits into
mainfrom
SFINT-6870-thunk-extra
Aug 3, 2026
Merged

fix(headless): fix insight generated answer stream end not using the right analytics actions#8085
erocheleau merged 7 commits into
mainfrom
SFINT-6870-thunk-extra

Conversation

@erocheleau

Copy link
Copy Markdown
Collaborator

SFINT-6870

Added extra thunk argument for generatedAnswerAnalyticsClient so it can be correctly used by the different generated answer streaming clients to log their generatedAnswerStreamEnd.

@erocheleau
erocheleau requested a review from Copilot July 28, 2026 01:55
@changeset-bot

changeset-bot Bot commented Jul 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7171973

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 19 packages
Name Type
@coveo/headless Patch
@coveo/quantic Patch
@coveo/headless-react Patch
@coveo/atomic-hosted-page Patch
@coveo/atomic Patch
@coveo/atomic-legacy Patch
@coveo/shopify Patch
@coveo/ui-kit-sample-atomic-commerce-react Patch
@coveo/ui-kit-sample-atomic-commerce-vite Patch
@coveo/ui-kit-sample-atomic-search-react Patch
@coveo/ui-kit-sample-atomic-search-vite Patch
@coveo/ui-kit-sample-headless-commerce-react Patch
@coveo/ui-kit-sample-headless-commerce-vite Patch
@coveo/ui-kit-sample-headless-search-react Patch
@coveo/ui-kit-sample-headless-search-vite Patch
@coveo/ui-kit-sample-headless-ssr-commerce-express Patch
@coveo/ui-kit-sample-headless-ssr-commerce-nextjs Patch
@coveo/atomic-react Patch
@coveo/atomic-angular Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@svcsnykcoveo

svcsnykcoveo commented Jul 28, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

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.

Pull request overview

This PR fixes generated-answer streaming analytics so the correct analytics action set is used depending on whether the GeneratedAnswer controller runs on a Search engine or an Insight engine. It introduces a shared GeneratedAnswerAnalyticsClient contract and registers the appropriate implementation as a thunk extra argument, allowing streaming code paths to dispatch the right logGeneratedAnswerStreamEnd.

Changes:

  • Introduces a GeneratedAnswerAnalyticsClient interface and wires Search/Insight-specific implementations into thunk extra arguments.
  • Updates generated-answer streaming code paths (async thunk + Answer API RTK Query) to dispatch logGeneratedAnswerStreamEnd via the injected analytics client.
  • Updates unit tests and adds a changeset for @coveo/headless.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/headless/src/features/generated-answer/generated-answer-insight-analytics-actions.ts Aligns Insight logGeneratedAnswerStreamEnd signature with Search and supports passing an explicit answerId/answerTextIsEmpty.
packages/headless/src/features/generated-answer/generated-answer-insight-analytics-actions.test.ts Updates Insight analytics action tests for the new stream-end signature.
packages/headless/src/features/generated-answer/generated-answer-analytics-client.ts Adds shared analytics-client interface for GeneratedAnswer controllers/streaming.
packages/headless/src/features/generated-answer/generated-answer-actions.ts Uses injected generatedAnswerAnalyticsClient to log stream-end analytics during Search streaming.
packages/headless/src/controllers/knowledge/generated-answer/headless-generated-answer-with-follow-ups.ts Updates GeneratedAnswerAnalyticsClient type import to new shared interface location.
packages/headless/src/controllers/knowledge/generated-answer/headless-answerapi-generated-answer.ts Updates GeneratedAnswerAnalyticsClient type import to new shared interface location.
packages/headless/src/controllers/core/generated-answer/headless-searchapi-generated-answer.ts Updates GeneratedAnswerAnalyticsClient type import to new shared interface location.
packages/headless/src/controllers/core/generated-answer/headless-core-generated-answer.ts Removes the in-file GeneratedAnswerAnalyticsClient interface in favor of the new shared interface.
packages/headless/src/app/thunk-extra-arguments.ts Adds optional generatedAnswerAnalyticsClient to thunk extra arguments base type.
packages/headless/src/app/search-thunk-extra-arguments.ts Requires generatedAnswerAnalyticsClient for Search engine thunks.
packages/headless/src/app/search-engine/search-engine.ts Registers the Search generated-answer analytics client in thunk extras.
packages/headless/src/app/search-engine/search-engine.test.ts Tests registration of the Search generated-answer analytics client in thunk extras.
packages/headless/src/app/insight-thunk-extra-arguments.ts Requires generatedAnswerAnalyticsClient for Insight engine thunks.
packages/headless/src/app/insight-engine/insight-engine.ts Registers the Insight generated-answer analytics client in thunk extras.
packages/headless/src/app/insight-engine/insight-engine.test.ts Tests registration of the Insight generated-answer analytics client in thunk extras.
packages/headless/src/api/knowledge/stream-answer-api.ts Routes stream-end analytics through the injected analytics client during Answer API streaming.
packages/headless/src/api/knowledge/tests/stream-answer-api.test.ts Updates Answer API stream tests to pass a mock analytics client and assert correct dispatch.
.changeset/insight-generated-answer-stream-end.md Changeset documenting the fix and signature alignment.

Comment thread packages/headless/src/api/knowledge/stream-answer-api.ts
@chromatic-com

chromatic-com Bot commented Jul 28, 2026

Copy link
Copy Markdown

Tip

All tests passed and all changes approved!

🟢 UI Tests: 465 tests unchanged
🟢 UI Review: 465 stories published -- no changes
Storybook icon Storybook Publish: 465 stories published

@pkg-pr-new

pkg-pr-new Bot commented Jul 28, 2026

Copy link
Copy Markdown
@coveo/atomic

npm i https://pkg.pr.new/@coveo/atomic@8085

@coveo/atomic-hosted-page

npm i https://pkg.pr.new/@coveo/atomic-hosted-page@8085

@coveo/atomic-legacy

npm i https://pkg.pr.new/@coveo/atomic-legacy@8085

@coveo/atomic-react

npm i https://pkg.pr.new/@coveo/atomic-react@8085

@coveo/auth

npm i https://pkg.pr.new/@coveo/auth@8085

@coveo/bueno

npm i https://pkg.pr.new/@coveo/bueno@8085

@coveo/create-atomic

npm i https://pkg.pr.new/@coveo/create-atomic@8085

@coveo/create-atomic-component

npm i https://pkg.pr.new/@coveo/create-atomic-component@8085

@coveo/create-atomic-component-project

npm i https://pkg.pr.new/@coveo/create-atomic-component-project@8085

@coveo/create-atomic-result-component

npm i https://pkg.pr.new/@coveo/create-atomic-result-component@8085

@coveo/create-atomic-rollup-plugin

npm i https://pkg.pr.new/@coveo/create-atomic-rollup-plugin@8085

@coveo/create-ui

npm i https://pkg.pr.new/@coveo/create-ui@8085

@coveo/headless

npm i https://pkg.pr.new/@coveo/headless@8085

@coveo/headless-react

npm i https://pkg.pr.new/@coveo/headless-react@8085

@coveo/relay

npm i https://pkg.pr.new/@coveo/relay@8085

@coveo/shopify

npm i https://pkg.pr.new/@coveo/shopify@8085

commit: 7171973

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

🔗 Scratch Orgs ready to test this PR:

Comment thread packages/headless/src/api/knowledge/stream-answer-api.ts Outdated
@SimonMilord
SimonMilord self-requested a review July 30, 2026 19:20
@erocheleau
erocheleau marked this pull request as ready for review July 31, 2026 14:19
@erocheleau
erocheleau requested review from a team, fbeaudoincoveo and jfcere-coveo July 31, 2026 14:19

@mmitiche mmitiche 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.

LGTM, GG!

@erocheleau
erocheleau added this pull request to the merge queue Aug 3, 2026
Merged via the queue into main with commit e463261 Aug 3, 2026
87 checks passed
@erocheleau
erocheleau deleted the SFINT-6870-thunk-extra branch August 3, 2026 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants