generated from eblume/project-template
All checks were successful
Build / validate (pull_request) Successful in 10m44s
The daemon is now an OS service (`heph daemon`); the plugin no longer spawns or supervises one. Removes the managed-daemon machinery entirely. - delete lua/heph/daemon.lua (spawn/ensure/stop_spawned/self-heal) - init.lua: connect-only; probe `health` once and guide to `heph daemon start` - rpc.lua: drop set_respawn + respawn-on-drop; a dropped connection just reconnects once (e.g. after `heph daemon restart`), never spawns - config.lua: drop autostart/bin/db; stable socket fallback (data-dir, matches hephd::default_socket_path), keep $HEPH_SOCKET for dev isolation - tests: spawn/wait_ready move into the e2e harness (test infra); rework managed_daemon_spec into a connect-only spec (connect / clean-fail / reconnect) 16 nvim e2e specs pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
47 lines
1.8 KiB
Lua
47 lines
1.8 KiB
Lua
-- The plugin is connect-only (tech-spec §8, [[design]] §4): it never spawns a
|
|
-- daemon — it connects to one run as an OS service (`heph daemon start`). These
|
|
-- specs cover connecting to a running daemon, a clean failure when none is
|
|
-- running, and reconnecting after the daemon is restarted.
|
|
|
|
local h = require("e2e.helpers")
|
|
|
|
describe("connect-only daemon", function()
|
|
it("connects to a running daemon and works", function()
|
|
local ctx = h.start() -- harness starts a real daemon; binds the plugin to it
|
|
require("heph").setup({ socket = ctx.sock, keymaps = false })
|
|
assert.is_truthy(require("heph.rpc").call("health", {}))
|
|
h.stop(ctx)
|
|
end)
|
|
|
|
it("fails cleanly when no daemon is running (never spawns one)", function()
|
|
local t = h.tmp() -- temp socket path with nothing serving it
|
|
require("heph.rpc").setup(t.sock)
|
|
-- A call must fail loudly (connection error), not hang or spawn a daemon.
|
|
local ok = pcall(require("heph.rpc").call, "health", {})
|
|
assert.is_false(ok, "expected a connection failure with no daemon running")
|
|
pcall(function()
|
|
require("heph.rpc").close()
|
|
end)
|
|
t.rm()
|
|
end)
|
|
|
|
it("reconnects after the daemon is restarted under it", function()
|
|
local ctx = h.start()
|
|
require("heph").setup({ socket = ctx.sock, keymaps = false })
|
|
require("heph.rpc").call("health", {})
|
|
|
|
-- Kill the daemon, then start a fresh one on the SAME socket (as
|
|
-- `heph daemon restart` would). The next call should reconnect.
|
|
ctx.daemon.handle:kill("sigterm")
|
|
vim.wait(2000, function()
|
|
return ctx.exited.done
|
|
end, 20)
|
|
pcall(function()
|
|
vim.uv.fs_unlink(ctx.sock)
|
|
end)
|
|
|
|
local ctx2 = h.start_on(ctx.dir, ctx.sock, ctx.db)
|
|
assert.is_truthy(require("heph.rpc").call("health", {}))
|
|
h.stop(ctx2)
|
|
end)
|
|
end)
|