feat: move session bar data to channels - #667
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (14)
🚧 Files skipped from review as they are similar to previous changes (10)
📝 WalkthroughWalkthroughAdded typed 5 Hz session timing and Session Bar snapshots. Integrated demand-driven runtimes with iRacing and mock bridges. Migrated frontend consumers to snapshot hooks. Added replay probes, tests, and golden validation data. ChangesSession snapshot migration
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 7
🧹 Nitpick comments (9)
src/frontend/components/Standings/components/SessionBar/components/AirTemperatureItem/AirTemperatureItem.tsx (1)
8-10: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd
displayNameto each memoized component.React DevTools cannot reliably identify these anonymous memoized component
definitions. Add an explicitdisplayNameafter each declaration.
src/frontend/components/Standings/components/SessionBar/components/AirTemperatureItem/AirTemperatureItem.tsx#L8-L10: addAirTemperatureItem.displayName = 'AirTemperatureItem';.src/frontend/components/Standings/components/SessionBar/components/BestLapItem/BestLapItem.tsx#L8-L9: addBestLapItem.displayName = 'BestLapItem';.src/frontend/components/Standings/components/SessionBar/components/BrakeBiasItem/BrakeBiasItem.tsx#L7-L12: addBrakeBiasItem.displayName = 'BrakeBiasItem';.src/frontend/components/Standings/components/SessionBar/components/ClassRankItem/ClassRankItem.tsx#L7-L10: addClassRankItem.displayName = 'ClassRankItem';.src/frontend/components/Standings/components/SessionBar/components/FuelLevelItem/FuelLevelItem.tsx#L8-L10: addFuelLevelItem.displayName = 'FuelLevelItem';.src/frontend/components/Standings/components/SessionBar/components/IncidentCountItem/IncidentCountItem.tsx#L7-L13: addIncidentCountItem.displayName = 'IncidentCountItem';.src/frontend/components/Standings/components/SessionBar/components/LastLapItem/LastLapItem.tsx#L8-L10: addLastLapItem.displayName = 'LastLapItem';.src/frontend/components/Standings/components/SessionBar/components/ManufacturerPositionItem/ManufacturerPositionItem.tsx#L8-L10: addManufacturerPositionItem.displayName = 'ManufacturerPositionItem';.src/frontend/components/Standings/components/SessionBar/components/PrecipitationItem/PrecipitationItem.tsx#L7-L8: addPrecipitationItem.displayName = 'PrecipitationItem';.src/frontend/components/Standings/components/SessionBar/components/SessionClockTimeItem/SessionClockTimeItem.tsx#L7-L16: addSessionClockTimeItem.displayName = 'SessionClockTimeItem';.As per coding guidelines, “Include
displayNamefor memoized components.”🤖 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/components/SessionBar/components/AirTemperatureItem/AirTemperatureItem.tsx` around lines 8 - 10, Add explicit displayName assignments immediately after each memoized component declaration: AirTemperatureItem, BestLapItem, BrakeBiasItem, ClassRankItem, FuelLevelItem, IncidentCountItem, LastLapItem, ManufacturerPositionItem, PrecipitationItem, and SessionClockTimeItem. Apply the corresponding component name as its displayName in each listed file.Source: Coding guidelines
src/frontend/context/ChannelStore/useSessionBarSnapshot.ts (1)
3-7: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winRemove the duplicate widget-rate lookup.
useChannelSnapshotalready gets the configured rate internally. The explicit
rate argument creates a seconduseWidgetChannelRatesubscription for every
Session Bar consumer.Proposed change
export const useSessionBarSnapshot = () => - useChannelSnapshot( - 'session-bar.snapshot', - useWidgetChannelRate('session-bar.snapshot') - ); + useChannelSnapshot('session-bar.snapshot');🤖 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/context/ChannelStore/useSessionBarSnapshot.ts` around lines 3 - 7, Remove the explicit useWidgetChannelRate call from useSessionBarSnapshot and invoke useChannelSnapshot with only the session-bar snapshot identifier, relying on its internal configured-rate lookup.src/frontend/components/Standings/components/SessionBar/components/SessionLapsItem/SessionLapsItem.tsx (1)
8-17: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd
displayNameto each memoized component.React DevTools and error stacks use this name to identify memoized components.
src/frontend/components/Standings/components/SessionBar/components/SessionLapsItem/SessionLapsItem.tsx#L8-L17: AddSessionLapsItem.displayName = 'SessionLapsItem';.src/frontend/components/Standings/components/SessionBar/components/SessionNameItem/SessionNameItem.tsx#L6-L7: AddSessionNameItem.displayName = 'SessionNameItem';.src/frontend/components/Standings/components/SessionBar/components/SessionTimeItem/SessionTimeItem.tsx#L8-L20: AddSessionTimeItem.displayName = 'SessionTimeItem';.src/frontend/components/Standings/components/SessionBar/components/TopSpeedItem/TopSpeedItem.tsx#L8-L17: AddTopSpeedItem.displayName = 'TopSpeedItem';.src/frontend/components/Standings/components/SessionBar/components/TrackNameItem/TrackNameItem.tsx#L6-L7: AddTrackNameItem.displayName = 'TrackNameItem';.src/frontend/components/Standings/components/SessionBar/components/TrackTemperatureItem/TrackTemperatureItem.tsx#L8-L10: AddTrackTemperatureItem.displayName = 'TrackTemperatureItem';.src/frontend/components/Standings/components/SessionBar/components/TrackWetnessItem/TrackWetnessItem.tsx#L7-L19: AddTrackWetnessItem.displayName = 'TrackWetnessItem';.src/frontend/components/Standings/components/SessionBar/components/WindItem/WindItem.tsx#L8-L11: AddWindItem.displayName = 'WindItem';.As per coding guidelines,
**/components/**/*.tsxrequires adisplayNamefor memoized components.🤖 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/components/SessionBar/components/SessionLapsItem/SessionLapsItem.tsx` around lines 8 - 17, Add explicit displayName assignments for the memoized components: in src/frontend/components/Standings/components/SessionBar/components/SessionLapsItem/SessionLapsItem.tsx lines 8-17, add one for SessionLapsItem; do the same in src/frontend/components/Standings/components/SessionBar/components/SessionNameItem/SessionNameItem.tsx lines 6-7 for SessionNameItem, SessionTimeItem/SessionTimeItem.tsx lines 8-20 for SessionTimeItem, TopSpeedItem/TopSpeedItem.tsx lines 8-17 for TopSpeedItem, TrackNameItem/TrackNameItem.tsx lines 6-7 for TrackNameItem, TrackTemperatureItem/TrackTemperatureItem.tsx lines 8-10 for TrackTemperatureItem, TrackWetnessItem/TrackWetnessItem.tsx lines 7-19 for TrackWetnessItem, and WindItem/WindItem.tsx lines 8-11 for WindItem.Source: Coding guidelines
src/app/processors/SessionBarProcessor.ts (2)
9-16: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRename the helpers
nandato match the sibling processor.
src/app/processors/SessionTimingProcessor.ts:13-21defines the same two helpers asnumberValueandnumberArray. Both files were added in this PR. Use one name per concept.♻️ Proposed refactor
-const n = (f: Telemetry, k: keyof Telemetry): number | undefined => { - const v = f[k]?.value?.[0]; - return typeof v === 'number' && Number.isFinite(v) ? v : undefined; -}; -const a = (f: Telemetry, k: keyof Telemetry): readonly unknown[] => { - const value = f[k]?.value; - return Array.isArray(value) ? value : []; -}; +const numberValue = ( + frame: Telemetry, + key: keyof Telemetry +): number | undefined => { + const value = frame[key]?.value?.[0]; + return typeof value === 'number' && Number.isFinite(value) ? value : undefined; +}; + +const numberArray = ( + frame: Telemetry, + key: keyof Telemetry +): readonly unknown[] => { + const value = frame[key]?.value; + return Array.isArray(value) ? value : []; +};Update all call sites in this file.
🤖 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/app/processors/SessionBarProcessor.ts` around lines 9 - 16, Rename the helper n to numberValue and a to numberArray in SessionBarProcessor.ts, matching SessionTimingProcessor.ts, and update every call site in the file to use the new names without changing behavior.
87-93: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueName the Clio car ID.
162is an unexplained magic number. It selects thedcPeakBrakeBiastelemetry channel instead ofdcBrakeBiasand setsbrakeBiasIsClio, which changes howBrakeBiasItemformats the value. A named constant records why the branch exists.♻️ Proposed refactor
+// The Renault Clio reports peak brake bias on a separate channel and as an +// unscaled value rather than a percentage. +const CLIO_CAR_ID = 162;- const isClio = player?.CarID === 162; + const isClio = player?.CarID === CLIO_CAR_ID;🤖 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/app/processors/SessionBarProcessor.ts` around lines 87 - 93, Define a descriptive named constant for the Clio car ID near the relevant processor logic, then replace the literal 162 in the isClio comparison with that constant. Preserve the existing telemetry-channel selection and brakeBiasIsClio behavior.src/app/processors/SessionTimingProcessor.ts (2)
29-29: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueBoth new processor class declarations exceed the 80 character Prettier width. The coding guidelines require Prettier formatting with an 80 character line width. Neither new file was formatted. Run Prettier on both files; it wraps the
implementsclause automatically.
src/app/processors/SessionTimingProcessor.ts#L29-L29: wrapexport class SessionTimingProcessor implements TelemetryProcessor<SessionTimingSnapshot> {(91 characters).src/app/processors/SessionBarProcessor.ts#L18-L18: wrapexport class SessionBarProcessor implements TelemetryProcessor<SessionBarSnapshot> {(85 characters).Expected result in both files:
export class SessionTimingProcessor implements TelemetryProcessor<SessionTimingSnapshot> {As per coding guidelines: "Use Prettier code formatting: single quotes, 80 character line width, trailing commas (ES5)".
🤖 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/app/processors/SessionTimingProcessor.ts` at line 29, Run Prettier formatting on the class declarations in src/app/processors/SessionTimingProcessor.ts (lines 29-29) and src/app/processors/SessionBarProcessor.ts (lines 18-18), wrapping each implements clause to comply with the 80-character width while preserving the existing class declarations.Source: Coding guidelines
106-119: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueExtract the
604800sentinel into a named constant.The value
604800appears at lines 111, 112, and 119. It encodes the iRacing "unlimited time" sentinel (one week in seconds). A named constant states the intent and keeps the three checks in sync.♻️ Proposed refactor
const UPDATE_INTERVAL_SECONDS = 0.2; const TIME_EPSILON = 1e-6; +// iRacing reports one week of seconds when session time is unlimited. +const UNLIMITED_TIME_SENTINEL_SECONDS = 604800;const timeRemaining = sessionType === 'Race' && state === SessionState.GetInCar && - rawTimeRemaining >= 604800 && - timeTotal >= 604800 + rawTimeRemaining >= UNLIMITED_TIME_SENTINEL_SECONDS && + timeTotal >= UNLIMITED_TIME_SENTINEL_SECONDS ? -1 : rawTimeRemaining; @@ - const fixedLapRace = !(timeRemaining > 0 && timeRemaining !== 604800); + const fixedLapRace = !( + timeRemaining > 0 && timeRemaining !== UNLIMITED_TIME_SENTINEL_SECONDS + );🤖 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/app/processors/SessionTimingProcessor.ts` around lines 106 - 119, Extract the repeated 604800 value in the session timing logic around timeRemaining and fixedLapRace into a named constant representing the iRacing unlimited-time sentinel, then use that constant in all three comparisons while preserving the existing behavior.src/app/processors/SessionTimingProcessor.spec.ts (1)
84-96: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winNeither spec asserts that
versionincreases across a reset. Both runtimes publish only when the snapshotversiondiffers from the last published version.src/app/processors/sessionTimingRuntime.ts:113-121shows the gate, andsrc/app/processors/sessionBarRuntime.ts:93-101uses the same pattern. Eachreset()therefore depends on incrementingversionto reach subscribers. A regression that reused the version would leave stale data on screen after a session change or a disconnect, and no test would fail.
src/app/processors/SessionTimingProcessor.spec.ts#L84-L96: captureprocessor.snapshot().versionbeforeonLifecycle({ type: 'sessionNumChange' })and assert the value increases afterwards.src/app/processors/SessionBarProcessor.spec.ts#L58-L62: captureprocessor.snapshot().versionbeforeonLifecycle({ type: 'disconnect' })and assert the value increases afterwards.🤖 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/app/processors/SessionTimingProcessor.spec.ts` around lines 84 - 96, Update the reset tests to verify version increments: in src/app/processors/SessionTimingProcessor.spec.ts lines 84-96, capture processor.snapshot().version before sessionNumChange and assert it increases afterward; in src/app/processors/SessionBarProcessor.spec.ts lines 58-62, capture the version before disconnect and assert it increases after the lifecycle event.src/app/processors/SessionBarProcessor.spec.ts (1)
6-63: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueSplit the single test into separate cases.
One
itblock covers session projection, top-speed tracking, and lifecycle reset. A failure in the first assertion hides the later behaviours. Separateitblocks report which behaviour regressed.Extract the session fixture and a
frame()helper, assrc/app/processors/SessionTimingProcessor.spec.ts:6-37does, then write oneitper behaviour.🤖 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/app/processors/SessionBarProcessor.spec.ts` around lines 6 - 63, The single test should be split into separate cases for session-state projection, top-speed tracking, and lifecycle reset so failures identify the affected behavior. Extract shared session setup into a fixture and add a frame() helper, following the pattern used by SessionTimingProcessor.spec.ts; reuse these helpers across one it block per behavior.
🤖 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 `@docs/IMPLEMENTATION_PLAN.md`:
- Line 33: Update docs/IMPLEMENTATION_PLAN.md lines 33-33 to state that session
timing and auxiliary Session Bar telemetry are both included in PR `#667`, with
only legacy telemetry removal or development-only restriction remaining. Update
lines 471-472 to remove the stale follow-up clause and record that auxiliary
Session Bar telemetry landed in the same PR.
- Around line 277-279: Update the “Session-bar telemetry migration” checklist so
the parent and both child items remain unchecked while PR `#667` is still in
review; remove the premature completion markers and preserve the existing PR
references until the merge requirement is met.
In `@src/app/processors/lapTimesRuntime.ts`:
- Around line 22-49: After registering the subscriber-count and lifecycle
handlers in the constructor, query the current subscriber count for
`lap-times.snapshot` and call `activate()` when it is greater than zero. Ensure
this initializes the processor for subscriptions that existed before
construction while preserving the existing activate/deactivate behavior for
future count changes.
In `@src/app/processors/SessionBarProcessor.ts`:
- Around line 137-139: Update SessionBarProcessor.snapshot() to return a
detached snapshot rather than this.latest, including defensive copies of
competitorCarIds and competitorPositions so published payloads cannot change
after publication. Align onFrame state updates with SessionTimingProcessor’s
fresh-object approach where appropriate, and declare these snapshot arrays as
readonly number[] if compatible with existing consumers.
In `@src/app/processors/SessionTimingProcessor.ts`:
- Around line 246-275: Update the checkered-state handling in
calculateRaceValues to use the frozen lap value, this.checkeredLap ??
currentLap, when setting totalRaceLaps, matching the currentLap value published
by the processor. Compute this frozen lap once and pass it into
calculateRaceValues, then extend the checkered test in
SessionTimingProcessor.spec.ts to assert totalRaceLaps equals the frozen lap.
In
`@src/frontend/components/Standings/components/SessionBar/SessionBarClassRank.stories.tsx`:
- Around line 76-94: Add TelemetryDecorator() to the decorators for
SessionBarClassRank stories at
src/frontend/components/Standings/components/SessionBar/SessionBarClassRank.stories.tsx#L76-L94
and SessionBarManufacturerPosition stories at
src/frontend/components/Standings/components/SessionBar/SessionBarManufacturerPosition.stories.tsx#L91-L118,
while retaining ChannelSnapshotDecorator() in both snapshot fixtures.
In `@tools/telemetry-replay/session-bar-probe.ts`:
- Around line 18-39: Update the telemetry variables list used by the session-bar
probe to include both dcBrakeBias and dcPeakBrakeBias, so SessionBarProcessor
can populate and validate brakeBias in generated snapshots for standard cars and
Clios.
---
Nitpick comments:
In `@src/app/processors/SessionBarProcessor.spec.ts`:
- Around line 6-63: The single test should be split into separate cases for
session-state projection, top-speed tracking, and lifecycle reset so failures
identify the affected behavior. Extract shared session setup into a fixture and
add a frame() helper, following the pattern used by
SessionTimingProcessor.spec.ts; reuse these helpers across one it block per
behavior.
In `@src/app/processors/SessionBarProcessor.ts`:
- Around line 9-16: Rename the helper n to numberValue and a to numberArray in
SessionBarProcessor.ts, matching SessionTimingProcessor.ts, and update every
call site in the file to use the new names without changing behavior.
- Around line 87-93: Define a descriptive named constant for the Clio car ID
near the relevant processor logic, then replace the literal 162 in the isClio
comparison with that constant. Preserve the existing telemetry-channel selection
and brakeBiasIsClio behavior.
In `@src/app/processors/SessionTimingProcessor.spec.ts`:
- Around line 84-96: Update the reset tests to verify version increments: in
src/app/processors/SessionTimingProcessor.spec.ts lines 84-96, capture
processor.snapshot().version before sessionNumChange and assert it increases
afterward; in src/app/processors/SessionBarProcessor.spec.ts lines 58-62,
capture the version before disconnect and assert it increases after the
lifecycle event.
In `@src/app/processors/SessionTimingProcessor.ts`:
- Line 29: Run Prettier formatting on the class declarations in
src/app/processors/SessionTimingProcessor.ts (lines 29-29) and
src/app/processors/SessionBarProcessor.ts (lines 18-18), wrapping each
implements clause to comply with the 80-character width while preserving the
existing class declarations.
- Around line 106-119: Extract the repeated 604800 value in the session timing
logic around timeRemaining and fixedLapRace into a named constant representing
the iRacing unlimited-time sentinel, then use that constant in all three
comparisons while preserving the existing behavior.
In
`@src/frontend/components/Standings/components/SessionBar/components/AirTemperatureItem/AirTemperatureItem.tsx`:
- Around line 8-10: Add explicit displayName assignments immediately after each
memoized component declaration: AirTemperatureItem, BestLapItem, BrakeBiasItem,
ClassRankItem, FuelLevelItem, IncidentCountItem, LastLapItem,
ManufacturerPositionItem, PrecipitationItem, and SessionClockTimeItem. Apply the
corresponding component name as its displayName in each listed file.
In
`@src/frontend/components/Standings/components/SessionBar/components/SessionLapsItem/SessionLapsItem.tsx`:
- Around line 8-17: Add explicit displayName assignments for the memoized
components: in
src/frontend/components/Standings/components/SessionBar/components/SessionLapsItem/SessionLapsItem.tsx
lines 8-17, add one for SessionLapsItem; do the same in
src/frontend/components/Standings/components/SessionBar/components/SessionNameItem/SessionNameItem.tsx
lines 6-7 for SessionNameItem, SessionTimeItem/SessionTimeItem.tsx lines 8-20
for SessionTimeItem, TopSpeedItem/TopSpeedItem.tsx lines 8-17 for TopSpeedItem,
TrackNameItem/TrackNameItem.tsx lines 6-7 for TrackNameItem,
TrackTemperatureItem/TrackTemperatureItem.tsx lines 8-10 for
TrackTemperatureItem, TrackWetnessItem/TrackWetnessItem.tsx lines 7-19 for
TrackWetnessItem, and WindItem/WindItem.tsx lines 8-11 for WindItem.
In `@src/frontend/context/ChannelStore/useSessionBarSnapshot.ts`:
- Around line 3-7: Remove the explicit useWidgetChannelRate call from
useSessionBarSnapshot and invoke useChannelSnapshot with only the session-bar
snapshot identifier, relying on its internal configured-rate lookup.
🪄 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: 94adf6fe-ee89-42f5-902b-5da8b75d4bd8
📒 Files selected for processing (54)
docs/IMPLEMENTATION_PLAN.mdsrc/app/bridge/iracingSdk/iracingSdkBridge.tssrc/app/bridge/iracingSdk/mock-data/mockSdkBridge.spec.tssrc/app/bridge/iracingSdk/mock-data/mockSdkBridge.tssrc/app/processors/SessionBarProcessor.spec.tssrc/app/processors/SessionBarProcessor.tssrc/app/processors/SessionTimingProcessor.spec.tssrc/app/processors/SessionTimingProcessor.tssrc/app/processors/lapTimesRuntime.tssrc/app/processors/sessionBarRuntime.spec.tssrc/app/processors/sessionBarRuntime.tssrc/app/processors/sessionTimingRuntime.spec.tssrc/app/processors/sessionTimingRuntime.tssrc/frontend/components/InformationBar/InformationBar.stories.tsxsrc/frontend/components/InformationBar/widgetRuntimeDefinition.tssrc/frontend/components/OverlayContainer/OverlayContainer.tsxsrc/frontend/components/Relative/widgetRuntimeDefinition.tssrc/frontend/components/Standings/components/SessionBar/SessionBar.spec.tsxsrc/frontend/components/Standings/components/SessionBar/SessionBar.stories.tsxsrc/frontend/components/Standings/components/SessionBar/SessionBarClassRank.stories.tsxsrc/frontend/components/Standings/components/SessionBar/SessionBarManufacturerPosition.stories.tsxsrc/frontend/components/Standings/components/SessionBar/components/AirTemperatureItem/AirTemperatureItem.tsxsrc/frontend/components/Standings/components/SessionBar/components/BestLapItem/BestLapItem.tsxsrc/frontend/components/Standings/components/SessionBar/components/BrakeBiasItem/BrakeBiasItem.tsxsrc/frontend/components/Standings/components/SessionBar/components/ClassRankItem/ClassRankItem.spec.tsxsrc/frontend/components/Standings/components/SessionBar/components/ClassRankItem/ClassRankItem.tsxsrc/frontend/components/Standings/components/SessionBar/components/FuelLevelItem/FuelLevelItem.tsxsrc/frontend/components/Standings/components/SessionBar/components/IncidentCountItem/IncidentCountItem.tsxsrc/frontend/components/Standings/components/SessionBar/components/LastLapItem/LastLapItem.tsxsrc/frontend/components/Standings/components/SessionBar/components/ManufacturerPositionItem/ManufacturerPositionItem.spec.tsxsrc/frontend/components/Standings/components/SessionBar/components/ManufacturerPositionItem/ManufacturerPositionItem.tsxsrc/frontend/components/Standings/components/SessionBar/components/PrecipitationItem/PrecipitationItem.tsxsrc/frontend/components/Standings/components/SessionBar/components/SessionClockTimeItem/SessionClockTimeItem.tsxsrc/frontend/components/Standings/components/SessionBar/components/SessionLapsItem/SessionLapsItem.tsxsrc/frontend/components/Standings/components/SessionBar/components/SessionNameItem/SessionNameItem.tsxsrc/frontend/components/Standings/components/SessionBar/components/SessionTimeItem/SessionTimeItem.tsxsrc/frontend/components/Standings/components/SessionBar/components/TopSpeedItem/TopSpeedItem.tsxsrc/frontend/components/Standings/components/SessionBar/components/TrackNameItem/TrackNameItem.tsxsrc/frontend/components/Standings/components/SessionBar/components/TrackTemperatureItem/TrackTemperatureItem.tsxsrc/frontend/components/Standings/components/SessionBar/components/TrackWetnessItem/TrackWetnessItem.tsxsrc/frontend/components/Standings/components/SessionBar/components/WindItem/WindItem.tsxsrc/frontend/components/Standings/widgetRuntimeDefinition.tssrc/frontend/context/ChannelStore/index.tssrc/frontend/context/ChannelStore/useSessionBarSnapshot.tssrc/frontend/context/ChannelStore/useSessionTimingSnapshot.tssrc/frontend/context/SessionTimingStore/SessionTimingStore.tsxsrc/frontend/context/SessionTimingStore/SessionTimingStoreUpdater.spec.tsxsrc/frontend/context/SessionTimingStore/SessionTimingStoreUpdater.tsxsrc/frontend/widgetRuntime.spec.tsxsrc/types/channels/channel.tstest-data/telemetry/ai-race-10min.golden.jsontools/telemetry-replay/run-curated-validation.tstools/telemetry-replay/session-bar-probe.tstools/telemetry-replay/session-timing-probe.ts
💤 Files with no reviewable changes (1)
- src/frontend/components/OverlayContainer/OverlayContainer.tsx
| variables: [ | ||
| 'AirTemp', | ||
| 'CarIdxBestLapTime', | ||
| 'CarIdxClassPosition', | ||
| 'CarIdxPosition', | ||
| 'DisplayUnits', | ||
| 'FuelLevel', | ||
| 'Lap', | ||
| 'LapBestLapTime', | ||
| 'LapLastLapTime', | ||
| 'PlayerCarTeamIncidentCount', | ||
| 'Precipitation', | ||
| 'SessionNum', | ||
| 'SessionTime', | ||
| 'SessionTimeOfDay', | ||
| 'Speed', | ||
| 'TrackTempCrew', | ||
| 'TrackWetness', | ||
| 'WindDir', | ||
| 'WindVel', | ||
| 'YawNorth', | ||
| ], |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Include the brake-bias telemetry variables.
SessionBarProcessor reads dcBrakeBias and dcPeakBrakeBias. This probe does not request either variable. The generated snapshots therefore cannot validate brakeBias for standard cars or Clios.
Proposed fix
'DisplayUnits',
+ 'dcBrakeBias',
+ 'dcPeakBrakeBias',
'FuelLevel',📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| variables: [ | |
| 'AirTemp', | |
| 'CarIdxBestLapTime', | |
| 'CarIdxClassPosition', | |
| 'CarIdxPosition', | |
| 'DisplayUnits', | |
| 'FuelLevel', | |
| 'Lap', | |
| 'LapBestLapTime', | |
| 'LapLastLapTime', | |
| 'PlayerCarTeamIncidentCount', | |
| 'Precipitation', | |
| 'SessionNum', | |
| 'SessionTime', | |
| 'SessionTimeOfDay', | |
| 'Speed', | |
| 'TrackTempCrew', | |
| 'TrackWetness', | |
| 'WindDir', | |
| 'WindVel', | |
| 'YawNorth', | |
| ], | |
| variables: [ | |
| 'AirTemp', | |
| 'CarIdxBestLapTime', | |
| 'CarIdxClassPosition', | |
| 'CarIdxPosition', | |
| 'DisplayUnits', | |
| 'dcBrakeBias', | |
| 'dcPeakBrakeBias', | |
| 'FuelLevel', | |
| 'Lap', | |
| 'LapBestLapTime', | |
| 'LapLastLapTime', | |
| 'PlayerCarTeamIncidentCount', | |
| 'Precipitation', | |
| 'SessionNum', | |
| 'SessionTime', | |
| 'SessionTimeOfDay', | |
| 'Speed', | |
| 'TrackTempCrew', | |
| 'TrackWetness', | |
| 'WindDir', | |
| 'WindVel', | |
| 'YawNorth', | |
| ], |
🤖 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 `@tools/telemetry-replay/session-bar-probe.ts` around lines 18 - 39, Update the
telemetry variables list used by the session-bar probe to include both
dcBrakeBias and dcPeakBrakeBias, so SessionBarProcessor can populate and
validate brakeBias in generated snapshots for standard cars and Clios.
Description
Phase 4 of the architecture plan: move the complete Session Bar data path from renderer telemetry hooks to typed, demand-driven channels.
session-timing.snapshotowns race/session timing, lap totals, green/checkered transitions, and timed-race projections.session-bar.snapshotowns the auxiliary display state: weather, temperatures, wind, fuel/units, brake bias, incidents, lap results, session clock/name, track name, player class/manufacturer position, and lap/session top speed. Standings, Relative, and Information Bar request both channels at 5 Hz only while mounted. Top speed is sampled on every source frame before snapshot publication, preserving short peaks.Both runtimes are wired for live/tape and lifecycle-less demo sources. The renderer Session Bar tree no longer imports raw telemetry hooks, and the obsolete top-speed, temperature, and session-best-lap renderer updaters are no longer mounted. Storybook supplies both snapshots through
ChannelSnapshotDecorator.Validation:
npm run lint -- --no-fixnpm run test -- --no-coverage— 1,208 passed, 1 skippednpm run test:replay:curated:updatenpm run test:replay:curated— 36,000 frames, 70 session revisions, 11 probesThis has not yet been validated in a live iRacing session.
Architecture checklist:
Screenshots
Before
No visual change intended. Session Bar values were derived independently in renderer hooks from the legacy telemetry stream.
After
No visual change intended. Session Bar values are derived once in the main process and delivered through typed snapshots.
Type of Change
Checklist
npm testnpm run lintand fixed any issuesSummary by CodeRabbit