Repository navigation
Redesign the app shell and study sessions, and move to Next 16 - #13
Merged
Merged
Conversation
Move off Next 14, which has unpatched critical advisories, to Next 15.5.27 with React 19.3. Bump next-auth to 4.24.15 for its security fixes. Dynamic route handlers and the session page now type params as a Promise, matching the Next 15 route signature. The handlers already awaited params, so only the annotations change. The route tests pass params the same way. Also update prisma, @prisma/client and @prisma/adapter-pg to 7.10, zod to 4.6, nanoid to 3.3.20, and apply the non-breaking npm audit fixes. Next adds an explicit compile target to tsconfig.json.
Run prisma generate after every install so the generated client never drifts from the schema, and add a typecheck script that CI now runs before the build.
When webpack bundles pdf-parse v1, its entry-module check always passes and it tries to read a test PDF that is not shipped, so PDF processing throws in production builds. Mark it as a server external package so Node loads it from node_modules.
next lint filled in an ES2017 target during the Next 15 upgrade, which makes tsc reject the BigInt literals in two test files. Every supported Node version and browser handles ES2022.
getClientIp only reads headers, so it now takes any Request and the auth routes no longer cast. The NextAuth POST handler types its context, the reflow transaction lets Prisma infer the client, and the attempt route narrows on result.error so the extra error fields are typed.
The upload directory comes from an env var, so Turbopack could not scope it and traced the whole project, .env and research PDFs included, into the standalone output. Mark those path calls as ignored for tracing.
Move to Next 16.4 (Turbopack now builds by default) and keep React on 19.3. Next 16 drops next lint, so linting runs through the ESLint 9 CLI with a flat eslint.config.mjs built from eslint-config-next's core-web-vitals and typescript configs. The old .eslintrc.json was already removed in the previous tsconfig commit, and @eslint/eslintrc is no longer needed. The new lint setup also covers e2e and scripts. Tests keep allowing any, and the screens that trip the new React hooks rules report them as warnings until the UI redesign replaces them. Next also switched tsconfig to the react-jsx runtime and added the dev route types.
Next 16 deprecates the middleware file convention in favor of proxy. The matcher and auth logic are unchanged. Proxy always runs on the Node.js runtime, which getToken supports.
Next 16 can generate an AGENTS.md at the project root during next dev. Turn that off so the file never lands in the repo.
The PDFs were publisher copies that no code read. The learning science doc now links every reference to its DOI, adds the papers it cited in the text but left out of the list, and lists the seeded research papers under further reading.
design/exports-raw was left over from a removed asset pipeline. The FTS index in prisma/indexes.sql already exists as a migration, and nothing ever ran the two partial indexes.
The callback redirected to /settings/calendar, which no longer exists, so connecting Google always ended on a 404. Outcomes now land on /settings with google=connected or google=error and an encoded reason. The settings page UI tests in the calendar spec targeted the removed page and always skipped; they are gone, and the remaining publish flow tests live in calendar-publish.spec.ts.
The Dockerfile could not build (dev tools were omitted before next build) and the app service never ran migrations, so both are gone. The app runs on the host with next start, which no longer conflicts with standalone output. npm run setup now applies prisma/manual-scripts/001_pgvector.sql after the migrations. The script only uses IF NOT EXISTS statements, so it is safe to re-run, and setup reports a missing extension as a note.
Plan creation and reflow placed availability windows with setHours and setDate, so "09:00" meant 09:00 on the server's clock and day indices followed the server's calendar. On a UTC server a New York student got sessions four hours early, and the reflow tests failed on any machine not set to UTC. lib/timezone gains addDays, daysBetween, hourOfDay and zonedTimeToUtc (moved from followups). Plan creation, the pre-exam taper, slot scoring, bedtime estimation, reflow, the reflow busy window and follow-up day indices now all work in StudyPlan.timezone. A plan's timezone comes from the request, then the user's setting, then America/New_York as before. Plan start and end dates in API responses are calendar days in that zone.
An explicit TZ still applies, so the suite can be checked in other zones.
Inline VAR=value prefixes in the webServer command only work in POSIX shells, so local e2e runs failed on Windows. The env block also sets GOOGLE_PROVIDER=fake, which the calendar publish and reflow specs need and which CI never set, so those specs always skipped. AI and email are pinned to their offline providers.
Removed: POST /api/content/search, GET /api/mastery, POST
/api/stats/daily-goal, GET /api/plans/[planId]/feed, and
/api/integrations/google/{test,freebusy}. No page, script or service
called them. The feed route was blocked by auth for calendar clients
anyway, so the feed_url and webcal_url fields go with it. Helpers that
only served these routes (searchContentSchema, setDailyXpGoal) and the
e2e check for freebusy are removed too.
src/lib/calendar held an abandoned provider interface, a second fake Google client, and a second computeEventHash; production code uses the ones in src/lib/google. The only live piece, hashUserId, now lives in event-builder.ts next to its one caller. The tests for the removed copies go with them.
src/lib/crypto.ts only re-exported token-vault under older names.
Deleted with their tests: pushLimiter, BADGE_KEYS, BadgeType, ItemStatus, TaperInput, UpdateAttemptMetaInput, findIntradaySpacingViolations, fetchFeedbackExcerpts (and its private storeCitations), listEvidenceTags, and the break helpers checkBreakEnded, breakRemainingSeconds and workRemainingSeconds. endBreak in the run service rebuilt the break state inline, which was a copy of endBreakEarly, so it now calls endBreakEarly instead. getBreakConfig stays because initBreakState uses it.
pdf.js copies its input with new input.constructor(input). For a Buffer under 4 KB that copy comes from Node's shared pool at a non-zero offset, which pdf.js ignores, so small PDFs failed with "bad XRef entry". The extractor now passes a plain Uint8Array. It also loads pdf-parse/lib/pdf-parse.js directly, which skips the debug routine in the package entry, and collects text per page through pagerender. The old form-feed split never matched pdf-parse's output, so chunks never carried page numbers. A unit test builds a two-page PDF in memory and checks the text and page numbers.
Server code read NEXT_PUBLIC_APP_URL for links in emails. Next inlines NEXT_PUBLIC_ variables at build time, so a build made with the default baked in localhost. getBaseUrl() reads BASE_URL at runtime.
.env.example documented GOOGLE_SYNC_CONCURRENCY, but publish read GOOGLE_CALENDAR_SYNC_CONCURRENCY and the client's own setting was never used. Both now share one value, default 3.
GOOGLE_TOKEN_ENC_KEY and TEST_TOKEN_ENC_KEY were undocumented legacy names for the same key.
Adds UPLOAD_DIR and a one-line comment for each setting, fixes the ADMIN_USER_IDS note (there is no /admin page, only /api/admin), and drops NEXT_PUBLIC_APP_URL.
zod 4 exports the same API from "zod" and "zod/v4" (the same module objects), and one file already used the root.
Nothing used the Vite React plugin. Node 22 is the version CI and .nvmrc target, so the Node types now match it.
Starting a run doesn't write the plan item. Home folds the open runs into each item's status, but Study read the stored status, so its planned row said Start session while Home said Resume session. Both now go through withRunUnderWay, with the run statuses Plan already counts as in progress.
The button was hidden on touch screens, so a phone or tablet with a paired keyboard ran the single-key shortcuts with no way to turn them off (WCAG 2.1.4). It now sits at the end of the lesson top bar on every screen, as in the card review. The phone footer stays one control tall, and the button stays on screen during feedback, where "?" used to open nothing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This branch rebuilds every screen. The shell (Home, Plan, Study, Flashcards, Study guides, Chat, Progress and Settings) now follows Material 3 the way Google's web apps do. A study session runs like a Duolingo lesson: one question per screen, a progress bar on top, answer cards that press down and a feedback sheet that slides up. I also moved from Next 14 to Next 16, deleted a lot of dead code, closed several security gaps, rewrote the copy and replaced the e2e suite.
It's 135 commits on top of
66e7f29, so reviewing by theme is probably easier than reading them in order. A few commits from the second review round don't build on their own, because a module move is spread across them. The branch head builds and passes everything below, so a squash merge keepsmainbisectable.What changed
Framework and tooling
middleware.tsis nowproxy.ts. Prisma 7.10, Playwright 1.64 and next-auth 4.24.15.postinstallrunsprisma generate, there's atypecheckscript, and tsconfig targets ES2022..envinto the standalone output.npm run setupapplies the pgvector script.Cleanup
run.tsis split intosrc/services/run/, and nine pure modules moved intosrc/lib. A lint rule stops services, lib and API routes from importing UI code..env.exampledocuments every variable the code reads.Design system
/designrenders every token and component in development. DESIGN.md writes them down.Screens
Intl, and an "AI-written" tag on every block of AI text.Accessibility
Security
requireAdmincheck.unsafe-eval, andX-Powered-Byis off.X-User-Idtest header is only trusted withALLOW_TEST_AUTH, plusCI=trueon a production build and a loopbackNEXTAUTH_URL.Tests
TZis set, and the payload budget test moved to the integration suite.@mobiletests. CI runs it in two shards, each with its own database and production build.Docs
Verification
Run on the branch head:
npm run typecheck: clean.npm run lint: 0 errors, 0 warnings.npm run buildwith the mock providers: passes.Known limitations
cycles: 1).sourcecolumn. "AI-written" on a deck is inferred from its title, and there's no manual New deck.scripts/seed-research.tsstill has dashes in its text. Only the planning prompt reads it, and changing the text would change the hashes the seed uses to skip papers it has already loaded.Before merging
main's history. Taking them out of history needs a rewrite and a force push.