Skip to content

fix: loose ends from retiring dev/scripts/git-hooks#7

Merged
WomB0ComB0 merged 1 commit intomainfrom
fix/loose-ends-post-retirement
Apr 14, 2026
Merged

fix: loose ends from retiring dev/scripts/git-hooks#7
WomB0ComB0 merged 1 commit intomainfrom
fix/loose-ends-post-retirement

Conversation

@WomB0ComB0
Copy link
Copy Markdown
Member

Summary

Two stragglers missed in #6:

  1. scripts/install-hooks.ps1 still raw-fetched from the retired resq-software/dev/$Ref/scripts/git-hooks path — Windows users would get 404s. Rewritten to mirror the sh version: prefer resq dev install-hooks when on PATH, fall back to the crates raw URL (RESQ_CRATES_REF replaces RESQ_DEV_REF). Also gained the local-pre-push scaffold prompt for parity.

  2. .github/workflows/hooks-tests.yml had paths: scripts/git-hooks/** in its trigger filter — that directory no longer exists, so the workflow was effectively dark on most relevant changes. Trigger now fires on tests/hooks/** + scripts/install-hooks.sh + the workflow file, plus a weekly cron to catch canonical-template drift on the crates side that would otherwise go unnoticed.

End-to-end validation (local)

install-resq.sh        → resq 0.2.6 downloaded + SHA-verified
fresh repo + Cargo.toml → install-hooks.sh preferred resq path
git commit             → real `resq pre-commit` ran:
                           ✅ Copyright ✅ Large Files ✅ Debug Stmts
                           ✅ Secrets ✅ Audit ✅ Format (picked up fake manifest)
resq hooks doctor      → All hooks healthy.

🤖 Generated with Claude Code

Two stragglers missed in #6:

1. scripts/install-hooks.ps1 still raw-fetched from
   resq-software/dev/$Ref/scripts/git-hooks — the retired path. Windows
   users following the curl-pipe flow would get 404s. Rewritten to
   mirror install-hooks.sh's two-path strategy: prefer
   `resq dev install-hooks` when on PATH, fall back to the crates raw
   URL. RESQ_CRATES_REF replaces RESQ_DEV_REF. Adds the scaffold prompt
   for the local-pre-push, matching the bash mirror.

2. .github/workflows/hooks-tests.yml had `paths: scripts/git-hooks/**`
   in its trigger filter — that directory no longer exists, so the
   workflow wouldn't fire on test changes alone. Trigger now fires on
   tests/hooks/**, scripts/install-hooks.sh, and the workflow file.
   Added a weekly cron so canonical-template drift on the crates side
   gets caught even without a dev-side change.

Verified end-to-end: install-resq.sh → fresh repo + Cargo.toml →
install-hooks.sh (resq-preferred path) → `git commit` triggers
`resq pre-commit` which runs through Copyright/Large Files/Debug/
Secrets/Audit/Format. Doctor reports healthy.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 14, 2026

Warning

Rate limit exceeded

@WomB0ComB0 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 53 minutes and 20 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 53 minutes and 20 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5c423050-923f-4253-9823-ec8c8e060199

📥 Commits

Reviewing files that changed from the base of the PR and between 98a9594 and 53a6fc3.

📒 Files selected for processing (2)
  • .github/workflows/hooks-tests.yml
  • scripts/install-hooks.ps1
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/loose-ends-post-retirement

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@WomB0ComB0 WomB0ComB0 merged commit 53c17c1 into main Apr 14, 2026
4 checks passed
@WomB0ComB0 WomB0ComB0 deleted the fix/loose-ends-post-retirement branch April 14, 2026 20:25
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the install-hooks.ps1 script to utilize the resq binary for hook installation and introduces a prompt for scaffolding local hooks. The review feedback identifies several areas where error handling should be strengthened, specifically by verifying exit codes for the resq and git commands and ensuring that Invoke-WebRequest terminates on failure.

Comment thread scripts/install-hooks.ps1
if ($resqBin) {
Write-Host "info Installing hooks via $resqBin dev install-hooks" -ForegroundColor Cyan
Push-Location $targetRoot
try { & $resqBin dev install-hooks } finally { Pop-Location }
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The script should check the exit code of the resq command to ensure the installation was successful, mirroring the set -e behavior in the shell version. If the command fails, the script currently continues and incorrectly reports success.

    try { & $resqBin dev install-hooks; if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } } finally { Pop-Location }

Comment thread scripts/install-hooks.ps1
$rawBase = "https://raw.githubusercontent.com/resq-software/crates/$Ref/crates/resq-cli/templates/git-hooks"
Write-Host "info Fetching hooks from $rawBase" -ForegroundColor Cyan
foreach ($h in $hooks) {
Invoke-WebRequest -Uri "$rawBase/$h" -OutFile (Join-Path $hooksDir $h) -UseBasicParsing
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

By default, Invoke-WebRequest does not throw a terminating error on HTTP failures (like 404). This can lead to a partial or corrupted installation where hook files contain error messages instead of script content. Adding -ErrorAction Stop ensures the script fails fast on network or server errors.

        Invoke-WebRequest -Uri "$rawBase/$h" -OutFile (Join-Path $hooksDir $h) -UseBasicParsing -ErrorAction Stop

Comment thread scripts/install-hooks.ps1
if ($IsLinux -or $IsMacOS) {
foreach ($h in $hooks) { & chmod +x (Join-Path $hooksDir $h) }
}
& git -C $targetRoot config core.hooksPath .git-hooks
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The exit code of the git config command should be checked to ensure the repository was correctly configured to use the new hooks directory.

    & git -C $targetRoot config core.hooksPath .git-hooks
    if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant