Skip to content

Conversation

@bc-facundo-yuffrida
Copy link
Contributor

Jira: JIRA_TOKEN

What/Why?

This PR modifies the /productDescription/${id} endpoint's description generation flow. It addresses an issue where product names containing '#' symbols could interfere with AI description generation.

To resolve this, the product name is now sanitized (all '#' symbols are removed) only for the AI generation request payload sent to /api/generateDescription. The original product name, including '#' symbols, remains unchanged in the UI and product record, effectively "restoring" it after generation without any persistence.

Rollout/Rollback

This is a code change. Rollout will be part of a standard deployment. Rollback would involve reverting the code.

Testing

  • Lint: Clean for the edited file.
  • Type-check: Passes.
  • Unit/Integration Tests: Could not be run in the assistant's environment due to missing environment variables.

@bigcommerce/team-data


Open in Cursor Open in Web

Co-authored-by: facundo.yuffrida <facundo.yuffrida@commerce.com>
@cursor
Copy link

cursor bot commented Dec 18, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@vercel
Copy link

vercel bot commented Dec 18, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
ai-app-foundation Ready Ready Preview, Comment Dec 18, 2025 6:20pm

Co-authored-by: facundo.yuffrida <facundo.yuffrida@commerce.com>
import { useTracking } from '~/hooks/useTracking';

const sanitizeProductNameForGeneration = (name: string) =>
name.replaceAll('#', '').replace(/\s{2,}/g, ' ').trim();

Choose a reason for hiding this comment

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

Make sure we have a test case validating this regex.

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.

4 participants