Codex 5.3 Refactor Note: Canonical refactor plan: docs/CODEX-5.3-REFACTOR-PLAN.md. This document is retained for historical and implementation context during the refactor.
W11 Candidate List - Delivery
โ Complete
W11 (Candidate List) is fully implemented with role-based saved views, advanced filtering, search, pagination, and candidate detail navigation.
๐ฆ Deliverables
Code (9 Files)
API:
src/app/api/candidates/route.ts(UPDATED - GET handler added)- Fetches candidates with RBAC filtering, search, filters, pagination
- Computes ageInStatusDays, ownerRole, isOverdue
- ~130 lines added
UI Components:
-
src/app/(app)/candidates/page.tsx(NEW - 180 lines)- Layout: header + sidebar + filters + table
- Fetches metadata (managers, positions)
- Coordinates data flow
-
src/app/(app)/candidates/_components/SavedViews.tsx(NEW - 95 lines)- Role-specific sidebar views
- Active view highlight
-
src/app/(app)/candidates/_components/FiltersBar.tsx(NEW - 180 lines)- Search, status, position, manager, date range, overdue
- Apply/Clear buttons
-
src/app/(app)/candidates/_components/CandidatesTable.tsx(NEW - 200 lines)- Table with 8 columns
- Pagination, row click, empty state
- Status color badges
Helpers:
src/lib/candidates/owner.ts(NEW - 60 lines)- getOwnerRole(status)
- getAgeInStatusDays(date)
- isOverdue(status, days)
Documentation
- W11-IMPLEMENTATION.md (A-H format, 20 test cases)
๐ฏ Features Implemented
โ
Role-based saved views (HR, Manager, SMO, Admin)
โ
Server-side RBAC filtering (Manager: assigned only, SMO: TO_SMO/decided)
โ
Advanced filtering: status, position, manager, date range, overdue
โ
Search: name, code, position
โ
Pagination (server-side)
โ
Computed columns: age in status, owner role, overdue indicator
โ
Table: 8 columns with color-coded status badges
โ
Row click โ candidate detail
โ
Empty state with clear filters
โ
URL parameters persist on refresh
โ Acceptance Criteria
- Role-specific saved views appear and filter correctly
- Table shows required columns and paginates
- Search works across name/code/applyingFor
- Clicking row opens candidate detail
- RBAC enforced: Manager only sees assigned; Admin sees all
- Overdue toggle works (hardcoded thresholds)
- No extra features beyond W11
๐งช Test Coverage
20 comprehensive test cases (see W11-IMPLEMENTATION.md Section H):
- Saved views per role
- Search functionality
- Status, position, manager, date filters
- Overdue toggle
- Pagination
- Row navigation
- Age in status calculation
- Owner role determination
- Status badge colors
- Empty state
- URL persistence
- Multi-filter combinations
- RBAC enforcement
๐ Key Implementation Details
Saved Views (Role-Specific)
HR:
- Needs HR Screening (status=NEW)
- Needs Manager Assignment (status=HR_SCREENED, no manager)
- Active Pipeline (status IN NEW, HR_SCREENED, MANAGER_EVAL_PENDING, MANAGER_REVIEWED, TO_SMO)
- All Candidates
Manager:
- My Queue (assigned, status=MANAGER_EVAL_PENDING)
- Waiting for SMO (assigned, status=TO_SMO)
- My Reviewed (assigned, status=MANAGER_REVIEWED)
- All Assigned (assigned to me)
SMO:
- Needs Decision (status=TO_SMO)
- Recent Decisions (status=APPROVED/REJECTED/KIV)
Admin:
- All Candidates
RBAC Filtering
if (role=MANAGER) โ where hiringManagerId = user.id
if (role=SMO) โ where status IN (TO_SMO, APPROVED, REJECTED, KIV)
HR/ADMIN โ no filter
Overdue Thresholds (Hardcoded)
NEW: > 2 days
HR_SCREENED: > 2 days
MANAGER_EVAL_PENDING: > 3 days
MANAGER_REVIEWED: > 3 days
TO_SMO: > 2 days
APPROVED/REJECTED/KIV: never
Table Columns
- Candidate (name + code)
- Applying For
- Status (color badge + overdue โ )
- Owner (computed from status)
- Assigned Manager (name + email)
- Age in Status (days)
- Updated At
- Actions (Open)
๐ Quick Test
- Start server:
npm run dev - Login as Manager
- Navigate
/candidates - Verify "My Queue" saved view
- Click candidate โ opens detail page
- Apply filters โ table updates
- Search by name โ results filter
- Toggle overdue โ see warning badge
๐ Files Changed
src/app/api/candidates/route.ts (+130 lines)
โโ GET handler with RBAC, filters, pagination
src/app/(app)/candidates/page.tsx (NEW)
โโ Layout + data fetching
src/app/(app)/candidates/_components/
โโ SavedViews.tsx (NEW)
โโ FiltersBar.tsx (NEW)
โโ CandidatesTable.tsx (NEW)
src/lib/candidates/owner.ts (NEW)
โโ Helper functions
โ ๏ธ Notes
- No database changes required
- statusUpdatedAt already exists in schema
- Overdue is computed on fetch (no SLA table in W11)
- Saved views are fixed per role (no custom views)
- RBAC enforced server-side
- All filters are optional (can apply individually or together)