Skip to content

Codebase audit: 8 fixes for student grading view, admin nav, auth race, analytics, settings#12

Merged
WangYuTengg merged 9 commits into
mainfrom
ethan-claude/frosty-grothendieck-fda9a1
May 6, 2026
Merged

Codebase audit: 8 fixes for student grading view, admin nav, auth race, analytics, settings#12
WangYuTengg merged 9 commits into
mainfrom
ethan-claude/frosty-grothendieck-fda9a1

Conversation

@WangYuTengg

Copy link
Copy Markdown
Owner

Summary

Eight independent fixes from a thorough codebase audit. Each commit is reviewed, typechecked, lint-clean, and browser-verified before commit.

Fix Commit What
A 6c313c3 'graded' and 'grading' submissions now show "View" badge + route to submission, not new attempt
B 229c6de Admin sidebar shows User Management & Settings regardless of view-as
G a9e8cf6 onAuthStateChange no longer clobbers password-login session on initial mount
C 2a70fe8 New /api/auto-grade/grading-stats + AnalyticsTab fetches real counts
D b4409ad New GET/PUT /api/courses/:id/automation-settings + SettingsTab persists per-course
E 297219e "0 question(s) missing model answer" → "No auto-gradable questions"
F f83a767 Removed duplicate "Not saved yet" SaveIndicator from header card
H e3a3653 Deleted dead seed-passwords.ts, removed npm script, updated CLAUDE.md

Test plan

  • npx tsc -b --noEmit clean
  • npx eslint . clean
  • npm test — 441/441 passing
  • Browser verified each fix end-to-end via Playwright (login as admin/staff/student, click through affected feature, confirm fix)
  • One known conflict against main in AssignmentAutoGradingList.tsx from in-progress feature merged separately — will resolve in this PR
  • Reviewer to spot-check the auth-race fix on a deep-link cold load (Cmd-click any /staff/* URL from a fresh tab)

🤖 Generated with Claude Code

WangYuTengg and others added 9 commits May 7, 2026 02:13
submissionStatus 'graded' and 'grading' fell through to "Start" button,
which tried to create a new attempt instead of opening the existing
submission. Add badges + route them through the same submission view as
submitted/late.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Filter compared item.roles against effectiveRole, but effectiveRole for
an admin is always 'student' or 'staff' (per AuthContext.tsx:132-137),
so admin-only items (User Management, Settings) were never shown.
Admins now always see admin items based on dbUser.role.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two bugs in onAuthStateChange that bounced password-authed users to
/login when they navigated directly to a deep URL:
- The handler unconditionally cleared dbUser when Supabase had no
  session, even if a custom JWT (password login) was active.
- The handler unconditionally flipped loading=false on every Supabase
  event, including the initial INITIAL_SESSION emitted before the
  custom-JWT fetchDbUser had finished. Route guards then ran with
  loading=false and dbUser=null and redirected.

Now: only clear dbUser if there is no custom token, and let the
custom-token path own setLoading(false) when it's the active session.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Top Auto-graded / Pending Review / Total Graded tiles were hardcoded 0.
Add /api/auto-grade/grading-stats returning:
- autoGradedThisWeek: distinct submissions with AI-assisted marks in 7d
- pendingReview: submissions in submitted/grading/late status
- totalGraded: submissions in 'graded' status

AnalyticsTab now fetches and renders, with em-dash placeholders while
loading.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Save Settings button on the per-course Settings tab popped a placeholder
alert. Now it loads + persists the two toggles (auto-grade on submit,
MCQ-only) via new GET/PUT /api/courses/:id/automation-settings, stored
in system_settings under course-scoped keys. UI shows inline success or
error feedback instead of an alert(). Field set is disabled while
loading/saving.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
For MCQ-only assignments canAutoGrade is false because gradableCount==0,
but missingModelAnswers is also 0 — so the warning rendered as "0
question(s) missing model answers", which is wrong and confusing. Show
"No auto-gradable questions" in that branch instead.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Both the header card and the sticky floating indicator rendered a
SaveIndicator at the top of the page, so users saw "Not saved yet" twice
side by side. Keep only the sticky one — it stays visible when scrolled,
which is what the user needs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
seed-passwords.ts shipped with an empty seedUsers array, so
db:seed-passwords was a no-op. Real seeding lives in db:seed
(src/db/seed.ts), which sets up users, courses, questions, and
assignments — and which this script is now removed in favor of.

Removes the script, the npm task, and updates CLAUDE.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…rothendieck-fda9a1

# Conflicts:
#	src/client/features/staff-grading/AssignmentAutoGradingList.tsx
#	src/server/routes/auto-grade/index.ts
@WangYuTengg
WangYuTengg merged commit d292631 into main May 6, 2026
3 checks passed
@WangYuTengg
WangYuTengg deleted the ethan-claude/frosty-grothendieck-fda9a1 branch May 6, 2026 19:05
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