Something went wrong. Try again.
small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
Something went wrong. Try again.
1.2 kB 32 lines
123456789101112131415161718192021222324252627282930313233/// Late and cancelled run ownership cannot be reliably scheduled in E2E.import albedo/daemon/turnimport gleam/erlang/processimport gleam/option.{None, Some}import gleeunit/should
fn run(id: String, work: turn.Work) -> turn.Run { let pid = process.spawn(fn() { Nil }) turn.Run(id, pid, process.monitor(pid), False, turn.latch(), work)}
fn running(id: String) -> turn.Activity { turn.Running(run(id, turn.Turn(None)))}
pub fn late_messages_from_an_old_run_are_not_owned_test() -> Nil { let activity = running("current") turn.owner(activity, "old") |> should.equal(None) turn.live(activity, "old") |> should.be_false turn.live(activity, "current") |> should.be_true turn.owner(turn.Resting, "current") |> should.equal(None)}
// A cancelled run may still save completed tool results but may not publish// or take queued input.pub fn cancelled_run_still_owns_writes_but_is_not_live_test() -> Nil { let activity = turn.cancel(running("a")) turn.live(activity, "a") |> should.be_false let assert Some(owned) = turn.owner(activity, "a") owned.cancelled |> should.be_true turn.cancel(turn.Resting) |> should.equal(turn.Resting)}