Skip to content

Conversation

@sevoku
Copy link
Member

@sevoku sevoku commented Mar 6, 2025

This pull request introduces a new survey feature to gather user feedback on their experience with the NoSQL and MongoDB functionalities in the extension. The changes include adding new survey-related utilities, integrating survey prompts into various parts of the codebase, and updating dependencies.

image

Survey Integration:

  • src/utils/survey.ts: Added a new module to handle survey logic, including initializing the survey, counting usage, and prompting users based on specific criteria with two stages:
    • Previous engagement: logic in initSurvey to reduce noise and not annoy users who have already engaged with the survey
      • Prompt only once per day
      • Snooze the prompt for 3 sessions if user chose Remind Me Later
      • If user opted out or took the survey
        • Don't prompt again for the same version (major/minor)
        • Don't prompt again for 90 days
        • Once rearmed (after update and 90 days), wait for 9 sessions
    • Scored feature usage: to prompt users based on their usage of specific features while (or after) they are using them
      • Features of interest can call promptAfterActionEventually to trigger the survey prompt based on the user's actions.
        • A score must be specified, which indicates how important the feature is for the survey prompt to show.
        • Additionally an experience must be specified (Mongo or NoSQL), a separate score will be tracked for each experience.
        • Prompt will only be shown if a score of 100 was reached for all experiences summarised.
        • A different Survey URL will be used based on which experience had the highest usage score.
      • Features which should not prompt but contribute to the score should call countExperienceUsageForSurvey with an appropriate score.

Codebase Modifications:

Dependency Updates:

  • package.json: Added a new dependency for @types/semver to support the survey feature.

There are two stages for the survey prompt to show

  • Connect to Mongo* Interactions (@tnaum-ms)
  • Remove TODO comments from survey.ts
  • Test E2E before merging

Copy link
Collaborator

@tnaum-ms tnaum-ms 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 to me.

Here, I'm sharing an idea for an improvement (Experience API mapping), and a reminder about your //TODO about removing a timer from initSurvey

@sevoku sevoku changed the title Add HaTS Survey promot Add HaTS Survey prompt Mar 7, 2025
@sevoku sevoku requested review from bk201-, Copilot and tnaum-ms March 11, 2025 23:04
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 a new HaTS survey feature that prompts users to provide feedback on their NoSQL and MongoDB experiences. The changes include a new survey utilities module, integration of survey prompts and usage tracking across various views and panels, and an update to dependencies.

Reviewed Changes

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

Show a summary per file
File Description
src/utils/surveyTypes.ts Added type definitions for usage impact and experience kind.
src/utils/survey.ts Introduced survey logic including candidate selection, prompt handling, and telemetry updates.
src/webviews/mongoClusters/collectionView/components/toolbar/ToolbarViewNavigation.tsx Integrated survey ping calls for navigation interactions.
src/webviews/mongoClusters/documentView/documentView.tsx Added survey ping call on document view actions.
src/webviews/mongoClusters/collectionView/CollectionView.tsx Added survey ping call on view selection.
src/webviews/mongoClusters/collectionView/components/toolbar/ToolbarTableNavigation.tsx Added survey ping calls in toolbar navigation actions.
src/panels/QueryEditorTab.ts Integrated survey prompt calls on query actions.
src/webviews/mongoClusters/collectionView/collectionViewRouter.ts Added survey prompt call after retrieving collection data.
src/webviews/api/configuration/appRouter.ts Added a surveyPing mutation endpoint invoking the survey prompt mechanism.
src/webviews/mongoClusters/documentView/documentsViewRouter.ts Added survey prompt call after document creation.
src/tree/docdb/DocumentDBItemsResourceItem.ts Added usage tracking calls for survey within document DB items.
src/panels/DocumentTab.ts Integrated a survey prompt call when opening a document tab.
src/tree/docdb/DocumentDBDatabaseResourceItem.ts Added usage tracking call for survey within the database resource item.
Comments suppressed due to low confidence (1)

src/utils/survey.ts:139

  • [nitpick] The constant 'SKIP_INITIAL_SESSIONS' is used to gate the prompt based on session count, but its name may be slightly misleading. Consider renaming it to 'MIN_SESSIONS_BEFORE_PROMPT' for improved clarity.
if (sessionCount < SKIP_INITIAL_SESSIONS) {

@sevoku sevoku marked this pull request as ready for review March 13, 2025 14:33
@sevoku sevoku requested a review from a team as a code owner March 13, 2025 14:33
bk201-
bk201- previously approved these changes Mar 13, 2025
@sevoku
Copy link
Member Author

sevoku commented Mar 14, 2025

Here is a PR with tests: #2598
@tnaum-ms would be great if you could test the other build, if everything looks fine, we'll merge both.

Copy link
Collaborator

@tnaum-ms tnaum-ms left a comment

Choose a reason for hiding this comment

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

I reviewed the files, I read and understood survey.ts and didn't spot any issues.

I also tested the flow a few times, with the flag const DEBUG_ALWAYS_PROMPT = true; set. Didn't experience any issues.

@sevoku sevoku merged commit 2e2ff7d into main Mar 14, 2025
2 checks passed
@sevoku sevoku deleted the dev/sevoku/hats-survey branch March 14, 2025 16:46
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.

5 participants