Skip to content

feat(actions): add telemetry-driven ON/OFF state to pit toggles and fuel fill#205

Merged
niklam merged 4 commits into
masterfrom
feat/197-pit-quick-actions-telemetry
Mar 27, 2026
Merged

feat(actions): add telemetry-driven ON/OFF state to pit toggles and fuel fill#205
niklam merged 4 commits into
masterfrom
feat/197-pit-quick-actions-telemetry

Conversation

@niklam
Copy link
Copy Markdown
Owner

@niklam niklam commented Mar 27, 2026

Related Issue

Fixes #197

What changed?

  • Extracted shared status bar utility (ON/OFF/N/A) from car-control into reusable status-bar.ts
  • Added telemetry-driven dynamic icons to Pit Quick Actions: windshield tearoff and fast repair now show live green ON / red OFF status bars (fast repair shows gray N/A when unavailable)
  • Added new toggle-fuel-fill mode to Fuel Service (now the default) with telemetry-driven icon showing refuel amount in display-unit-aware format (L/g)
  • Created dynamic SVG templates for pit-quick-actions and fuel-service
  • Synced action/control counts across all documentation (32 actions, 349 controls)

How to test

  1. Add a Pit Quick Actions button, set to Windshield Tearoff — verify green ON / red OFF based on pit settings
  2. Set to Request Fast Repair — verify ON/OFF or gray N/A when unavailable
  3. Add a Fuel Service button (defaults to Toggle Fuel Fill) — verify refuel amount with correct units and ON/OFF bar
  4. Set Pit Quick Actions to Clear All Checkboxes — verify static icon (no status bar)
  5. Toggle each mode and verify icon updates immediately

Checklist

  • Linked to an approved issue
  • New code has unit tests
  • Changes registered in all applicable plugins (Stream Deck, Mirabox)
  • No unrelated changes included

Summary by CodeRabbit

  • New Features

    • Added "Toggle Fuel Fill" mode to Fuel Service with live refuel amount and ON/OFF status indicator; made Windshield Tearoff and Fast Repair show live ON/OFF/N/A status bars.
    • Default Fuel Service mode updated to "Toggle Fuel Fill".
  • Documentation

    • Updated action catalog counts (32 actions, 349 controls) and docs for Fuel Service and Pit Quick Actions.

