Documentation
¶
Overview ¶
Package lltest provides test doubles for the leyline daemon wire: an in-process fake speaking the line-delimited JSON UDS protocol, and a gated spawner for the SHA-pinned real binary. Tests point mache at either via t.Setenv("LEYLINE_SOCKET", sock) — leyline.DiscoverOrStart honors that env var before any spawn/download logic runs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FakeDaemon ¶
FakeDaemon starts a Unix-domain-socket server that speaks the daemon's line-delimited JSON protocol, answering every request via handler. It returns the socket path; callers wire it up with t.Setenv("LEYLINE_SOCKET", sock). The server tolerates probe connections that close without sending (DiscoverOrStart's liveness check does exactly that). Shutdown is registered via t.Cleanup.
func IngestSourceViaLeyline ¶
IngestSourceViaLeyline is the test-side equivalent of the serve/mount source path after in-process tree-sitter removal (mache-37ae8b, ADR-0012 step 4): it parses srcPath with the pinned leyline binary into an `_ast` db, attaches an ASTWalker to engine, and ingests. Tests that previously did `engine.Ingest(sourceFileOrDir)` — which now errors because the Engine has no in-process parser — call this instead.
srcPath may be a file or a directory (leyline parse wants a directory, so a single file is staged into a temp dir first). The binary is resolved with ResolveBinary(false), so the test SKIPS rather than downloading when the pinned leyline isn't cached — mirroring every other leyline e2e test.
func PinnedBinaryOrSkip ¶ added in v0.21.0
PinnedBinaryOrSkip resolves the SHA-pinned leyline binary the same way production does — version-namespaced ~/.mache/bin/leyline-<pin> first, legacy unversioned path only when it happens to hold the pin — and SKIPS the test when none is cached. It never downloads.
Resolving the legacy path DIRECTLY (as this did until mache-7555da) made every pinned gate skip unconditionally once the cache became version-namespaced: nothing writes ~/.mache/bin/leyline any more, so on a machine whose legacy file was left behind by an older pin the gate could never fire.
func StartPinnedDaemon ¶
StartPinnedDaemon spawns the SHA-pinned leyline binary from ~/.mache/bin/leyline as a PRIVATE daemon (own arena/control/socket in a short-lived temp dir — no interference with the shared ~/.mache arena) and returns its socket path.
Gated, never downloads: the test SKIPS when the binary is absent or its --version does not match leyline.PinnedBinaryVersion(). It deliberately does NOT fall back to a leyline on PATH — an unpinned binary produces different wire behavior than CI's SHA-verified release (mache-608a3c).
func UsePinnedDaemon ¶
UsePinnedDaemon spawns a private pinned daemon (see StartPinnedDaemon) and points LEYLINE_SOCKET at it for the remainder of the test, which is how every gated e2e consumer wires the daemon into mache's discovery path.