Skip to content

Conversation

@mabaasit
Copy link
Collaborator

@mabaasit mabaasit commented Oct 30, 2025

Show warnings if relations are not valid - missing foreign collection/fields.

Preview image image

Description

Checklist

  • New tests and/or benchmarks are included
  • Documentation is changed or added
  • If this change updates the UI, screenshots/videos are added and a design review is requested
  • I have signed the MongoDB Contributor License Agreement (https://www.mongodb.com/legal/contributor-agreement)

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

Dependents

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

@mabaasit mabaasit force-pushed the COMPASS-9847-node-warning-icon branch 3 times, most recently from 4063ce3 to 9c9124d Compare November 11, 2025 13:44
@mabaasit mabaasit force-pushed the COMPASS-9847-node-warning-icon branch from 9c9124d to 1f793de Compare November 11, 2025 14:12
@mabaasit mabaasit changed the title WIP: feat(data-modeling): show warning for invalid relationships COMPASS-9847 feat(data-modeling): show warning for invalid relationships COMPASS-9847 Nov 11, 2025
@mabaasit mabaasit marked this pull request as ready for review November 11, 2025 14:25
@mabaasit mabaasit requested a review from a team as a code owner November 11, 2025 14:25
@mabaasit mabaasit requested review from Copilot and lerouxb November 11, 2025 14:25
@github-actions github-actions bot added the feat label Nov 11, 2025
Copy link
Contributor

Copilot AI left a comment

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 adds validation warnings for invalid relationships in the data modeling feature. When relationships are missing required foreign collections or fields, warning indicators are now displayed both on the diagram nodes and in the relationships section of the drawer.

Key changes:

  • Added utility functions to validate relationships and filter relationships by namespace
  • Updated diagram nodes and relationship list items to show warning icons for invalid relationships
  • Upgraded the @mongodb-js/diagramming package to version 2.2.1 to support the warning variant

Reviewed Changes

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

Show a summary per file
File Description
packages/compass-data-modeling/src/utils/utils.ts Added getNamespaceRelationships and isRelationshipInvalid utility functions
packages/compass-data-modeling/src/utils/utils.spec.tsx Added comprehensive tests for the isRelationshipInvalid function
packages/compass-data-modeling/src/utils/nodes-and-edges.ts Modified collectionToDiagramNode to accept relationships and set warning variant for invalid relationships
packages/compass-data-modeling/src/components/drawer/relationships-section.tsx Added warning icon with tooltip for invalid relationships in the drawer
packages/compass-data-modeling/src/components/drawer/collection-drawer-content.tsx Refactored to use getNamespaceRelationships utility function
packages/compass-data-modeling/src/components/diagram-editor.tsx Updated to pass relationships to collectionToDiagramNode
packages/compass-components/package.json Upgraded @mongodb-js/diagramming to version 2.2.1
.github/PULL_REQUEST_TEMPLATE.md Formatting changes adding blank lines between sections

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mabaasit mabaasit force-pushed the COMPASS-9847-node-warning-icon branch 2 times, most recently from 803baf6 to 257a609 Compare November 11, 2025 14:29
@mabaasit mabaasit force-pushed the COMPASS-9847-node-warning-icon branch from 257a609 to 9626bdf Compare November 11, 2025 14:31
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [ ] *Backport Needed*

- [ ] _Backport Needed_
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These changes started to show up when I merged the main in my branch. I think these are due to precommit hook, where prettier reformatted the file.

Copy link
Member

@Anemy Anemy left a comment

Choose a reason for hiding this comment

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

Looks good, left one non blocking suggestion

@mabaasit mabaasit merged commit 545d44e into main Nov 12, 2025
193 of 228 checks passed
@mabaasit mabaasit deleted the COMPASS-9847-node-warning-icon branch November 12, 2025 10:08
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.

3 participants