Skip to content

WS-3212: Introduce client-side error tracking for IDCTA and UAS - #14377

Open
elvinasv wants to merge 12 commits into
latestfrom
WS-3212-introduce-client-side-error-tracking-using-use-custom-event-tracker-for-idcta-and-uas-functionality
Open

WS-3212: Introduce client-side error tracking for IDCTA and UAS#14377
elvinasv wants to merge 12 commits into
latestfrom
WS-3212-introduce-client-side-error-tracking-using-use-custom-event-tracker-for-idcta-and-uas-functionality

Conversation

@elvinasv

@elvinasv elvinasv commented Sep 8, 2026

Copy link
Copy Markdown
Member

Resolves JIRA: https://bbc.atlassian.net/browse/WS-3212

Summary

This PR introduces a new client-side “error” analytics beacon (Piano/Reverb) and wires it into the UAS save/remove flow so client-side failures can be tracked with richer diagnostic context (status + service error code/message when available).

Changes:

Add a new buildErrorEventModel + sendErrorEvent utility to send standalone Reverb “error” beacons.
Extend UAS error handling to capture error bodies (JSON { key, message } or plain text) and expose them via UasError.
Add useErrorTracking and integrate it into useUASButton (including offline filtering) while updating Reverb beacon types to support the new error event.

Screenshot 2026-09-09 at 13 03 11

Piano dashboard

Code changes

  • Fixes offline user Save Article Button spinner
  • Introduces buildErrorEventModel and useErrorTracking
  • Adds error tracking to the UAS related hooks

Testing

  1. Use Charles to Rewrite or breakpoints to mock error states (e.g.)
Screenshot 2026-09-09 at 16 51 40

More details re. Charles Proxy

Useful Links

@elvinasv elvinasv changed the title WS-3212: Introduce client-side error tracking using useCustomEventTracker for IDCTA and UAS functionality WS-3212: Introduce client-side error tracking for IDCTA and UAS Sep 9, 2026
@elvinasv elvinasv self-assigned this Sep 9, 2026
@elvinasv
elvinasv marked this pull request as ready for review September 9, 2026 11:38
Copilot AI lite review requested due to automatic review settings September 9, 2026 11:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

It introduces a type-safety regression in shared Reverb event typing and the implementation scope appears to diverge from the stated “IDCTA and UAS” tracking goal.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR introduces a new client-side “error” analytics beacon (Piano/Reverb) and wires it into the UAS save/remove flow so client-side failures can be tracked with richer diagnostic context (status + service error code/message when available).

Changes:

  • Add a new buildErrorEventModel + sendErrorEvent utility to send standalone Reverb “error” beacons.
  • Extend UAS error handling to capture error bodies (JSON { key, message } or plain text) and expose them via UasError.
  • Add useErrorTracking and integrate it into useUASButton (including offline filtering) while updating Reverb beacon plumbing/types to support the new error event.
File summaries
File Description
src/app/lib/uasApi/index.ts Parses UAS error bodies and passes diagnostic detail into UasError.
src/app/lib/uasApi/index.test.ts Adds coverage for JSON vs plain-text UAS error bodies.
src/app/lib/uasApi/errors.ts Extends UasError to carry code and serviceMessage.
src/app/lib/analyticsUtils/sendErrorEvent/index.ts New utility to build and send standalone “error” beacons.
src/app/lib/analyticsUtils/sendErrorEvent/index.test.ts Tests beacon sending/guard conditions for error events.
src/app/lib/analyticsUtils/sendBeacon/index.ts Allows Reverb “error” events and forwards error label payload.
src/app/lib/analyticsUtils/sendBeacon/index.test.ts Adds a test ensuring the error label is forwarded to Reverb.
src/app/hooks/useUASButton/index.ts Tracks UAS failures (fetch-status, metadata-sync, save/remove) and filters offline actions.
src/app/hooks/useUASButton/index.test.tsx Adds tests for offline handling and UAS error tracking integration.
src/app/hooks/useErrorTracking/index.tsx New hook to translate errors into a structured analytics “error” event.
src/app/hooks/useErrorTracking/index.test.tsx Tests tracking context wiring, UasError detail extraction, and offline filtering.
src/app/components/ATIAnalytics/types.ts Updates Reverb event typing to include error events/labels.
src/app/components/ATIAnalytics/atiUrl/index.ts Adds buildErrorEventModel to generate the new error beacon payload.
src/app/components/ATIAnalytics/atiUrl/index.client.test.ts Adds tests for buildErrorEventModel.
Review details
  • Files reviewed: 14/14 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/app/components/ATIAnalytics/types.ts
Comment thread src/app/components/ATIAnalytics/atiUrl/index.ts
Comment thread src/app/hooks/useErrorTracking/index.tsx
Comment thread src/app/hooks/useUASRecentActivity/index.ts Outdated
Comment thread src/app/hooks/useUASButton/index.ts
Comment thread src/app/lib/uasApi/index.ts Outdated
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.

5 participants