Skip to content

Align Analytics Events with Docs/Metrics Conventions and Fix Tracking Gaps #86exvrzy8#32

Merged
navidshad merged 9 commits into
mainfrom
dev
Jun 8, 2026
Merged

Align Analytics Events with Docs/Metrics Conventions and Fix Tracking Gaps #86exvrzy8#32
navidshad merged 9 commits into
mainfrom
dev

Conversation

@navidshad

@navidshad navidshad commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

🏷️ PR Title: Align Analytics Events with Docs/Metrics Conventions and Fix Tracking Gaps

📋 Summary

This PR updates analytics event tracking to align with documentation and metrics conventions, addressing missing events and closing existing tracking gaps. It also fixes issues related to importing authentication in unit test suites and updates the gitignore to include .agent. Additionally, the Chrome Extension Tester MCP is set as the default verification workflow.

🔗 Related Tasks

  • CU-86exvrzy8 - Close analytics gaps against docs/metrics convention names and track missing events in Stripe webhook lifecycle

📝 Additional Details

  • Fixed import issues to ensure unit test suites load correctly by importing authentication from the client library.
  • Tweaked .gitignore to include .agent files.
  • Updated documentation to set chrome-extension-tester MCP as the default verification workflow.

📜 Commit List

navidshad and others added 8 commits June 5, 2026 11:58
Add a Verifying changes section establishing the chrome-extension-tester (Playwright) MCP as the default per-change verification tool (local + CCW), with cross-links from the Cloud agent workflow, Verification checklist, and Useful pointers sections.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…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>
…gaps-against-docsmetrics-convention-names-missing-events-Stripe-webhook-lifecycle_Navid-Shad

Title: Align Analytics Events with Documentation and Fix Unit Test Imports #86exvrzy8
# [1.13.0-dev.3](v1.13.0-dev.2...v1.13.0-dev.3) (2026-06-08)

### Bug Fixes

* **analytics:** import authentication from client lib so unit suites load ([902436f](902436f))

### Features

* **analytics:** align events with docs/metrics conventions, close tracking gaps ([6e3236e](6e3236e))
@navidshad

Copy link
Copy Markdown
Collaborator Author

@navidshad navidshad changed the title Dev Align Analytics Events with Docs/Metrics Conventions and Fix Tracking Gaps #86exvrzy8 Jun 8, 2026
# [1.14.0-dev.1](v1.13.0...v1.14.0-dev.1) (2026-06-08)

### Bug Fixes

* **analytics:** import authentication from client lib so unit suites load ([902436f](902436f))

### Features

* **analytics:** align events with docs/metrics conventions, close tracking gaps ([6e3236e](6e3236e))
@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 📦🚀

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: 86exvrzza — Align extension analytics events with docs/metrics


Task alignment

The PR covers the extension-scoped subtask (86exvrzza) only — the dashboard and server subtasks (86exvt00m, 86exvt01x) belong to other repos, as expected.

  • Rename legacy/dash-named events"Definition translated""definition_translated" (Definition.vue); "Word hovered""phrase_hovered" (Subtitle.vue); "Error on initiating""extension_init-failed" (main.ts). All three are now snake_case aligned with the naming convention.
  • Add phrase_clicked — fired in Word.vue > OpenWordDetail() before the emitOpen call, with word and platform properties.
  • Add user_logged-in — fired in LoginView.vue > handleTokenLogin() with a comment clarifying it does not fire on session restores.
  • Pass userId for server-side translation_requestedauthentication.user?.id appended to both fetchSimpleTranslation and fetchDetailedTranslation payloads in translate.service.ts.
  • Test mocks updatedauthentication: { user: { id: "test-user-id" } } added to the @modular-rest/client mock in all three affected test files.
  • Docs updatedCLAUDE.md promotes the chrome-extension-tester MCP as the default verification workflow and cross-links to the new § Verifying changes section from both the checklist and the cloud-agent section.

Commit messages

  • feat(analytics): align events with docs/metrics conventions, close tracking gaps — correct type, descriptive.
  • fix(analytics): import authentication from client lib so unit suites load — correct type for a broken-test fix.
  • ⚠️ tweak gitignore to add .agent — missing a conventional-commit type prefix. Should be chore: add .agent to gitignore. It has no impact on versioning (semantic-release ignores it), but it's inconsistent with the repo's convention.
  • docs: make chrome-extension-tester MCP the default verification workflow — correct type and clear.

