fix(lock): prevent false execution_failed when worker returns nil/false#932
fix(lock): prevent false execution_failed when worker returns nil/false#932
Conversation
|
Warning Rate limit exceeded
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 9 minutes and 2 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
UntilExpired passed the raw worker block to locksmith.execute, so if the worker returned nil or false (e.g. early exit with `return unless condition`), the return value was treated as "not executed" and incorrectly triggered the :execution_failed reflection. Fix by wrapping the block to return item[JID] (always truthy when locked), matching the pattern already used by WhileExecuting and UntilExecuted. Closes #885
…ired Add explicit test that when the lock cannot be acquired (another process holds it), execution_failed is correctly reflected — proving the item[JID] fix doesn't suppress genuine lock failures.
6cc9161 to
9f03de4
Compare
Summary
UntilExpired#executepassed the raw worker block tolocksmith.execute, using the worker's return value to determine successnilorfalse(e.g. early exit withreturn unless condition),execution_failedwas incorrectly reflecteditem[JID](always truthy when locked), matching the pattern already used byWhileExecutingandUntilExecutedCloses #885
Test plan
Summary by CodeRabbit
Refactor
Tests
nilorfalsevalues.