✓
Passing This code compiles and runs correctly.
Code
// 698_013 — the same home check guards `stored` writes: a `ref(Dog)`
// column written through the apply dispatcher refuses a handle minted by
// a store that does not hold Dog rows. The owner row starts unset (-1),
// then a cats handle is stored into it — the trap fires at the write.
import std/proto
import std/store
import std/io
std/proto(Dog) {
hp: i64
}
std/proto(Owner) {
dog: ref(Dog)
}
std/store:new(dogs, capacity: 8) { Dog }
std/store:new(cats, capacity: 8) { lives: i64 }
std/store:new(owners, capacity: 8) { Owner }
std/store:insert(cats) { lives: 9 }
| row c |> std/store:insert(owners) { dog: -1 }
| row o |> std/store:stored { owners[o].dog: c }
Actual
thread 308932673 panic: std/store: 'owners.dog' is ref(Dog) - the value is not a handle a Dog-holding store minted (`| row` on such a store's insert or cursor; -1 is the unset sentinel)
???:?:?: 0x1027e68c3 in _output_emitted.main_module.__koru_home_owners_dog (???)
???:?:?: 0x1027e6e7f in _output_emitted.main_module.__store_apply_owners_event.__koru_handler_impl (???)
???:?:?: 0x1027e633f in _output_emitted.main_module.__store_write_owners_event.__koru_handler_impl (???)
???:?:?: 0x1027e58f3 in _output_emitted.main_module.flow0 (???)
???:?:?: 0x1027e574f in _output_emitted.main (???)
???:?:?: 0x1027e566b in _main (???)
???:?:?: 0x1816a3dff in ??? (???)
???:?:?: 0x0 in ??? (???)
Expected patterns
Each line is a regex that must match the program output.
'owners\.dog' is ref\(Dog\)Flows
flow ~std/proto click a branch to expand · @labels scroll to their anchor
std/proto (Dog, source: hp: i64)
flow ~std/proto click a branch to expand · @labels scroll to their anchor
std/proto (Owner, source: dog: ref(Dog))
flow ~new click a branch to expand · @labels scroll to their anchor
new (dogs, capacity: 8, source: Dog)
flow ~new click a branch to expand · @labels scroll to their anchor
new (cats, capacity: 8, source: lives: i64)
flow ~new click a branch to expand · @labels scroll to their anchor
new (owners, capacity: 8, source: Owner)
flow ~insert click a branch to expand · @labels scroll to their anchor
insert (cats, source: lives: 9)
Test Configuration
MUST_RUN EXPECT_TRAP · exit 134