-- Workflow (e): a recurring task with a checklist. Completing it must roll the -- task forward in place and present the next occurrence with a FRESH, -- all-unchecked checklist — completion never carries forward (tech-spec §4.4). -- -- The e2e daemon uses the real system clock (it's the actual binary), so we -- assert the do-date *advanced* past the original rather than an exact value; -- the fresh checklist is the hard requirement. local h = require("e2e.helpers") describe("recurring task checklist", function() local ctx before_each(function() ctx = h.start() end) after_each(function() h.stop(ctx) end) it("resets the checklist to all-unchecked on the next occurrence", function() local base = 1717200000000 -- 2024-06-01, safely in the past local task = require("heph.task").capture("Water plants", { recurrence = "FREQ=DAILY", do_date = base, }) -- Its canonical-context doc holds the checklist (the recurrence template). local ctx_id for _, l in ipairs(ctx.q:call("links.outgoing", { id = task.node_id })) do if l.link_type == "canonical-context" then ctx_id = l.dst_id end end assert.is_truthy(ctx_id) -- Add a checklist via the buffer, then check both items off. local buf = h.open(ctx_id) h.set_lines(buf, { "- [ ] water fern", "- [ ] water cactus" }) h.save(buf) h.set_lines(buf, { "- [x] water fern", "- [x] water cactus" }) h.save(buf) -- Complete the occurrence from its context buffer → rolls forward in place. require("heph.task").set_state_current("done") local t = ctx.q:call("task.get", { id = task.node_id }) assert.are.equal("outstanding", t.state) -- rolled forward, not done assert.is_true(t.do_date > base, "do-date should advance to the next occurrence") -- The hard requirement: a fresh, all-unchecked checklist. local stored = ctx.q:call("node.get", { id = ctx_id }) assert.are.equal("- [ ] water fern\n- [ ] water cactus", stored.body) end) end)