B3.2 · dive 3 — the order theorem's dividend
One set is three indexes.
Because job ids are branded snowflakes, the pending structure gets Chapter 1.2's theorem for free on a new substrate: the ids are the chronology. The set is "simultaneously the FIFO (lex-min is the oldest job) and the browse index (lex-max-down is newest-first) and the time-range index (an id-prefix range is a time window)". J4 collects the dividend on stage; J5 closes the loop on the cargo law.
Source: content/bcs3.2.md, quoting bcs_rung_3_2_check.out. On stage the
set holds 301 pending; the model below holds six.
JOB ids minted in sequence for this
model with the course's minting tool — demonstration data, not committed evidence; the committed
figures sit in the frozen record below. Every answer is computed live from the bytes.Static record — the FIFO head is JOB0Nvmd8aV5iy, the first id minted;
newest-first browse returns the last five in reverse mint order, JOB0Nvmd96ZlQG first; the
prefix JOB0Nvmd9 cuts the window that holds the last two mints. No timestamp column
anywhere.
The transcript
bcs_rung_3_2_check.out · verbatim · this dive reads J4 and J5boot: the registry grows by one -- JOB, work as a kind with identity and lifecycle J1 surface ok -- the bus module's surface: enqueue, browse, pending_size -- scripts and key shapes are nobody's business J2 idempotent ok -- enqueue is one script and idempotent by id: first call enqueued, second answered duplicate, the row untouched and pending holds 1 J3 kind ok -- kind policy lives in the script: an ORD id in the job position answers EMQKIND on the wire -- the key let it pass, the law did not J4 dividend ok -- the order theorem's dividend: newest-first browse over the ids themselves returns the last five minted in reverse mint order; the very first job sits at the head; 301 pending, no second index anywhere J5 cargo ok -- the cargo law holds: the payload carries ORD0Nt6z93U3dY and a quantity, never a row -- decoded and re-parsed on the far side of the wire PASS 5/5
The dividend
content/bcs3.2.md · What · WhoJ4 collects on stage what the structure promised: newest-first browse over the ids
themselves returns the last five minted in reverse mint order; the very first job sits at the head; 301
pending, no second index anywhere. The rung holds three hundred and one pending jobs and asks the
set the operator's questions — newest-first, oldest-first — and the answers fall out of the bytes,
because equal scores order lexicographically and for branded ids byte order is mint order.
For producers: retry-safe enqueue by construction — fire it again on any doubt, the id is the receipt. For operators: browse pending newest-first with one command and cut time windows as lex ranges over id prefixes, "no schema migration ever having happened because the grammar is the schema and keys appear on first use." Two honest boundaries travel with the dividend: browse covers pending only — terminal-state browsing arrives with the states themselves — and multi-producer ordering is arrival-interleaved, as any queue's is; within one producer, mint order holds. And B3.3 · The State Machine in Lua inherits a pending set whose lex-min is always the claimable head.
The cargo law
content/bcs3.2.md · What · WhenJ5 closes the loop: the payload carries ORD0Nt6z93U3dY and a quantity, never a row
-- decoded and re-parsed on the far side of the wire. The payload decodes on the far side to a map
carrying ORD0Nt6z93U3dY and a quantity, the id re-parses through the contract, and no row
ever crossed the wire.
The chapter's When states the rule for callers: "Put ids and parameters in the payload; never rows, and never blobs — a large artifact gets stored where artifacts live and referenced by its name, like everything else in this series."
Static verdicts — decoded: order_id → ORD0Nt6z93U3dY ·
qty → a quantity (the field on the record, the number off stage) · re-parsed
through the contract: namespace ORD, node 7, seq 0, minted
2026-06-11 09:01:41 UTC · the row never ships — ids and parameters only.
References
sources · relatedSources
- Valkey — ZRANGEthe REV and BYLEX forms behind newest-first browse; equal-score elements order lexicographically
- Valkey — Sorted setsthe same-score lexicographic family as a generic index; the different-scores caveat behind the score-zero decision
Related
- B3.2 — Jobs Are Entitiesthe module hub; the full rung in context
- B3 — The Busthe chapter landing; Part III's arc
- B3.1 — The Fence and the Keyspacethe keys the browse ranges over
- B2.2 — Property Storeswhere chronology-without-a-column first performed
- EchoMQ — the coursethe bus protocol in rung-level depth
- Redis Patterns Appliedthe substrate: sorted sets as indexes