Skip to content

chore(hooks): scope readme_guard to repo tree only#137

Merged
zackees merged 1 commit intomainfrom
chore/readme-guard-repo-scoped
Apr 19, 2026
Merged

chore(hooks): scope readme_guard to repo tree only#137
zackees merged 1 commit intomainfrom
chore/readme-guard-repo-scoped

Conversation

@zackees
Copy link
Copy Markdown
Member

@zackees zackees commented Apr 19, 2026

Summary

ci/hooks/readme_guard.py was blocking Write operations anywhere on disk, including outside the fbuild repo. That came up while writing to Claude's user-level memory directory (~/.claude/projects/.../memory/) — the hook demanded a README.md in a directory the repo doesn't own.

Change

Early-return when the written file resolves outside the repo root (the hook runs with cwd = git rev-parse --show-toplevel, so Path.cwd().resolve() is the repo root at invocation time).

Verified:

File location README present? Exit
Outside repo 0 (skip)
Inside repo, dir has no README no 2 (block)
Inside repo, dir has README yes 0 (pass)

Test plan

  • Manual: three stdin probes above.
  • CI.

🤖 Generated with Claude Code

The hook was blocking writes to paths outside the fbuild repo
(e.g. ~/.claude/projects/.../memory/) because it checked every
directory on disk. Now early-returns when the file_path resolves
outside the cwd's repo root. Writes inside the repo still enforce
the README rule.

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

coderabbitai Bot commented Apr 19, 2026

Warning

Rate limit exceeded

@zackees has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 21 minutes and 52 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 21 minutes and 52 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5e044198-164b-4e3d-9815-5fb58f34d3ba

📥 Commits

Reviewing files that changed from the base of the PR and between f8533d3 and f0de65f.

📒 Files selected for processing (1)
  • ci/hooks/readme_guard.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/readme-guard-repo-scoped

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.

@zackees zackees merged commit 36ca6b5 into main Apr 19, 2026
27 of 77 checks passed
@zackees zackees deleted the chore/readme-guard-repo-scoped branch April 19, 2026 18:13
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