Skip to content

fix(git-hooks): fetch the lefthook remote from the installed marketplace - #17554

Merged
kyle-sexton merged 2 commits into
mainfrom
fix/17208-git-hooks-remote-url
Nov 19, 2026
Merged

kyle-sexton merged 2 commits into
mainfrom
fix/17208-git-hooks-remote-url

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Refs: #17208

Summary

The 11 plugins that ship git hooks name this publisher's repository as their lefthook remote in git-hooks/entries.json, and the remote plan wrote that URL into every consumer's lefthook config, which lefthook refetches hourly. A consumer that installed a fork's marketplace still fetched the publisher's repository (#17208).

Fix

  • lib/git-hooks/install.mjs: loadPlugin takes the remote's git_url from the marketplace the plugin was installed from, read from known_marketplaces.json beside the plugin cache (the file marketplaceClone already reads): a github source becomes https://github.com/<repo>, a git source its url without a trailing .git. A plugin not installed from a marketplace cache, or one whose marketplace has another source type, keeps the entries.json URL, which stays the shipped default.
  • A marketplace that is the shipped repository reached another way (an SSH git@host:owner/repo URL, another letter case, a trailing slash) keeps the entries.json URL, so a consumer's lefthook config that already names it still matches and plan offers no second remotes: entry.
  • The aggregate lookup accepts a sibling plugin whose entries.json names either the derived URL or the shipped default, so a fork's aggregate still finds its other plugins.
  • git-hook-decisions.md says which URL the snippet names. Both files are regenerated into the 11 carrying plugins by scripts/sync-shared-copies.sh.
  • Mechanism basis: the Remove organization-specific dependencies from shipped plugins #17208 classification row R14 ("Resolve the remote from the installed marketplace's source, with entries.json as the default"), and the decision to keep the publisher URL as the shipped default.
  • Fragments: minor for each of the 11 plugins.

Verification

  • node --test lib/git-hooks/install.test.mjs: 256 tests, 252 pass, 0 fail, 4 skipped. Two new tests: the snippet names the GitHub and git marketplace URLs and falls back to entries.json for a directory source, a malformed repo and no record, and keeps it for the shipped repository given over SSH or in another case, while a fork's SSH URL stays as given; a consumer entry naming the derived URL counts as the plugin's remote (no lefthook-config decision).
  • scripts/sync-shared-copies.sh --check and --check-bump origin/main: clean.
  • scripts/check-changelog-fragments.sh --check: all fragments valid.

Remaining

What #17208 still needs after this PR:

  • The guardrails lanes App login (block-lane-pr-disable-auto.sh), in its own PR.
  • The portability CI check that fails a PR adding this organization's name to shipped plugin content outside the allowed citation shapes; it lands last.

Related

🤖 Generated with Claude Code

https://claude.ai/code/session_01KeBVgaQE4QB75SPD3ky1jd

The remote plan named the publisher's git URL from entries.json for every
consumer. It now names the git URL of the marketplace the plugin was
installed from (a GitHub or git source), so a fork's install fetches the
fork; entries.json's URL stays the default otherwise.

Refs: #17208

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KeBVgaQE4QB75SPD3ky1jd
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 19, 2026 22:41
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T22:44:15.912439Z 8ab13d1 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

…he same repository

A marketplace added over SSH, or with the repository in another case,
named the shipped repository in a different form, so plan offered a
second remotes entry beside the one a consumer config already has. That
case now keeps the entries.json URL.

Refs: #17208

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KeBVgaQE4QB75SPD3ky1jd
@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-refine/fix-docs
Model rung 0
Leg base
Run job success
Activity step skipped
Commits pushed none (read lane)
Run 44631925609

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed d8fbfa028eba45326c2e40adfd42020a455d1926: read 13 of 13 changed file(s); 0 finding(s), 0 as inline comments.

Code review (incremental): PR #17554, from 8ab13d1d to d8fbfa02

This push fixes the blocking finding from the last review (earlier comment). marketplaceGitUrl now receives the shipped entries.json URL and returns it whenever the marketplace record points at the same repository. To compare the two URLs, it:

  • turns git@host:path into https://host/path;
  • drops trailing slashes;
  • lowercases both URLs.

A fork's URL, whether HTTPS or SSH, still passes through unchanged. All 11 plugin copies of install.mjs match lib/git-hooks/install.mjs. I read that file and plugins/actionlint/lib/git-hooks/install.mjs in full and skipped the other copies, as the identical-files list allows.

What I checked:

  • shipped is always a valid string here. loadPlugin rejects a remote.git_url that is not an https:// or git@ URL (install.mjs#L283). The call at L377 runs only when manifest.remote is set, so same(shipped) cannot throw.
  • Existing lefthook configs still match. When the marketplace is the shipped repository, remote.git_url equals the entries.json value byte for byte. The strict === check in remoteEntry (L894) therefore matches a config that already names it, and plan offers no second remotes: entry. That is what the PR description promises.
  • The new tests cover the cases the description names. They cover the shipped repository over SSH with .git, in another letter case with a trailing slash, and a fork's SSH URL that must stay as given.

Blocking findings: none. This was a blocking-only review, because the lane had already reviewed an earlier head, so advisory points were dropped.

The PR refs #17208 rather than closing it, so there were no acceptance criteria to check. I found no embedded instructions in the PR text.

I ran no tests. The author's test counts and sync-check results are their own claim and I did not verify them.

Loosened-check verdict: fail by default. The prompt gave no loosened_check_verdict: or loosened_check_patterns: line, so there are no consumer entries. With no decision-record line, I did not check the citation requirement. This push weakens no test, lint or check.

Verifier dropped 0 of 0 candidates.

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed d8fbfa028eba45326c2e40adfd42020a455d1926: read 13 of 13 changed file(s); 0 finding(s), 0 as inline comments.

Security review (incremental, blocking only): no security issues found

This push changes marketplaceGitUrl in lib/git-hooks/install.mjs and its plugin copies. The function now takes the shipped entries.json git_url as a second argument. If the marketplace's git URL points to the same repository as the shipped URL, it returns the shipped URL. To decide that, it converts git@host:path to https://host/path, strips trailing slashes and ignores letter case. Otherwise it returns the marketplace URL as before. There are three new test assertions in install.test.mjs.

What I checked:

  • Same trust boundary. The function can now return only two values: the publisher's own shipped URL from entries.json, or the marketplace URL the user chose to add. It could already return either before this push. The new branch can only swap a marketplace URL for the publisher's URL, never for an outside one. A false match, such as a case-sensitive host where only the letter case differs, also falls back to the publisher's URL. So this adds no new source the lefthook remote can fetch from.
  • Validation order is unchanged. The ^(https:\/\/|git@)\S+$ check still runs on the marketplace URL before the comparison. If it fails, the function returns undefined, which falls back to entries.json as before. The shipped URL comes from the plugin's own manifest, which ships with the plugin and is not consumer input. So no whitespace or newline can reach the git_url: line of the YAML snippet.
  • Copies. The changes to plugins/*/lib/git-hooks/install.mjs are identical to the root lib/git-hooks/install.mjs change, at the same library path in each plugin. None of those paths is a hook, workflow, settings file or manifest.
  • Not touched: no trust controls, plugin manifests, workflows, merge holds or instruction surfaces.

The earlier non-security note said the PR description promised SSH and letter-case normalization that the code did not have. This push adds that normalization and a test for it.

The only prior post was the summary, with no line anchor, and it had no findings to restate. This review was blocking only, so it reports only CRITICAL and IMPORTANT findings. Nothing in this change draws on prepaid credit or can cause a charge.

critical-findings: 0

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit 4433fa3 Nov 20, 2026
82 of 83 checks passed
@kyle-sexton
kyle-sexton deleted the fix/17208-git-hooks-remote-url branch November 20, 2026 00:00
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant