generated from eblume/project-template
Some checks failed
Build / validate (pull_request) Failing after 18m44s
Make the owner's saved filters first-class so the agenda isn't one flat list. `list` now takes a ListFilter predicate-as-data (heph-core::filter): attention include/exclude sets, project-id scope, exclude_projects, and an actionable do-date gate. New Store::view(name) resolves a built-in ViewSpec — looking project names up to ids and subtree-expanding them through parent links — then lists. Five built-ins seeded from the Todoist queries (design §6.2.1): tom, ondeck, chores, work, tasks (Schedule dropped — time-of-day isn't modeled on date-grained do-dates). Surfaced as `heph view <name>` (no name lists them), the `view` RPC + RemoteStore forward, and `:Heph view <name>` in nvim. The list RPC/RemoteStore/CLI/heph.nvim migrate to the filter wire; legacy --scope/--attention/--no-blue map onto it (nvim view.lua updated). Tests: filter unit predicate, a views integration suite (subtree scope+exclude, actionable gate, unknown-view error, absent-project empties), a socket list/view dispatch test, two nvim e2e specs. 154 Rust tests + 18 nvim e2e green; clippy/fmt clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
45 lines
1.8 KiB
Lua
45 lines
1.8 KiB
Lua
-- Filter views (tech-spec §8.2): `:Heph view <name>` renders a built-in slice.
|
|
|
|
local h = require("e2e.helpers")
|
|
|
|
describe("filter views", function()
|
|
local ctx
|
|
before_each(function()
|
|
ctx = h.start()
|
|
end)
|
|
after_each(function()
|
|
h.stop(ctx)
|
|
end)
|
|
|
|
it("renders the Top of Mind view (red|orange, not blue)", function()
|
|
ctx.q:call("task.create", { title = "urgent thing", attention = "red" })
|
|
ctx.q:call("task.create", { title = "warm thing", attention = "orange" })
|
|
ctx.q:call("task.create", { title = "cool thing", attention = "blue" })
|
|
|
|
-- The backend view returns just the red + orange tasks.
|
|
local rows = ctx.q:call("view", { name = "tom" })
|
|
assert.are.equal(2, #rows)
|
|
|
|
-- The plugin renders them into a dedicated view buffer.
|
|
require("heph.view").view("tom")
|
|
local buf = vim.api.nvim_get_current_buf()
|
|
assert.is_truthy(
|
|
vim.api.nvim_buf_get_name(buf):find("heph://view/tom", 1, true),
|
|
"view buffer not named heph://view/tom"
|
|
)
|
|
local text = table.concat(vim.api.nvim_buf_get_lines(buf, 0, -1, false), "\n")
|
|
assert.is_truthy(text:find("urgent thing", 1, true), "red task missing from ToM")
|
|
assert.is_truthy(text:find("warm thing", 1, true), "orange task missing from ToM")
|
|
assert.is_falsy(text:find("cool thing", 1, true), "blue task should not be in ToM")
|
|
end)
|
|
|
|
it("scopes the chores view to chore projects via the daemon", function()
|
|
local chores = ctx.q:call("node.create", { kind = "project", title = "Chores" })
|
|
ctx.q:call("task.create", { title = "take out trash", attention = "white", project_id = chores.id })
|
|
ctx.q:call("task.create", { title = "unrelated", attention = "white" })
|
|
|
|
local rows = ctx.q:call("view", { name = "chores" })
|
|
assert.are.equal(1, #rows)
|
|
assert.are.equal("take out trash", rows[1].title)
|
|
end)
|
|
end)
|