Prior review follow-up

No prior automated or manual review requests on this PR.


Convention check

  • ✅ Analytics event names are consistently noun_verb with underscores; compound verbs use hyphens (user_logged-in, extension_init-failed) — consistent with the explicitly required event names listed in the task.
  • ✅ No new Vue mount points added, so the .subturtle-scope rule is not triggered.
  • ✅ No new bundle entries; no import from ConsoleCrane store in feature bundles.
  • ⚠️ .gitignore still lacks a trailing newline after .agent (\ No newline at end of file). The file had the same issue before this PR, so this is pre-existing — but worth fixing in a follow-up.
  • Minor: window.location.hostname is used as the platform property in the phrase_clicked event (Word.vue:99). This gives the raw hostname (e.g. "www.youtube.com"). If the metrics convention expects a short platform identifier (e.g. "youtube"), consider normalising it. Not a blocking issue.

Verdict

APPROVE

The extension subtask is fully and correctly addressed: all required renames are done, all missing events are added, test mocks are in sync, and docs are updated. The one flagged commit message (tweak gitignore) is a minor style issue that doesn't affect correctness or release automation.


Generated by Claude Code

@navidshad navidshad removed the review label Jun 8, 2026 — with Claude

Copy link
Copy Markdown
Collaborator Author

Automated PR Review

Primary Task: CU-86exvrzy8 — Close analytics gaps against docs/metrics: convention names, missing events, Stripe-webhook lifecycle
Extension subtask: CU-86exvrzza — Align extension analytics events: rename legacy names, add phrase_clicked and user_logged-in, pass userId


Task alignment

The PR covers exactly the extension subtask (CU-86exvrzza). All six deliverables are present:

Requirement Status Notes
Rename "Word hovered" → phrase_hovered src/subtitle/_support-template/components/Subtitle.vue
Rename "Definition translated" → definition_translated src/console-crane/components/Definition.vue
Rename "Error on initiating" → extension_init-failed src/main.ts
Add phrase_clicked { word, platform } on subtitle word click src/subtitle/components/specific/Word.vue — correctly handles both single-word and multi-word selection
Fire user_logged-in only on explicit login (not session restore) src/popup/views/LoginView.vue:244 — placed after loginWithLastSession() completes
Pass userId to both translate calls src/common/services/translate.service.ts — both fetchSimpleTranslation and fetchDetailedTranslation paths updated

The dashboard subtask (CU-86exvt00m) and Stripe-webhook subtask (CU-86exvt01x) are explicitly out of scope for this repo — correct.


Commit messages

Commit Assessment
feat(analytics): align events with docs/metrics conventions, close tracking gaps ✅ Correct type — introduces new events and renames (new capability)
fix(analytics): import authentication from client lib so unit suites load ✅ Correct type — test suite was broken without this
docs: make chrome-extension-tester MCP the default verification workflow ✅ Correct type
tweak gitignore to add .agent ⚠️ Missing conventional-commit type prefix — should be chore: add .agent to .gitignore. Low impact (no-release type either way) but inconsistent with the repo's convention.
Merge + release commits ✅ Auto-generated, no issues

Prior review follow-up

No prior reviews on this PR.


Convention check

  • ✅ No bundle architecture violations — no cross-bundle imports, bridge used correctly
  • ✅ Test mocks updated in all three affected test files (nibble-surface.test.ts, selection-popup.test.ts, translate.service.test.ts) to expose authentication.user.id
  • ✅ Comments in translate.service.ts and LoginView.vue follow the CLAUDE.md "explain the WHY" rule
  • phrase_clicked correctly reads markerStore.selectedPhrase for multi-word selections and props.modelValue for single-word — matches the existing pattern in OpenWordDetail
  • ⚠️ .gitignore is missing a trailing newline after .agent — cosmetic, but the previous entry (/test-results) also had this issue before this commit, so the line is at least consistent now

Verdict

APPROVE

All subtask requirements are fully implemented, the right files were touched, test mocks are correct, and the code follows project conventions. The only friction is the one commit missing its type prefix (tweak gitignore) — not a blocker.


Generated by Claude Code

@navidshad navidshad merged commit 9d36e00 into main Jun 8, 2026
@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.

2 participants