Fix Sentry noise: downgrade unknown-feature warning from reportError to console.warn#2759
Open
bengotow wants to merge 3 commits into
Open
Fix Sentry noise: downgrade unknown-feature warning from reportError to console.warn#2759bengotow wants to merge 3 commits into
bengotow wants to merge 3 commits into
Conversation
Contributor
…to console.warn AppEnv.reportError (which sends to Sentry) was called inside _dataForFeature whenever a feature key was absent from the identity's featureUsage map. This is expected during new-feature rollout — the server hasn't necessarily added the feature to all users' identities yet. For example, every logged-in user who opened the composer after the grammar-check feature shipped would generate a "Warning: No usage information available for grammar-check" Sentry event on every render of GrammarCheckToggle. Change to console.warn so the warning is still visible in devtools without flooding Sentry. Return value (EMPTY_FEATURE_USAGE) is unchanged, so the feature defaults to "usable" during the rollout window. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wa5rMERDupj7BbeEMtKXe3
- grammar-check-store.ts line 104: wrap long if condition onto multiple lines - feature-usage-store.tsx line 162: wrap console.warn argument onto its own line Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wa5rMERDupj7BbeEMtKXe3
de3a421 to
ca6f7d6
Compare
…tError The test for the unknown-feature path was asserting that AppEnv.reportError was called, which matched the old behavior. Now that the path uses console.warn to avoid flooding Sentry, update the spy and assertion to match. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wa5rMERDupj7BbeEMtKXe3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was observed
FeatureUsageStore._dataForFeature()calledAppEnv.reportError()— which routes to Sentry — whenever a feature key was absent from the user's identityfeatureUsagemap:GrammarCheckToggle.render()callsFeatureUsageStore.isUsable('grammar-check')on every render. Sincegrammar-checkis a newly shipped feature, the server may not have added it to all existing users' identity objects yet. This means every logged-in user who opens the composer generates a"Warning: No usage information available for grammar-check"Sentry event on each render, until their identity is refreshed from the server.The same pattern would fire for any other feature that is added to the app before the server adds it to the identity schema.
Root cause
AppEnv.reportErrorwas used here to catch coding mistakes (e.g. a typo in a feature ID), but it is too aggressive for production. A feature being absent from the identity is an expected transient state during new-feature rollout, not an application error. UsingreportErrorfloods Sentry with noise that obscures real issues.Fix
Downgrade to
console.warnso the warning is still visible in DevTools without reaching Sentry. The return value (EMPTY_FEATURE_USAGE, which causesisUsableto returntrue) is unchanged, so the feature defaults to "usable" during the rollout window — the correct behaviour.Test plan
console.warnstill appears in DevTools when a feature is missing from identity🤖 Generated with Claude Code
https://claude.ai/code/session_01Wa5rMERDupj7BbeEMtKXe3
Generated by Claude Code