Skip to content

Conversation

@joanagmaia
Copy link
Contributor

@joanagmaia joanagmaia commented Dec 19, 2025

Changes

Repositories already mapped to other projects

Creating segments with names or slugs that already exist

  • If slug or name already exist in another project, throw a meaningful error.
    • Backend Message:
      • subprojectSlugExists: Sub-project with slug "{0}" already exists in project {1}.,
      • projectSlugExists: Project with slug "{0}" already exists in project group {1}.,
      • projectGroupSlugExists: Project Group with slug "{0}" already exists.,
      • subprojectNameExists: Sub-project {0} already exists in project {1}.,
      • projectNameExists: Project {0} already exists in project group {1}.,
      • projectGroupNameExists: Project Group {0} already exists.
    • Frontend should render exactly what it receives from backend (for segments (all levels) creation and update)

Note

Adds checks to prevent mapping the same repo to multiple integrations and introduces centralized validation for duplicate segment names/slugs with specific error messages.

  • Integrations (Git/GitHub/GitLab):
    • Enforce repo mapping uniqueness: before updating mappings, check existing records and throw Error400('errors.integrations.repoAlreadyMapped', ...) if a repo is already linked to another integrationId.
    • Standardize error key/message to errors.integrations.repoAlreadyMapped.
  • Segments:
    • Add centralized conflict validation for name/slug across levels (project group/project/sub-project), including LF vs non-LF slug variants; used on create and update.
    • New helpers: validateSegmentConflicts, throwSegmentConflictError, validateUpdateDuplicates, getSegmentType; repository method findByName.
  • i18n:
    • Add granular segment conflict messages and unify repo-mapped error wording.

Written by Cursor Bugbot for commit 9ff86dd. This will update automatically on new commits. Configure here.

@github-actions
Copy link
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

2 similar comments
@github-actions
Copy link
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

@github-actions
Copy link
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

@joanagmaia joanagmaia changed the title chore: improve api error messages chore: improve api error messages (CM-855) Dec 19, 2025
if (data.name || data.slug) {
await this.validateUpdateDuplicates(id, segment, data, segmentRepository)
}

Copy link

Choose a reason for hiding this comment

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

Bug: Update validation misses slug conflicts from isLF transformation

When updating a segment, validateUpdateDuplicates skips slug validation if data.slug === segment.slug (line 735). However, the slug is subsequently transformed by validateNonLfSlug when isLF changes to false (line 54). The transformed slug (with nonlf_ prefix) is never validated for conflicts. This allows creating duplicate slugs when a user updates a segment with the same slug value but changes isLF from true to false, potentially colliding with an existing segment that already has the nonlf_-prefixed version of that slug.

Additional Locations (1)

Fix in Cursor Fix in Web

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