Skip to content

Conversation

jcobis
Copy link
Collaborator

@jcobis jcobis commented Sep 9, 2025

Description

Because we now gate the schema analysis action behind the experiment check (as part of this PR) in the plugin activation, we can now remove the experiment check in the component and rely solely on the redux state to gate the feature.

Empty Collection - Button Disabled with Tooltip

Screenshot 2025-09-09 at 11 04 27 AM

Overly Nested Collection - Button Disabled with Tooltip

Screenshot 2025-09-09 at 11 07 08 AM

Time Series - Button Hidden

Screenshot 2025-09-09 at 11 08 19 AM

Collection Has Data - Button Displayed and Enabled

Screenshot 2025-09-09 at 11 04 37 AM

Button Opens Modal

Screenshot 2025-09-09 at 11 04 40 AM

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

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 Copilot AI review requested due to automatic review settings September 9, 2025 14:43
@jcobis jcobis requested a review from a team as a code owner September 9, 2025 14:43
@jcobis jcobis changed the title Gate experiment feature behind redux state check instead of hook call feat(compass-collection): Gate experiment feature behind redux state check instead of hook call - CLOUDP-344022 Sep 9, 2025
@github-actions github-actions bot added the feat label Sep 9, 2025
Copy link
Contributor

@Copilot 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 removes the experiment hook-based gating for the Mock Data Generator feature and replaces it with redux state checking. The change simplifies the experiment integration by relying on schema analysis state to determine feature availability instead of direct experiment assignment checks.

  • Removes useAssignment hook usage and related experiment checking logic
  • Updates feature gating to check schema analysis status (analyzing/complete states)
  • Simplifies test setup by removing experimentation provider mocking

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/compass-telemetry/src/provider.tsx Removes export of useAssignment hook
packages/compass-telemetry/src/experimentation-provider.tsx Removes useAssignment hook implementation and related types
packages/compass-collection/src/components/collection-header/collection-header.spec.tsx Updates tests to remove experimentation provider setup and hook mocking
packages/compass-collection/src/components/collection-header-actions/collection-header-actions.tsx Replaces experiment assignment check with schema analysis status check
packages/compass-collection/src/components/collection-header-actions/collection-header-actions.spec.tsx Removes experimentation provider from test setup

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@jcobis jcobis added the no release notes Fix or feature not for release notes label Sep 9, 2025
Comment on lines 44 to 46
const renderMethod = connectionInfo
? renderWithActiveConnection
: renderWithConnections;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: seems unnecessary, active connection already requires this function to be handled as async, so you can just use the renderWithActiveConnection for all tests

@@ -72,8 +51,3 @@ export const CompassExperimentationProvider: React.FC<{
</ExperimentationContext.Provider>
);
};

// Hook for components to access experiment assignment
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think we need to remove this, this seems useful for future use-cases

Comment on lines 85 to +87
const shouldShowMockDataButton =
isInMockDataTreatmentVariant &&
(schemaAnalysisStatus === SCHEMA_ANALYSIS_STATE_ANALYZING ||
schemaAnalysisStatus === SCHEMA_ANALYSIS_STATE_COMPLETE) &&
Copy link
Collaborator

@gribnoysup gribnoysup Sep 9, 2025

Choose a reason for hiding this comment

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

This change means that even when the experiment related code is removed, the button now will always jump in the view because the analysis doesn't start immediately: first render happens before that. This also makes the button pop out if the analysis has failed. Not sure if this is an intended change in the behavior here. Feels like checking the assignment status is a clearer way of dealing with this UI: when experiment code is removed, this button will always be visible if other conditions are met, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

My thinking was that this will actually reduce the latency for which the button pops in, since before this change, it'd have to wait for the useAssignment call to resolve before showing the button.

True that currently this PR has the button pop out on failed analysis, but I think that's okay, as that's an unexpected error state. Alternatively, we could keep the button displayed but disabled.

Yes, when we remove experiment code, we can remove this. I can add a note to do so here if in the future we do remove the experiment gate.

If you feel this PR is better left unmerged, happy to skip it. Maybe we can keep it unmerged for now.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmmm, If the plan is to remove the button if we failed to analyze instead of surfacing the error somehow, then indeed it's probably better to not show the button at all and limit the state checks even more than you have here to only showing it when analysis is completed successfully, otherwise in the current version the button shows up hen analysis starts, it's disabled because analysis is in progress, then it just disappears with no notice on error, this doesn't make much sense as a behavior 🙂

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok, sounds good. For now, I'll leave this PR and we can revisit/reconsider it once higher priority work is done.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sure! Do you mind switching it to draft so that it doesn't look like ready for review?

@addaleax addaleax changed the title feat(compass-collection): Gate experiment feature behind redux state check instead of hook call - CLOUDP-344022 feat(compass-collection): bate experiment feature behind redux state check instead of hook call - CLOUDP-344022 Sep 9, 2025
@addaleax addaleax changed the title feat(compass-collection): bate experiment feature behind redux state check instead of hook call - CLOUDP-344022 feat(compass-collection): gate experiment feature behind redux state check instead of hook call - CLOUDP-344022 Sep 9, 2025
@jcobis jcobis marked this pull request as draft September 10, 2025 20:50
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.

2 participants