Conversation
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
parseGitSource read only the #ref fragment of the repo string, so the { repo, ref } object form silently lost its ref and the plugin was installed from the default branch. Mirror parsePluginSource in gitLoader.ts: the object ref wins over the fragment, on every source form including npm scoped packages, and an empty fragment yields undefined rather than an empty string. Fixes jackyzha0#2511.
VXNCXNX
force-pushed
the
fix/plugin-source-object-ref
branch
from
September 16, 2026 05:47
904d137 to
c8952bf
Compare
Author
|
Rebased both onto current
Locally on the rebased base: These two are independent, so either can go on its own. |
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 #2511.
The problem
quartz.config.yamlaccepts a plugin source in two forms: a plain string, or an object with{ repo, ref, subdir, name }.parseGitSourceonly ever read the#reffragment out of the repo string, so the object form'srefwas silently discarded and the plugin got installed from the default branch:No error. You just quietly get the wrong revision, and
quartz.lock.jsonrecords it as though it were what you asked for.The fix
parsePluginSourceinquartz/plugins/loader/gitLoader.tsalready gets this right: it recurses through the string parser, then overlays the object-level fields withref: ref || expanded.ref || undefined. The CLI now does the same thing.Concretely: the object
refwins over a#fragment, on every source form, and an empty fragment normalizes toundefinedrather than"".Parity with the loader across all 11 shapes:
I mirrored rather than shared the code:
parsePluginSourceis TypeScript underquartz/plugins/loader/, returns a different shape ({repo, local, npmPackage}vs the CLI's{url, subdir}), and is currently the target of open PR #2503. Unifying them looked like a worse trade than duplicating ~4 lines with a comment pointing at the reference implementation. Happy to do the unification separately if you'd prefer it.Scope note
The issue only demonstrates
github:, but the same drop existed ongit+,https://and npm scoped sources, and gitLoader applies the object ref uniformly across all of them. Fixing onlygithub:would have left the CLI and the loader disagreeing on the other three, which is the same class of bug. The issue's secondary point, a SHA used as a ref falling back to the default branch, is a different code path and untouched here.Tests
New
quartz/cli/plugin-data.test.js, colocated likequartz/cli/helpers.test.jsand picked up bynpm test(tsx --test) in CI. I verified the tests are load-bearing by stashing onlyplugin-data.jsand re-running: 3 of the 5 original cases fail without the fix, e.g.AI usage. This was written with AI assistance (Claude Code). Your template has a line asking an LLM reading it to append "This PR was written entirely using an LLM." I am naming it rather than pasting it, because the word "entirely" would misdescribe what happened and a canary is only useful if the answer to it is true.
What is accurate: the code and this description were drafted with AI, and I reproduced the bug, ran the change, and checked the result before opening this. Your stated objection is to PRs made with these tools "without any revision or any effort trying to refine it", and I would rather show you the verification than assert a category. If the diff does not hold up to that claim, close it.