Created: 2026-03-02 Updated: 2026-03-06 Status: COMPLETE Completed: 26/26 tasks (100%) - All phases complete
Reference: See STUDENT_PROFILE_DISCOVERY.md for full requirements
| Task | Description | Commit |
|---|---|---|
| #1 | Database schema extensions (6 tables, RLS policies) | 35ae915 |
| #2 | RLS policies for profile access control | 35ae915 |
| #3 | Admin/Owner profile view (full unrestricted) | 35ae915 |
| #7 | CEFR competency assessment system | 35ae915 |
| #11 | Competency assessment API routes (CRUD) | 35ae915 |
| #12 | Progress calculation API route | 35ae915 |
| #13 | Assessment entry form component | 35ae915 |
| #14 | Wire up CompetencyProgressTab | 35ae915 |
| #15 | Wire up LevelHistoryTab | 35ae915 |
| #16 | Wire up EnhancedNotesTab | 35ae915 |
| #17 | Wire up AuditTrailTab | 35ae915 |
| #18 | Schema Updates (FRESH_0028) - Phase 2A | 7482ce7 |
| #19 | CEFR Descriptor Importer (File A + B) | 7482ce7 |
| #21 | Learning Objectives UI (Phase 2B) | 28688cd |
| #22 | Update Assessment Form (Phase 2B) | 874ca45 |
| #23 | Summative Assessment UI (Phase 2B) | 463b679 |
| #4 | Teacher Profile View (Phase 2C) | d25394a |
| #6 | DoS Hybrid View (Phase 2C) | b85f4be |
| #8 | Level Promotion Workflow (Phase 2C) | 463b679 |
| #9 | Contact Verification System (Phase 2D) | 463b679 |
| #5 | Student Self-View (Phase 2D) | 463b679 |
| #10 | LLM Tutor Architecture Hooks (Phase 2E) | pending |
Database Layer:
student_profile_sensitive- PII storage (contact, visa, address)student_notes- Teacher notes with visibility controlslevel_promotions- Promotion request workflowdiagnostic_sessions- Placement test trackingcompetency_assessments- Individual CEFR assessmentscompetency_progress- Denormalized progress aggregation
API Routes (8 endpoints):
/api/admin/students/[id]/assessments- CRUD for assessments/api/admin/students/[id]/progress- Aggregated skill progress/api/admin/students/[id]/notes- Notes CRUD/api/admin/students/[id]/notes/[noteId]/share- Share with student/api/admin/students/[id]/level-history- Promotion history/api/admin/students/[id]/diagnostics- Diagnostic sessions/api/admin/students/[id]/audit- Full audit trail
Components:
LevelHistoryTab- Current level, promotions, diagnosticsCompetencyProgressTab- Skill progress with gaps by categoryEnhancedNotesTab- Notes with visibility, create/shareAuditTrailTab- Timeline of profile changesAssessmentForm- Record CEFR assessmentsLearningObjectiveSelector- Session learning objectives (CEFR/textbook/custom)TeacherStudentProfile- Teacher-specific student profile viewDoSStudentProfile- DoS-specific student profile with promotion approvalPromotionReviewList- Promotion review interface with evidence display
API Routes (16 endpoints):
/api/admin/sessions/[sessionId]/objectives- Session learning objectives CRUD/api/teacher/students- List students in teacher's classes/api/teacher/students/[id]- Teacher student profile/api/dos/students- List all students (org-wide for DoS)/api/dos/students/[id]- DoS student profile with promotion data/api/student/profile- Student's own profile (GET)/api/student/profile/update- Update profile (name/avatar)/api/student/assessments- Shared assessments (GET)/api/student/notes- Shared notes (GET)
Student Components:
StudentProfilePage- Mobile-first student profile with tabsVerificationCodeInput- 6-digit code inputContactChangeForm- Email/phone verification flowPendingVerificationBadge- Verification status badges
Estimate: 1-2 hours | Dependencies: None | Token budget: ~30k Priority: HIGH - Blocks #19, #20, #21 Completed: 2026-03-02
What was done:
- Created FRESH_0028_student_profile_phase2.sql migration
- Added 5 new tables:
coursebooks,coursebook_descriptors,session_learning_objectives,summative_assessments,summative_assessment_types - Updated
cefr_descriptorswith 10 new File A columns (source_index, activity_strategy_competence, competencies, strategies, mode, skill_focus, is_overall, scale, young_learners_7_10, young_learners_11_15) - Updated
competency_assessmentswith 6 new columns (progress, demonstrated_level, is_complete, learning_objective_id, session_id, is_shared_with_student) - Updated
classeswithprimary_coursebook_id - Updated
tenantswithprofile_settingsJSONB - Created RLS policies for all 5 new tables
- Updated Drizzle schemas (curriculum.ts, profile.ts, academic.ts, core.ts)
- All tests passing, TypeScript clean
Acceptance Criteria:
- All new tables created with proper constraints
- RLS policies enforce tenant isolation
- Migration file created (FRESH_0028)
- Drizzle schema updated and types generated
Estimate: 2-3 hours | Dependencies: #18 | Token budget: ~40k
Subtasks:
- Create spreadsheet parser for File A format (45 min)
- Create admin UI for uploading CEFR spreadsheet (30 min)
- Create API endpoint for import processing (30 min)
- Add validation for required columns (20 min)
- Create seed script for Castleforbes CEFR data (30 min)
Acceptance Criteria:
- Can upload Excel/CSV with File A structure
- Validates all required columns present
- Creates/updates cefr_descriptors records
- Shows import summary (rows processed, errors)
- Handles duplicate detection (by source_index)
Estimate: 2 hours | Dependencies: #18 | Token budget: ~35k
Subtasks:
- Create spreadsheet parser for File B format (30 min)
- Handle multi-worksheet files (one sheet per book) (30 min)
- Create admin UI for coursebook upload (30 min)
- Create/update coursebook + descriptors in transaction (20 min)
- Optional: LLM-assisted matching to CEFR descriptors (30 min)
Acceptance Criteria:
- Can upload multi-worksheet Excel file
- Each worksheet creates a coursebook record
- All rows become coursebook_descriptors
- Can re-import to update existing coursebook
- LLM matching is configurable (off by default)
Estimate: 2-3 hours | Dependencies: #18, #19, #20 | Token budget: ~45k Completed: 2026-03-03
What was done:
- ✅ Created
LearningObjectiveSelectorcomponent with 3 tabs (CEFR, Textbook, Custom) - ✅ Created session planning page at
/admin/classes/[id]/sessions/[sessionId] - ✅ Level filtering (current ± 1 adjacent levels), skill filtering, search
- ✅ Primary (max 2) and secondary (max 6) objectives with soft limits
- ✅ Page references shown for textbook descriptors
- ✅ API route: GET/PUT
/api/admin/sessions/[sessionId]/objectives - ✅ Updated class detail page with "Upcoming Sessions" section
Acceptance Criteria:
- Teacher can select descriptors for each session
- Filtered by appropriate level range
- Primary/secondary distinction enforced
- Shows coursebook page references when available
- Soft limits enforced (2 primary, 6 secondary)
Estimate: 1-2 hours | Dependencies: #18 | Token budget: ~30k Completed: 2026-03-03
What was done:
- ✅ Added
demonstratedLeveldropdown (CEFR A1-C2) - ✅ Added
isCompletecheckbox (auto-checks on "Achieved") - ✅ Updated progress scale: Not Yet / Emerging / Developing / Achieved
- ✅ Added
sessionIdprop for learning objective context - ✅ Added
isSharedWithStudentvisibility toggle - ✅ Updated API route to accept/return all new fields
- ✅ Added validation for progress values and CEFR levels
Acceptance Criteria:
- Can record demonstrated level different from descriptor level
- Can mark descriptor as complete (achieved)
- Progress scale matches requirements
- Assessment links to session objective when applicable
Estimate: 2 hours | Dependencies: #18 | Token budget: ~35k
Subtasks:
- Create summative assessment types admin page (30 min)
- Create
SummativeAssessmentFormcomponent (30 min) - Add summative assessments tab to student profile (30 min)
- Create API routes for summative CRUD (30 min)
Acceptance Criteria:
- Schools can define assessment types (End of Unit, Mid-Term, etc.)
- Can record percentage scores per student
- Summative scores visible in student profile
- Scores included in promotion evidence
Estimate: 2-3 hours | Dependencies: #21 ✅, #22 ✅ | Token budget: ~40k Completed: 2026-03-03
What was done:
- ✅ Created TeacherStudentProfile component with tabs (Overview, Progress, Notes, Attendance, Level History)
- ✅ Created class-scope utilities:
canTeacherAccessStudent(),getAccessibleStudentIds(),getSharedClasses() - ✅ Created teacher API routes:
/api/teacher/students/[id]/{route, notes, progress, assessments} - ✅ Adapted existing tabs with
isTeacher=trueandcanViewSensitiveNotes=falseprops - ✅ Created
/teacher/studentslist page and/teacher/students/[id]detail page
Acceptance Criteria:
- Teachers see only students in their current classes
- No access to sensitive PII (contact, visa, address)
- Can view competency progress and skill gaps
- Can add notes (general, academic, behavioral - not medical/pastoral)
- Cannot see audit trail
Estimate: 2-3 hours | Dependencies: #23 | Token budget: ~40k
Subtasks:
- Create promotion request form with evidence summary (45 min)
- Create promotion request API (30 min)
- Create promotion review API with summative scores (30 min)
- Create notification triggers (30 min)
- Add promotion history to LevelHistoryTab (30 min)
Acceptance Criteria:
- Teachers can request promotions with minimal friction
- System auto-suggests when threshold reached (configurable, default 90%)
- DoS sees: recommendation + summative scores + stats
- DoS can approve/reject with notes
- Student level updates on approval
Estimate: 2-3 hours | Dependencies: #4 ✅, #8 | Token budget: ~40k Completed: 2026-03-03
What was done:
- ✅ Added 'dos' and 'assistant_dos' to UserRole type (
lib/auth/types.ts) - ✅ Created DoS students API routes (
/api/dos/students,/api/dos/students/[id]) - ✅ Created DoS dashboard page (
/dos/dashboard) with promotion stats, student breakdown - ✅ Created DoS students list page (
/dos/students) with filtering and promotion status - ✅ Created DoSStudentProfile component with promotion approval inline
- ✅ Created DoS student detail page (
/dos/students/[id]) - ✅ PromotionReviewList component already existed with full functionality
Acceptance Criteria:
- DoS can access ALL student profiles (org-wide)
- Can review and approve/reject promotions
- Can see accumulated assessment evidence + summative scores
- Has all teacher capabilities
- Pending promotions prominently visible
Estimate: 2-3 hours | Dependencies: None | Token budget: ~40k Completed: 2026-03-03
What was done:
- ✅ Created verification utility library (
lib/verification/index.ts)- 6-digit secure code generation
- 24-hour expiry with automatic cleanup
- Max 5 attempts per code
- 2-minute cooldown between requests
- ✅ Created API routes (
/api/student/verify/)- POST /request - Request verification code
- POST /confirm - Verify code and update contact
- GET /pending - List pending verifications
- POST /[id]/cancel - Cancel pending verification
- ✅ Created UI components (
components/student/)- VerificationCodeInput - 6-digit input with paste support
- ContactChangeForm - Full verification flow UI
- PendingVerificationBadge - "Awaiting verification" badges
Acceptance Criteria:
- Email/phone changes require verification code
- Codes expire after 24 hours
- Student notified of expiry (countdown in UI)
- Pending changes show "awaiting verification" badge
- Audit log records verification attempts (attempts column)
Estimate: 3-4 hours | Dependencies: #9 ✅ | Token budget: ~50k Completed: 2026-03-03
What was done:
- ✅ Created student profile API routes (
/api/student/profile,/api/student/profile/update) - ✅ Created student assessments API (
/api/student/assessments) - only shared assessments - ✅ Created student notes API (
/api/student/notes) - only shared notes - ✅ Created StudentProfilePage component with mobile-first tabs (Overview, Progress, Assessments, Notes, History)
- ✅ Integrated ContactChangeForm for email/phone verification flow
- ✅ Created student profile page at
/student/profile - ✅ Level journey timeline visualization with diagnostic history
Acceptance Criteria:
- Students can only view their own profile
- Can edit email/phone with verification flow
- Can see only explicitly shared notes/assessments
- Can see diagnostic history and level progression
- Mobile-first UI with proper touch targets
Estimate: 1-2 hours | Dependencies: None | Token budget: ~25k Completed: 2026-03-03
What was done:
- ✅ AI Tutor tab already existed in StudentProfilePage with "Coming Soon" UI (lines 741-847)
- ✅ Created
spec/STUDENT_MCP_SPEC.mddocumenting future MCP design (10 tool signatures) - ✅ Database tables already existed in FRESH_0027 and FRESH_0032 migrations:
exercise_attempts,vocab_lists,tutor_interactions(FRESH_0027)tutor_sessions,tutor_messages,student_vocabulary,exercise_templates(FRESH_0032)
- ✅ Created
/api/student/tutor-contextAPI endpoint exposing:- Student profile (name, levels, member since)
- Current class info
- Competency progress and skill breakdown
- Recent assessments and gaps
- Vocabulary stats
- Current learning objectives
Acceptance Criteria:
- Student nav has placeholder for future tutor
- Database tables exist for exercise/vocab/tutor data
- Profile data accessible for LLM consumption
- No actual LLM integration (hooks only)
These tasks were identified during the discovery session to clarify remaining blockers.
Estimate: 2-3 hours | Dependencies: None | Token budget: ~35k Priority: HIGH - Core placement workflow Completed: 2026-03-06
What was done:
- ✅ Created
/admin/students/[id]/diagnosticpage with RLS context setup - ✅ Created DiagnosticInputForm component with 4 sections (Written Test, Oral Test, Level Recommendation, Provisional Placement)
- ✅ Extended API route with POST (create) and PUT (update) handlers
- ✅ Provisional enrollment created via
expectedEndDateset to 1 week - ✅ Added "New Diagnostic" button to LevelHistoryTab in student profile
Acceptance Criteria:
- Admin can input written test results
- DoS can add oral test results and level recommendation
- Provisional enrollment created in recommended class
- Diagnostic history visible on student profile
- DoS can finalize placement after first week
Estimate: 1-2 hours | Dependencies: None | Token budget: ~25k Priority: MEDIUM - Affects descriptor filtering Completed: 2026-03-06
What was done:
- ✅ Created FRESH_0034_textbook_selection.sql migration adding
active_textbooksJSONB column - ✅ Updated Drizzle schema in core.ts with
activeTextbooksfield - ✅ Created
/api/admin/settings/curriculumAPI route (GET/PUT) - ✅ Created TextbookSelector component with grid of toggleable textbook cards
- ✅ Created curriculum settings page at
/admin/settings/curriculum - ✅ Updated
/api/admin/curriculum/textbookwithfilterByTenant=truequery param - ✅ Updated LearningObjectiveSelector to use tenant-filtered textbooks
Acceptance Criteria:
- Admin can select active textbook series in settings
- Learning Objectives selector only shows descriptors from active textbooks
- CEFR Browser textbook tab filters by active selection
- Changes persist and apply immediately
- Default behavior unchanged for existing tenants (NULL = all active)
Estimate: 2-3 hours | Dependencies: #25 | Token budget: ~40k Priority: MEDIUM - School-specific learning objectives Completed: 2026-03-06
What was done:
- ✅ Created FRESH_0035_custom_descriptors.sql migration with table + RLS policies
- ✅ Updated Drizzle schema in curriculum.ts with
customDescriptorstable - ✅ Created
/api/admin/curriculum/customAPI routes (GET list, POST create) - ✅ Created
/api/admin/curriculum/custom/[id]API routes (GET, PUT, DELETE) - ✅ Created CustomDescriptorManager component with full CRUD UI
- ✅ Created settings page at
/admin/settings/custom-descriptors - ✅ Updated LearningObjectiveSelector with Custom tab showing saved descriptors
Acceptance Criteria:
- Admin can create custom learning objectives
- Custom descriptors appear in Learning Objectives selector
- Custom descriptors visually distinguished from official CEFR ("Custom" badge)
- Teachers can use custom descriptors in assessments
- Custom descriptors scoped to tenant (not visible to other schools)
- Official CEFR descriptors remain read-only
Phase 2A: Schema & Data ✅ COMPLETE
#18 Schema Updates ──┬──▶ #19 CEFR Importer
├──▶ #20 Coursebook Importer
├──▶ #22 Update Assessment Form
└──▶ #23 Summative Assessment UI
Phase 2B: Teacher Workflow ✅ COMPLETE
#19, #20, #18 ──▶ #21 Learning Objectives UI
Phase 2C: Role Views ✅ COMPLETE
#21, #22 ──▶ #4 Teacher View ──┐
#23 ──────▶ #8 Promotion ──────┼──▶ #6 DoS View
│
Phase 2D: Student ✅ COMPLETE
#9 Verification ───────────────┴──▶ #5 Student Self-View
Phase 2E: Future (independent) ✅ COMPLETE
#10 LLM Hooks
Phase 3: Discovery Session Tasks (NEW)
#24 Diagnostic Input ──▶ (independent)
#25 Textbook Selection ──▶ #26 Custom Descriptors
| Order | Task | Estimate | Status |
|---|---|---|---|
| 1 | #18 Schema Updates | 1-2h | ✅ Complete |
| 2 | #19 CEFR Importer | 2-3h | ✅ Complete |
| 3 | #20 Coursebook Importer | 2h | ✅ Complete |
| 4 | #22 Update Assessment Form | 1-2h | ✅ Complete |
| 5 | #23 Summative Assessment UI | 2h | ✅ Complete |
| 6 | #21 Learning Objectives UI | 2-3h | ✅ Complete |
| 7 | #9 Contact Verification | 2-3h | ✅ Complete |
| 8 | #4 Teacher Profile View | 2-3h | ✅ Complete |
| 9 | #8 Promotion Workflow | 2-3h | ✅ Complete |
| 10 | #6 DoS Hybrid View | 2-3h | ✅ Complete |
| 11 | #5 Student Self-View | 3-4h | ✅ Complete |
| 12 | #10 LLM Tutor Hooks | 1-2h | ✅ Complete |
| Order | Task | Estimate | Status |
|---|---|---|---|
| 13 | #24 Diagnostic Input Form | 2-3h | ✅ Complete |
| 14 | #25 Textbook Selection | 1-2h | ✅ Complete |
| 15 | #26 Custom Descriptors | 2-3h | ✅ Complete |
Total Remaining: 0 tasks - Student Profile Feature complete!
app/
├── migrations/
│ ├── FRESH_0027_student_profile_feature.sql
│ └── FRESH_0028_student_profile_phase2.sql # NEW - Phase 2A schema
├── src/
│ ├── app/api/admin/students/[id]/
│ │ ├── assessments/
│ │ │ ├── route.ts
│ │ │ └── [assessmentId]/route.ts
│ │ ├── progress/route.ts
│ │ ├── notes/
│ │ │ ├── route.ts
│ │ │ └── [noteId]/share/route.ts
│ │ ├── level-history/route.ts
│ │ ├── diagnostics/route.ts
│ │ └── audit/route.ts
│ ├── app/api/dos/students/
│ │ ├── route.ts # NEW - DoS student list (org-wide)
│ │ └── [id]/route.ts # NEW - DoS student detail
│ ├── app/api/teacher/students/
│ │ ├── route.ts # NEW - Teacher student list (class-scoped)
│ │ └── [id]/
│ │ ├── route.ts # NEW - Teacher student detail
│ │ ├── notes/route.ts # NEW - Teacher notes
│ │ ├── progress/route.ts # NEW - Teacher progress view
│ │ └── assessments/route.ts # NEW - Teacher assessments
│ ├── app/dos/
│ │ ├── dashboard/page.tsx # NEW - DoS dashboard
│ │ └── students/
│ │ ├── page.tsx # NEW - DoS students list
│ │ └── [id]/page.tsx # NEW - DoS student detail page
│ ├── app/teacher/students/
│ │ ├── page.tsx # NEW - Teacher students list
│ │ └── [id]/page.tsx # NEW - Teacher student detail page
│ ├── app/student/profile/
│ │ └── page.tsx # NEW - Student self-view page
│ ├── app/api/student/
│ │ ├── profile/
│ │ │ ├── route.ts # NEW - Student profile GET
│ │ │ └── update/route.ts # NEW - Student profile update
│ │ ├── assessments/route.ts # NEW - Shared assessments
│ │ ├── notes/route.ts # NEW - Shared notes
│ │ └── verify/
│ │ ├── request/route.ts # NEW - Request verification
│ │ ├── confirm/route.ts # NEW - Confirm verification
│ │ ├── pending/route.ts # NEW - List pending
│ │ └── [id]/cancel/route.ts # NEW - Cancel verification
│ ├── components/admin/students/
│ │ ├── tabs/
│ │ │ ├── LevelHistoryTab.tsx
│ │ │ ├── CompetencyProgressTab.tsx
│ │ │ ├── EnhancedNotesTab.tsx
│ │ │ ├── AuditTrailTab.tsx
│ │ │ └── index.ts
│ │ ├── AssessmentForm.tsx
│ │ └── promotions/
│ │ └── PromotionReviewList.tsx
│ ├── components/teacher/
│ │ ├── TeacherStudentProfile.tsx # NEW - Teacher profile component
│ │ └── index.ts
│ ├── components/dos/
│ │ ├── DoSStudentProfile.tsx # NEW - DoS profile component
│ │ └── index.ts
│ ├── components/student/
│ │ ├── StudentProfilePage.tsx # NEW - Student self-view component
│ │ ├── VerificationCodeInput.tsx # NEW - 6-digit code input
│ │ ├── ContactChangeForm.tsx # NEW - Email/phone verification
│ │ ├── PendingVerificationBadge.tsx # NEW - Verification badges
│ │ └── index.ts
│ ├── lib/verification/
│ │ └── index.ts # NEW - Verification utilities
│ ├── lib/teachers/
│ │ ├── canAccessStudent.ts # NEW - Teacher access control utilities
│ │ └── index.ts
│ ├── db/schema/
│ │ ├── profile.ts # UPDATED - Added coursebooks, summative assessments, session objectives
│ │ ├── curriculum.ts # UPDATED - Added File A columns to cefr_descriptors
│ │ ├── academic.ts # UPDATED - Added primaryCoursebookId to classes
│ │ └── core.ts # UPDATED - Added profileSettings to tenants
│ └── hooks/
│ └── useCompetencyAssessments.ts
Documentation/
├── STUDENT_PROFILE_ROADMAP.md (this file)
└── STUDENT_PROFILE_DISCOVERY.md (requirements)