fix(leyline): public ley-line-open download + version pin [mache-9051f0]#388
Merged
Merged
Conversation
…n pin [mache-9051f0] The auto-download URL in internal/leyline/socket.go had two problems that together produced silent breakage on fresh-clone machines: 1. Private repo. The URL referenced agentic-research/ley-line (private), so any CI runner or dev machine without an actions/checkout-style token got a 404 on every download attempt. The public counterpart is agentic-research/ley-line-open; switch to that. 2. Floating `/releases/latest/`. Even with the public repo, /latest/ pulls whatever LLO tagged most recently — which has no guaranteed relationship to the schema-client version pinned in mache's go.mod (github.com/agentic-research/ley-line-open/clients/go/leyline-schema v0.4.1). A floating fetch can hand mache a daemon binary whose wire format the Go schema-client can't decode, producing errors that are very hard to diagnose from the consumer side. Fix: introduce a `leylineBinaryVersion` const (Option A from the bead) that mirrors the go.mod schema-client pin and bake the version into the URL: OLD: https://github.com/agentic-research/ley-line/releases/latest/download/leyline-{os}-{arch} NEW: https://github.com/agentic-research/ley-line-open/releases/download/v0.4.1/leyline-{os}-{arch} The const lives next to the URL template at internal/leyline/socket.go with a "BUMP THIS WHEN UPDATING leyline-schema in go.mod" comment so future schema upgrades catch the version-pin requirement at edit time. The 404 error message is also updated to mention the pinned version so logs show exactly which tag was missing, and a forward pointer to mache-8kif documents the eventual hardening (startup version handshake with the daemon). Tests updated together with the code: - TestLeylineReleaseURL_PointsAtPublicRepo: existing test passed against the new URL with no change (it asserts on the repo path only). - TestLeylineReleaseURL_IncludesVersion: new test, asserts the rendered URL contains the pinned version, uses /releases/download/<tag>/ form, and never falls back to /releases/latest/. Pure-Go fmt.Sprintf — no network calls. ONE production file + ONE test file, as required.
find_smells (advisory)Scoped to files changed in this PR. Rules below run on the standalone (no-LLO) cross-ref tables; fan_out_skew — 1 finding(s) in changed files
Rules: see |
This was referenced May 19, 2026
jamestexas
added a commit
that referenced
this pull request
May 19, 2026
Pure-stdlib Go CLI at tools/coverage-gate/ that gates trunk PRs on new-code coverage. Contract: - Input: a Go cover profile (go test -coverprofile=cover.out) + a unified diff - Output: list of new/modified prod lines lacking coverage; exit 0 if clean, 1 if uncovered, 2 on error - Skips _test.go, testdata/, non-Go files, comment-only lines, blank lines - Supports // coverage:ignore single-line annotations - Deterministic output (sorted by file, then by line, with collapsed ranges) Demo run against PR #388 found 2 uncovered lines in downloadLeyline (L583, L605 — the httpGet + 404 paths). Demo run against PR #389 found 4 uncovered lines in DiscoverOrStart (L190-191 stale-managed reap, L256-257 pre-spawn liveness). Both are real, in-diff, uncovered prod lines — true positives. 15 self-tests covering profile parsing, diff parsing, intersection, overlap handling, comment-skip, test-file skip, testdata skip, coverage:ignore, exit codes, report formatting, and binary integration. All pass under -race -count=10. Fresh-eyes audit recommendation: APPROVE — no false positives or false negatives detected. Production-ready as merge gate. Closes part of mache-66d8df. The per-package ratchet baseline tracking is the natural Phase 2 (separate bead). Lands on feat/evolve-coverage-trunk (PR #385). Once merged, the gate runs against every subsequent trunk PR + retroactively on already-merged commits.
…9051f0] PR #388 added the version-pinned auto-download path in socket.go but left two new-prod lines uncovered (coverage-gate flagged): - socket.go:583 — assetName / URL Sprintf line - socket.go:605 — http.StatusNotFound branch Refactor (one-token): - Change leylineReleaseURLTemplate from const to var so hermetic tests can swap in an httptest server URL. Production code never mutates it; the swap is test-only via a small swapLeylineReleaseURLTemplate helper with t.Cleanup restore. Comment on the var documents the contract. New tests (no real network): - TestDownloadLeyline_HappyPath — httptest.Server returns 200 + payload, asserts the downloaded file exists with the right bytes and an executable bit set, and that the server saw a request path of the form /releases/download/<version>/leyline-<os>-<arch> (exercises both flagged lines plus the io.Copy + chmod + rename tail of the function). - TestDownloadLeyline_NotFound — httptest.Server returns 404, asserts the error string contains 'no leyline release available' and the pinned version, plus a negative assertion that destPath was NOT created. Verification: - go test -race -count=3 -run TestDownloadLeyline ./internal/leyline/ — PASS - coverage-gate on the PR diff exits 0 (down from 2 flagged lines) - task check — green
jamestexas
added a commit
that referenced
this pull request
May 19, 2026
Pure-stdlib Go CLI at tools/coverage-gate/ that gates trunk PRs on new-code coverage. Contract: - Input: a Go cover profile (go test -coverprofile=cover.out) + a unified diff - Output: list of new/modified prod lines lacking coverage; exit 0 if clean, 1 if uncovered, 2 on error - Skips _test.go, testdata/, non-Go files, comment-only lines, blank lines - Supports // coverage:ignore single-line annotations - Deterministic output (sorted by file, then by line, with collapsed ranges) Demo run against PR #388 found 2 uncovered lines in downloadLeyline (L583, L605 — the httpGet + 404 paths). Demo run against PR #389 found 4 uncovered lines in DiscoverOrStart (L190-191 stale-managed reap, L256-257 pre-spawn liveness). Both are real, in-diff, uncovered prod lines — true positives. 15 self-tests covering profile parsing, diff parsing, intersection, overlap handling, comment-skip, test-file skip, testdata skip, coverage:ignore, exit codes, report formatting, and binary integration. All pass under -race -count=10. Fresh-eyes audit recommendation: APPROVE — no false positives or false negatives detected. Production-ready as merge gate. Closes part of mache-66d8df. The per-package ratchet baseline tracking is the natural Phase 2 (separate bead). Lands on feat/evolve-coverage-trunk (PR #385). Once merged, the gate runs against every subsequent trunk PR + retroactively on already-merged commits.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes bead
mache-9051f0. The auto-download URL ininternal/leyline/socket.gohad two problems that together produced silent breakage on fresh-clone machines:agentic-research/ley-line(private). Anything without a checkout token got 404s./releases/latest/: Even with the public repo,latestpulls whatever LLO tagged most recently — no relationship to theleyline-schema v0.4.1pin ingo.mod. A daemon at the wrong schema produces wire-format decode errors that are very hard to diagnose.Changes
leylineBinaryVersion = "v0.4.1"const beside the URL template (Option A from the bead — simplest, no extra build infra). The const must mirror theleyline-schemapin ingo.mod; comment block documents the bump discipline./releases/download/%s/%sanddownloadLeylinenow substitutes both version and asset name.mache-8kif(startup version handshake with the daemon) noted in the comment as the eventual hardening.Files
ONE production file + ONE test file, as required:
internal/leyline/socket.go— const + URL template + 404 messageinternal/leyline/socket_test.go— newTestLeylineReleaseURL_IncludesVersion; existingTestLeylineReleaseURL_PointsAtPublicRepostill passes unchanged (it only asserts on the repo path).Test plan
go test -run 'TestLeyline|TestDownload|TestDiscover' -v ./internal/leyline/— all passtask check— gofumpt, vet, golangci-lint, full test sweep, docs lint all passfmt.Sprintfonly on the rendered URL)MACHE_NO_LEYLINE=1short-circuit path (TestDiscoverOrStart_NoLeylineEnv_SkipsDownload) still gates the download as before