refactor(analytics): migrate gen-ai tracking to shared analytics context API #10763
All Vouch review confidence checks passed
Residual risk 0.28 = Change Risk (0.71) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.71 · 534 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.376
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.071
Real PR Conversation Timeline
1 comments
"Review active on #10763"
general
weight: 0.35
ikeola13
Fixes: https://redhat.atlassian.net/browse/RHAI-21479
Fixes: https://redhat.atlassian.net/browse/RHAI-21480
Fixes: https://redhat.atlassian.net/browse/RHAI-21481
Fixes: https://redhat.atlassian.net/browse/RHAI-21482
Problem
GenAI sends feature events through dashboard-internal analytics helpers. This couples reusable asset, playground, document/media/MCP, and response-service code to the dashboard's delivery implementation instead of the tracking callback supplied by its host.
Solution
TrackEventcallback into clipboard, document, and response helpers so they remain usable outside React. Preserve event names, payloads, emission conditions, and the public response-request interface.createStandaloneAnalyticsusing module-owned build metadata. Federated and embedded consumers inherit their parent's provider; host policy continues to control delivery.Evidence
| Area | Validation |
| --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| GenAI | Lint, public-type checks, TypeScript checks, all 2,136 unit tests, and the production build pass. |
| Shared analytics | Lint, TypeScript checks, and all 42 unit tests pass. |
| MaaS Portal | All 72 unit/configuration tests, application and Cypress type-checks, the production build, and all 37 mocked browser tests across six specs pass. |
| AutoRAG embedding | All 16 focused provider-wiring and playground-embedding tests pass. |
| Shared infrastructure | Federation checks and
git diff --checkpass. |Focused coverage verifies clipboard success/rejection, null/array forwarding, standalone and embedded provider wiring, profile callback replacement, and guardrail errors/refusals through normal SSE lines and trailing buffers. Added asynchronous cases use explicitly resolved promises or completed streams without wall-clock sleeps. The caller audit confirms no remaining legacy analytics imports in GenAI and unchanged event names and payload expressions across 132 migrated calls.
MaaS Portal's GenAI routes inherit its existing
NoopAnalyticsTrackingProvider, preserving intentionally disabled analytics. MaaS Portal browser tests exercise model endpoints, model access, API keys, subscriptions, observability, and the user dropdown. Opening endpoint details exercises a migrated tracking call. No MaaS Portal code changes are required.Production builds report bundle-size warnings.
<details>
<summary>Validation commands</summary>
Run from the repository root:
</details>