Skip to content

Title: Align Analytics Events with Documentation and Fix Unit Test Imports #86exvrzy8 #31

Merged
navidshad merged 3 commits into
devfrom
CU-86exvrzy8_Close-analytics-gaps-against-docsmetrics-convention-names-missing-events-Stripe-webhook-lifecycle_Navid-Shad
Jun 8, 2026
Merged

Title: Align Analytics Events with Documentation and Fix Unit Test Imports #86exvrzy8 #31
navidshad merged 3 commits into
devfrom
CU-86exvrzy8_Close-analytics-gaps-against-docsmetrics-convention-names-missing-events-Stripe-webhook-lifecycle_Navid-Shad

Conversation

@navidshad

@navidshad navidshad commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

🏷️ PR Title: Align Analytics Events with Documentation and Fix Unit Test Imports

📋 Summary

This PR enhances the analytics module by aligning event tracking with official documentation and metrics conventions, closing existing tracking gaps. It also fixes the import of the authentication module from the client library to ensure unit test suites load correctly. Additionally, the .gitignore file is updated to exclude .agent files.

🔗 Related Tasks

#902436f - Fix (analytics): import authentication from client lib so unit suites load
#6e3236e - Feat (analytics): align events with docs/metrics conventions, close tracking gaps

📝 Additional Details

  • Updated .gitignore to add .agent entries to avoid committing agent files.
  • The fixes improve both development workflow and analytics data accuracy.

📜 Commit List

c0eebf4 tweak gitignore to add .agent
902436f fix(analytics): import authentication from client lib so unit suites load
6e3236e feat(analytics): align events with docs/metrics conventions, close tracking gaps

navidshad and others added 3 commits June 7, 2026 13:00
…acking gaps

- Rename legacy names: 'Word hovered' -> phrase_hovered, 'Definition
  translated' -> definition_translated, 'Error on initiating' ->
  extension_init-failed. Old prod data stays under the old names.
- Add phrase_clicked { word, platform } in Word.vue — the doc's core
  interaction event was never fired.
- Add user_logged-in on explicit login success (popup LoginView);
  session restores do not fire it.
- Pass userId to translateWithContext so the server can fire the
  translation_requested server-truth event.
…load

The analytics commit imported `authentication` from plugins/modular-rest,
which runs GlobalOptions.set() plus chrome listeners and profile-store wiring
at module load. Three unit suites (translate.service, nibble-surface,
selection-popup) mock @modular-rest/client with only `functionProvider`, so
pulling in the plugin threw "No GlobalOptions export is defined on the mock"
and the files failed to load — yarn test dropped from 138 to 124.

Import `authentication` straight from @modular-rest/client (the same singleton
the plugin re-exports, and how functionProvider is already imported in this
file) and stub it in the three mocks. No plugin side-effects in the service.
yarn test back to 138/138; typecheck clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@navidshad

Copy link
Copy Markdown
Collaborator Author

Copy link
Copy Markdown
Collaborator Author

Automated PR Review

Primary Task: Close analytics gaps against docs/metrics: convention names, missing events, Stripe-webhook lifecycle
Extension subtask: Align extension analytics events with docs/metrics: rename legacy names, add phrase_clicked and user_logged-in, pass userId for translation tracking


Task alignment

The diff is correctly scoped to the extension subtask 86exvrzza. All six touch files listed in the task are present.

  • phrase_hovered"Word hovered" renamed in src/subtitle/_support-template/components/Subtitle.vue
  • definition_translated"Definition translated" renamed in src/console-crane/components/Definition.vue
  • extension_init-failed"Error on initiating" renamed in src/main.ts
  • phrase_clicked { word, platform } — new event added in src/subtitle/components/specific/Word.vue, fires before emitOpen, correctly handles both single-word and multi-word selection
  • user_logged-in — fired only in handleTokenLogin in src/popup/views/LoginView.vue, not on session restores (the inline comment explains the invariant)
  • userId passed in translate service — both fetchSimpleTranslation and fetchDetailedTranslation now include authentication.user?.id; optional-chaining handles the logged-out case cleanly
  • Auth import fixauthentication now imported alongside functionProvider from @modular-rest/client; three test mocks updated to match

The other two sibling subtasks (dashboard frontend 86exvt00m, backend/server 86exvt01x) are correctly out of scope for this PR.


Commit messages

  • ⚠️ tweak gitignore to add .agent — missing the conventional-commit type prefix. Should be chore: tweak gitignore to add .agent. A bare verb like "tweak" passes through semantic-release without triggering a version bump, but it violates the repo convention and will look odd in the changelog. Low risk for this specific commit, but worth correcting.
  • fix(analytics): import authentication from client lib so unit suites load
  • feat(analytics): align events with docs/metrics conventions, close tracking gaps

Convention check

  • ✅ No new abstractions or scope creep.
  • ✅ Comments in LoginView.vue are multi-line and explain a non-obvious invariant (explicit login vs. session restore) — matches the project's "multi-line encouraged for non-obvious why" rule in CLAUDE.md.
  • ✅ Inline comments in translate.service.ts are single-line explaining the server-side purpose — appropriate.
  • ⚠️ PR body task links are incorrect. The "Related Tasks" section links #902436f and #6e3236e to https://app.clickup.com/t/902436f and https://app.clickup.com/t/6e3236e — these are commit short-SHAs, not ClickUp task IDs. Those ClickUp URLs 404. The correct tasks are 86exvrzy8 (parent) and 86exvrzza (extension subtask). Cosmetic issue only — the PR bot comment already links the right task.
  • .gitignore .agent entry is correctly placed; the missing trailing newline matches the surrounding file style (prior last line also had no newline at EOF).

Verdict

APPROVE

All subtask requirements for the extension scope are fully implemented and correct. The one structural issue (missing chore: prefix on the gitignore commit) is low-risk and won't cause a bad release bump, but should be noted for future commits.


Generated by Claude Code

@navidshad navidshad changed the title Cu 86exvrzy8 close analytics gaps against docsmetrics convention names missing events stripe webhook lifecycle navid shad Title: Align Analytics Events with Documentation and Fix Unit Test Imports #86exvrzy8 Jun 8, 2026
@navidshad navidshad merged commit d75bc62 into dev Jun 8, 2026
3 checks passed
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 1.13.0-dev.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 1.14.0-dev.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 1.14.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant