feat(config): add minimum_release_age option#2159
Open
h-michael wants to merge 2 commits into
Open
Conversation
The self-spec auto-injection used to be a hardcoded "folke/lazy.nvim",
which forced anyone running lazy.nvim from a fork to either rewrite
this file or accept the spec/origin mismatch error ("Origin has
changed: ...") on every :Lazy update.
Read the origin URL from Config.me/.git/config at setup time and
build the self-spec from that:
* GitHub URLs become the familiar "owner/repo" shorthand
* Other URLs fall back to {url = ..., name = "lazy.nvim"}
* Missing .git/config (e.g. an immutable Nix store path) falls
back to the previous "folke/lazy.nvim" default
The behavior is unchanged for upstream users -- their local origin
already points to folke/lazy.nvim -- but forks now work out of the
box.
1 task
Mitigate supply-chain attacks by ignoring commits and tags that have
not been published long enough. Inspired by pnpm minimumReleaseAge,
mise minimum_release_age, Renovate, and Dependabot's cooldown option.
Configure globally via opts.defaults.minimum_release_age, or per-plugin
with `minimum_release_age = "..."` / `false` to disable for that
plugin. Accepts a number of seconds or a single-unit duration string
("30m", "24h", "7d", "2w", "1y"). Combined forms ("7d12h", "1d 2h")
are not supported -- use a single unit.
Applies only to fuzzy resolution paths: semver ranges (`version=`)
and branch HEAD following. Explicit `commit=` / `tag=` pins and
`pin = true` are not affected, matching Renovate's pin-exemption
semantics.
By default, an already-installed plugin whose current commit is
newer than what minimum_release_age would otherwise pick is kept
as-is rather than rolled back to an older one. Set
`defaults.minimum_release_age_downgrade = true` (or the per-plugin
equivalent) to restore the strict "always check out the latest
commit that satisfies minimum_release_age" behavior. Fresh installs
always honor minimum_release_age regardless of this flag.
Updates that minimum_release_age is holding back are surfaced in a
new "Pending (minimum_release_age = ...)" section in the `:Lazy` UI,
with per-plugin diagnostics showing the held commit or version and
an ETA -- e.g. "commit b33c466 (available in 4d)" or "version 1.40.0
(available in 4d)" -- so the active constraint and unlock time are
visible at a glance.
Default is nil for both options, so this is purely opt-in with no
behavioral change for existing users.
6435bb5 to
0d22980
Compare
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.
Description
Add a
minimum_release_ageoption that mitigates supply-chain attacks by ignoring commits and tags that have not been published long enough. Modeled on pnpm's minimumReleaseAge, mise's minimum_release_age, Renovate, and Dependabot'scooldown. Default isnil, so this is fully opt-in with no behavior change for existing users.Usage
Accepts a non-negative integer (seconds) or a single-unit duration string (
"30m","24h","7d","2w","1y"). Combined forms ("7d12h") are not supported -- use a single unit.Per-plugin overrides are accepted on each spec entry:
{ "owner/risky", minimum_release_age = "30d" }, -- stricter for this one { "owner/critical", minimum_release_age = false }, -- disable for this oneValue semantics
How each value is interpreted depending on where it is set:
defaults(global)nilfalsenil"30m"/"24h"/"7d"/"2w"/"1y""7d12h","foo", …)nilScope
Applies only to fuzzy resolution paths. Explicit pins and
pin = trueplugins are exempt, matching Renovate's pin-exemption semantics:minimum_release_age?{ "owner/repo" }(default-branch following){ "owner/repo", branch = "main" }{ "owner/repo", version = "*" }/"^1.0"(semver range){ "owner/repo", tag = "v1.0" }(explicit tag pin){ "owner/repo", commit = "abc123" }(explicit commit pin){ "owner/repo", pin = true }(excluded from updates)Update behavior matrix
info= currently checked-out commit.target= the latest commit/tag that satisfiesminimum_release_age.minimum_release_age_downgrade = false(default)= truetargettargetinfo == targetinfois an ancestor oftarget(info is older)targettargetinfois a descendant oftarget(info is newer than the eligible ceiling)info(no downgrade); newer commits surfaced asPendingtargettargetisnil)Pendingminimum_release_age_downgradehonors per-plugin overrides identically tominimum_release_age. Fresh installs always honorminimum_release_ageregardless of this flag.UI
Updates held back by
minimum_release_ageare surfaced in a newPending (minimum_release_age = ...)section in the:LazyUI, with per-line diagnostics showing the held commit or version plus an ETA:The ETA uses the same time source as the age filter (tag creatordate for tag targets, committer date for plain commit targets), so the displayed countdown matches when the candidate actually unlocks.
Bundled refactor
This PR also includes a small refactor that derives lazy.nvim's auto-injected self-spec from the local clone's
originURL instead of hardcodingfolke/lazy.nvim. This makes the new feature dogfoodable from a fork without manually patching the self-injection line, and is a general improvement for anyone running lazy.nvim from a non-official clone. Behavior is unchanged for upstream users -- their local origin already points tofolke/lazy.nvim.Related Issue(s)
Screenshots
The
:LazyUI shows fresh updates that have aged pastminimum_release_agein the regular Updates section, while newer commits/tags still inside the cooldown window are surfaced in Pending (minimum_release_age = "7d") with a per-plugin ETA: