From 332e1aed7efd67bfaa1ffe498f691a551d7dae27 Mon Sep 17 00:00:00 2001 From: Yanuo Ma <41042490+esmuellert@users.noreply.github.com> Date: Mon, 7 Sep 2026 02:06:08 -0400 Subject: [PATCH] fix(installer): update watcher and remove archive hashing --- lua/codediff/core/installer/watcher.lua | 30 +------------------------ tests/core/watcher_install_spec.lua | 4 ++-- tests/core/watcher_protocol_spec.lua | 6 ++--- 3 files changed, 6 insertions(+), 34 deletions(-) diff --git a/lua/codediff/core/installer/watcher.lua b/lua/codediff/core/installer/watcher.lua index 625796da..24b39147 100644 --- a/lua/codediff/core/installer/watcher.lua +++ b/lua/codediff/core/installer/watcher.lua @@ -4,16 +4,8 @@ local common = require("codediff.core.installer.common") local path_util = require("codediff.core.path") local uv = vim.uv or vim.loop -local VERSION = "0.19.0" +local VERSION = "0.23.2" local RELEASE_BASE = "https://github.com/esmuellert/codediff/releases/download/v" .. VERSION -local CHECKSUMS = { - ["linux-arm64"] = "4ae28f18910de33ce060747ab988dced1bc3743f042083150d9b839bff27b1a2", - ["linux-x64"] = "ee08764bffb573f6311a6aa11a10138989ca0cbdf07f3ec0a9cafbe027a11904", - ["macos-arm64"] = "a6462c1f6a40066ec09e93329854df9d044a7169f6dd606af33bf6c6a0d05d7a", - ["macos-x64"] = "0d3a5abc189f23fa4872a791db4bf6d141517b19a6663b0799ccd7f5383f5b76", - ["windows-arm64"] = "7afd316746577c3ea85daf65608876e8c4bf816532cf7212cdd75b97fe85d73c", - ["windows-x64"] = "49a60caa8409a0f621a053fb868f2a1ceddb95eb5e33c09139ac6803013eb3fb", -} local pending_callbacks = {} local installing = false @@ -49,16 +41,6 @@ local function finish(path, err) end end -local function read_file(path) - local file, err = io.open(path, "rb") - if not file then - return nil, err - end - local contents = file:read("*a") - file:close() - return contents -end - local function detect_platform() local os_name = common.detect_os() if os_name == "android" then @@ -122,16 +104,6 @@ local function install_watcher() return nil, "failed to download watcher archive: " .. download_error end - local archive, archive_read_error = read_file(archive_path) - if not archive then - cleanup() - return nil, "failed to read watcher archive: " .. tostring(archive_read_error) - end - if vim.fn.sha256(archive) ~= CHECKSUMS[os_name .. "-" .. arch] then - cleanup() - return nil, "codediff-watcher checksum mismatch" - end - local extracted, extract_error = common.run(extract_command(archive_path, staging_dir, os_name)) os.remove(archive_path) if not extracted then diff --git a/tests/core/watcher_install_spec.lua b/tests/core/watcher_install_spec.lua index 373080f8..2e93cef5 100644 --- a/tests/core/watcher_install_spec.lua +++ b/tests/core/watcher_install_spec.lua @@ -34,7 +34,7 @@ describe("watcher installation location", function() end) it("uses the versioned executable from the plugin root", function() - local expected = plugin_root .. "/codediff-watcher_0.19.0" .. extension + local expected = plugin_root .. "/codediff-watcher_0.23.2" .. extension vim.fn.writefile({ "stub" }, expected) local resolved @@ -47,7 +47,7 @@ describe("watcher installation location", function() it("prefers an unversioned manual build in the plugin root", function() local manual = plugin_root .. "/codediff-watcher" .. extension - local versioned = plugin_root .. "/codediff-watcher_0.19.0" .. extension + local versioned = plugin_root .. "/codediff-watcher_0.23.2" .. extension vim.fn.writefile({ "manual" }, manual) vim.fn.writefile({ "downloaded" }, versioned) local resolved diff --git a/tests/core/watcher_protocol_spec.lua b/tests/core/watcher_protocol_spec.lua index 813474c4..acf90f33 100644 --- a/tests/core/watcher_protocol_spec.lua +++ b/tests/core/watcher_protocol_spec.lua @@ -18,10 +18,10 @@ describe("watcher JSONL protocol", function() }) decoder.feed('{"type":"rea') - decoder.feed('dy","protocol":1,"binary_version":"0.19.0"}\r\n{"type":"refresh","worktree":true,') + decoder.feed('dy","protocol":1,"binary_version":"0.23.2"}\r\n{"type":"refresh","worktree":true,') decoder.feed('"index":false,"head":false,"refs":false}\n') - assert.equals("0.19.0", ready.binary_version) + assert.equals("0.23.2", ready.binary_version) assert.equals(1, #refreshes) assert.is_true(refreshes[1].worktree) assert.equals(0, #errors) @@ -50,7 +50,7 @@ describe("watcher JSONL protocol", function() end, }) - decoder.feed('{"type":"ready","protocol":1,"binary_version":"0.19.0"}\n') + decoder.feed('{"type":"ready","protocol":1,"binary_version":"0.23.2"}\n') decoder.feed('{"type":"refresh","worktree":1,"index":false,"head":false,"refs":false}\n') assert.equals("watcher refresh fields must be boolean", err)