Repository navigation
Fix: CI - #16504
Fix: CI#16504
Conversation
📝 WalkthroughWalkthrough
ChangesPre-commit Hook Dependency Guards
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@lefthook.yml`:
- Around line 51-58: The mutex handling in the lefthook pre-commit flow is only
cleaned up on the normal path, so the lock directory can be left behind if the
shell exits early. Update the script sections around the web install logic and
the related lock usage to register a trap that always removes the mutex on EXIT,
INT, and TERM, and keep the existing manual cleanup as a fallback. Make sure the
cleanup is tied to the lock variable used in the npm ci guard so both the first
block and the later matching block release the same mutex reliably.
In `@web/src/components/ui/modal/modal.tsx`:
- Around line 1-5: This change touches the off-limits modal component under
src/components/ui/, so revert any import-order edits in modal.tsx and avoid
modifying that file as part of the CI race-condition fix. If modal behavior is
needed, implement the adjustment in a wrapper/composed component outside
src/components/ui/ and keep the existing modal imports unchanged unless explicit
approval is obtained.
🪄 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: CHILL
Plan: Pro
Run ID: bec96d8c-5ef2-4e1c-8248-9f392ce9393a
📒 Files selected for processing (2)
lefthook.ymlweb/src/components/ui/modal/modal.tsx
| LOCKDIR=/tmp/ragflow-web-npm-lock | ||
| while ! mkdir "$LOCKDIR" 2>/dev/null; do sleep 0.5; done | ||
| if [ ! -f web/node_modules/.package-lock.json ]; then | ||
| echo "==> web/node_modules missing or incomplete; running npm ci --prefix web" | ||
| rm -rf web/node_modules | ||
| npm ci --prefix web --no-audit --no-fund || { rm -rf "$LOCKDIR"; exit 1; } | ||
| fi | ||
| rm -rf "$LOCKDIR" |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Release the mutex via trap, not only on the happy path.
If the shell exits after Line 52 or Line 66 but before Line 58 or Line 72, /tmp/ragflow-web-npm-lock is left behind and every later pre-commit will spin forever in the while ! mkdir ... loop. This guard needs cleanup on EXIT/INT/TERM, not just manual rm -rf calls.
Suggested fix
LOCKDIR=/tmp/ragflow-web-npm-lock
+ cleanup_lock() { rmdir "$LOCKDIR" 2>/dev/null || true; }
while ! mkdir "$LOCKDIR" 2>/dev/null; do sleep 0.5; done
+ trap cleanup_lock EXIT INT TERM
if [ ! -f web/node_modules/.package-lock.json ]; then
echo "==> web/node_modules missing or incomplete; running npm ci --prefix web"
rm -rf web/node_modules
- npm ci --prefix web --no-audit --no-fund || { rm -rf "$LOCKDIR"; exit 1; }
+ npm ci --prefix web --no-audit --no-fund
fi
- rm -rf "$LOCKDIR"
+ cleanup_lock
+ trap - EXIT INT TERMAlso applies to: 65-72
🤖 Prompt for 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.
In `@lefthook.yml` around lines 51 - 58, The mutex handling in the lefthook
pre-commit flow is only cleaned up on the normal path, so the lock directory can
be left behind if the shell exits early. Update the script sections around the
web install logic and the related lock usage to register a trap that always
removes the mutex on EXIT, INT, and TERM, and keep the existing manual cleanup
as a fallback. Make sure the cleanup is tied to the lock variable used in the
npm ci guard so both the first block and the later matching block release the
same mutex reliably.
| // src/components/ui/modal.tsx | ||
| import React, { FC, ReactNode, useCallback, useEffect, useMemo } from 'react'; | ||
| import { cn } from '@/lib/utils'; | ||
| import * as DialogPrimitive from '@radix-ui/react-dialog'; | ||
| import { AlertCircle, CheckCircle, Info, Loader, X } from 'lucide-react'; |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Do not modify files under src/components/ui/.
This file is inside src/components/ui/ which is explicitly off-limits for modifications per project path instructions. Changes here require explicit user approval. Additionally, this import reorder appears unrelated to the stated PR objective of fixing the CI race condition in lefthook.yml.
If the import order change is necessary, consider wrapping or composing this component outside src/components/ui/ instead, or seek explicit approval for this modification.
🤖 Prompt for 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.
In `@web/src/components/ui/modal/modal.tsx` around lines 1 - 5, This change
touches the off-limits modal component under src/components/ui/, so revert any
import-order edits in modal.tsx and avoid modifying that file as part of the CI
race-condition fix. If modal behavior is needed, implement the adjustment in a
wrapper/composed component outside src/components/ui/ and keep the existing
modal imports unchanged unless explicit approval is obtained.
Source: Path instructions
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #16504 +/- ##
=======================================
Coverage 93.16% 93.16%
=======================================
Files 10 10
Lines 717 717
Branches 118 118
=======================================
Hits 668 668
Misses 29 29
Partials 20 20 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
Fix race condition in parallel lefthook hooks causing ETXTBSY error