commit f6ffa00 ↗ · redis/redis · · committed Jun 12, 2026 · +416−17 · base df63a65d4d4e
Agent prompt
what a new run launched now would send
Redis already has SINTERCARD for intersection cardinality, but clients that only need the size of a union still have to run SUNION (or SUNIONSTORE) and count the members, which is wasteful for large sets.
Add a SUNIONCARD command that returns the cardinality of the union of multiple sets without returning the elements.
Syntax: SUNIONCARD numkeys key [key ...] [APPROX] [LIMIT limit]
Behavior a teammate would expect up front:
- Exact mode (default): return the exact number of distinct members across the given keys. Missing keys are empty sets. If any key holds a non-set type, reply WRONGTYPE.
- LIMIT: optional non-negative integer; LIMIT 0 means no limit. When LIMIT is positive, stop once cardinality reaches that value and return at most that value (true early termination in exact mode).
- APPROX: optional flag that estimates union cardinality with Redis’s existing HyperLogLog support (standard ~0.81% HLL error) instead of materializing the full union. With LIMIT, allow early exit once the estimate reaches the limit, and do not report a value above the limit when a limit is set.
- Parse/validate arguments in the same style as SINTERCARD (numkeys > 0, numkeys vs argc checks, unknown tokens → syntax error, negative/non-integer LIMIT rejected).
- Existing SUNION, SUNIONSTORE, SDIFF, SDIFFSTORE, and SPOP behavior must stay the same.
- Wire the command into Redis as a readonly set command with numkeys-based key specs, consistent with other set cardinality commands.
Interface contract — the change must expose exactly this surface:
Redis command SUNIONCARD, arity -3, syntax `SUNIONCARD numkeys key [key ...] [APPROX] [LIMIT limit]`, integer reply.
Work only inside this repository checkout. Make the code change the task
describes, keeping the diff focused — no drive-by refactors.
When you are done, leave your changes committed or in the working tree;
they are collected automatically.
Stay on this snapshot checkout (`task/ycb_redis_cf6ffa0003a25`). Never checkout, pull, or rebase onto `main`. That branch is a README-only orphan.
Stay on this HEAD. Do not fetch another default branch. Push only on the Cursor-created `crazy-cursor/…` side branch from this HEAD.
Some past runs of this task were launched with a different prompt (the prompt template changed since, or those runs predate this benchmark's stored prompt). Each run persists the exact prompt it sent at launch — that per-launch record is the audit trail; this page shows only the current one.
Reference diff
The task commit's diff against its first parent — the judge's comparison target.