Skip to content

packages/analytics implementation is never wired into packages/ui — it's dead code #851

Description

@BigBen-7

What's wrong

`packages/analytics` has a real, tested implementation: `EventEmitter`, `ConsoleSink`/`HttpSink`/`FileSink`, sampling, deduplication, retry, PII scrubbing, a dead-letter queue — 87 passing tests across 14 files.

`packages/ui` has a completely separate, ad-hoc analytics implementation instead of using it:

  • `packages/ui/src/lib/analytics.ts` (28 lines) — its own `track()` + listener registry
  • `packages/ui/src/lib/analyticsEvents.ts`, `analyticsPrivacy.ts`, `apiErrorTracking.ts`, `searchTracking.ts` — more parallel, hand-rolled tracking helpers

Nothing in `packages/ui` imports `@stellar-explain/analytics` (checked — zero matches). Whatever `packages/analytics` does (sampling, retry, PII scrubbing, sinks) never actually runs in the app; the UI's own mini-implementation has none of that behavior.

Why it matters

This is likely why analytics "isn't working" in practice — the tested, feature-complete package sits unused while a much thinner duplicate handles real traffic with none of its guarantees (no retry on failed sends, no PII scrubbing, no sampling).

Suggested fix

Either:

  1. Have `packages/ui`'s tracking calls actually construct and use an `EventEmitter` from `@stellar-explain/analytics` with a real sink (`HttpSink` pointed at the analytics endpoint), removing the duplicate `lib/analytics*.ts` files, or
  2. If the UI-side implementation was intentionally kept separate for a reason, document why and what `packages/analytics` is actually for.

Depends on #853 — the package has no entry point yet, so it can't be imported until that lands.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third Campaign

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions