generated from eblume/project-template
Some checks failed
Build / validate (pull_request) Failing after 3s
Backend (TDD):
- task.promote {container_id, item_ref, attention?, project?}: mint a committed
task from the item_ref-th `- [ ]` context item (1-based, document order via a
new extract::context_item_lines) and rewrite that source line into a [[link]]
to it. Unit + rpc_socket tests.
- resolve_id now excludes canonical-context docs, so [[Task Title]] resolves to
the task, not its identically-titled context doc (deterministic; a general fix
surfaced by promotion's ULID-tiebreak ambiguity).
Plugin: :Heph promote / promote_under_cursor (save-if-dirty → compute item index
with a code-fence-aware scanner mirroring extract.rs → task.promote → reload the
rewritten buffer). e2e spec (f): promote a context line, assert the new task in
next, the source line became a link, and the container backlinks the task.
CI via Dagger: a test_nvim function bakes a pinned, arch-detected Neovim
(v0.11.2 — Debian's is too old for vim.uv) onto rust:1-bookworm, builds hephd,
and runs the self-contained shim suite (cargo + target cache volumes);
build.yaml calls `dagger call test-nvim`. run.lua now fails on zero specs (no
false-green). Validated end-to-end: passing suite → exit 0, failing spec →
Dagger exit 1.
117 Rust tests + 7 nvim e2e specs green.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
46 lines
1.6 KiB
Lua
46 lines
1.6 KiB
Lua
-- Workflow (f): promote a context-item line to a committed task. The daemon
|
|
-- mints the task and rewrites the source line into a [[link]] to it.
|
|
|
|
local h = require("e2e.helpers")
|
|
|
|
describe("promote context item", function()
|
|
local ctx
|
|
before_each(function()
|
|
ctx = h.start()
|
|
end)
|
|
after_each(function()
|
|
h.stop(ctx)
|
|
end)
|
|
|
|
it("mints a task, links the source line, and surfaces it in next", function()
|
|
local container = h.create_doc("Errands", "- [ ] call plumber")
|
|
local buf = h.open(container.id)
|
|
vim.api.nvim_win_set_cursor(0, { 1, 0 }) -- on the context-item line
|
|
|
|
local task = require("heph.task").promote_under_cursor({ attention = "orange" })
|
|
assert.is_truthy(task.node_id)
|
|
|
|
-- The promoted task appears in the Tactical ranking.
|
|
local found = false
|
|
for _, t in ipairs(ctx.q:call("next", { limit = 10 })) do
|
|
if t.node_id == task.node_id then
|
|
found = true
|
|
end
|
|
end
|
|
assert.is_true(found, "promoted task missing from next")
|
|
|
|
-- The source line became a wiki-link to the task (persisted + in-buffer).
|
|
assert.are.equal("- [[call plumber]]", ctx.q:call("node.get", { id = container.id }).body)
|
|
local reloaded = vim.api.nvim_get_current_buf()
|
|
assert.are.equal("- [[call plumber]]", vim.api.nvim_buf_get_lines(reloaded, 0, 1, false)[1])
|
|
|
|
-- ...and the container backlinks the task.
|
|
local linked = false
|
|
for _, l in ipairs(ctx.q:call("links.backlinks", { id = task.node_id })) do
|
|
if l.src_id == container.id and l.link_type == "wiki" then
|
|
linked = true
|
|
end
|
|
end
|
|
assert.is_true(linked, "expected a wiki backlink from the container to the task")
|
|
end)
|
|
end)
|