feat!: drop v1 runtime, keep v1 -> v2 auto-migration (PR1 of plenary removal) - #341
Conversation
PR 1 of the plenary.nvim removal effort (refs #340). - Remove the v1 database runtime (entry score / table writes / DB write+sort+update paths) and its specs. - Flatten the v1 read path and the existing migrate_from / from_v1 logic into v2 so `file_frecency.bin` users upgrade transparently. The v1 binary is left on disk for rollback safety. The migration shim is scheduled for removal in a later 2.x minor release after a CHANGELOG notice. - Drop the `db_version` config option (only v2 exists now). - Update `query()` to expose v2 fields (`num_accesses`, `last_accessed`, `half_life`, `reference_time`) plus a `count = num_accesses` alias for backwards compatibility. The `timestamps` array is gone because v2 keeps only the most-recent access time, not history. - Bump minimum Neovim to v0.11.7 by dropping v0.10.4 from the CI matrix (matches telescope.nvim). - Replace v1-shape test assertions with v2 smoke tests; broader v2 coverage is deferred to follow-up PRs. - Document the migration, the v0.11.7 requirement, and the query() shape change in `:help` and README. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The protected `tbl` field and the V2-only `wait_ready` method need the same `---@diagnostic disable-next-line` annotation that the surrounding `tbl:set` line already has. Caught by the lua-typecheck-action CI step. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
luacheck flagged 125 > 120; switch the inline `--[[@as ...]]` to a separate `---@cast` annotation on the next line. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Long-time users who follow master without pinning to a tag may still be on the v1 database silently. Make the breaking change discoverable so they don't think the plugin is broken after pulling HEAD. - Add a hard error in lua/frecency/init.lua if Neovim < v0.11.7 (mirrors telescope.nvim's plugin/telescope.lua pattern). Failing loud beats cryptic errors from missing vim.fs APIs. - After a successful v1 -> v2 migration, schedule a one-time vim.notify (WARN level) explaining what happened, why rankings shift, and where the v1 file is preserved for rollback. The v2-file existence guard naturally serves as the once-flag, so subsequent launches stay quiet. - Add an "Upgrading to 2.0.0" section to README right after the existing versioning notice, listing the breaking changes and the ^1.0.0 pin recipe for users who want to stay on v1. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
CI ran (a) stylua, (b) lua-language-server (lua-typecheck-action), (c) luacheck (docker), (d) bin/run-tests. Last PR1 push had to be re-run twice because (b) and (c) were not exercised locally. This script bundles all four behind one entry point so the checks happen before push, not after. Notes on the trickier bits: - luacheck runs in the same `lunarmodules/luacheck:v1.2.0` docker image CI uses, so output is byte-identical. Falls back to the Mason luacheck only if it is actually runnable (the macOS Mason copy hard- codes /opt/homebrew/opt/lua/bin/lua5.4 which usually isn't there). - lua-language-server diagnostics are filtered to files changed vs --base (default origin/master) so pre-existing warnings in untouched code don't fail the check. Known luassert false positives (`assert.are.*`, `assert.is_*`, etc.) are also dropped because the Mason lua-language-server flags them while the CI version does not. - stylua is restricted to changed .lua files per the project's "format only what you changed" convention; CI doesn't run stylua at all so this is purely a local guard. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
TableV2:from_v1 was leaving record.last_accessed at the absolute v1
epoch, while every other code path stores it as a delta from
reference_time (see EntryV2:update). Migrated entries therefore
reported wildly different last_accessed values from freshly-registered
ones, breaking:
- query({ record = true }) consistency,
- the documented "reference_time + last_accessed = absolute epoch"
recovery path,
- order = "timestamps" sort behaviour (migrated entries sorted as if
they were ~50 years in the future).
The inner fold's entry:update() already computes the correct delta on
entry.last_accessed; just mirror it back onto record.last_accessed. The
score path was already mirrored the same way.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Hi @clason — I dropped
They sit pending and block the merge button. Could you remove them from Settings → Rules → Rulesets → main → Required status checks when you have a moment? I don't have admin on the repo. Thanks! |
|
Sorry, removed them! (And bumped your privileges.) Regarding your plan: My plan is to keep
|
|
@clason Thank you! It is really helpful that |
Summary
PR 1 of the plenary.nvim removal effort.
migrate_from/from_v1logic into v2 so existingfile_frecency.binusers upgrade transparently. The v1 binary is left on disk for rollback safety. The migration shim is scheduled for removal in a later 2.x minor release after a CHANGELOG notice (separate tracking issue to be filed).db_versionconfig option (only v2 exists now).query({ record = true })to expose v2 native fields (num_accesses,last_accessed,half_life,reference_time) plus acount = num_accessesalias for backwards compatibility. Thetimestampsarray is gone because v2 keeps only the most-recent access time, not history.order = "count"andorder = "timestamps"are remapped tonum_accesses/last_accessedinternally so existing call sites keep working.v0.10.4from the CI matrix (matches telescope.nvim).query()shape in:helpand README.Net diff: +615 / −1075 across 18 files (including the deleted
v1/directory).Breaking changes
db_versionis removed (passing it tosetup()becomes a no-op or validation error).file_frecency.binis migrated automatically on first launch with 2.0.0; the v1 file itself is left on disk for rollback safety. Internal score representation changes from v1 (count × static recency) to v2 (exponential decay), so initial rankings may shift after upgrade.query({ record = true })no longer returns atimestampsarray; usereference_time + last_accessedto recover the most-recent access epoch (single value, not a list).Test plan
bin/run-testsgreen locally on Neovim stable (Apple Silicon macOS).styluaclean on changed lua files.:Telescope frecency, register-on-open,:FrecencyDelete,:FrecencyValidate, workspace tag filtering.file_frecency.binonly, confirmfile_frecency_v2.binis created and entries are preserved (with re-decayed scores).Follow-up PRs (tracking #340)
plenary.logfacade with an in-tree logger.lua/frecency/async/and migrateplenary.path/plenary.asynccall sites to builtins / vendored async.scandir.__make_gitignore, switch tests to plentest.nvim, dropFrecencyPlenary*types, finish README /:helpcleanup.🤖 Generated with Claude Code