Skip to content

fix: isolate pre-push Git environment - #71

Merged
flyingrobots merged 2 commits into
mainfrom
fix/pre-push-git-env
Jul 17, 2026
Merged

fix: isolate pre-push Git environment#71
flyingrobots merged 2 commits into
mainfrom
fix/pre-push-git-env

Conversation

@flyingrobots

Copy link
Copy Markdown
Member

Linked Issue\n\n- Fixes #70\n\n## Change\n\n- Clears repository-local variables reported by git rev-parse --local-env-vars before the hook launches child quality commands.\n- Keeps lint and the full unit suite enabled.\n- Adds a contract test that preserves the sanitation boundary ahead of both gates.\n\n## Evidence\n\n- Focused hook and GUIDE tests: 5/5 passed.\n- ESLint: passed.\n- Bash syntax validation: passed.\n- Normal git push with the repaired hook: 213 test files passed; 1,873 tests passed; 2 skipped.\n- Graft review: two-file non-structural change; no breaking changes.\n\n## Why this is separate\n\nThis test-infrastructure defect blocked the scoped cache acquisition branch but is independent of that public API change. Landing it first keeps the acquisition PR focused and makes all future pre-push verification honest in linked worktrees.\n

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 54 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 068c8cf3-0443-40ca-95de-f20e074b4d7a

📥 Commits

Reviewing files that changed from the base of the PR and between 1411127 and 36074e2.

📒 Files selected for processing (2)
  • scripts/hooks/pre-push
  • test/unit/scripts/pre-push-hook.test.js
📝 Walkthrough

Walkthrough

The pre-push hook now removes repository-local Git environment variables before running lint and unit tests. A unit test verifies the sanitization commands occur before both quality gates.

Changes

Pre-push Git environment sanitization

Layer / File(s) Summary
Sanitize environment before quality gates
scripts/hooks/pre-push, test/unit/scripts/pre-push-hook.test.js
The hook unsets variables reported by git rev-parse --local-env-vars before invoking lint and tests; the regression test verifies this command order.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: git-stunts

Poem

I’m a rabbit with a clean Git nest,
No stray variables disturb the test.
Lint hops first, then unit tests run,
The push gate guards everyone.
Binky! Clean hooks get the job done.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed Title is concise and accurately describes the pre-push Git environment isolation change.
Description check ✅ Passed It covers the linked issue, change, and evidence, but omits the template's Design/Proof, Validation, and Release Impact sections.
Linked Issues check ✅ Passed The hook clears local GIT_* vars, keeps lint/tests enabled, adds a regression contract, and reports passing push verification.
Out of Scope Changes check ✅ Passed Changes stay scoped to the hook and its contract test, with no unrelated code or behavior introduced.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/hooks/pre-push`:
- Around line 10-12: Update the Git environment sanitization loop to explicitly
capture and validate the output of git rev-parse --local-env-vars before
iterating. If discovery fails, terminate the pre-push hook without launching
either quality gate; otherwise, preserve the existing unset behavior for every
discovered variable.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: fc25c61f-a683-4e06-9427-f51b2b9fd3ef

📥 Commits

Reviewing files that changed from the base of the PR and between 80059fa and 1411127.

📒 Files selected for processing (2)
  • scripts/hooks/pre-push
  • test/unit/scripts/pre-push-hook.test.js
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: test-unit
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2026-02-28T19:21:13.982Z
Learnt from: flyingrobots
Repo: git-stunts/git-cas PR: 15
File: test/unit/domain/services/CasService.envelope.test.js:326-330
Timestamp: 2026-02-28T19:21:13.982Z
Learning: In fuzz tests for cryptographic operations, use a seeded PRNG (e.g., xorshift32) for control-flow variables such as plaintext size selection and recipient index selection to ensure reproducibility. Continue to use randomBytes() for cryptographic keys and nonces to preserve realistic randomness and avoid security anti-patterns. This guideline applies to test files that perform fuzz testing of crypto logic; implement a consistent seed setup (e.g., fixed seed in test initialization) and document the rationale to enable deterministic replays across runs.

Applied to files:

  • test/unit/scripts/pre-push-hook.test.js
🔇 Additional comments (1)
test/unit/scripts/pre-push-hook.test.js (1)

1-23: LGTM!

Comment thread scripts/hooks/pre-push Outdated
@flyingrobots
flyingrobots merged commit eac13af into main Jul 17, 2026
6 checks passed
@flyingrobots
flyingrobots deleted the fix/pre-push-git-env branch July 17, 2026 07:08
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.

Pre-push hook leaks repository-local Git environment into child tests

1 participant