Skip to content

Conversation

@ncarbon
Copy link
Collaborator

@ncarbon ncarbon commented Jul 30, 2025

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)

Copilot AI review requested due to automatic review settings July 30, 2025 17:07
@ncarbon ncarbon requested a review from a team as a code owner July 30, 2025 17:07
@github-actions github-actions bot added the feat label Jul 30, 2025
@ncarbon ncarbon marked this pull request as draft July 30, 2025 17:07
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 introduces a mock data generator modal container with experimentation provider support for the CLOUD-333848 ticket. The implementation establishes the foundation for a multi-step modal workflow with A/B testing capabilities.

  • Adds a new experimentation provider context for managing A/B test assignments
  • Creates a multi-step mock data generator modal with state management
  • Exports the experimentation provider for cross-package usage

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/compass-web/src/index.tsx Exports CompassExperimentationProvider for external use
packages/compass-telemetry/src/index.ts Exports experimentation provider from telemetry package
packages/compass-telemetry/src/experimentation-provider.tsx Implements React context for experiment assignment and tracking
packages/compass-collection/src/components/mock-data-generator-modal/types.ts Defines enum for modal workflow steps
packages/compass-collection/src/components/mock-data-generator-modal/mock-generator-modal.tsx Creates multi-step modal component with state management
packages/compass-collection/src/components/mock-data-generator-modal/constants.ts Defines default document count constant

</ModalBody>

<ModalFooter className={footerStyles}>
<Button onClick={onBack}>Back</Button>
Copy link

Copilot AI Jul 30, 2025

Choose a reason for hiding this comment

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

The Back button is always rendered but should be disabled or hidden on the first step (AI_DISCLAIMER). Currently clicking Back on step 1 will have no effect but provides a confusing user experience.

Suggested change
<Button onClick={onBack}>Back</Button>
<Button onClick={onBack} disabled={currentStep === MockDataGeneratorSteps.AI_DISCLAIMER}>
Back
</Button>

Copilot uses AI. Check for mistakes.
<div className={rightButtonsStyles}>
<Button onClick={onCancel}>Cancel</Button>
<Button variant={ButtonVariant.Primary} onClick={onNext}>
Next
Copy link

Copilot AI Jul 30, 2025

Choose a reason for hiding this comment

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

The Next button text should change to 'Generate' or 'Finish' on the final step (GENERATE_DATA) to better indicate the action being performed.

Suggested change
Next
{currentStep === MockDataGeneratorSteps.GENERATE_DATA ? 'Generate' : 'Next'}

Copilot uses AI. Check for mistakes.
Comment on lines +36 to +50
const [rawSchema, setRawSchema] = useState<string | null>(null);
const [fakerSchema, setFakerSchema] = useState<string | null>(null);
const [outputDocsCount, setOutputDocsCount] = useState<number>(
DEFAULT_OUTPUT_DOCS_COUNT
);
const [validationRules, setValidationRules] = useState<string | null>(null);
const [sampleDoc, setSampleDoc] = useState<string | null>(null);

const resetState = () => {
setCurrentStep(MockDataGeneratorSteps.AI_DISCLAIMER);
setRawSchema(null);
setFakerSchema(null);
setOutputDocsCount(DEFAULT_OUTPUT_DOCS_COUNT);
setValidationRules(null);
setSampleDoc(null);
Copy link

Copilot AI Jul 30, 2025

Choose a reason for hiding this comment

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

Multiple state variables are defined but never used in the current implementation. Consider removing unused state variables (rawSchema, fakerSchema, validationRules, sampleDoc) or add TODO comments indicating their planned usage.

Suggested change
const [rawSchema, setRawSchema] = useState<string | null>(null);
const [fakerSchema, setFakerSchema] = useState<string | null>(null);
const [outputDocsCount, setOutputDocsCount] = useState<number>(
DEFAULT_OUTPUT_DOCS_COUNT
);
const [validationRules, setValidationRules] = useState<string | null>(null);
const [sampleDoc, setSampleDoc] = useState<string | null>(null);
const resetState = () => {
setCurrentStep(MockDataGeneratorSteps.AI_DISCLAIMER);
setRawSchema(null);
setFakerSchema(null);
setOutputDocsCount(DEFAULT_OUTPUT_DOCS_COUNT);
setValidationRules(null);
setSampleDoc(null);
const [outputDocsCount, setOutputDocsCount] = useState<number>(
DEFAULT_OUTPUT_DOCS_COUNT
);
const resetState = () => {
setCurrentStep(MockDataGeneratorSteps.AI_DISCLAIMER);
setOutputDocsCount(DEFAULT_OUTPUT_DOCS_COUNT);

Copilot uses AI. Check for mistakes.
@ncarbon ncarbon closed this Jul 30, 2025
@ncarbon ncarbon deleted the CLOUDP-333848/mock-data-modal-container branch July 30, 2025 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants