Skip to content

refactor: isolate Telemetry Inspector stream - #671

Merged
tariknz merged 3 commits into
mainfrom
feat/telemetry-inspector-debug-bridge
Aug 9, 2026
Merged

refactor: isolate Telemetry Inspector stream#671
tariknz merged 3 commits into
mainfrom
feat/telemetry-inspector-debug-bridge

Conversation

@tariknz

@tariknz tariknz commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Description

Completes the final Phase 4 renderer-telemetry cleanup from docs/ARCHITECTURE_REVIEW.md.

  • removes raw telemetry from the normal renderer-facing IrSdkBridge
  • replaces the legacy telemetry subscription path with an explicit per-window telemetryInspectorBridge
  • caps Inspector raw-frame delivery at 10 Hz in live, mock, and browser-source/WebSocket paths
  • preserves arbitrary telemetry and session-path inspection without turning the typed channel bus into another firehose
  • leaves unknown and normal widgets unable to opt into raw telemetry accidentally
  • keeps raw telemetry fixture support explicitly story-only
  • updates the implementation plan to record PR feat: move remaining widgets to channels #670 as merged and this final cleanup as in progress

The Inspector remains behaviorally compatible: configured telemetry and session properties render from the same raw stores. Normal widgets continue to use their typed snapshot channels. Final Windows A/B re-profiling remains follow-up evidence after this code lands.

Validation:

  • npm test — 150 files passed, 1 skipped; 1,217 tests passed, 1 skipped
  • npm run lint
  • npm run test:replay:curated — 36,000 frames, 70 session revisions, 14 probes
  • npm run build-storybook
  • git diff --check

Architecture checklist:

  • N1 — no new synchronous filesystem I/O
  • N2 — no frontend imports from src/app
  • N3 — no new cross-widget imports
  • N4 — renderer subscription keys are explicitly validated
  • R4.1/R4.6 — bridge exposure uses defineBridge; subscriptions are per-window and hidden overlays are suppressed
  • R4.4/R4.5 — normal widget data remains on minimal typed channels; the arbitrary raw stream is isolated as a diagnostic exception
  • R11.1 — no direct console logging
  • R13.2 — Inspector delivery is demand-driven and capped at 10 Hz
  • R14.3 — Telemetry Inspector Storybook coverage added

Screenshots

Before

No visual change. Telemetry Inspector used the generic legacy renderer telemetry provider and stream.

After

No visual change. Telemetry Inspector uses the dedicated diagnostic bridge; normal renderers cannot subscribe to raw telemetry.

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Performance improvement
  • Refactoring (no functional changes)
  • Documentation update
  • Dependency update

Checklist

  • I have discussed this change in the discord server
  • I have tested this in iRacing (either in an online session or with AI)
  • All tests pass locally via npm test
  • I have added tests that prove my fix is effective or that my feature works
  • I have run npm run lint and fixed any issues
  • I have performed a self-review of my own code
  • I have added/updated Storybook stories for visual changes
  • I have updated the README.md (if applicable)
  • I have updated defaultDashboard.ts if introducing new widgets or configurations (if applicable)

Summary by CodeRabbit

  • New Features
    • Added dedicated Telemetry Inspector subscriptions for telemetry and session data.
    • Added Telemetry Inspector provider support and a Storybook example with live values.
    • Added explicit widget configuration for Telemetry Inspector data.
  • Bug Fixes
    • Session data now refreshes when a subscribed overlay becomes visible.
    • Telemetry Inspector updates are limited to 10 Hz and sent only when requested.
  • Refactor
    • Replaced legacy telemetry subscriptions and widget settings with the new renderer data system.
  • Documentation
    • Updated implementation-plan progress and activity records.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@tariknz, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 50 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 133fed69-08a0-483c-96f5-54572ad19022

📥 Commits

Reviewing files that changed from the base of the PR and between 67e8e40 and 2e4e9f5.

📒 Files selected for processing (4)
  • src/app/bridge/iracingSdk/iracingSdkBridge.ts
  • src/frontend/components/Standings/Standings.stories.tsx
  • src/frontend/components/TelemetryInspector/TelemetryInspector.stories.tsx
  • src/frontend/context/DashboardContext/DashboardContext.tsx
📝 Walkthrough

Walkthrough

The change replaces legacy telemetry with a dedicated Telemetry Inspector bridge. It adds demand-driven 10 Hz delivery, renderer subscription streams, explicit widget configuration, frontend providers, and updated Storybook and test wiring.

Changes

Telemetry Inspector migration

Layer / File(s) Summary
Contracts and runtime detection
src/types/*, src/interface.d.ts, src/frontend/widgetRuntime.tsx, src/frontend/components/*/widgetRuntimeDefinition.ts, src/frontend/widgetRuntime.spec.tsx
Adds Telemetry Inspector contracts and replaces legacyTelemetry with explicit telemetryInspector detection.
SDK telemetry publishing
src/app/bridge/iracingSdk/*
Publishes inspector telemetry only for subscribers and limits delivery to 10 Hz.
Renderer and WebSocket subscriptions
src/app/bridge/rendererDataSubscriptions.ts, src/app/bridge/rendererExposeBridge.ts, src/app/overlayManager.ts, src/app/webserver/*, src/app/rendererDataVisibility.ts, src/main.ts
Replaces legacy streams with telemetryInspector and sessionData subscriptions, including caching, filtering, visibility replay, resubscription, and cleanup.
Frontend providers and Storybook integration
src/frontend/context/*, src/frontend/components/RendererDataProviders/*, .storybook/*, site/src/utils/mockSetup.tsx, docs/IMPLEMENTATION_PLAN.md
Adds Telemetry Inspector and story-only providers, updates provider tests and stories, and records migration progress.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant TelemetryInspectorWidget
  participant TelemetryInspectorProvider
  participant telemetryInspectorBridge
  participant WebSocketBridge
  participant bridgeProxy
  TelemetryInspectorWidget->>TelemetryInspectorProvider: request telemetry and session data
  TelemetryInspectorProvider->>telemetryInspectorBridge: subscribe to streams
  telemetryInspectorBridge->>WebSocketBridge: send telemetryInspectorSubscribe
  WebSocketBridge->>bridgeProxy: register stream subscription
  bridgeProxy-->>WebSocketBridge: deliver cached or rate-limited data
  WebSocketBridge-->>telemetryInspectorBridge: receive inspector data
  telemetryInspectorBridge-->>TelemetryInspectorProvider: update stores
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main refactor: isolating the Telemetry Inspector stream.
Description check ✅ Passed The description covers the change, impact, validation, screenshots, type, architecture checklist, and relevant checklist items.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/telemetry-inspector-debug-bridge

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@tariknz
tariknz marked this pull request as ready for review August 9, 2026 02:04

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 3

🧹 Nitpick comments (1)
src/frontend/components/Standings/Standings.stories.tsx (1)

1150-1150: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use TelemetryDecorator() for mock telemetry setup.

Replace the direct StoryTelemetryProvider instances with TelemetryDecorator(). Compose the compact dashboard bridge setup separately.

As per coding guidelines, “Use TelemetryDecorator() from @irdashies/storybook in component stories to provide mock telemetry.”

Also applies to: 1164-1164

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/frontend/components/Standings/Standings.stories.tsx` at line 1150,
Replace the direct StoryTelemetryProvider usage in the affected stories with
TelemetryDecorator() from `@irdashies/storybook`, and compose the compact
dashboard bridge setup separately while preserving each story’s existing mock
telemetry behavior.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/app/bridge/iracingSdk/iracingSdkBridge.ts`:
- Around line 264-269: Update the ready-window telemetry seed in the bridge flow
around telemetryForRenderer so it only publishes when that specific overlay is
subscribed to telemetryInspector, using the same per-window subscription check
as normal Inspector delivery; otherwise remove this direct seed and rely on the
subscription snapshot path.

In `@src/frontend/components/TelemetryInspector/TelemetryInspector.stories.tsx`:
- Line 2: Update the TelemetryDecorator import in the TelemetryInspector story
to use the shared `@irdashies/storybook` alias instead of the local
.storybook/telemetryDecorator path.

In `@src/frontend/context/DashboardContext/DashboardContext.tsx`:
- Line 289: Update the error thrown by the useTelemetry hook to identify
useTelemetry and the required raw telemetry store provider, instead of
referencing useDashboard or an incorrect provider.

---

Nitpick comments:
In `@src/frontend/components/Standings/Standings.stories.tsx`:
- Line 1150: Replace the direct StoryTelemetryProvider usage in the affected
stories with TelemetryDecorator() from `@irdashies/storybook`, and compose the
compact dashboard bridge setup separately while preserving each story’s existing
mock telemetry behavior.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e3bcf931-2bfc-4732-bdcf-6587c62796c0

📥 Commits

Reviewing files that changed from the base of the PR and between 781f93f and cb374f8.

📒 Files selected for processing (61)
  • .storybook/telemetryDecorator.tsx
  • docs/IMPLEMENTATION_PLAN.md
  • site/src/utils/mockSetup.tsx
  • src/app/bridge/iracingSdk/iracingSdkBridge.ts
  • src/app/bridge/iracingSdk/mock-data/generateMockData.ts
  • src/app/bridge/iracingSdk/mock-data/mockSdkBridge.spec.ts
  • src/app/bridge/iracingSdk/mock-data/mockSdkBridge.ts
  • src/app/bridge/iracingSdk/setup.ts
  • src/app/bridge/legacyRendererSubscriptions.ts
  • src/app/bridge/rendererDataSubscriptions.ts
  • src/app/bridge/rendererExposeBridge.ts
  • src/app/overlayManager.ts
  • src/app/webserver/bridgeProxy.ts
  • src/app/webserver/componentRenderer.spec.ts
  • src/app/webserver/componentRenderer.tsx
  • src/app/webserver/componentServer.ts
  • src/dashboard-view-entry.tsx
  • src/frontend/components/Battle/widgetRuntimeDefinition.ts
  • src/frontend/components/BlindSpotMonitor/widgetRuntimeDefinition.ts
  • src/frontend/components/CornerNameOverlay/widgetRuntimeDefinition.ts
  • src/frontend/components/FasterCarsFromBehind/widgetRuntimeDefinition.ts
  • src/frontend/components/Flag/widgetRuntimeDefinition.ts
  • src/frontend/components/FlatTrackMap/widgetRuntimeDefinition.ts
  • src/frontend/components/FuelCalculator/widgetRuntimeDefinition.ts
  • src/frontend/components/GarageCover/widgetRuntimeDefinition.ts
  • src/frontend/components/HeartRate/widgetRuntimeDefinition.ts
  • src/frontend/components/InformationBar/widgetRuntimeDefinition.ts
  • src/frontend/components/Input/widgetRuntimeDefinition.ts
  • src/frontend/components/LapTimeLog/widgetRuntimeDefinition.ts
  • src/frontend/components/PitlaneHelper/widgetRuntimeDefinition.ts
  • src/frontend/components/RejoinIndicator/widgetRuntimeDefinition.ts
  • src/frontend/components/Relative/widgetRuntimeDefinition.ts
  • src/frontend/components/RendererDataProviders/RendererDataProviders.spec.tsx
  • src/frontend/components/RendererDataProviders/RendererDataProviders.tsx
  • src/frontend/components/SectorDelta/widgetRuntimeDefinition.ts
  • src/frontend/components/SlowCarAhead/widgetRuntimeDefinition.ts
  • src/frontend/components/Standings/Relative.stories.tsx
  • src/frontend/components/Standings/Standings.stories.tsx
  • src/frontend/components/Standings/widgetRuntimeDefinition.ts
  • src/frontend/components/Tachometer/widgetRuntimeDefinition.ts
  • src/frontend/components/TelemetryInspector/TelemetryInspector.stories.tsx
  • src/frontend/components/TelemetryInspector/widgetRuntimeDefinition.ts
  • src/frontend/components/TrackMap/widgetRuntimeDefinition.ts
  • src/frontend/components/TwitchChat/widgetRuntimeDefinition.ts
  • src/frontend/components/Weather/widgetRuntimeDefinition.ts
  • src/frontend/components/Wind/widgetRuntimeDefinition.ts
  • src/frontend/context/DashboardContext/DashboardContext.tsx
  • src/frontend/context/RunningStateContext/RunningStateContext.spec.tsx
  • src/frontend/context/TelemetryInspectorStore/TelemetryInspectorProvider.spec.tsx
  • src/frontend/context/TelemetryInspectorStore/TelemetryInspectorProvider.tsx
  • src/frontend/context/TelemetryInspectorStore/index.ts
  • src/frontend/context/TelemetryStore/StoryTelemetryProvider.tsx
  • src/frontend/context/TelemetryStore/TelemetryProvider.tsx
  • src/frontend/context/index.ts
  • src/frontend/widgetRuntime.spec.tsx
  • src/frontend/widgetRuntime.tsx
  • src/interface.d.ts
  • src/main.ts
  • src/types/index.ts
  • src/types/irSdkBridge.ts
  • src/types/telemetryInspectorBridge.ts
💤 Files with no reviewable changes (26)
  • src/frontend/components/Battle/widgetRuntimeDefinition.ts
  • src/frontend/context/RunningStateContext/RunningStateContext.spec.tsx
  • src/frontend/components/Relative/widgetRuntimeDefinition.ts
  • src/frontend/components/HeartRate/widgetRuntimeDefinition.ts
  • src/frontend/components/FlatTrackMap/widgetRuntimeDefinition.ts
  • src/frontend/components/GarageCover/widgetRuntimeDefinition.ts
  • src/frontend/components/FasterCarsFromBehind/widgetRuntimeDefinition.ts
  • src/frontend/components/FuelCalculator/widgetRuntimeDefinition.ts
  • src/app/bridge/legacyRendererSubscriptions.ts
  • src/frontend/components/BlindSpotMonitor/widgetRuntimeDefinition.ts
  • src/frontend/context/TelemetryStore/TelemetryProvider.tsx
  • src/frontend/components/Standings/widgetRuntimeDefinition.ts
  • src/frontend/components/SlowCarAhead/widgetRuntimeDefinition.ts
  • src/frontend/components/TwitchChat/widgetRuntimeDefinition.ts
  • src/frontend/components/Tachometer/widgetRuntimeDefinition.ts
  • src/frontend/components/RejoinIndicator/widgetRuntimeDefinition.ts
  • src/frontend/components/Flag/widgetRuntimeDefinition.ts
  • src/frontend/components/Wind/widgetRuntimeDefinition.ts
  • src/frontend/components/TrackMap/widgetRuntimeDefinition.ts
  • src/frontend/components/InformationBar/widgetRuntimeDefinition.ts
  • src/frontend/components/Input/widgetRuntimeDefinition.ts
  • src/frontend/components/PitlaneHelper/widgetRuntimeDefinition.ts
  • src/frontend/components/SectorDelta/widgetRuntimeDefinition.ts
  • src/frontend/components/Weather/widgetRuntimeDefinition.ts
  • src/frontend/components/LapTimeLog/widgetRuntimeDefinition.ts
  • src/frontend/components/CornerNameOverlay/widgetRuntimeDefinition.ts

Comment thread src/app/bridge/iracingSdk/iracingSdkBridge.ts Outdated
Comment thread src/frontend/components/TelemetryInspector/TelemetryInspector.stories.tsx Outdated
Comment thread src/frontend/context/DashboardContext/DashboardContext.tsx Outdated
@tariknz
tariknz merged commit 355a6d6 into main Aug 9, 2026
7 checks passed
@tariknz
tariknz deleted the feat/telemetry-inspector-debug-bridge branch August 9, 2026 02:17
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.

1 participant