Skip to content

Core: Ensure telemetry is never triggered on initial load of checklist data#33918

Merged
ghengeveld merged 2 commits intonextfrom
fix-checklist-telemetry
Feb 25, 2026
Merged

Core: Ensure telemetry is never triggered on initial load of checklist data#33918
ghengeveld merged 2 commits intonextfrom
fix-checklist-telemetry

Conversation

@ghengeveld
Copy link
Copy Markdown
Member

@ghengeveld ghengeveld commented Feb 24, 2026

What I did

Added a check to prevent triggering telemetry on initial load of checklist data from persistence.

Unfortunately, I was not able to reproduce the problem locally. However, the data suggests that telemetry is triggered when loading from persistence, because controls and viewports appear over-reported. These two items have very high completion rates despite normally requiring a manual user action (changing controls or switching viewports). As such, I want to eliminate the possibility by adding this extra guard.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

Unfortunately it's unknown how to reproduce the original issue.

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>

@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Feb 24, 2026

View your CI Pipeline Execution ↗ for commit 04fd300

Command Status Duration Result
nx run-many -t compile,check,knip,test,pretty-d... ❌ Failed 9m 54s View ↗

☁️ Nx Cloud last updated this comment at 2026-02-25 16:38:57 UTC

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 24, 2026

📝 Walkthrough

Walkthrough

The PR modifies telemetry handling in the checklist utility by removing the dequal import and adding an early return guard that skips telemetry processing when loading from persistence during the initial load transition, preventing telemetry events from firing in this scenario.

Changes

Cohort / File(s) Summary
Telemetry Guard Logic
code/core/src/core-server/utils/checklist.ts
Removed dequal import and added early return condition that skips telemetry and state-diff processing when previousState.loaded is false, preventing onboarding telemetry from firing during initial persistence-based loading.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
code/core/src/core-server/utils/checklist.ts (1)

87-90: Consider narrowing the guard to the explicit false → true transition.

The current condition !previousState.loaded skips telemetry for any state change where the previous state had loaded: false. In this codebase that only ever happens once (the initial setState call sets loaded: true), so the fix is correct today. However, if a future refactor ever drops the loaded: true assignment, this guard would silently swallow all telemetry without any obvious signal.

Tightening the condition to also assert state.loaded makes the intent precise:

💡 Proposed refinement
-      // Skip telemetry when loading from persistence (first transition to loaded: true)
-      if (!previousState.loaded) {
+      // Skip telemetry when loading from persistence (first transition to loaded: true)
+      if (!previousState.loaded && state.loaded) {
         return;
       }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@code/core/src/core-server/utils/checklist.ts` around lines 87 - 90, The guard
currently returns whenever previousState.loaded is falsy, which is too broad;
change the check in checklist.ts to only skip telemetry on the explicit
false→true transition by testing both sides: return early only when
previousState.loaded === false && state.loaded === true (so reference the
previousState and state.loaded symbols and update that conditional accordingly).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@code/core/src/core-server/utils/checklist.ts`:
- Around line 87-90: The guard currently returns whenever previousState.loaded
is falsy, which is too broad; change the check in checklist.ts to only skip
telemetry on the explicit false→true transition by testing both sides: return
early only when previousState.loaded === false && state.loaded === true (so
reference the previousState and state.loaded symbols and update that conditional
accordingly).

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 10d1e88 and 3b7f67d.

📒 Files selected for processing (1)
  • code/core/src/core-server/utils/checklist.ts

@ghengeveld ghengeveld merged commit 1c3fef3 into next Feb 25, 2026
122 of 125 checks passed
@ghengeveld ghengeveld deleted the fix-checklist-telemetry branch February 25, 2026 20:10
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.

2 participants