✓
Passing This code compiles and runs correctly.
Code
// PINS: `std/indexes:store(s, col)` on a non-i64 column — the bucket map's
// key type follows the column's declared width, not a hardcoded i64. The
// benchmark's `act: i32` index is the first non-i64 key in the corpus, so
// this pins that routing, an eager membership move on an i32 write, a
// dead member after take, and a negative key all behave as on i64.
// The emit oracle (post.sh) checks the map key type is the column's own.
import std/store
import std/indexes
import std/io
std/store:new(tags, capacity: 8) { grp: i32, val: i32 }
std/indexes:store(tags, grp)
std/store:insert(tags) { grp: 1, val: 10 }
std/store:insert(tags) { grp: 2, val: 20 }
std/store:insert(tags) { grp: -5, val: 50 }
std/store:insert(tags) { grp: 1, val: 11 }
std/store:insert(tags) { grp: 3, val: 30 }
std/store:query(tags)
! query t when t.grp == 1 |> std/io:print.ln("one {{ t.val:d }}")
// a signed key routes the same way
std/store:query(tags)
! query t when t.grp == -5 |> std/io:print.ln("neg {{ t.val:d }}")
// a stored write to the i32 key moves membership eagerly
std/store:query(tags)
! first t when t.val == 30 |> std/store:stored { t.grp: 1 }
std/store:query(tags)
! query t when t.grp == 1 |> std/io:print.ln("one' {{ t.val:d }}")
// take inside the routed walk leaves dead members the resolve skips
std/store:query(tags)
! query t when t.grp == 1 |> std/store:take(tags[t])
| item i |> std/io:print.ln("took {{ i.val:d }}")
std/store:query(tags)
! first t when t.grp == 1 |> std/io:print.ln("still {{ t.val:d }}")
| none |> std/io:print.ln("all gone")
// the untouched buckets are still whole
std/store:query(tags)
! query t when t.grp == -5 |> std/io:print.ln("neg' {{ t.val:d }}")
Actual
one 10
one 11
neg 50
one' 10
one' 11
one' 30
took 10
took 11
took 30
all gone
neg' 50
Expected output
✓ Zig✓ JavaScriptone 10
one 11
neg 50
one' 10
one' 11
one' 30
took 10
took 11
took 30
all gone
neg' 50
Flows
flow ~new click a branch to expand · @labels scroll to their anchor
new (tags, capacity: 8, source: grp: i32, val: i32)
flow ~store click a branch to expand · @labels scroll to their anchor
store (expr: tags, grp, source: <implicit_source>)
flow ~insert click a branch to expand · @labels scroll to their anchor
insert (tags, source: grp: 1, val: 10)
flow ~insert click a branch to expand · @labels scroll to their anchor
insert (tags, source: grp: 2, val: 20)
flow ~insert click a branch to expand · @labels scroll to their anchor
insert (tags, source: grp: -5, val: 50)
flow ~insert click a branch to expand · @labels scroll to their anchor
insert (tags, source: grp: 1, val: 11)
flow ~insert click a branch to expand · @labels scroll to their anchor
insert (tags, source: grp: 3, val: 30)
flow ~query click a branch to expand · @labels scroll to their anchor
query (tags)
flow ~query click a branch to expand · @labels scroll to their anchor
query (tags)
flow ~query click a branch to expand · @labels scroll to their anchor
query (tags)
flow ~query click a branch to expand · @labels scroll to their anchor
query (tags)
flow ~query click a branch to expand · @labels scroll to their anchor
query (tags)
flow ~query click a branch to expand · @labels scroll to their anchor
query (tags)
flow ~query click a branch to expand · @labels scroll to their anchor
query (tags)
Test Configuration
MUST_RUN LANGUAGES: zig js
Post-validation Script:
#!/bin/bash
# Emitted-code oracle: the bucket map's key type must be the column's own
# declared type — `i32` here, visible as `AutoHashMapUnmanaged(i32, ...)` —
# not a hardcoded i64; and `! query` on the i32 key must route, not sweep.
set -u
if [ ! -f output_emitted.zig ]; then
echo "FAIL: no output_emitted.zig"
exit 1
fi
if ! grep -q '__index_grp: @import' output_emitted.zig; then
echo "FAIL: std/indexes:store(tags, grp) emitted no __index_grp map"
exit 1
fi
if ! grep -q 'AutoHashMapUnmanaged(i32' output_emitted.zig; then
echo "FAIL: the bucket map did not take the column's i32 key type"
exit 1
fi
if ! grep -q '__index_grp.getPtr(__koru_ik)) |__koru_ib|' output_emitted.zig; then
echo "FAIL: '! query t when t.grp == 1' did not route to the bucket"
exit 1
fi
echo "PASS: i32-keyed index routes — map keyed on the column's declared type"
exit 0