Skip to content

feat(telemetry): track workspace feature flags in workspace features observed#12976

Draft
jordanl17 wants to merge 1 commit into
mainfrom
feat/workspace-feature-telemetry
Draft

feat(telemetry): track workspace feature flags in workspace features observed#12976
jordanl17 wants to merge 1 commit into
mainfrom
feat/workspace-feature-telemetry

Conversation

@jordanl17

Copy link
Copy Markdown
Member

Description

Expands the existing Workspace Features Observed telemetry event from a single advancedVersionControlEnabled flag to a flat snapshot of the workspace feature flags, via a new collectWorkspaceFeatures(workspace) helper. The snapshot covers releases, tasks, scheduled drafts, scheduled publishing (both effective and explicit opt-in), media library, canvas, variants, events API (documents and releases), announcements, drafts, partial indexing, file and image direct uploads, and search strategy.

The event name and version: 1 are intentionally left unchanged so existing queries stay backwards compatible - the new fields are purely additive and the original advancedVersionControlEnabled field is preserved.

While here, the event is now deduped per workspace: it fires once per workspace identity (re-emitting when the active workspace changes) rather than double-firing under React StrictMode.

What to review

collectWorkspaceFeatures in featureAvailability.telemetry.ts - the field selection and the ?? default fallbacks, which mirror the config reducers so an unset option reports its effective value. Every field is a low-cardinality boolean, small enum, or short number; there is deliberately no free text, identifier, customer value, project/dataset (already on the envelope), or token.

The per-workspace dedupe ref in StudioTelemetryProvider.tsx is keyed on ${projectId}:${name}, so a workspace switch still re-emits while a StrictMode remount does not.

scheduledPublishing is tracked as two fields: scheduledPublishingEnabled (effective, on by default) and scheduledPublishingExplicitlyEnabled (the explicit opt-in __internal__workspaceEnabled, which is the real adoption signal). The gating that consumes both lives in ScheduledPublishingEnabledProvider.

Testing

Unit tests in StudioTelemetryProvider.test.tsx cover the effective defaults, explicitly configured flags, the complete payload shape, StrictMode deduplication, and re-emission on workspace switch. All 15 tests pass; type-check, eslint, and format are green.

Notes for release

N/A

Copilot AI review requested due to automatic review settings June 8, 2026 19:05
@vercel

vercel Bot commented Jun 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
auth-test-studio Ready Ready Preview, Comment Jun 8, 2026 7:07pm
page-building-studio Ready Ready Preview, Comment Jun 8, 2026 7:07pm
test-studio Ready Ready Preview, Comment Jun 8, 2026 7:07pm

Request Review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Expands the Workspace Features Observed telemetry event to emit a flat, low-cardinality snapshot of resolved workspace feature flags (instead of only advancedVersionControlEnabled), and prevents duplicate emission per workspace in React StrictMode while still re-emitting on active workspace changes.

Changes:

  • Added collectWorkspaceFeatures(workspace) helper to generate the expanded telemetry payload (with reducer-aligned defaults).
  • Updated StudioTelemetryProvider to log the expanded payload and dedupe the event per workspace identity.
  • Extended unit tests and updated telemetry documentation to reflect the richer event payload.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
packages/sanity/src/core/studio/telemetry/StudioTelemetryProvider.tsx Uses collectWorkspaceFeatures and adds per-workspace dedupe for Workspace Features Observed emission.
packages/sanity/src/core/studio/telemetry/tests/StudioTelemetryProvider.test.tsx Adds coverage for expanded payload fields, default/effective values, StrictMode dedupe, and workspace-switch re-emission.
packages/sanity/src/core/studio/telemetry/featureAvailability.telemetry.ts Defines the expanded event payload shape and implements collectWorkspaceFeatures mapping with effective defaults.
docs/TELEMETRY.md Updates the event description to document the expanded workspace feature snapshot.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants