✗
Failing This test is currently failing.
Failed: backend-exec
Failure Output
error[KORU161]: std/store:new(nodes): `! removed` binds 'id' but never uses it — discard the payload (`! removed _`), or use the field in the body
--> tests/regression/600_STDLIB/690_STORE/690_093_interceptor_payload_reaches_nested_sweep/input.k:28:0
error[KORU161]: std/store:take(nodes[...]): unknown or not-yet-created container store 'nodes'
--> tests/regression/600_STDLIB/690_STORE/690_093_interceptor_payload_reaches_nested_sweep/input.k:39:0 Code
// PINS: an interceptor's payload reaches a sweep arm nested in its body.
//
// This is the shape a store needs to maintain a SEPARATE index reactively:
// `! removed { id }` learns which entry left, then sweeps the index to find and
// invalidate it. Each half is green on its own and only the combination fails —
// measured 2026-07-28:
//
// ! removed _ |> sweep(idx) ! sweep e when e.live == 1 |> stored {...} compiles
// ! removed { id } |> stored { idx[0].live: id } compiles
// ! removed { id } |> sweep(idx) ! sweep e when e.id == id |> stored {...} THIS
//
// Two checkers go blind on the same fact. The backend reports `use of
// undeclared identifier 'id'` from the sweep's `when` guard, and KORU100
// independently reports "`! removed` binds 'id' but never uses it" — neither
// sees a use that lives inside the nested arm.
//
// CAUSE: sweep's capture pass collects enclosing MID-PIPE binds from the host
// flow (store.kz, `Cap.collectBindsOnPath` — the 690_073 mechanism). An
// interceptor payload is not a mid-pipe bind; it is the arm's payload on a
// transplanted interceptor body, so the walk never finds it and the name is
// never threaded into the sweepbody event.
import std/io
import std/store
std/store:new(idx, capacity: 8) { id: i64, live: i64 }
std/store:new(nodes, capacity: 8) { id: i64, val: i64 }
! removed { id } |> std/store:sweep(idx)
! sweep e when e.id == id |> std/store:stored { e.live: 0 }
std/store:insert(idx) { id: 10, live: 1 }
| row _ |> std/store:insert(idx) { id: 20, live: 1 }
| row _ |> _
| full _ |> _
| full _ |> _
std/store:insert(nodes) { id: 10, val: 100 }
| row a |> std/store:take(nodes[a])
| item _ |> _
| empty |> _
std/store:sweep(idx)
! sweep e |> std/io:print.ln("id {{ e.id:d }} live {{ e.live:d }}")
Expected output
id 10 live 0
id 20 live 1
Flows
flow ~new click a branch to expand · @labels scroll to their anchor
new (expr: idx, capacity: 8, source: id: i64, live: i64)
flow ~new click a branch to expand · @labels scroll to their anchor
new (expr: nodes, capacity: 8, source: id: i64, val: i64)
flow ~insert click a branch to expand · @labels scroll to their anchor
insert (expr: idx, source: id: 10, live: 1)
flow ~insert click a branch to expand · @labels scroll to their anchor
insert (expr: nodes, source: id: 10, val: 100)
flow ~sweep click a branch to expand · @labels scroll to their anchor
sweep (expr: idx)
Test Configuration
MUST_RUN