Skip to content

refactor: extract AnalyticsRuntime trait#4231

Open
yujonglee wants to merge 2 commits intomainfrom
refactor/extract-analytics-runtime
Open

refactor: extract AnalyticsRuntime trait#4231
yujonglee wants to merge 2 commits intomainfrom
refactor/extract-analytics-runtime

Conversation

@yujonglee
Copy link
Contributor

  • Add AnalyticsRuntime trait to crates/analytics with enrich, distinct_id, is_disabled, set_disabled
  • Add AnalyticsService wrapper that delegates enrichment/gating to the runtime
  • Implement TauriAnalyticsRuntime in plugins/analytics with desktop-specific enrichment and store-backed disabled state
  • Simplify plugin ext.rs to delegate entirely to AnalyticsService
  • No changes to external callers or TS bindings

Signed-off-by: Yujong Lee <yujonglee.dev@gmail.com>
@netlify
Copy link

netlify bot commented Feb 25, 2026

Deploy Preview for hyprnote ready!

Name Link
🔨 Latest commit a4909fd
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote/deploys/699ee1e15636cb000856e315
😎 Deploy Preview https://deploy-preview-4231--hyprnote.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Feb 25, 2026

Deploy Preview for hyprnote-storybook canceled.

Name Link
🔨 Latest commit a4909fd
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote-storybook/deploys/699ee1e145e14f00088b4e4c

Signed-off-by: Yujong Lee <yujonglee.dev@gmail.com>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

pub use hypr_analytics::*;

pub type ManagedState = hypr_analytics::AnalyticsClient;
pub type ManagedState = hypr_analytics::AnalyticsService;
Copy link

Choose a reason for hiding this comment

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

Flag plugin breaks: managed state type changed

Medium Severity

The Tauri managed state type changed from AnalyticsClient to AnalyticsService, but the plugins/flag plugin still declares pub type ManagedState = hypr_analytics::AnalyticsClient and calls self.manager.state::<ManagedState>() in get_posthog_flag. Since only AnalyticsService is now managed, any code path reaching a Posthog-backed feature flag will trigger a runtime panic. Currently no features use FlagStrategy::Posthog, so this is latent but structurally broken.

Additional Locations (1)

Fix in Cursor Fix in Web

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.

1 participant