Skip to content

Conversation

@kpamaran
Copy link
Collaborator

@kpamaran kpamaran commented Aug 28, 2025

Description

Updates the redux reducer in package/compass-collection to track request state for the AtlasAiService getMockDataSchema operation backed by the NLQ API and control the first few screens of the modal.

The contents of the schema confirmation and schema editor steps will be fleshed out in future tickets and screenshots will be shared there. For now, placeholders are rendered.

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

  • Added compass-generative-ai as a dep to compass-collection. Is running npm install --save @mongodb-js/compass-generative-ai@ --workspace=packages/compass-collection (per CONTRIBUTING.md). Is there more I need to do? There's a change to the dependency happening at the same time as the dep addition, not sure if the upgrade bot handles that
  • I reviewed the official Redux style guide (essential to recommended). Would like reviewers to check for anti-patterns.
  • I considered used combineReducers since the root reducer is getting big, but a first attempt at it wasn't trivial as straight forward as I thought.
  • I added the first reducer test for this module, and I find organizing it by "for this reducer logic's state" -> "when X action is received" is sensible.

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)

@github-actions github-actions bot added the feat label Aug 28, 2025
@kpamaran kpamaran added the no release notes Fix or feature not for release notes label Aug 28, 2025
@kpamaran kpamaran requested a review from jcobis August 29, 2025 13:43
Comment on lines 595 to 596
// todo: dedup/abort requests using requestId (CLOUDP-333850)
const requestId = new UUID().toString();
Copy link
Collaborator

Choose a reason for hiding this comment

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

For controlling the abort flow we usually use the thunk arg to keep the reference to the abort controller, see compass-indexes plugin for example

Copy link
Collaborator Author

@kpamaran kpamaran Sep 2, 2025

Choose a reason for hiding this comment

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

didn't see one there but I think this ref in compass-schema-validation that Nataly shared with me works as an example too

) => {
const { schemaAnalysis, fakerSchemaGeneration, namespace } = getState();
if (schemaAnalysis.status !== SCHEMA_ANALYSIS_STATE_COMPLETE) {
logger.log.error(
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should probably be a warn, not an error if it doesn't actually cause any harm, compass users look at logs sometimes and do get confused sometimes by errors in the log that are not really errors

@kpamaran kpamaran requested a review from ncarbon September 3, 2025 11:46
@kpamaran
Copy link
Collaborator Author

kpamaran commented Sep 3, 2025

Finished a round of diffs for applying the redux changes on actual modal contents

@kpamaran kpamaran requested a review from gribnoysup September 3, 2025 12:03
@kpamaran kpamaran requested a review from a team September 3, 2025 12:31
};
}

it('cancels in-flight faker mapping requests when the cancel button is clicked', async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice coverage!

Copy link
Collaborator

@jcobis jcobis left a comment

Choose a reason for hiding this comment

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

Nice work Kevin!

Comment on lines 19 to +22
function renderModal({
isOpen = true,
currentStep = MockDataGeneratorStep.SCHEMA_CONFIRMATION,
mockServices = createMockServices(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just FYI, we call out testing-library-compass in development guide for a reason. A lot of manual setup you do here and in createMockServices we already do via testing helpers exposed from testing-library-compass (specifically https://github.com/mongodb-js/compass/tree/main/configs/testing-library-compass#createplugintesthelpers for testing parts of the plugin)

Copy link
Collaborator Author

@kpamaran kpamaran Sep 4, 2025

Choose a reason for hiding this comment

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

I attempted createPluginTestHelpers but had some trouble, I'll try again in my upcoming PR and look at the existing usage more closely

@kpamaran kpamaran merged commit 8a5b385 into main Sep 4, 2025
59 checks passed
@kpamaran kpamaran deleted the compass-collection-redux-integrates-mock-data-schema branch September 4, 2025 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat no release notes Fix or feature not for release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants