Expand description
Canonical reaction-count codec shared between the meta adapter
(which writes to the actions_data.reactions column) and the
STAT native hook (which normalizes inbound STAT content.r).
Wire format: “
totalis the uncapped sum; the per-type list is capped to the top 5 entries, sorted DESC by count then ASC by code.- Empty list with
total == 0encodes as an empty string.
Functions§
- decode_
reaction_ counts - Decodes the canonical wire format into
(entries, total). Lenient: skips malformed tokens silently. - encode_
reaction_ counts - Encodes reactions into the canonical wire format. Sorts and truncates
entriesin place so callers can’t accidentally pass unsorted data. Returns “” whentotal == 0. - reaction_
type_ key - Map a reaction sub_type (e.g. “LIKE”) to its single-char wire key.