Skip to content

refactor(rpc): delete unused JsonTo*Visitor classes (#3251 / #3244 Tier 3I) - #3261

Merged
zackees merged 1 commit into
masterfrom
feat/3251-delete-dead-json-visitors
Jun 19, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/3251-delete-dead-json-visitors

Conversation

@zackees

@zackees zackees commented Jun 19, 2026 •

Copy link
Copy Markdown
Member

Summary

Deletes 347 lines of dead code that no caller references after PR #3253 (#3247) moved every JsonToType<T> specialization onto the non-template json_convert_to_X_core dispatch layer.

Removed:

  • src/fl/remote/rpc/json_visitors.h -- defined JsonToIntegerVisitor<T>, JsonToFloatVisitor<T>, JsonToBoolVisitor, JsonToStringVisitor. Zero remaining callers across src/, tests/, examples/ (verified by grep).
  • Stale #include "fl/remote/rpc/json_visitors.h" from json_to_type.h.
  • Updated the historical comment in json_dispatch.h to record where the visitors used to live and that [Type-Erasure] json: outline visitor warning-string formatter (#3244 Tier 3I) #3251 removed them.

Flash impact -- LPC845-BRK / AutoResearch

Metric Master Branch Delta
Flash (.bin) 46,840 B 46,840 B 0 B

The byte target for #3251 was already captured by #3247 / PR #3253. When the per-(visitor x alternative) dispatch was outlined into the shared json_convert_to_X_core functions, the linker started stripping the unreferenced visitor classes. This PR is the follow-up cleanup that removes the now-dead source so the file no longer carries 347 lines of code with no callers. The reading-flash-bytes test doesn't move because there's nothing left to strip; the codebase is just cleaner.

Closes #3251

The issue asked for "outline visitor warning-string formatter". The outlining itself happened in #3247 (warnings now live in non-template json_dispatch.cpp.hpp cores). What was left was deleting the artifact named in the issue body. That's what this PR does.

Test plan

  • bash test rpc -- 1/1 test binary passes (all RPC test cases).
  • bash lint --cpp -- 0 violations.
  • LPC845 / AutoResearch host-cross build via ./compile lpc845brk --examples AutoResearch (Flash 71.5% unchanged).
  • grep -rn JsonTo*Visitor in src/ / tests/ / examples/ -- only this PR's edited comment in json_dispatch.h remains.

Refs #3244, #3247, #3235 Tier 3I.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor
    • Optimized internal JSON conversion handling to improve code efficiency and maintainability. No changes to public APIs.

…er 3I)

PR #3253 (closes #3247 / Tier 2E Phase 2) moved every JsonToType<T>
specialization onto the non-template `json_convert_to_X_core` dispatch
layer. The original `JsonToIntegerVisitor<T>`, `JsonToFloatVisitor<T>`,
`JsonToBoolVisitor`, and `JsonToStringVisitor` classes in
`fl/remote/rpc/json_visitors.h` lost all callers in the process.

Removes:
  - `src/fl/remote/rpc/json_visitors.h` (347 lines, all dead)
  - stale `#include "fl/remote/rpc/json_visitors.h"` from `json_to_type.h`

Updates the `json_dispatch.h` header comment to record where the
visitor classes used to live and that #3251 deleted them.

Flash impact (LPC845 / AutoResearch):
  - Master baseline: 46,840 B
  - This branch:     46,840 B
  - Delta:           0 B

The audit's predicted ~1-2 KB savings for #3251 was already captured
when #3247 outlined the per-(visitor x alternative) dispatch into the
shared non-template cores -- the linker has been stripping the
unreferenced visitor classes for several releases. This PR is the
follow-up cleanup that removes the now-dead source. No flash drop
because there was nothing left to drop, but the codebase is 347 lines
lighter and the include graph drops one stale entry.

Closes #3251 (deletes the artifact the issue named; the byte target was
captured by #3247).

Refs #3244, #3247, #3235 Tier 3I.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Jun 19, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b60278c7-3f40-4918-87c6-ab3ebd976e00

📥 Commits

Reviewing files that changed from the base of the PR and between 51c90b4 and 87c5880.

📒 Files selected for processing (3)
  • src/fl/remote/rpc/json_dispatch.h
  • src/fl/remote/rpc/json_to_type.h
  • src/fl/remote/rpc/json_visitors.h
💤 Files with no reviewable changes (2)
  • src/fl/remote/rpc/json_visitors.h
  • src/fl/remote/rpc/json_to_type.h

📝 Walkthrough

Walkthrough

Removes json_visitors.h and its four templated visitor structs (JsonToIntegerVisitor<T>, JsonToBoolVisitor, JsonToFloatVisitor<T>, JsonToStringVisitor). Updates the block comment in json_dispatch.h to describe the replacement non-template core dispatch strategy, and rewires json_to_type.h to include json_dispatch.h instead of the deleted header.

Changes

JSON visitor removal and dispatch rewire

Layer / File(s) Summary
Update dispatch comment and rewire include
src/fl/remote/rpc/json_dispatch.h, src/fl/remote/rpc/json_to_type.h, src/fl/remote/rpc/json_visitors.h
json_visitors.h is deleted (removing all four visitor structs, ~347 lines). json_dispatch.h block comment is rewritten to describe the shared non-template core approach and references FL_NO_INLINE for LTO dedup. json_to_type.h replaces its json_visitors.h include with json_dispatch.h.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related issues

Possibly related PRs

  • FastLED/FastLED#3253: Implements the same refactor — removing JSON visitor machinery and replacing with json_dispatch.* shared non-template cores — making it a near-identical change to this PR.
  • FastLED/FastLED#3226: Modifies the float-conversion visitor behaviors under FL_PLATFORM_HAS_LARGE_MEMORY, directly overlapping with the visitor structs this PR removes.
  • FastLED/FastLED#3258: Depends on the JSON-to-primitive conversion layer being refactored here, as RuntimeRpcBinding::invoke relies on json_to_type.h for argument decoding.

Poem

🐰 Hop hop, the visitors are gone at last,
Four template structs deleted, shed their past.
A shared dispatch core now does the deed,
FL_NO_INLINE ensures LTO takes heed.
Less code, less bloat — the rabbit's glad indeed! 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: deletion of unused visitor classes following their migration to a dispatch layer in PR #3253.
Linked Issues check ✅ Passed The PR addresses issue #3251's core objective (removing dead visitor code) as a follow-up to PR #3253, which completed the actual code migration. The byte-savings goal was already achieved by PR #3247.
Out of Scope Changes check ✅ Passed All changes are scoped to removing the visitor classes and their includes; no unrelated modifications are present in json_dispatch.h, json_to_type.h, or json_visitors.h.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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/3251-delete-dead-json-visitors

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.

@zackees
zackees merged commit d2566be into master Jun 19, 2026
11 checks passed
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jun 19, 2026
@zackees
zackees deleted the feat/3251-delete-dead-json-visitors branch August 21, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Type-Erasure] json: outline visitor warning-string formatter (#3244 Tier 3I)

1 participant