Skip to content

fix: solve all assignment bugs and add new features - #338

Open
anurag-chandra9 wants to merge 1 commit into
modelsuite-ai:masterfrom
anurag-chandra9:fix/submission-pipeline-bugs
Open

fix: solve all assignment bugs and add new features#338
anurag-chandra9 wants to merge 1 commit into
modelsuite-ai:masterfrom
anurag-chandra9:fix/submission-pipeline-bugs

Conversation

@anurag-chandra9

Copy link
Copy Markdown

Bug Fixes

1. Atomic Task Claiming (Race Condition)

  • Replaced two-step read-then-write with a single atomic findOneAndUpdate
  • Status filter acts as a guard — only one concurrent request can succeed
  • Second claimant now receives a clean 400 'Task is no longer available'

2. Submission Versioning (Data Loss on Re-submit)

  • Added version (integer) and isLatest (boolean) fields to Submission model
  • Re-submissions no longer overwrite — each attempt is a new document
  • Previous versions flipped to isLatest: false, preserved forever
  • re-submission resets reviewStatus to Pending for admin re-review
  • Added compound index { taskId, talentId, version } for query performance
  • reviewStatus locked to enum ['Pending', 'Approved', 'Rejected']

3. Cascade Delete (Orphaned Submissions)

  • deleteTask now calls Submission.deleteMany({ taskId }) before removing task
  • All submission versions for a task are cleaned up in the same request

New Features

4. Submission History Timeline (Talent View)

  • New GET /api/submissions/my/history endpoint
  • New /talent/history page with grouped timeline per task
  • Each task thread shows all versions with status badges, file links, notes
  • Stat cards: Tasks Submitted / Approved / Rejected / Pending
  • Fixed broken 'My Tasks' sidebar link — now points to /talent/history

5. Admin Split-Pane Submissions Review

  • Replaced basic data table with full-viewport split-pane layout
  • Left pane: scrollable card list with search + status tabs (All/Pending/Approved/Rejected)
  • Right pane: sticky detail view with task info, talent info, notes, file link
  • Inline Approve/Reject buttons with optimistic UI — instant badge update
  • Keyboard navigation: left/right arrow keys cycle through submissions
  • No more modal — review happens entirely inline

6. Form Loading States

  • Login, Register, SubmitTaskModal all show spinner + disabled state during requests
  • SubmitTaskModal also shows skeleton while prefetching prior submission
  • Cancel/close buttons disabled while submission is in flight

7. Pre-React HTML Loader

  • Added native HTML/CSS loader in index.html — visible before JS bundle loads
  • Eliminates white/blank screen on slow connections (Slow 4G / 3G)
  • MutationObserver removes loader once React mounts with a fade-out transition
  • Animated: pulsing logo, sliding progress bar, bouncing dots

8. Remove Assign-To from Create Task

  • Removed talent assignment dropdown from CreateTaskModal
  • Tasks now always start as Open and are visible to all talents
  • Talents claim tasks themselves — supports the race condition fix

Summary (max 3 sentences)

Checklist

Required before opening this PR: Complete these checks locally to ensure the code is ready for review. PRs opened without these checks passing may be closed.

  • I ran cd client && npm run lint && npm run build and cd server && npm run lint && npm run build locally
  • All checks passed (lint, build)
  • No errors or warnings remain

Note: This is a pre-PR checklist completed before submission. Additional checklists below are completed after the PR is opened.

Short Demo Video (required)


Required Checklist

Task & Workflow

  • Create a new Branch exactly matching your assigned name (e.g. 27-26-22-7-5-pranav-test)
  • PR title is exactly your assigned branch name
  • Latest target branch (master) was pulled immediately before opening this PR

Quality & Safety

  • Change tested locally
  • Full diff reviewed before submitting (no blind copy/paste)
  • No secrets, keys, or personal data included

Checklist Completion Rule

The checklist must be completed after the Pull Request is opened.

Process:

  1. Create and submit the Pull Request
  2. Reopen the Pull Request page
  3. Complete all required checklist items
  4. Ensure your PR link and Voice recorded video are submitted before the deadline

Incomplete or incorrect checklists will result in the PR being closed.

## Bug Fixes

### 1. Atomic Task Claiming (Race Condition)
- Replaced two-step read-then-write with a single atomic findOneAndUpdate
- Status filter acts as a guard — only one concurrent request can succeed
- Second claimant now receives a clean 400 'Task is no longer available'

### 2. Submission Versioning (Data Loss on Re-submit)
- Added version (integer) and isLatest (boolean) fields to Submission model
- Re-submissions no longer overwrite — each attempt is a new document
- Previous versions flipped to isLatest: false, preserved forever
- re-submission resets reviewStatus to Pending for admin re-review
- Added compound index { taskId, talentId, version } for query performance
- reviewStatus locked to enum ['Pending', 'Approved', 'Rejected']

### 3. Cascade Delete (Orphaned Submissions)
- deleteTask now calls Submission.deleteMany({ taskId }) before removing task
- All submission versions for a task are cleaned up in the same request

## New Features

### 4. Submission History Timeline (Talent View)
- New GET /api/submissions/my/history endpoint
- New /talent/history page with grouped timeline per task
- Each task thread shows all versions with status badges, file links, notes
- Stat cards: Tasks Submitted / Approved / Rejected / Pending
- Fixed broken 'My Tasks' sidebar link — now points to /talent/history

### 5. Admin Split-Pane Submissions Review
- Replaced basic data table with full-viewport split-pane layout
- Left pane: scrollable card list with search + status tabs (All/Pending/Approved/Rejected)
- Right pane: sticky detail view with task info, talent info, notes, file link
- Inline Approve/Reject buttons with optimistic UI — instant badge update
- Keyboard navigation: left/right arrow keys cycle through submissions
- No more modal — review happens entirely inline

### 6. Form Loading States
- Login, Register, SubmitTaskModal all show spinner + disabled state during requests
- SubmitTaskModal also shows skeleton while prefetching prior submission
- Cancel/close buttons disabled while submission is in flight

### 7. Pre-React HTML Loader
- Added native HTML/CSS loader in index.html — visible before JS bundle loads
- Eliminates white/blank screen on slow connections (Slow 4G / 3G)
- MutationObserver removes loader once React mounts with a fade-out transition
- Animated: pulsing logo, sliding progress bar, bouncing dots

### 8. Remove Assign-To from Create Task
- Removed talent assignment dropdown from CreateTaskModal
- Tasks now always start as Open and are visible to all talents
- Talents claim tasks themselves — supports the race condition fix
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.

1 participant