niklam added 3 commits March 27, 2026 21:14
…uel fill (#197)

- Extract shared status bar utility (ON/OFF/N/A) from car-control
- Add telemetry subscription to Pit Quick Actions for windshield tearoff
  and fast repair modes with live ON/OFF/N/A status bars
- Add toggle-fuel-fill mode to Fuel Service with telemetry-driven icon
  showing refuel amount in display-unit-aware format (L/g)
- Fast repair shows gray N/A bar when FastRepairAvailable is 0
- Create dynamic SVG templates for pit-quick-actions and fuel-service
- Match car-control onWillDisappear order (super before cleanup)
- Use telemetry helpers in execute methods instead of inline hasFlag
- Remove dead static icon entries/imports for telemetry-aware modes
- Remove unused FUEL_SERVICE_LABELS entry for toggle-fuel-fill
- Remove unnecessary statusBar re-export from car-control
- Fix PI fallback default to match new toggle-fuel-fill default
- Add toggle-fuel-fill mode to actions.json and fuel-service docs
- Document telemetry-driven ON/OFF/N/A status bars for pit quick actions
- Sync action/control counts across README, website, overview, and skills
  (32 actions, 349 controls; Pit Service: 15 controls)
@github-actions github-actions Bot added the type: feature New feature label Mar 27, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 27, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8000ac8b-0b57-475f-a238-3c083437674f

📥 Commits

Reviewing files that changed from the base of the PR and between cc5c8b8 and ca24f5c.

📒 Files selected for processing (1)
  • packages/actions/src/actions/pit-quick-actions.ts

📝 Walkthrough

Walkthrough

Adds telemetry-driven ON/OFF/N/A visual indicators for pit actions, extracts a shared status-bar SVG utility, introduces a new telemetry-aware toggle-fuel-fill mode (now the default), and updates action lifecycle to subscribe/unsubscribe telemetry; documentation and property-inspector defaults updated to reflect the expanded action set.

Changes

Cohort / File(s) Summary
Shared status-bar utility
packages/actions/src/icons/status-bar.ts, packages/actions/src/icons/status-bar.test.ts
New statusBarOn(), statusBarOff(), statusBarNA() SVG generators and tests exported for reuse.
Car Control refactor
packages/actions/src/actions/car-control.ts
Removed local status-bar implementations; now imports shared status-bar helpers and eliminated unused color constant.
Fuel Service feature
packages/actions/src/actions/fuel-service.ts, packages/actions/src/actions/fuel-service.test.ts, packages/stream-deck-plugin/src/pi/fuel-service.ejs, docs/reference/actions.json, packages/website/.../pit-service/fuel-service.md
Added toggle-fuel-fill mode (default), telemetry-aware SVG rendering, telemetry helpers (isFuelFillOn, getFuelAmount, formatFuelFillAmount), SDK execute path (pit.clearFuel() / pit.fuel(0)), lifecycle telemetry subscribe/unsubscribe, and tests updated/expanded; PI default and docs updated.
Pit Quick Actions feature
packages/actions/src/actions/pit-quick-actions.ts, packages/actions/src/actions/pit-quick-actions.test.ts, packages/website/.../pit-service/pit-quick-actions.md
Replaced static icons for some modes with telemetry-driven rendering using shared status-bar, added telemetry helpers/types (isWindshieldOn, isFastRepairOn, isFastRepairAvailable, PitQuickActionTelemetryState), per-context state tracking, subscribe/unsubscribe lifecycle, and tests for telemetry-driven behavior.
Icons & tests
packages/actions/src/icons/status-bar.ts, packages/actions/src/icons/status-bar.test.ts, packages/actions/.../pit-quick-actions.svg*
New status-bar icon module and tests; shared SVG template usage introduced for telemetry-aware pit icons (template file touched/used).
Documentation & README updates
.claude/skills/iracedeck-actions/SKILL.md, README.md, packages/website/src/content/docs/docs/actions/overview.md, packages/website/src/content/docs/index.mdx
Updated action/catalog counts (32 actions, 349 controls) and descriptive text for Pit Service and View/Camera categories.

Sequence Diagram

sequenceDiagram
    participant User as Stream Deck (User)
    participant Action as Telemetry-Aware Action
    participant SDK as iRacing SDK
    participant Display as Stream Deck Display

    User->>Action: onWillAppear(actionId)
    Action->>SDK: subscribe(actionId)
    SDK->>Action: telemetry update (PitSvFlags, fuel amt, availability)

    loop on telemetry change
        Action->>Action: derive telemetryState (isOn, amount, available)
        alt stateKey changed
            Action->>Action: generateSvg(settings, telemetryState)
            Action->>Display: setImage(svg)
        else no change
            Note right of Action: skip update
        end
    end

    User->>Action: onKeyDown
    Action->>SDK: pit.clearXXX() or pit.xxx(0) based on telemetryState
    SDK->>Action: telemetry reflects change
    Action->>Display: setImage(updated svg)

    User->>Action: onWillDisappear
    Action->>SDK: unsubscribe(actionId)
    Note right of Action: clear cached state
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Poem

🐰
I nibble code and tweak the view,
Green for go and red for "no"—it's true,
A toggle hops, fuel meter gleams,
Status bars dance in engineer dreams,
Docs refreshed, the actions grew!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately describes the main feature: adding telemetry-driven ON/OFF state indicators to pit quick actions and fuel fill toggle.
Description check ✅ Passed The PR description follows the template with all required sections: Related Issue (#197), What changed, How to test, and a completed Checklist with all items verified.
Linked Issues check ✅ Passed All code changes comprehensively address the requirements in issue #197: telemetry-driven status bars for pit actions, toggle-fuel-fill mode with live display, shared status-bar utility extraction, telemetry subscription patterns, dynamic SVG templates, and documentation updates.
Out of Scope Changes check ✅ Passed All changes are directly aligned with issue #197 objectives; no unrelated modifications were introduced. Changes scope includes refactored status bar utilities, telemetry-aware pit actions, fuel service enhancements, tests, documentation, and plugin configuration updates.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/197-pit-quick-actions-telemetry

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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/stream-deck-plugin/src/pi/fuel-service.ejs (1)

42-44: ⚠️ Potential issue | 🟠 Major

Reorder PI partials to match required template contract.

Line 42 places common-settings before color-overrides; this should be reversed so common settings come after color overrides.

🔧 Proposed fix
-		<%- include('common-settings') %>
-
-		<%- include('color-overrides', { slots: ['backgroundColor', 'textColor', 'graphic1Color'], defaults: require('./data/color-defaults.json')['fuel-service'] }) %>
+		<%- include('color-overrides', { slots: ['backgroundColor', 'textColor', 'graphic1Color'], defaults: require('./data/color-defaults.json')['fuel-service'] }) %>
+
+		<%- include('common-settings') %>

As per coding guidelines: Property Inspector templates must include color-overrides between action-specific and global sections, and include common-settings after color-overrides.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/stream-deck-plugin/src/pi/fuel-service.ejs` around lines 42 - 44,
The partial includes in the PI template are in the wrong order: swap the two
include lines so that color-overrides (the include('color-overrides', { slots:
..., defaults: ... })) appears before common-settings
(include('common-settings')), ensuring color-overrides sits between
action-specific and global sections and common-settings follows it to satisfy
the template contract.
🧹 Nitpick comments (1)
packages/actions/src/actions/pit-quick-actions.ts (1)

24-33: Remove duplicate JSDoc comment.

There are two consecutive JSDoc comments documenting STATIC_ACTION_ICONS. The first (lines 24-26) is incomplete, while the second (lines 27-30) provides the full explanation.

♻️ Proposed fix
-/**
- * Standalone SVG templates for static pit quick action modes (imported from `@iracedeck/icons`)
- */
 /**
  * Standalone SVG templates for static pit quick action modes (imported from `@iracedeck/icons`).
  * Telemetry-aware modes (windshield-tearoff, request-fast-repair) use the dynamic template instead.
  */
 const STATIC_ACTION_ICONS: Partial<Record<PitQuickActionType, string>> = {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/actions/src/actions/pit-quick-actions.ts` around lines 24 - 33,
Remove the duplicate/incomplete JSDoc above STATIC_ACTION_ICONS so only the full
descriptive comment remains; locate the consecutive comments that document
STATIC_ACTION_ICONS (referenced by the symbol STATIC_ACTION_ICONS and related
types like PitQuickActionType and clearAllCheckboxesIconSvg) and delete the
first incomplete JSDoc block, leaving the complete JSDoc immediately before the
constant.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@packages/stream-deck-plugin/src/pi/fuel-service.ejs`:
- Around line 42-44: The partial includes in the PI template are in the wrong
order: swap the two include lines so that color-overrides (the
include('color-overrides', { slots: ..., defaults: ... })) appears before
common-settings (include('common-settings')), ensuring color-overrides sits
between action-specific and global sections and common-settings follows it to
satisfy the template contract.

---

Nitpick comments:
In `@packages/actions/src/actions/pit-quick-actions.ts`:
- Around line 24-33: Remove the duplicate/incomplete JSDoc above
STATIC_ACTION_ICONS so only the full descriptive comment remains; locate the
consecutive comments that document STATIC_ACTION_ICONS (referenced by the symbol
STATIC_ACTION_ICONS and related types like PitQuickActionType and
clearAllCheckboxesIconSvg) and delete the first incomplete JSDoc block, leaving
the complete JSDoc immediately before the constant.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 31fcf9bc-d29b-48b3-b05b-6866d5971d1b

📥 Commits

Reviewing files that changed from the base of the PR and between 7e7afd0 and cc5c8b8.

⛔ Files ignored due to path filters (2)
  • packages/actions/icons/fuel-service.svg is excluded by !**/*.svg
  • packages/actions/icons/pit-quick-actions.svg is excluded by !**/*.svg
📒 Files selected for processing (15)
  • .claude/skills/iracedeck-actions/SKILL.md
  • README.md
  • docs/reference/actions.json
  • packages/actions/src/actions/car-control.ts
  • packages/actions/src/actions/fuel-service.test.ts
  • packages/actions/src/actions/fuel-service.ts
  • packages/actions/src/actions/pit-quick-actions.test.ts
  • packages/actions/src/actions/pit-quick-actions.ts
  • packages/actions/src/icons/status-bar.test.ts
  • packages/actions/src/icons/status-bar.ts
  • packages/stream-deck-plugin/src/pi/fuel-service.ejs
  • packages/website/src/content/docs/docs/actions/overview.md
  • packages/website/src/content/docs/docs/actions/pit-service/fuel-service.md
  • packages/website/src/content/docs/docs/actions/pit-service/pit-quick-actions.md
  • packages/website/src/content/docs/index.mdx

@niklam niklam merged commit 0d0196e into master Mar 27, 2026
3 of 4 checks passed
@niklam niklam deleted the feat/197-pit-quick-actions-telemetry branch March 27, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(actions): add telemetry-driven ON/OFF state to Pit Quick Actions and fuel fill toggle

1 participant