Skip to content

fix: move getConnectorTelemetryMeta from components/ to lib#1426

Merged
MODSetter merged 1 commit into
MODSetter:devfrom
guangyang1206:fix/1375-move-getConnectorTelemetryMeta-to-lib
May 23, 2026
Merged

fix: move getConnectorTelemetryMeta from components/ to lib#1426
MODSetter merged 1 commit into
MODSetter:devfrom
guangyang1206:fix/1375-move-getConnectorTelemetryMeta-to-lib

Conversation

@guangyang1206
Copy link
Copy Markdown
Contributor

@guangyang1206 guangyang1206 commented May 22, 2026

…ependency inversion

lib/posthog/events.ts was importing from components/assistant-ui/..., creating an inverted dependency layer (lib → components).

Move ConnectorTelemetryMeta type, CONNECTOR_TELEMETRY_REGISTRY, getConnectorTelemetryMeta, and getReauthEndpoint into the new lib/connector-telemetry.ts module so that lib/ no longer depends upward into the UI tree.

connector-constants.ts now re-exports from the new module for backward compatibility.

Fixes #1375

Description

Moves getConnectorTelemetryMeta and related types (ConnectorTelemetryMeta, ConnectorTelemetryGroup, CONNECTOR_TELEMETRY_REGISTRY) and getReauthEndpoint from components/assistant-ui/connector-popup/constants/connector-constants.ts to the new file lib/connector-telemetry.ts.

lib/posthog/events.ts now imports from @/lib/connector-telemetry instead of @/components/.../connector-constants, eliminating the inverted dependency from lib/components/.

connector-constants.ts re-exports these symbols from @/lib/connector-telemetry to preserve backward compatibility for existing importers.

Why

lib/posthog/events.ts is an analytics module that should sit below the UI layer in the dependency graph. However, it was statically importing functions from components/, causing:

  1. Refactoring/moving UI code could unintentionally break events.ts
  2. Code splitting cannot isolate the telemetry module independently
  3. Inverted dependency direction increases maintenance cost

By moving telemetry-related logic into lib/, the dependency direction becomes components/lib/, which aligns with the project's architecture expectations.

Changes

  • surfsense_web/lib/connector-telemetry.ts (new file): hosts ConnectorTelemetryMeta type, CONNECTOR_TELEMETRY_REGISTRY, getConnectorTelemetryMeta, getReauthEndpoint
  • surfsense_web/lib/posthog/events.ts: import path changed to @/lib/connector-telemetry
  • surfsense_web/components/assistant-ui/connector-popup/constants/connector-constants.ts: removed migrated content, now re-exports from @/lib/connector-telemetry

Testing

  • TypeScript compilation should produce no errors (ConnectorTelemetryMeta type and function signatures unchanged)
  • events.ts behavior with getConnectorTelemetryMeta is identical after the move
  • Existing importers from connector-constants.ts are unaffected due to re-exports

Related

Fixes #1375

…ependency inversion

lib/posthog/events.ts was importing from components/assistant-ui/...,
creating an inverted dependency layer (lib → components).

Move ConnectorTelemetryMeta type, CONNECTOR_TELEMETRY_REGISTRY,
getConnectorTelemetryMeta, and getReauthEndpoint into the new
lib/connector-telemetry.ts module so that lib/ no longer depends upward
into the UI tree.

connector-constants.ts now re-exports from the new module for
backward compatibility.

Fixes MODSetter#1375
@vercel
Copy link
Copy Markdown

vercel Bot commented May 22, 2026

@guangyang1206 is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 269f4bf8-4ed5-4a14-8ec3-7be521a0b014

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@MODSetter MODSetter merged commit 06bcc85 into MODSetter:dev May 23, 2026
5 of 9 checks passed
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