Repository navigation
Description
Issue
The JSON-RPC envelope internal marker "__async" (and its sibling "__skip") is currently a top-level field on outgoing response objects in fl::Rpc::handle() and fl::Remote::processRpc(). Examples:
// src/fl/remote/rpc/rpc.cpp.hpp -- inside Rpc::handle()
if (isAsync) {
response.set("__async", true); // Internal marker
}
// src/fl/remote/remote.cpp.hpp -- inside processRpc() async path
fl::json nullResponse = fl::json::object();
nullResponse.set("__skip", true); // Marker to skip queueing
return nullResponse;Why the naming is wrong
In C / C++ tradition, double-underscore-prefixed names are reserved for the implementation (compiler + standard library). Treating __async as a first-class JSON-RPC envelope field implies:
- It's an internal hack that callers should not depend on
- It might collide with reserved JSON-Schema / OpenRPC reserved-namespace conventions
- It signals "private" to anyone reading the code, but the field is actually load-bearing -- the Server framework keys off it to decide whether to suppress queueing, the Remote class returns
__skipto short-circuit response handling, etc.
In reality these are public envelope-control fields in the FastLED-internal JSON-RPC dialect. They have a contract:
__async: true— the response was already sent viasendAsyncResponse; callers / the queue machinery should skip pushing this synthetic response__skip: true— the same intent on theRemote::processRpcside: skip queueing
Concrete bugs caused by the naming
- Linter false positives — some lints (and some IDE refactors) flag any
__-prefixed identifier as a reserved-namespace violation and suggest renaming. With our usage that produces unnecessary noise. - Searchability —
grep __asynccollides with C-runtime /cmsis_gcc/ async-runtime symbols on many platforms (__async_loop,__async_run, …). The marker is harder to find than it should be. - JSON-Schema documentation — when we eventually publish OpenRPC schema for the FastLED RPC envelope (cf LPC845 bloat: RPC dispatch surface is 12.6 KB (Rpc::handle 3.1K + Remote::processRpc 3.0K + TypedRpcBinding<sig>::invokeWithReturn 2.2K/sig) #3081 + META: LPC845 flash-budget Phase 2 — grow headroom from 1.4 KB to ~6-10 KB for feature capacity #3224 schema-gating work), these field names appear in the schema.
__asyncreads as "you should not touch this" but actually it's the canonical way to say "ACK already sent, please don't push a duplicate response." - Memory work — in META: LPC845 flash-budget Phase 2 — grow headroom from 1.4 KB to ~6-10 KB for feature capacity #3224 Tier 1B I gated the
__asyncsetter behindFL_PLATFORM_HAS_LARGE_MEMORYand saved 1.9 KB. The gate works, but every time someone reviews that diff they ask "what does__asyncmean?" -- the answer is "it's a public envelope marker that just happens to look private."
Proposed rename
Drop the __ prefix and give the field a name that signals "envelope control":
| Today | Proposed |
|---|---|
__async: true |
ackOnly: true (or envelope: "ack-only") |
__skip: true |
noEnqueue: true (or envelope: "skip") |
If a single field is preferred over two, an enum-like string is cleanest:
{"envelope": "ack-only" | "skip" | null}That way the field name itself documents what the envelope is for.
Migration plan
This is an envelope schema change, but the audience of consumers is small:
- The Server framework's response-queue code in
src/fl/remote/rpc/server.h/.cpp.hpp(key off the new name; keep a brief back-compat read of the old name in 1-2 releases). fl::Remote::processRpc()andfl::Rpc::handle()(single producer each).- Any host-side JSON-RPC client docs / OpenRPC schemas we generate.
Tests in tests/fl/remote/ that assert on the response shape also need updating.
Out of scope
- The
_F/_FMTmacro family that uses double-underscore-suffixed names internally — those are macro-internal and fine. - C++ symbol names that genuinely should stay double-underscore-prefixed (CMSIS intrinsics like
__get_PRIMASK, libgcc helpers like__aeabi_l2f, etc.).
Related
- Surfaced during META: LPC845 flash-budget Phase 2 — grow headroom from 1.4 KB to ~6-10 KB for feature capacity #3224 Tier 1B
Rpc::handleslim PR (the gate around the__asyncsetter looks odd until you realize the symbol isn't actually compiler-reserved). - Related to LPC845 bloat: RPC dispatch surface is 12.6 KB (Rpc::handle 3.1K + Remote::processRpc 3.0K + TypedRpcBinding<sig>::invokeWithReturn 2.2K/sig) #3081 schema-discovery gating and the broader RPC envelope documentation effort.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
zackees commentedon Jun 18, 2026
Now tracked under Phase 3 burn-down meta #3244 as a standalone follow-on.
refactor(rpc): rename envelope markers __async / __skip to ackOnly / …