mirror of
https://github.com/hanzoai/kv.git
synced 2026-11-09 16:05:35 +00:00
The command spec shipped without its code. `msetex.json` declared
`msetexCommand`, nothing defined it, and the generated commands.def
referenced a symbol that did not link — which is why the spec was parked
in _attic-unimplemented rather than fixed.
The implementation was never written by hand here; it was lost. Upstream
c82591ebf carried both halves and the `-X ours` merge kept only the JSON.
Recovered the source hunks (t_string.c, server.{c,h}, db.c, t_hash.c) and
the 353 lines of upstream tests along with them.
Recovering it exposed a latent bug in our own tree: getKeysUsingKeySpecs
computed a keynum spec's last key as `first + numkeys - 1`, ignoring the
step. Every keynum command until now had step 1, so the arithmetic was
accidentally right. MSETEX is the first with step 2, and COMMAND GETKEYS
returned only the first of its keys — meaning a cluster proxy or an ACL
key check would have seen half the keys it was supposed to.
last = first + ((int)numkeys - 1) * step;
Tests: unit/type/string + unit/introspection-2 — 163 ok, 20 of them
MSETEX, 0 failures. (The two `Check for memory leaks` errors are macOS
SIP blocking leaks(1) on an unsigned binary; unit/type/incr, untouched,
fails identically.)
Co-authored-by: Hanzo Dev <[email protected]>