Skip to content

Rename RPC envelope markers '__async' / '__skip' -- they look reserved-namespace but are public envelope-control fields #3228

Closed

Description

@zackees

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 __skip to 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 via sendAsyncResponse; callers / the queue machinery should skip pushing this synthetic response
  • __skip: true — the same intent on the Remote::processRpc side: skip queueing

Concrete bugs caused by the naming

  1. 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.
  2. Searchability — grep __async collides 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.
  3. 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. __async reads 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."
  4. 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 __async setter behind FL_PLATFORM_HAS_LARGE_MEMORY and saved 1.9 KB. The gate works, but every time someone reviews that diff they ask "what does __async mean?" -- 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:

  1. 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).
  2. fl::Remote::processRpc() and fl::Rpc::handle() (single producer each).
  3. 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 / _FMT macro 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

Activity

  1. zackees commented on Jun 18, 2026

    @zackees
    MemberAuthor

    Now tracked under Phase 3 burn-down meta #3244 as a standalone follow-on.

  2. moved this from Triage to Done in FastLED Trackeron Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions