Conversation
handlePluginInstallUnified()'s "already installed" check only verified that quartz.lock.json had an entry for the plugin's name and that its directory existed — it never compared the entry's recorded `source` against the plugin's current source in quartz.config.yaml. So bumping a plugin's pinned ref (e.g. switching a fork branch, or repointing at a different fork) was silently ignored whenever the old directory and lockfile record were still present: the plugin was treated as up to date and never re-cloned. This mattered most whenever `.quartz/plugins/` gets reused across runs instead of rebuilt from scratch — a persistent CI cache, or a local dev machine re-running `plugin install --from-config` after editing quartz.config.yaml — since a fresh checkout has no stale state to miss in the first place. Worse, the existing-directory fast path re-stamped the lockfile's `source` field to the new value while leaving `commit` pointing at whatever was actually checked out, producing a lockfile entry that claimed to be on the new ref while still serving the old one. Fixed by extracting the comparison into `pluginSourceChanged()` and using it in both the "is this missing" filter and the existing- directory handling: a source mismatch now removes the stale directory and lets the normal clone path reinstall it, while an unrelated pre-existing directory (no prior lockfile record at all) is left alone as before. Verified: added quartz/cli/plugin-git-handlers.test.js covering the new helper, `npm test` (167 tests passing) and `npm run check` (tsc + prettier) both clean.
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
tyrcho
marked this pull request as ready for review
July 30, 2026 16:02
This branch was successfully deployed
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.
Fixes
plugin install --from-configsilently keeps a stale plugin when its pinned source changesGoal
Bumping a plugin's pinned source in
quartz.config.yaml(e.g. switching a fork branch, or repointing at a different fork/ref) should always be picked up the next timenpx quartz plugin install --from-configruns, whether that's a fresh checkout or a reused.quartz/plugins/directory (a persistent CI cache, or a local dev machine that already had the old version installed).Problem
handlePluginInstallUnified()'s "is this plugin already installed" check only verified thatquartz.lock.jsonhad an entry for the plugin's name and that its directory existed on disk — it never compared that entry's recordedsourceagainst the plugin's current source inquartz.config.yaml. So whenever the old directory and lockfile record were still present, the plugin was treated as up to date and never re-cloned, regardless of what the config now said.This is easy to miss with the tool's own default workflow (delete
.quartz/or start from a fresh checkout, so there's no stale state to miss in the first place), but it bites as soon as.quartz/plugins/is reused across runs — most notably a CI cache keyed on something coarser than every individual plugin's source, or repeated local runs ofplugin install --from-configafter editing the config.It's also worse than a silent no-op: the existing-directory fast path re-stamps the lockfile's
sourcefield to the new value while leavingcommitpointing at whatever was actually still checked out — producing a lockfile entry that claims to be on the new ref while actually still serving the old one.Implementation
quartz/cli/plugin-git-handlers.js: extracted the comparison into a small purepluginSourceChanged(priorEntry, currentSource)helper, used in both:An unrelated pre-existing directory with no prior lockfile record at all (e.g. first-ever install onto an already-populated
.quartz/plugins/) is left alone, matching the previous behavior for that case.quartz/cli/plugin-git-handlers.test.js(new): coverspluginSourceChanged— no prior record, unchanged source, changed ref, changed repo.Verified:
npm test(167 tests passing) andnpm run check(tsc --noEmit+prettier --check) both clean.