-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Problem
The pre-push hook runs checks in this order:
- RuboCop (fast, small output)
- RSpec (slow, verbose output - 617 tests with warnings)
- Gem build (fast, small output)
When RuboCop fails, the failure message gets buried in 38,000+ characters of RSpec output, making it invisible to developers.
Evidence from SPI-1301
When pushing PR #41, we saw:
✓ RSpec passed (all tests passing)
✓ Gem built successfully
...
Some pre-push checks failed! ✗
But couldn't see which check failed. The RuboCop failure was in the truncated section (38,000+ chars of RSpec warnings). We used --no-verify to bypass, and CI caught it later.
Proposed Solution
Reorder checks to fail-fast:
- RuboCop first (fast, small output) - failures are immediately visible
- Gem build second (fast, validates gemspec)
- RSpec last (slow, verbose, but most likely to pass)
Benefits:
- RuboCop failures appear at the top of output (always visible)
- Developers get immediate feedback without scrolling
- Faster feedback loop (RuboCop takes ~5 seconds vs RSpec ~10 seconds)
- Matches CI order (RuboCop → RSpec → Build)
Alternative Solutions
Option A: Suppress RSpec warnings in pre-push hook
bundle exec rspec --tag ~e2e --format progress 2>/dev/nullPros: Smaller output, Con: Hides potentially useful warnings
Option B: Run only RuboCop + gem build pre-push, let CI run full tests
Pros: Fast feedback, Con: Slower feedback loop for test failures
Option C: Add summary at the end showing which checks failed
Pros: Always visible, Con: Still requires scrolling to see details
Recommendation
Option: Reorder to RuboCop → Gem → RSpec (proposed solution above)
Simple, effective, no information loss.
Related
- PR fix: resolve E2E SSH test failures [SPI-1301] #41: RuboCop failures were missed due to output truncation
- PR fix: resolve RuboCop linting issues in E2E SSH tests #43: Follow-up fix for the missed linting issues
- Violated constraint: CLAUDE.md line 8 "❌ NEVER bypass git hooks without documented reason"
Files to Change
.githooks/pre-push(lines 60-113)