hecate_om_wire (hecate_om v0.16.2)
View SourceTolerant field lookup on a decoded mesh payload map (RPC/stream args, or a pubsub event payload), instead of every provider desk re-solving the same gotcha independently.
macula's frame decoder round-trips a payload's keys through binary_to_existing_atom/1 on the way in, so a caller that sent binary keys can find them waiting as atoms on the other side. Three incompatible ways of coping with this were already live in the workspace when this was written (see hecate-om/plans/PLAN_HECATE_OM_MESH_WRAPPERS.md, piece F): hecate-embedder tries the atom form first, falling back to binary; hecate-spartan reimplements the same fallback (mget/2,3) 11+ times across its federation_* modules for pubsub payloads, not just RPC args; and hecate-dns/-git/-llm/-rag's route/2 handlers pattern-match binary keys only, with zero tolerance — silently wrong if a real caller's payload ever arrives atom-keyed.
field/2,3 accepts either an atom or a binary key literal, whichever the caller naturally reaches for. Either way the atom form is tried first (the confirmed-live shape for both RPC/stream args and pubsub payloads, piece C/D's own live tests), the binary form second.
retryable/1 (piece G) is the response-side counterpart: whether a failed RPC/stream call outcome is worth retrying, per macula's own published BOLT#4 retry policy. hecate-tom-player's tom_wire_ macula.erl was, before this, the one place in the workspace doing this at all -- asking macula_bolt4:is_retryable/1 rather than keeping a second copy of its code table locally, which would rot the moment BOLT#4 grows a code.
Summary
Functions
Equivalent to field(Key, Payload, undefined).
Look up Key in Payload, trying both the atom and binary form of Key regardless of which one the caller passed in. Returns Default if neither form is present.
Whether a failed RPC/stream call outcome is worth retrying.
Functions
Equivalent to field(Key, Payload, undefined).
Look up Key in Payload, trying both the atom and binary form of Key regardless of which one the caller passed in. Returns Default if neither form is present.
Whether a failed RPC/stream call outcome is worth retrying.
{error, {call_error, Code, _Name}} is macula's own documented outcome shape for a CALL failure (macula_station_link.erl's own doc table), not a caller-specific convention -- covers macula: call/5, call_station/6,7,8, and hecate_om_capabilities: call_capability/5,7 uniformly. A success, or an error macula didn't code-classify at all (a raw catch, a timeout), has nothing for the BOLT#4 table to say, so those are decided directly here rather than delegated.