-
Notifications
You must be signed in to change notification settings - Fork 1
fix: claim on already asasigned to $self #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Claude finished @fblgit's task —— View job Review Tasks
Code Review for PR #22I've reviewed the changes to 📋 SummaryThe PR fixes a bug where tasks already assigned to the same instance would incorrectly throw an error when attempting to reassign them to the same worker. ✅ Code QualityGood fix! The change correctly addresses the issue by allowing re-assignment to the same instance while still preventing cross-instance assignment conflicts. The modification is minimal and targeted. 🔍 Specific Changesapps/server/src/handlers/task/task.assign.handler.ts:56 - if (previousAssignment) {
+ if (previousAssignment && previousAssignment !== input.instanceId) {This change ensures that:
🐛 Potential IssuesNone identified. The fix correctly handles the edge case. ⚡ Performance ConsiderationsNo performance impact - this is a simple logical check adjustment. 🔒 Security ConcernsNo security issues. The change maintains proper task ownership validation. 🧪 Test Coverage RecommendationsConsider adding these test cases to verify the fix:
Example test structure: it('should allow re-assignment to the same instance', async () => {
const taskId = 't-123';
const instanceId = 'worker-1';
// First assignment
await handler.handle({ taskId, instanceId }, ctx);
// Second assignment to same instance should succeed
const result = await handler.handle({ taskId, instanceId }, ctx);
expect(result.instanceId).toBe(instanceId);
});
it('should prevent assignment to different instance', async () => {
const taskId = 't-456';
// Assign to first instance
await handler.handle({ taskId, instanceId: 'worker-1' }, ctx);
// Assignment to different instance should fail
await expect(
handler.handle({ taskId, instanceId: 'worker-2' }, ctx)
).rejects.toThrow('already assigned to worker-1');
});💡 Additional Observations
✅ VerdictThis is a clean, focused fix that resolves the described issue without introducing side effects. The change is production-ready. |
This PR: