Skip to content

[audit] PackChanged callback uses unstable vim.pack nightly event fields #299

Description

@stanfish06

What

The PackChanged autocmd in lua/config/plugin_config.lua destructures ev.data.spec.name, ev.data.kind, and ev.data.active. These fields come from vim.pack's experimental event API, which is only in Neovim nightly and has not yet been stabilised or documented in :help PackChanged.

Where

lua/config/plugin_config.lua:236–260

vim.api.nvim_create_autocmd("PackChanged", {
    callback = function(ev)
        local name, kind = ev.data.spec.name, ev.data.kind
        if kind ~= "install" and kind ~= "update" then
            return
        end
        if name == "fff.nvim" then
            if not ev.data.active then          -- <-- `active` field
                vim.cmd.packadd("fff.nvim")
            end
            ...
        elseif name == "blink.cmp" then
            if not ev.data.active then          -- <-- `active` field
                ...
            end
        end
    end,
})

Why it matters

vim.pack (including its PackChanged event schema) is still pre-release. If the field names change (spec.namename, kindtype, activeloaded, etc.) the callback silently does nothing — native binaries for fff.nvim and blink.cmp won't be rebuilt after an update, leading to crashes or missing functionality that are hard to debug.

The ev.data.active field in particular is not mentioned in any Neovim PR or help file found to date; it may already differ from the real implementation.

Recommended action

  1. Verify the actual PackChanged event data shape by adding a one-time vim.notify(vim.inspect(ev.data), ...) inside the callback and running :SyncPkgs.
  2. Add a nil-guard before dereferencing ev.data.spec: if not ev.data or not ev.data.spec then return end.
  3. Document the Neovim nightly SHA at which this was last verified, so it's easy to re-check after Neovim releases 0.12.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions