Skip to content

Latest commit

 

History

History
325 lines (285 loc) · 106 KB

PROGRESS.md

File metadata and controls

325 lines (285 loc) · 106 KB

PROGRESS.md — Cortex

Living status file. Update after every step (see CLAUDE.md §1).

Status

  • Current phase: 9 — Docker (optional)
  • Next step: 9.1 Dockerfile + compose + prod start (Phase 9 is optional — ask the user whether to do it)
  • Last updated: 2026-11-28 (8.4 done — Phase 8 complete)

Checklist

Phase 0 — Workspace & foundation

  • 0.1 Workspace wiring (root scripts, pnpm-workspace, @cortex/* names, shared package, git, prettier)
  • 0.2 Dependencies & dev loop (TanStack Query, Drizzle, better-sqlite3, tsx, vitest, Vite proxy, /api/health)
  • 0.3 Theme & typography (Midnight Indigo tokens, GitHub heat colors, Geist, ThemeProvider, no flash)
  • 0.4 App shell & routing (sidebar, top bar, all routes, providers, error boundary, 404)
  • 0.5 Shortcut system (registry, provider, sequences, ? overlay, /shortcuts page)

Phase 1 — Shared domain & database

  • 1.1 Shared constants, schemas, utils (+ tests: url-detect, dates)
  • 1.2 Drizzle schema & migrations (+ db scripts, auto-migrate on start)
  • 1.3 Seed data

Phase 2 — API

  • 2.1 Server structure (validate, errors, logger)
  • 2.2 Problems API (+ tags, check-url)
  • 2.3 Solutions & attempts API (+ derived fields)
  • 2.4 Revision, contests, todos API (+ positions tests)
  • 2.5 Stats API (+ stats tests)

Phase 3 — Client data layer & problems

  • 3.1 Data layer (api.ts, query keys, hooks, badges)
  • 3.2 Quick add dialog
  • 3.3 Problems list page

Phase 4 — Problem page

  • 4.1 Layout & metadata
  • 4.2 Markdown editor & viewer
  • 4.3 Solutions
  • 4.4 Attempts & history

Phase 5 — Revision & todos

  • 5.1 Revision board (dnd-kit, optimistic)
  • 5.2 Revision session (focus mode)
  • 5.3 Todos

Phase 6 — Contests

  • 6.1 Contests list & detail (+ upsolve queue)
  • 6.2 Rating chart (removed 2026-11-28 — user decision, see decisions log)

Phase 7 — Dashboard

  • 7.1 Header & stat cards
  • 7.2 Heatmap (GitHub-exact)
  • 7.3 Breakdowns & lists

Phase 8 — Power features & data safety

  • 8.1 Full-text search (FTS5)
  • 8.2 Command palette
  • 8.3 Backups & export/import + Settings
  • 8.4 Polish pass

Phase 9 — Docker (optional)

  • 9.1 Dockerfile + compose + prod start

Decisions log

Newest at the bottom. Format: YYYY-MM-DD — decision — reason.

  • 2026-11-27 — Name Cortex, tagline "Your second brain for CP & DSA" — modern, short, logo-friendly.
  • 2026-11-27 — pnpm workspaces: client, server, shared (no Turborepo/Nx) — one install, shared types/constants without drift.
  • 2026-11-27 — shared consumed as TS source (no build step) — Vite and tsx compile it directly.
  • 2026-11-27 — SQLite + better-sqlite3 + Drizzle; all data (incl. markdown notes) in the DB; JSON backup + Markdown export for portability — single-user localhost, one file to back up, FTS5 search.
  • 2026-11-27 — Express 5 + tsx; no auth, no cookie-parser — single user on localhost.
  • 2026-11-27 — Vite proxy for /api instead of relying on CORS — one origin in the browser.
  • 2026-11-27 — Native fetch wrapper, no axios — TanStack Query covers retries/caching; one dependency fewer.
  • 2026-11-27 — TanStack Query for server state; filters in URL params; no global state library.
  • 2026-11-27 — shadcn/ui on Base UI (Nova preset: Lucide + Geist) — shadcn's default for new projects; use render prop, not asChild.
  • 2026-11-27 — Tailwind-only motion, no Framer Motion — enough for transitions; dnd-kit animates drags.
  • 2026-11-27 — Palette Midnight Indigo (indigo → violet gradient, cyan highlight), light + dark + system; heatmap uses GitHub's exact green ramp.
  • 2026-11-27 — Difficulty supports both labels (Easy/Medium/Hard) and numeric ratings, per platform kind.
  • 2026-11-27 — Patterns: fixed two-level list (category → pattern) in shared + free-form tags.
  • 2026-11-27 — History is an attempt event log (solve / revision / resolve) with outcome (alone / hint / editorial / failed), time taken, mistakes — all stats derive from it.
  • 2026-11-27 — No confidence score; revision is manual (board columns To Revise → Revising → Confident); no automatic scheduling.
  • 2026-11-27 — Mistakes: fixed categories + free text per attempt; dashboard shows top recurring mistakes.
  • 2026-11-27 — Contests: separate page (rating chart, upsolve queue); contest problems are normal problems linked to a contest; dashboard has source toggle All / Practice / Contest.
  • 2026-11-27 — Keyboard-first: own small shortcut registry (no hotkey lib), searchable /shortcuts page, ? overlay, cmdk palette.
  • 2026-11-27 — Optimistic updates only for board moves, todo toggle/reorder, star, revision status.
  • 2026-11-27 — Tests kept small: shared utils + server stats/positions only; typecheck + lint + build every step.
  • 2026-11-27 — Day-level dates stored as local YYYY-MM-DD strings (avoid UTC/IST off-by-one).
  • 2026-11-27 — TypeScript pinned to ~6.0.3 in every package (server had 7.0.2) — typescript-eslint 8.72 supports only TS <6.1; one version avoids drift.
  • 2026-11-27 — Root tsconfig.base.json holds the shared strict options (strict, noUncheckedIndexedAccess, erasableSyntaxOnly, verbatimModuleSyntax, noEmit…), extended by client/server/shared — shared source is type-checked by all three, so they must agree. exactOptionalPropertyTypes deliberately off (friction with zod/Drizzle inferred types).
  • 2026-11-27 — @types/node ^24 everywhere — matches the installed Node 24 runtime.
  • 2026-11-27 — Native builds allowed via allowBuilds in root pnpm-workspace.yaml (format pnpm 12 itself wrote) for esbuild + better-sqlite3.
  • 2026-11-27 — Prettier: no semicolons, double quotes, es5 trailing commas, width 100 — matches shadcn-generated code so regenerated components stay stable; *.md ignored so docs aren't reflowed.
  • 2026-11-27 — ESLint react-refresh/only-export-components off for src/components/ui/** only — shadcn files export variants next to components.
  • 2026-11-27 — cors kept (user-installed) but restricted to http://localhost:5173; the Vite proxy is the primary path.
  • 2026-11-27 — client/src/lib/api.ts (full §9.17 fetch wrapper + ApiError) and features/settings/hooks/use-health.ts written in 0.2 rather than 3.1 — the health check needed them and they are the real implementations, not throwaway code.
  • 2026-11-27 — Health response type lives in shared/src/schemas/health.ts (zod) — API types are never duplicated in client/server.
  • 2026-11-27 — Server db:* scripts are explicit "implemented in step 1.x" placeholders that exit 1; test uses vitest run --passWithNoTests so pnpm test is green before tests exist.
  • 2026-11-27 — Theme context/hook in lib/use-theme.ts, provider in lib/theme.tsx — react-refresh lint requires component files to export only components.
  • 2026-11-27 — Sidebar shadcn tokens not in §4.2 chosen to fit: --sidebar-accent light #E5E7EE / dark #181B25 (hover on the sidebar surface), dark --sidebar-border #1C1F2B (subtler than --border against the darker sidebar).
  • 2026-11-27 — Pre-paint script also sets color-scheme, so the browser canvas is dark before CSS loads (no flash even in dev, where Vite injects CSS via JS) without defining a color outside index.css.
  • 2026-11-27 — /_ui token preview kept as a dev-only lazy route (import.meta.env.DEV), not in production bundles — handy for checking tokens in later phases.
  • 2026-11-27 — Rewrote shadcn's generated hooks/use-mobile.ts with useSyncExternalStore — the generated version fails react-hooks/set-state-in-effect lint.
  • 2026-11-27 — Removed the cookie write and the raw ctrl+b keydown listener from generated components/ui/sidebar.tsx; AppShell controls open and persists it in localStorage["cortex-sidebar-open"], and mod+b goes through the shortcut registry (CLAUDE.md: no raw keydown listeners, localStorage for UI prefs).
  • 2026-11-27 — shadcn sonner uses our useTheme().resolvedTheme; next-themes (pulled in by shadcn) removed — one theme system.
  • 2026-11-27 — /revision/session is a top-level route outside AppShell (focus mode = no sidebar/top bar). Two error boundaries: shell-level (full screen) and a pathless page-level layer so a page crash keeps the sidebar usable.
  • 2026-11-27 — Page titles in the top bar come from route handle: { title } (app/route-handle.ts).
  • 2026-11-27 — Common Kbd wraps shadcn kbd (components/ui/kbd.tsx) — tooltip styles already target data-slot=kbd; key labels/OS detection in lib/keys.ts.
  • 2026-11-27 — React Query devtools button bottom-right (bottom-left covered the sidebar's Settings item); dev only, absent from prod bundle.
  • 2026-11-27 — Shortcut engine: handler registration is what makes a shortcut live (a page's handler exists only while it is mounted); useShortcutScope(scope) declares the page scope for the ? overlay. Same combo bound twice → latest registration wins. Dialog mode detected from the DOM ([role=dialog][data-open], Base UI) so every dialog is covered without opting in; in dialog mode escape is left to the dialog. Focused menus/listboxes/comboboxes count as "typing" so arrow/letter keys stay with them.
  • 2026-11-27 — Registry adds two entries implied by the spec but missing from the §10 table: session.open-link (o, §9.10) and todos.link-problem (mod+l, §9.12). mod+k is allowInInput (palette reachable while typing; also stops the browser's own Ctrl+K).
  • 2026-11-27 — Every visible hint renders via ShortcutKbd id=… from the registry (top bar, sidebar tooltips, shortcuts page) so hints can't drift from bindings.
  • 2026-11-27 — features/shortcuts/registry.ts SHORTCUTS array is // prettier-ignore — one entry per line reads as a table.
  • 2026-11-27 — shared/tsconfig.json adds lib: DOM — URL (used by url-detect) is a web-standard global in both runtimes, and shared code runs in the browser; shared has no @types/node.
  • 2026-11-27 — Shared tests live in shared/test/*.test.ts (included in the shared typecheck) rather than next to the sources.
  • 2026-11-27 — PatternId / MistakeId / PlatformId are literal unions derived from the as const lists in shared/constants; zod schemas use z.enum on the derived tuples (one source of truth, typed lookups like PATTERNS[id]).
  • 2026-11-27 — Input schemas export two types: XInput (z.input, what the client sends — defaults optional) and XData (z.output, what the server gets after defaults/trim/dedupe). Entity/response schemas export one z.infer type.
  • 2026-11-27 — Query-string helpers in shared/schemas/common.ts (csv, queryInt, queryBool, queryDate, queryId) accept a,b and repeated keys; blank values = absent. The pattern filter accepts a pattern id or a category id (patternFilterSchema).
  • 2026-11-27 — Window math: 1y = 365 days inclusive of today; previousWindowRange() gives the equal-length range before it (for stat deltas); DEFAULT_WINDOW = "30d" (server default when window is omitted).
  • 2026-11-27 — Problem list default sort created desc (spec named no default) — newest logged on top, and unsolved problems (null first_solved_on) aren't buried.
  • 2026-11-27 — Spec additions recorded in IMPLEMENTATION.md §8: BoardCard.url (card "Open link", session o); create problem accepts revisionStatus (quick add "Add to revision"); Todo carries a problem ref (chip title); upsolve rows = ProblemListItem + contest {id,name,date}; rating points add platform, rank, ratingDelta (chart tooltip, §9.11); search results add difficultyLabel, rating (palette, §9.15).
  • 2026-11-27 — Validation limits: title ≤ 300, key insight ≤ 1000, tags 1–32 chars (lowercased, no commas) and ≤ 20 per problem, patterns ≤ 20, timeTakenMin 1–1440, contest rating 0–5000, problemsTotal 1–50. A practice problem can't carry contestId/contestResult (400 on create; on PATCH the server checks the merged state).
  • 2026-11-27 — attemptOutcomeIssue(type, outcome) in shared is the single outcome rule (revision → no outcome, solve/resolve → required); create refines with it, the server re-applies it to merged PATCHes.
  • 2026-11-27 — DB: no SQL CHECK constraints on enum columns (zod validates at the API boundary; keeps migrations simple). Timestamps default in the app ($defaultFn / $onUpdateFn), not in SQL — raw SQL inserts must set created_at/updated_at.
  • 2026-11-27 — Extra index solutions(problem_id, position) (not in §6) — every read is "solutions of a problem in order", and the FK cascade benefits.
  • 2026-11-27 — drizzle.config.ts does not import src/env.ts (drizzle-kit loads config as CJS: no import.meta, no JSON import attributes); it repeats the default ./data/cortex.db + CORTEX_DB_PATH.
  • 2026-11-27 — db/client.ts exports openDb(path) (pragmas + data-dir creation; ":memory:" for tests), Db, Tx, DbExecutor (services take DbExecutor so callers own the transaction). db/migrate.ts exports runMigrations(db) and runs itself only when executed directly (lib/is-main.ts). Server start = open → migrate → listen; how the db reaches routes/services is decided in 2.1.
  • 2026-11-27 — Initial migration generated with --name initial → server/drizzle/0000_initial.sql.
  • 2026-11-27 — recomputeProblemDerived(db, problemId) implemented in 1.3 in services/problems.ts (its spec'd home) because the seed needs it; 2.2 builds the rest of the service around it.
  • 2026-11-27 — Seed: data in server/src/db/seed-data/* (contests, practice-core, practice-advanced, todos, types/helpers); dates written as "days ago" relative to today; deterministic PRNG (mulberry32(42)) adds filler revisions (every day 59–71 days ago → 15-day longest streak; ~25% of older days; last 14 days hand-written → current streak 7). Attempt order is asserted (solve until solved, resolve after). --force wipes all tables before seeding (dev only); without it the seed refuses if any problem exists.
  • 2026-11-27 — zod added to server deps (same ^4.6.7 as shared) — the error handler needs ZodError.
  • 2026-11-27 — createApp({ db, logRequests }); each route file exports a factory xRouter(db) mounted at /api with full paths (nested routes like /problems/:id/solutions live with their resource). Services take the db/tx as first argument.
  • 2026-11-27 — validate({ params, query, body }) replaces req.params / req.body with the parsed values and redefines req.query on the request (Express 5 makes it a prototype getter); handler types are inferred from the schemas.
  • 2026-11-27 — Errors: ZodError → 400 VALIDATION_ERROR (details = zod issues, message = first issue as path: message (+n more)); body-parser errors → 400/413 BAD_REQUEST; unknown /api/* → 404; anything else → logged + 500 INTERNAL_ERROR. AppError + badRequest/notFound/conflict/found helpers in lib/errors.ts. Request log line in dev only, registered before the JSON parser so malformed bodies are logged too.
  • 2026-11-27 — Correlated subqueries reference the outer row via PROBLEM_ID / CONTEST_ID (sql.raw('"problems"."id"')): in a single-table select Drizzle renders ${problems.id} as a bare "id", which silently binds to the inner table. Raw exists(sql…) isn't parenthesised by Drizzle — write sql\exists (…)`` instead.
  • 2026-11-27 — Attempt history rule (extends §8): order = (date, id); solve only up to the first successful solve, resolve only after it; create/patch rejected only for new violations; future dates → 400; deletes never blocked. Recorded in IMPLEMENTATION.md §8.
  • 2026-11-27 — upsolved → back to upsolve_pending when no successful attempt remains; recomputeProblemDerived also runs after problem PATCH (a changed contest result may contradict the log). IMPLEMENTATION.md §7.1.
  • 2026-11-27 — Board: move with no neighbors into a non-empty column appends at the bottom (keyboard moves, "Move to…", session); same column + no neighbors = no-op; quick add "Add to revision" appends too; status: "none" sets position 0 and revisionStatusChangedAt null; stale neighbor → 409. Todos: no neighbors → top. IMPLEMENTATION.md §7.2.
  • 2026-11-27 — Problem list: rows with a null sort key (unsolved, unrated) go last in both directions, tiebreak by id in the same direction; title sorts case-insensitively; dateField=created compares date(created_at, 'localtime'); patterns/tags keep the order they were added (rowid). Multiple values in one filter = OR, different filters = AND.
  • 2026-11-27 — Stats functions take today as a parameter (routes pass todayLocal()) so tests pin the clock. source also filters streaks, board counts and upsolvePending. Heatmap year = full Jan 1–Dec 31 (future days count 0), heatmap is not source-filtered, years = only years with activity. Weak patterns: coded attempts only, zero-struggle patterns dropped. Breakdown zero/ordering rules in IMPLEMENTATION.md §7.3.
  • 2026-11-27 — Contest POST/PATCH return ContestDetail; todo POST/PATCH/move return Todo; deleting a contest leaves its problems' source/contestResult as they were (only the link is nulled), and such pending problems drop out of the upsolve queue.
  • 2026-11-27 — Server tests live in server/test/ (in the server typecheck); test/test-db.ts creates an in-memory DB with the real migrations.
  • 2026-11-27 — Query keys: every resource has an all prefix (["problems"], ["revision"], …) with lists/details below it; qk.todos.list(status) instead of qk.todos(status). Client filter types are derived from the shared zod output types (ProblemListFilters = Partial<Omit<ProblemListQuery, "limit"|"offset">>) — the z.input of the csv()/queryInt preprocess fields is unknown.
  • 2026-11-27 — invalidateAfter extends §9.17: problem change also invalidates contests + todos (they embed problem rows / titles); new kinds solution → problems, revision → problems, revision, stats.
  • 2026-11-27 — Mutation error toasts come from one MutationCache.onError (lib/query-client.ts); per-mutation meta.errorTitle gives the toast title, meta.errorToast: false opts out (inline form errors). Optimistic pattern = applyOptimistic(qc, patches) in onMutate → restoreSnapshot in onError → invalidateAfter in onSettled (lib/optimistic.ts).
  • 2026-11-27 — Problem list = useInfiniteQuery (offset pages of PROBLEM_PAGE_SIZE, keepPreviousData while filters change). Revision moves update the board via moveCardInBoard (client mirror of §7.2) and every cached copy of the problem (problemFieldPatches).
  • 2026-11-27 — Common Hint (tooltip wrapper) added for icon-only badges and DateText; PlatformBadge uses <abbr title>. Sidebar badges read stats/summary (boardCounts.to_revise, upsolvePending) and the active todos list; hidden when 0.
  • 2026-11-27 — Quick add: dates use the native <input type="date"> (max = today) — no calendar dependency needed. Outcome has no default (an unthinking default would inflate the honesty ratio); 1–4 pick it while focused, 1–3 pick difficulty. Enter never submits the form (it adds chips / picks combobox items); only mod+enter / mod+shift+enter / the Save button do. Rating quick chips are 800–2400 in steps of 200 and kept out of Tab order (arrow keys step the input by 100). A title guessed from a link is replaced by a later link's guess; a typed title never is.
  • 2026-11-27 — Pickers are Base UI comboboxes: GroupedMultiPicker (common) powers PatternPicker and MistakePicker (filter = every query word in group name, item name or id, so "dp" matches all DP patterns); TagInput is a creatable multi-combobox (normalised like the server's tagSchema); PlatformSelect / ContestSelect are single comboboxes. "New contest" inside quick add creates with name + date + current platform only.
  • 2026-11-27 — QuickAddContext (useOpenQuickAdd()) lets pages open the AppShell-owned quick-add dialog. useCreateProblem({ toastErrors: false }) for quick add, which shows a 409 duplicate inline ("Already logged — Open") and toasts anything else.
  • 2026-11-27 — shadcn components added in 3.2: combobox (+ input-group), popover, toggle-group (+ toggle), switch, textarea, select, context-menu.
  • 2026-11-27 — The §9.8 Log attempt dialog (features/attempts/log-attempt-dialog.tsx + log-attempt-form.tsx, incl. the board follow-up toast → Revising / → Confident / Keep) was built in 3.3, not 4.4 — the list's a shortcut and "Log attempt…" menu item need it. 4.4 reuses it and adds the timeline. Type defaults to Revision once solved; outcome has no default.
  • 2026-11-27 — Problems list: filters live in the URL (each key validated by problemListQuerySchema.shape, invalid values dropped); paging is not in the URL. Search is debounced 200 ms with replace history; other filter changes push. "Clear all" keeps sort/order. Defaults (sort=created, order=desc, dateField=solved) are omitted from the URL. Date presets write concrete from/to dates (same format the dashboard heatmap links will use). Selection is by id (survives refetch / load more); focus inside a row selects it so enter acts on the focused row. One shared context menu for the list (row found via data-problem-id).
  • 2026-11-27 — Base UI comboboxes clear their whole selection on Escape while the popup is closed; escapeKeepsSelection(open) (lib/combobox.ts) cancels that so Escape closes the surrounding dialog instead.
  • 2026-11-27 — Generated components/ui/slider.tsx thumb bg-white → bg-background (no non-token colors). shadcn components added in 3.3: slider, checkbox, alert-dialog. Common additions: ConfirmDialog (AlertDialog), SkeletonList.
  • 2026-11-28 — Problem page tab memory = sessionStorage["cortex-problem-tab"] (one value for all problems; "per session" in §9.6) via readSessionPref/writeSessionPref in lib/ui-prefs.ts.
  • 2026-11-28 — Problem page edits: title and key insight edit inline (Enter saves, Esc cancels, blur saves); patterns / tags / source edit inline in the meta panel with Save / Cancel; "Edit details…" (more menu) is a dialog for title, link, platform, external id, difficulty (a link's detected platform / id fill only empty or "other" fields; 409 shown inline). Pattern and tag chips link to the filtered problems list.
  • 2026-11-28 — Queries don't retry 4xx responses (404 / validation won't change on retry) — "Problem not found" shows immediately.
  • 2026-11-28 — REVISION_DOT, nextRevisionStatus, isRevisionStatus live in lib/revision-status.ts (shared by the badge and the header menu). shadcn tabs added.
  • 2026-11-28 — Markdown deps added in 4.2: @uiw/react-codemirror, @codemirror/{lang-markdown,language-data}, react-markdown, remark-gfm, remark-math, rehype-katex, shiki (all named in CLAUDE.md) plus @codemirror/{view,state,language}, @lezer/highlight (peers we import directly for the theme / commands) and katex (its CSS).
  • 2026-11-28 — Shiki: one lazy highlighter with the JavaScript regex engine (no oniguruma wasm download); both themes emitted as CSS variables (defaultColor: false) and picked per mode in index.css, so a theme switch never re-highlights. Unknown fence languages render as plain text.
  • 2026-11-28 — CodeMirror theme + highlight style use only CSS variables (tokens), no JS theme switching. Editor shortcuts inside CodeMirror go through registryKeymap() (features/shortcuts/codemirror-keymap.ts, Prec.highest, keys read from the registry) because CodeMirror's own Mod-/ would swallow the key before the global provider; outside the editor the same ids are bound with useShortcut.
  • 2026-11-28 — Notes: draft + autosave live at page level (useNotesController) so tab switches never reload a draft; saves are chained (in order) and a pending change is flushed on unmount. Unsaved-change guard = useBlocker that saves first and only asks ("Leave without saving") if the save fails, plus beforeunload while dirty. Notes open in Preview when they exist, Edit when empty; e switches to Edit (keeps Split) and focuses the editor.
  • 2026-11-28 — Key insight renders as markdown (math/code/links); clicking the text edits it, links still open, a hover pencil is the keyboard path.
  • 2026-11-28 — /problems/:id route is lazy (lazy() in the router) — the CodeMirror/markdown/KaTeX stack (~750 kB) only loads there. Rest of route splitting stays in 8.4.
  • 2026-11-28 — Solutions: reorder is optimistic on the problem detail cache (rolled back + toast on error) — a dropped tab snapping back until the server answers reads as broken; same class as board/todo reorder. Create/update/delete write the returned solution into the detail cache before the broad invalidation, so a new approach opens in edit mode instantly. @dnd-kit/{core,sortable,utilities} added (named in CLAUDE.md); the horizontal-axis modifier is a 1-line local Modifier instead of adding @dnd-kit/modifiers.
  • 2026-11-28 — Solution editing is explicit (Save / Discard, mod+s while open — its useShortcut registers after the notes one, so it wins); "Add approach" creates "Approach N" and opens it with the name selected. Switching approach with unsaved changes is refused with a toast. Complexities are stored as typed; formatComplexity() (shared, tested) shows bare values as O(…).
  • 2026-11-28 — Problem tab panels are keepMounted (editors keep drafts and undo history across tab switches); [ / ] are enabled only while the Solutions tab shows. One leave guard for the page (UnsavedChangesGuard, React Router allows a single blocker): pending notes are saved, an unsaved solution edit asks "Discard and leave".
  • 2026-11-28 — History edit reuses LogAttemptForm (attempt prop): editing may change the type to any of the three (the server's history rule decides); the board follow-up toast only follows a new attempt. Timeline newest first, mistakes as hard-tinted chips with the description on hover.
  • 2026-11-28 — HydrateFallback = ProblemDetailSkeleton on the lazy problem route (direct visit / reload).
  • 2026-11-28 — CheckList and FilterPopover moved from features/problems/list/ to components/common/ — the revision board filters reuse them.
  • 2026-11-28 — Board drag & drop: while dragging, a local copy of the board is rearranged live (the card joins another column as soon as the pointer crosses into it); on drop the final layout stays on screen until the optimistic cache update lands (no one-frame snap back), then useMoveRevision takes over (rollback + toast on error). Collision: the column under the pointer decides, then the closest card in it (gaps between cards never mean "end of column"); keyboard drags use closest corners.
  • 2026-11-28 — Board keyboard sensor picks up / drops with Space (Enter stays "open problem", §9.9). h/l jump to the nearest non-empty column at the same row; x selects the card that takes the removed one's place.
  • 2026-11-28 — Board "Remove" Undo moves the card back between its old neighbors; a neighbor that left the column meanwhile is dropped (no 409). Remove/delete toasts use mutateAsync so every action gets its own Undo (mutate-level callbacks only follow the latest call).
  • 2026-11-28 — Revision session: queue snapshot at load; ?start=<id> (board context menu "Start session with this") goes first, from any column; 1 logs a revision dated today directly (once per problem); 2 opens the log attempt dialog (Re-solve, or Solve if unsolved) with the board follow-up toast off (boardFollowUp={false}; new onLogged callback feeds the summary). Arrows only call the API when the column changes. Exit / Esc / summary return to the board with the same filters. Recorded in IMPLEMENTATION.md §9.9–9.10.
  • 2026-11-28 — /revision/session route is lazy (markdown stack for the revealed sections), SessionSkeleton as HydrateFallback.
  • 2026-11-28 — Todos: tab in the URL (?tab=done); / focuses "Add a todo…"; drag only by the handle (double-click edits, checkbox toggles); selection remembers its index so it stays at the same height when the selected todo leaves the list. mod+l turns the row's link area into an inline problem search (Base UI combobox over /api/problems?q=, empty query = newest problems; Esc / click away cancels).
  • 2026-11-28 — Todo delete Undo = useRestoreTodo: re-create (new id) → mark done again, or move between the old neighbors (a stale neighbor leaves it on top). Chosen over a delayed delete, which any refetch during the toast would visually undo. Recorded in IMPLEMENTATION.md §9.12.
  • 2026-11-28 — dnd axis modifiers live in lib/dnd-modifiers.ts (horizontal for solution tabs, vertical for todos); lib/use-debounced-value.ts added for the todo link search.
  • 2026-11-28 — Notes autosave generalized for the contest reflection: features/markdown/{use-markdown-autosave,use-markdown-notes,markdown-notes,save-status,notes-mode} take a save(value) function (problem notes and contest reflection both use them; the problem-only copies were removed). UnsavedChangesGuard moved to components/common (editsDirty optional) — still one per page (React Router allows a single blocker).
  • 2026-11-28 — Quick add prefill: useOpenQuickAdd() now takes an optional QuickAddPrefill (platform, source, contestId, contestResult, date); AppShell keeps it for "save & add another". Buttons wrap the opener (() => openQuickAdd()) so a click event is never taken as a prefill. Recorded in IMPLEMENTATION.md §9.11.
  • 2026-11-28 — Contests: new common ContestResultBadge (icon + text, easy / medium / primary tint; also replaces the plain chip in the problem header) and RatingDelta (arrow + sign + color). Contest form refuses future dates and nulls ratings when unrated; creating opens the new contest. No platform filter on the table in 6.1 — 6.2's platform tabs belong to the chart. /contests/:id is a lazy route (markdown stack for the reflection), ContestDetailSkeleton as HydrateFallback; the page declares only the editor shortcut scope (§10 has no contest shortcuts).
  • 2026-11-28 — Rating chart: one rating-history request for all platforms, split per platform on the client. Tabs show only when ≥ 2 platforms have rated contests (otherwise just the platform name). Default tab = platform with the most rated contests (ties → most recent); the choice is in the URL as ?platform= (omitted for the default, invalid values fall back). X axis is a true time scale (month-start ticks, day ticks for short histories), Y axis padded with round steps (rating-scale.ts). Line = brand gradient stroke (userSpaceOnUse, so a flat line still renders) over a soft chart-1 area; dots tinted by that contest's Δ (easy / hard / primary); summary shows current rating + last Δ and peak (highlight). Clicking a point opens the contest. No draw animation (Recharts animates path geometry, not transform/opacity); switching platform fades in. Recharts added by shadcn add chart (recharts 3.8.0); the chart is React.lazy inside the card so Recharts is its own chunk. The chart card is hidden when there are no contests at all (the page empty state covers it); with contests but none rated it shows its own empty state with "New contest". Recorded in IMPLEMENTATION.md §9.11.
  • 2026-11-28 — Contests table uses table-fixed with tighter fixed columns (long names truncate with the full name on hover) — at 1366px the auto layout pushed the Problems column into a horizontal scroll.
  • 2026-11-28 — Dashboard: window in localStorage["cortex-dashboard-window"] (spec), source toggle in the URL (?source=) rather than another stored pref (CLAUDE.md limits localStorage); heatmap mode/year are card state. Stats summary/heatmap/breakdown/mistakes queries use keepPreviousData — switching window/source dims the old numbers instead of flashing skeletons. Recorded in IMPLEMENTATION.md §9.13.
  • 2026-11-28 — Dashboard bar charts are plain CSS bar lists / columns (features/stats/dashboard/bar-list.tsx, rating columns in difficulty-card.tsx), not Recharts — single-hue bars need no chart library, and the dashboard stays out of the 340 kB Recharts chunk. Bar hue by meaning: primary (counts), hard (mistakes), medium (struggle rate).
  • 2026-11-28 — Stat deltas: up = easy, down = hard, 0 = muted, always with arrow + sign; tooltip shows the previous window's value and dates. Honesty delta is in percentage points. Extra card subtitles from data already in the summary: avg solve time + newly logged (Solved), To Revise count (Revisions), "of N days" (Active days).
  • 2026-11-28 — Heatmap lives in features/stats/heatmap/ (layout helper, SVG grid, text, tooltip, year select, card) instead of the single features/stats/heatmap.tsx the spec named. One portalled, fixed-position tooltip for all cells (a Base UI tooltip per cell would mount ~365 popups). Month label on the first column whose top day is in the month; a first label closer than 3 columns to the next is dropped (GitHub). Year view renders future days dimmed and not clickable. Narrow screens scroll the grid, starting at the newest weeks.
  • 2026-11-28 — SidebarInset gets min-w-0: as a flex item it grew to its content's min width, so a wide child (the heatmap) pushed the whole page into a horizontal scroll at 1024px.
  • 2026-11-28 — FTS table comes from a drizzle-kit custom migration (drizzle-kit generate --custom --name problems_fts → 0001_problems_fts.sql); drizzle's schema can't express FTS5 virtual tables, and the migration journal stays the single path for schema changes. The migration only creates the table; the startup ensureSearchIndex (count mismatch → rebuild) fills it, so the indexing SQL lives in one place (services/search.ts). Seed rebuilds the index at the end of its transaction.
  • 2026-11-28 — Search query building: words = Unicode letter/digit runs, each sent as "word"* (implicit AND) — user-typed ", *, OR, NEAR, - can't break the FTS syntax; no words → no results (search) / title-only (list).
  • 2026-11-28 — Problems list q ≥ 2 chars = FTS or the old title substring match (superset — mid-word text like "sum" in "TwoSum" still matches); list keeps the chosen sort (no relevance sort in the list; ranking is for the palette).
  • 2026-11-28 — snippet is taken from key insight → notes → solutions only (first column with a hit), "" for title-only hits — the palette shows the title anyway, a duplicated title line is noise. Hits wrapped in \u0002 / \u0003 (SNIPPET_MARK_* in shared), markdown flattened to one line on the server (cleanSnippet).
  • 2026-11-28 — Command palette: cmdk added via shadcn add command; the CLI's overwrite prompts for dialog.tsx / input-group.tsx were declined (ours are customised), so components/ui/command.tsx was written from the registry source with: sr-only title/description moved inside the popup (Base UI labels the dialog from there), data-[selected=true]: instead of data-selected: (cmdk renders data-selected="false", which matches [data-selected]), and bg-accent for the selected row like our combobox/menus (muted ≈ popover in dark).
  • 2026-11-28 — Palette: shouldFilter={false} (problems are server-ranked); pages/actions match when every typed word starts a word of the label or a keyword. vimBindings={false} — cmdk's ctrl+k ("previous item") calls preventDefault, which hid mod+k from our provider; mod+k now toggles the palette. Selection is controlled and snaps to the first row whenever the row list changes (results arrive after the 150 ms debounce). The body mounts only while open, so query/selection/recent start fresh each time.
  • 2026-11-28 — Palette actions that open a dialog or focus an input run in onOpenChangeComplete(false) (after the close), so the palette's focus restore can't steal focus. "New contest" renders its own ContestDialog (same behaviour as the contests page: toast + open the contest). "Add todo" navigates to /todos with router state FOCUS_TODO_INPUT (features/todos/focus-request.ts). "Toggle theme" is labelled "Switch to light/dark theme" (flips the resolved theme). "Export backup" is a placeholder toast until 8.3 adds /api/export/json.
  • 2026-11-28 — Recent problems: localStorage["cortex-recent-problems"] (spec: localStorage), max 5, validated on read with searchResultSchema.omit({ snippet }) (no direct zod dependency in the client); written by the problem page on view/rename, removed by useDeleteProblem. qk.search became { all, query(q) }; problem and solution changes now invalidate ["search"] (§9.17 updated).
  • 2026-11-28 — Startup backup runs before migrations (a bad migration can be undone from today's copy). Backups live in backups/ next to the DB file (default server/data/backups); env.backupsDir / env.exportsDir, overridable through createApp({ dirs }). Uses better-sqlite3's online backup() via Drizzle's db. (the Db type now includes ``).
  • 2026-11-28 — Pre-import backups: cortex-pre-import-YYYYMMDD-HHmmss.db, same-second copies get -2, -3… (found while testing: a second import in the same second overwrote the only copy of the original data). Daily and pre-import files are pruned separately to the newest 14 each, by name in code-unit order (localeCompare can ignore -); other files in the folder are never touched.
  • 2026-11-28 — Import: one transaction (clearAllData → insert parents before children in chunks of 200 rows → rebuildSearchIndex); ids, timestamps and derived fields kept as in the dump; any SQLite constraint error in the cause chain → 400 "Backup data is inconsistent (nothing was changed)". /api/import/json gets its own 200 MB JSON parser registered before the general 5 MB one (body-parser skips an already-parsed body).
  • 2026-11-28 — clearAll moved from the seed to services/backup-json.ts (clearAllData); the seed's inserts became an exported insertSeedData(tx) (copies the seed lists so it can run more than once) and main() now runs only via isMainModule — importing the module used to seed the real DB.
  • 2026-11-28 — Tests extended to backups (server/test/backup.test.ts, on the full seed): export covers every table and passes backupSchema, export → import into an empty DB is identical, import replaces rather than merges, broken references roll back, daily backup once + prune to 14, same-second pre-import copies, Markdown file layout. Data-loss bugs here would be silent, which is the bar in CLAUDE.md §7.
  • 2026-11-28 — Markdown export: frontmatter values JSON-quoted (valid YAML, no YAML dependency), platform / patterns / mistakes as display names, <id>-<slug>.md (slug ≤ 60 chars, "problem" if empty), history as a table (pipes escaped, one line per cell). Same-minute exports get -2.
  • 2026-11-28 — Settings (§9.16): new GET /api/backups (spec §8 named no endpoint for the backups list). JSON download is fetched and saved via a blob link (server errors → toast instead of a broken download); import validates the file with backupSchema in the browser before the confirm dialog, then invalidates every query and clears Recent problems. Page is max-w-3xl cards: Appearance, Your data, Automatic backups, About (paths have a copy button). ComingSoon removed (no users left).
  • 2026-11-28 — Heatmap footer no longer has a "Log a problem" button when there is no activity (user request: "New problem" in the top bar already does it). The cyan outline on the last cell is the today marker (§9.13.2), shown whether or not today has activity.
  • 2026-11-28 — Heatmap today ring is drawn inside its cell (inset by half the 1.5px stroke) instead of 1px outside: the SVG is sized exactly to the grid, and today is always in the last column (often the bottom row), so the outer ring was clipped and looked like it overflowed.
  • 2026-11-28 — Every page is a lazy route (app/route-imports.ts holds one import() per page, shared by the router and an idle-time prefetch of all page chunks after the first render). One HydrateFallback: () => null on the pathless layer inside the shell, so a reload keeps the sidebar/top bar and the page brings its own loading state; the problem/contest detail and session routes keep their page-shaped skeletons. Without a fallback on that layer React Router would render only the root's (empty) fallback, i.e. no shell.
  • 2026-11-28 — Dev-only bits removed: the /_ui token preview page and React Query devtools (dependency removed). The app is used day-to-day through pnpm dev, so the devtools button was visible every day and sat on top of the toasts.
  • 2026-11-28 — Reduced motion: one global @media (prefers-reduced-motion: reduce) rule in index.css (animations/transitions → 0.01ms, !important so it also beats dnd-kit's inline sortable transitions and the shadcn popup animations). Spinners (.animate-spin) are exempt — a frozen spinner reads as "stuck"; the palette's spinner now matches the others.
  • 2026-11-28 — 1024px layout: two-column page layouts (problem page main + meta panel, contests table + upsolve queue) and the problems list's Patterns column start at xl (1280px) instead of lg. At 1024px with the sidebar open the content area is ~690px: the problem page's main column was ~357px and the contests table (448px of fixed columns) ~325px; the Patterns column (minmax(0,17rem) fills before the 1fr title) left titles ~30px. Container queries were considered and rejected: container-type makes the container the containing block for position: fixed descendants, which would misplace dnd-kit's DragOverlay.
  • 2026-11-28 — Re-renders on keyboard selection: ProblemRow is memoized with stable callbacks (they read the latest actions through a ref), and the revision board's BoardCardBody is memoized (the sortable wrapper re-renders anyway via useSortable). Todo rows left as-is (short lists, light rows).
  • 2026-11-28 — Key-hint legends unified in features/shortcuts/key-hints.tsx (KeyHints), used by the board, todos and — new — the problems list footer (j k select, enter open, s star, r to revise, a log). The revision session shows a "Reveal all ⇧Space" button in the next hidden section's header (the shortcut had no visible hint). Row-title links (problems list, contests table, contest problems, upsolve queue) show the ring focus ring instead of an underline only.
  • 2026-11-28 — Rating chart removed (user decision). Ratings are typed in by hand after every contest (Codeforces runs several rated rounds a week, CodeChef / LeetCode weekly), so the chart is only right if every rated contest is logged — and each platform already shows the real graph. Removed: features/contests/rating/, GET /api/contests/rating-history (+ service, shared ratingHistoryQuerySchema / RatingPoint, hook, query key), shadcn components/ui/chart.tsx and the recharts dependency (nothing else used them). Contests keep rank, rated flag, rating before/after and Δ in the table, form and detail page — DB columns untouched (no destructive migration). Contests page description now "Ranks, what you solved in contest, and your upsolve queue."
  • 2026-11-28 — Dashboard Platforms card redesigned (user found the old bars confusing: each bar was scaled to the largest platform, so 1 and 1 both looked "full"). Now: "N problems solved in the last 30 days" caption, one split bar (segments sized by count, 2px gaps, tooltip per segment) and a legend with count + share. Colors follow the platform, never its rank: new --series-1..4 tokens (indigo, cyan, rose, amber) for LeetCode, Codeforces, CodeChef, AtCoder; every other platform folds into one neutral "Other (names…)" slice. The four were checked with the dataviz palette validator against the card surface in both themes, all pairs (a slice can sit next to any other when platforms in between are missing): all pass. Five hues (with green) failed all-pairs, hence four + Other. Separate tokens because --chart-* also colour syntax in the editor theme.
  • 2026-11-28 — Contest rating fields removed from the app (user decision, follows the chart removal): no rating before / after inputs in the contest dialog, no Rating column in the contests table, no Rating / Change stats on the contest page (stat row is now Rank — with "Unrated contest" note — · Solved in contest · Upsolved X / leftover). Rank and the Rated flag stay. Shared create/patch input schemas no longer accept ratings (zod strips them), the derived ratingDelta is gone from list/detail responses, RatingDelta component deleted, seed no longer writes ratings. The rating_before / rating_after columns stay in the DB and in contestSchema so existing data and backups round-trip — no destructive migration.
  • 2026-11-28 — One solid accent instead of the brand gradient (user decision, option A). The indigo → violet gradient read muddy on the selected "30d" pill (next to the solid indigo "New problem" button — two competing primaries), was invisible as a gradient on 2–3px bars, and its ~30° hue jump greyed out in the middle. Now: logo + favicon use a tonal indigo gradient (--brand-from/to = #7A6FF2 → #4A3ECF light, #8B80F8 → #5A4BE6 dark; white glyph ≥ 3.2:1); active nav bar, selected-row bars (problems, board, todos), key-insight edge and session progress are solid bg-primary; the dashboard window pills use the same neutral selected chip as the source toggle (shared SEGMENT_ITEM_CLASS), so filled indigo means "action". Unused text-brand utility removed. CLAUDE.md styling rule and IMPLEMENTATION §4.2 / §9.2 / §9.6 updated.
  • 2026-11-28 — Restore button for automatic backups (user request). POST /api/backups/:name/restore (services/backup-restore.ts): name must match the daily / pre-import patterns (isBackupFileName, which also keeps the request inside the folder) → the file is copied to a temp dir, migrated (a daily backup is taken before that start's migrations, so it can be one schema behind), exported with exportBackup and written with importBackup. Reusing the import path gives restore the same safety copy, single transaction, constraint → 400 handling and search rebuild, and makes every restore undoable by restoring the safety copy it took. Settings rows: "safety copy" tag (was "before import") + Restore button + ConfirmDialog. Tests: restore round-trip and name rejection (server/test/backup.test.ts).
  • 2026-11-28 — Todos page alignment (user report: page looked shifted right). Removed the centred max-w-3xl column so it starts where every other page starts (full content width, like Contests / Revision). Rows: drag handle moved into the left gutter (absolute, hover-only) instead of reserving a 24px slot; px-3 puts the checkbox under the input's "+" icon and the text under the input text.
  • 2026-11-28 — Sidebar count badges explain themselves (user: bare numbers were confusing, info should stay visible). Pills now read "5 to revise" / "3 to upsolve" / "3 to do" (tinted bg-primary/10 text-primary, hidden at 0); the same text is in the link for screen readers; collapsed to icons → a notification-style number badge on the icon (see next entry) and the text in the tooltip. Sidebar 16rem → 15rem (set via --sidebar-width on SidebarProvider, no edit to the generated ui/sidebar.tsx); labels + pills still fit, collapse to icons stays on mod+b. Dashboard greeting removed — the header is a plain "Dashboard" title over today's date, like the other pages.
  • 2026-11-28 — Collapsed sidebar shows the count as a notification badge (user request) instead of a dot: filled bg-primary circle with the number (99+ cap), top-right of the icon, ring-sidebar to separate it from the icon. An exception to "filled indigo = action": an unread-style count is the convention people read instantly.
  • 2026-11-28 — Top bar title only after scrolling (user: "Dashboard" showed twice, option A). Page headings register through usePageHeading(title) (lib/page-heading.ts, a tiny external store read by the top bar with useSyncExternalStore, so scrolling re-renders only the top bar); an IntersectionObserver (top inset = 56px top bar) flags when the heading is above the bar and the title + separator fade in (opacity, 200ms; reduced-motion rule applies). Registered: PageHeader (now title: string + optional titleAside, used for the Problems count), dashboard header, problem header (on a wrapper — the title swaps to an input while renaming), contest header. Detail pages now show the real name instead of "Problem"/"Contest". Route handle titles and app/route-handle.ts removed (only the top bar used them); pages without a heading (Not found, errors) show no top-bar title — no "Problem" flash while a detail page loads.
  • 2026-11-28 — No top bar title at all (user decision, replaces the scroll-to-reveal title above). The top bar is now sidebar toggle · search · New problem · theme; each page's big heading is its only title and the active sidebar item shows the section. lib/page-heading.ts and the heading registration in the headers were removed again; PageHeader keeps title: string + titleAside (Problems count).
  • 2026-11-28 — Problems header (user decision, option B): the bare count next to the title moved into the description as text — "N problems · searchable by title, notes and solutions." / with filters "X of N problems match these filters." (the unfiltered total comes from useProblemList({}), the same cached query the page uses without filters). The page-level New problem button was removed (duplicate of the top bar's; the empty state keeps its own). PageHeader's titleAside prop removed again (no users).
  • 2026-11-29 — API is loopback-only, cors removed (server audit). app.listen(port, "127.0.0.1") — before, Node listened on every interface, so anyone on the same network could export or replace the data. Vite proxy target is now http://127.0.0.1:3001 (localhost may resolve to ::1, where nothing listens). A Host check in app.ts answers 400 unless req.hostname is localhost, 127.0.0.1 or [::1] (blocks DNS rebinding; the proxy keeps Host: localhost:5173). cors + @types/cors and env.clientOrigin removed: the client is same-origin through the proxy, and without CORS headers browsers refuse cross-origin reads and preflighted writes, which is stricter than the old allow-list. IMPLEMENTATION §3 updated.

Session log

Newest at the bottom. Each entry: date · steps · summary · files · how to verify in the UI · notes.

  • 2026-11-27 · planning · Product spec, rules and plan written (CLAUDE.md, IMPLEMENTATION.md, PROGRESS.md). User has scaffolded client (Vite React TS, Tailwind v4, shadcn Base UI/Nova, react-router-dom), server (Express + TS, cors, zod) and shared (pnpm init). TanStack Query not yet installed. · Verify: n/a.

  • 2026-11-27 · 0.1 · Workspace wired: root package.json (scripts per spec §3, packageManager pnpm@12.23.0, prettier), root pnpm-workspace.yaml, packages renamed @cortex/*, shared set up as TS-source package (zod, date-fns, APP_NAME test constant), client & server depend on @cortex/shared, tsconfig.base.json, client tsconfig made strict, server tsconfig fixed (ESNext/Bundler, no rootDir/emit), one root .gitignore, .prettierrc/.prettierignore. Removed per-package lockfiles, server/pnpm-workspace.yaml, client/.gitignore, Vite template README/assets/App. · Files: package.json, pnpm-workspace.yaml, tsconfig.base.json, .gitignore, .prettierrc, .prettierignore, client/{package.json,tsconfig.app.json,tsconfig.node.json,eslint.config.js,src/App.tsx,src/main.tsx}, server/{package.json,tsconfig.json,src/index.ts}, shared/{package.json,tsconfig.json,src/index.ts} · Verify: pnpm install && pnpm typecheck && pnpm lint && pnpm build all pass; pnpm --filter @cortex/client dev shows "Cortex" centered. · Notes: folder is not a git repo yet — run git init.

  • 2026-11-27 · 0.2 · Dev loop: client deps (TanStack Query + devtools, date-fns), server deps (drizzle-orm, better-sqlite3 13 — native binding loads, FTS5 available, drizzle-kit, vitest, @types/*). Server: env.ts (PORT 3001, CORTEX_DB_PATH, version from package.json), tiny lib/logger.ts, app.ts (cors → 5173, json 5mb), routes/health.ts, index.ts. Client: Vite proxy /api → 3001 (strictPort 5173), lib/api.ts, lib/query-keys.ts, app/providers.tsx (QueryClient staleTime 30s / retry 1 + devtools), temporary health line in App.tsx. · Verify: pnpm dev, open http://localhost:5173 → under "Cortex" it shows "API ok · v0.1.0 · …\server\data\cortex.db"; curl localhost:5173/api/health returns JSON. · Notes: better-sqlite3 needed no approve-builds (allowed in pnpm-workspace.yaml).

  • 2026-11-27 · 0.3 · Theme: Midnight Indigo tokens (light + dark) incl. sidebar, brand, highlight, easy/medium/hard, GitHub heat ramp, charts, all mapped via @theme inline; bg-brand / text-brand utilities; .markdown placeholder; Geist + Geist Mono; ThemeProvider (light/dark/system, localStorage["cortex-theme"], live system follow, no transition flicker on switch); pre-paint script in index.html; ThemeToggle (sun/moon/monitor menu); LogoMark + new favicon; dev-only /_ui preview; shadcn components added: badge, card, input, label, dropdown-menu, sidebar (+ sheet), dialog, tooltip, skeleton, separator. · Files: client/index.html, client/public/favicon.svg, client/src/{index.css,lib/theme.tsx,lib/use-theme.ts,features/settings/theme-toggle.tsx,components/common/logo-mark.tsx,pages/ui-preview.tsx,app/router.tsx,app/providers.tsx,main.tsx,hooks/use-mobile.ts,components/ui/*} · Verify: pnpm dev → http://localhost:5173/_ui; switch Light/Dark/System from the top-right menu; reload in Dark — no white flash; badges, heat swatches, card and inputs look right in both modes.

  • 2026-11-27 · 0.4 · App shell: createBrowserRouter with all §9.1 routes (placeholder pages via PageHeader + EmptyState), AppShell (collapsible icon sidebar, persisted), AppSidebar (logo + tagline, nav, gradient active bar, Settings pinned bottom, rail, tooltips when collapsed), Topbar (sidebar trigger, page title, search button with Ctrl K hint, New problem primary button with N hint → placeholder QuickAddDialog, theme toggle), providers (Theme, Query, Tooltip, Toaster bottom-right), route error boundaries, 404 page. Common components: PageHeader, EmptyState, ErrorState, Kbd, LogoMark, ComingSoon. Settings shows a real About card (version + DB path from /api/health, skeleton + error/retry). Shadcn sonner, kbd added. Removed App.tsx. · Files: client/src/app/{router.tsx,providers.tsx,route-handle.ts,route-error.tsx,layout/*}, client/src/pages/*, client/src/components/common/*, client/src/lib/{keys.ts,ui-prefs.ts}, client/src/features/problems/quick-add-dialog.tsx, client/src/components/ui/{sidebar,sonner,kbd}.tsx · Verify: pnpm dev → click through every sidebar item (active item gets the indigo→violet bar), collapse with the top-left button and reload (stays collapsed), hover icons when collapsed (tooltips), New problem opens a dialog, /nope shows the 404, /revision → Start session opens focus mode without sidebar; check Light and Dark at ~1280px and ~1024px wide. · Notes: verified by build + route checks only (no browser automation this session) — visual pass is on you.

  • 2026-11-27 · 0.5 · Shortcuts: features/shortcuts/ — registry.ts (all 64 §10 entries, typed ShortcutId, scopes + labels), match.ts (event → combo, typing/modal detection), shortcut-context.ts (useShortcut, useShortcutScope), shortcut-provider.tsx (single keydown listener, g x sequences with 1s timeout, input-ignoring, dialog mode), shortcut-kbd.tsx, search.ts, shortcut-list.tsx, shortcuts-overlay.tsx (?). Wired now: mod+k (placeholder toast), n (quick add), mod+b (sidebar), ?, g d/p/r/c/t/k/s, / on the shortcuts page, escape exits revision focus mode. /shortcuts page with instant search. Pages declare their scopes. Ran Prettier over the workspace (code only; *.md ignored). · Files: client/src/features/shortcuts/*, client/src/app/layout/{global-shortcuts.tsx,nav-items.ts,app-sidebar.tsx,topbar.tsx,app-shell.tsx}, client/src/app/providers.tsx, client/src/pages/* · Verify: pnpm dev → press g then p (Problems), g k (Shortcuts), ? (overlay with Global + Navigation + page shortcuts; on /problems it also lists Problems list), Ctrl+B (sidebar collapses/expands), n (dialog opens; n/g p do nothing while it's open), click into the shortcuts search and type g (no navigation), type revision (list filters instantly), / focuses the search, collapsed-sidebar tooltips show G then D, on /revision/session press Esc → back to board. · Notes: key normalisation checked with a scratch script (12/12 cases); no browser automation this session.

  • 2026-11-27 · 1.1 · Shared domain: constants/ (platforms, 124 patterns in 18 categories, 24 mistakes in 6 groups, enums + labels, rating buckets, windows, heatmap levels), utils/ (dates: todayLocal, toLocalDate, isValidDateStr, parseDateStr, addDays, daysBetween, windowRange, previousWindowRange, eachDate, localDateOfIso; format: formatRelative, difficultyText; url-detect: detectFromUrl, titleFromSlug), schemas/ (common helpers, errors, attempt, solution, problem, revision, contest, todo, stats, search, backup — entities + every §8 input/output). Vitest in shared: 44 tests (each platform URL, garbage input, window/addDays across month/year/leap boundaries, formatRelative, heat levels, rating buckets). · Files: shared/src/{constants,utils,schemas}/*, shared/src/index.ts, shared/test/*, shared/{package.json,tsconfig.json} · Verify: pnpm test → 44 passed. No UI change yet.

  • 2026-11-27 · 1.2 · Database: db/schema.ts (all §6 tables, FKs, indexes, typed enum columns), db/client.ts (WAL + foreign keys, creates data dir), db/migrate.ts (programmatic migrator, also pnpm db:migrate), db/reset.ts (deletes db + WAL/SHM, re-migrates; friendly error if the file is locked), drizzle.config.ts, migration drizzle/0000_initial.sql; server start now migrates before listening. Scripts db:generate|migrate|studio|reset wired. · Files: server/{drizzle.config.ts,drizzle/*,package.json}, server/src/{db/client.ts,db/schema.ts,db/migrate.ts,db/reset.ts,lib/is-main.ts,env.ts,index.ts} · Verify: pnpm dev → server/data/cortex.db appears; pnpm db:studio → open https://local.drizzle.studio and see 8 tables (+ __drizzle_migrations). Checked on a scratch DB: migrate is idempotent, reset works on Windows.

  • 2026-11-27 · 1.3 · Seed: 32 problems (20 LeetCode with labels, 7 Codeforces + 2 CodeChef with ratings, 2 AtCoder, 1 CSES), 33 solutions with C++ and complexities, 103 attempts over the last 150 days (all outcomes, revisions, re-solves, 30 mistake tags), 4 contests (3 Codeforces + 1 CodeChef; CF rating 1384 → 1452 → 1531 → 1487), 9 contest problems (5 in contest, 1 upsolved, 3 pending), board 5 / 3 / 4, 6 todos (2 linked, 2 done). Derived fields come from recomputeProblemDerived. · Files: server/src/db/{seed.ts,seed-data/*}, server/src/services/problems.ts, server/package.json · Verify: stop pnpm dev, run pnpm db:reset && pnpm db:seed, then pnpm db:studio: in problems, first_solved_on / last_activity_on are filled, "Arranging The Sheep" shows upsolved, "Implement Trie" has no dates. Running pnpm db:seed again refuses. Checked by SQL on a scratch DB: 0 derived-field mismatches, 0 invalid attempt rows, current streak 7, longest 15. · Notes: the real server/data/cortex.db is still empty (only created by a server start); seeding it is up to you.

  • 2026-11-27 · 2.1 · Server structure: lib/errors.ts (AppError + helpers), middleware/validate.ts, middleware/error.ts (error handler + /api 404), middleware/request-log.ts, createApp({ db, logRequests }), index.ts passes the db. Added zod to server. · Verify: pnpm dev, open http://localhost:5173/api/nope → {"error":{"code":"NOT_FOUND",…}}; http://localhost:5173/api/problems/abc → 400 VALIDATION_ERROR with zod issues. Checked by script: malformed JSON → 400, sync and async throws → 500 JSON.

  • 2026-11-27 · 2.2 · Problems API: list (all §8 filters, sort, paging, firstOutcome, counts), detail, create (patterns, tags, revision status, initial attempt — one transaction), patch (arrays replace, merged practice/contest check, URL clash excluding self), delete, check-url, /api/tags. · Files: services/{problems,filters}.ts, routes/problems.ts · Verify (after pnpm db:seed): http://localhost:5173/api/problems?pattern=dp (category), ?ratingMin=1200&ratingMax=1500&sort=rating&order=asc, ?dateField=activity&from=<3 days ago>, ?outcome=unsolved, http://localhost:5173/api/tags. Curl-checked on a seeded scratch DB incl. duplicate URL → 409 { details: { id } }.

  • 2026-11-27 · 2.3 · Solutions & attempts: create (appended), patch, delete (repack 0..n-1), reorder (must list every id once); attempts create/patch/delete with outcome rule, history-order rule, no future dates, derived recompute, contest upsolved ⇄ pending. · Files: services/{solutions,attempts}.ts, routes/{solutions,attempts}.ts · Verify: curl -X POST localhost:3001/api/problems/<id>/attempts -H content-type:application/json -d '{"type":"solve","outcome":"solved_alone","date":"<today>"}' on a solved problem → 400 "Already solved on … — log a re-solve instead"; on a pending contest problem → contestResult becomes upsolved, deleting that attempt puts it back. Curl-checked all of these on a scratch DB.

  • 2026-11-27 · 2.4 · Revision board + move (fractional positions, renormalize, stale-neighbor 409), contests CRUD + counts + ratingDelta + upsolve queue + rating history, todos CRUD + move. lib/positions.ts + 5 tests (server/test/positions.test.ts, incl. 60 moves into the same gap on a real in-memory DB). · Files: lib/positions.ts, services/{revision,contests,todos}.ts, routes/{revision,contests,todos}.ts, server/test/*, server/tsconfig.json · Verify: http://localhost:5173/api/revision/board, /api/contests, /api/contests/upsolve, /api/contests/rating-history?platform=codeforces, /api/todos?status=all; pnpm test → server 5 positions tests pass.

  • 2026-11-27 · 2.5 · Stats: summary (window + previous window, streaks, honesty, avg solve time, board counts, upsolve pending), heatmap (365 days or a year, all/solves), breakdown, top mistakes (top 5 + other), weak patterns, recent attempts. 15 tests in server/test/stats.test.ts (window boundaries, previous window, counts, 4 streak cases, honesty + avg time, source filter, heatmap span/levels/modes, breakdown, mistakes, weak patterns). · Files: services/stats.ts, routes/stats.ts, server/test/stats.test.ts · Verify: pnpm test → 44 shared + 20 server pass; after pnpm db:seed, http://localhost:5173/api/stats/summary?window=all shows current streak 7, longest 15; /api/stats/heatmap has 365 days. · Notes: the real server/data/cortex.db is still empty — run pnpm db:seed (with pnpm dev stopped) to explore the API with sample data.

  • 2026-11-27 · 3.1 · Client data layer: lib/query-keys.ts (all resources), lib/query-string.ts, lib/invalidate.ts (invalidateAfter), lib/optimistic.ts, lib/query-client.ts (mutation error toasts), errorMessage() in api.ts; hooks for problems (list/detail/check-url/tags + create/update/delete/optimistic star), solutions, attempts, revision (board + optimistic move), contests, todos (optimistic toggle + reorder), stats. Badges: PlatformBadge, DifficultyBadge, PatternChip, OutcomeBadge, RevisionStatusBadge, DateText, Hint. Temporary list on /problems; sidebar count badges. · Files: client/src/lib/*, client/src/features/{problems,solutions,attempts,revision,contests,todos,stats}/**, client/src/components/common/*, client/src/app/{providers.tsx,layout/app-sidebar.tsx,layout/use-nav-counts.ts}, client/src/pages/problems.tsx · Verify: seed the DB (pnpm db:seed with pnpm dev stopped), pnpm dev → /problems lists the 32 seed problems with platform, difficulty (LC labels colored, CF ratings tinted), first pattern, outcome icon and solved date — hover the icon/date/dot for tooltips; the sidebar shows counts next to Revision (5), Contests (3) and Todos (4). Checked in both themes is on you (no browser automation).

  • 2026-11-27 · 3.2 · Quick add dialog (§9.4): link with URL detection on paste/blur (platform, external id, title guess) + live duplicate check, searchable platform, title, difficulty (segmented labels or rating + quick picks, per platform kind), patterns, tags (autocomplete from /api/tags), source with contest select / inline "New contest" / result, "I solved it" (outcome, date, time, mistakes, note) with "Just save to list" switch, "Add to revision". Validation with the shared schema, inline errors, focus on first error; mod+enter save, mod+shift+enter save & fresh form; success toast with Open. New common SegmentedControl, GroupedMultiPicker, FormField. · Files: client/src/features/problems/{quick-add-dialog.tsx,quick-add/*,pattern-picker.tsx,tag-input.tsx,platform-select.tsx,difficulty-input.tsx,hooks/use-problem-mutations.ts}, client/src/features/attempts/mistake-picker.tsx, client/src/features/contests/{contest-select,contest-quick-create}.tsx, client/src/components/common/{segmented-control,grouped-multi-picker,form-field}.tsx, client/src/components/ui/* (new shadcn), client/src/app/layout/app-shell.tsx · Verify: pnpm dev, press N, paste https://leetcode.com/problems/longest-repeating-character-replacement/ → platform LeetCode + title filled; Tab to Difficulty, press 2; Tab to Patterns, type sliding var, Enter, with count, Enter; Tab past Tags/Source; outcome 2 (Hint); type a time; Ctrl+Enter → toast "Logged …" and the row appears on /problems. Paste the same link again → "Already logged — Open". Switch platform to Codeforces → rating input + chips. Source → Contest shows the contest picker and "New contest". · Notes: parse/validation + create/duplicate flow checked by script against a seeded scratch DB; the interactive keyboard flow needs your eyes (no browser automation).

  • 2026-11-27 · 3.3 · Problems list page (§9.5): header with count + New problem (via useOpenQuickAdd), search (/, debounced, Esc clears), filter popovers (Platform, Difficulty labels + rating range slider, Patterns, Tags, Revision, Source, Outcome, Date field + presets + custom range, Starred), removable chips + Clear all, sort menu, dense rows (star, title, platform, difficulty, 2 patterns +N, first outcome, solutions, solved date, revision dot), keyboard j/k/enter/o/r/s/a, right-click menu (Open, Open link, board moves, Log attempt…, Star, Copy link, Delete… with ConfirmDialog), Load more, skeleton / empty / filtered-empty / error states. Log attempt dialog (§9.8) with board follow-up toast. · Files: client/src/pages/problems.tsx, client/src/features/problems/list/*, client/src/features/attempts/{log-attempt-dialog,log-attempt-form,board-follow-up-toast,show-board-follow-up}.tsx, client/src/components/common/{confirm-dialog,skeleton-list}.tsx, client/src/lib/combobox.ts, client/src/components/ui/{slider,checkbox,alert-dialog}.tsx · Verify: pnpm dev → /problems: press j twice, s (star fills), r (dot turns amber, toast), a → log a Re-solve → follow-up toast → "→ Confident"; right-click a row for the menu; Delete… asks first; apply Platform + Difficulty rating + Date "30 days", reload → filters and chips stay; back button undoes the last filter; ?q=zzz shows "No problems match" with Clear filters. · Notes: drove the real UI with headless Chrome over the DevTools protocol (scratch DB, no new deps): quick add keyboard-only flow saved a LeetCode problem with 2 patterns + 2 tags + outcome in ~10 s, duplicate warning, context menu, delete, enter, follow-up toast, both themes — no console errors. This caught the Escape-clears-combobox bug (fixed). "Load more" not exercised (seed has < 50 problems).

  • 2026-11-28 · 4.1 · Problem page layout (§9.6): back link, inline-editable title, platform / difficulty / contest-result badges, star (s), Open link (o), revision dropdown (r cycles none → To Revise → Revising → Confident, optimistic), more menu (Edit details…, Copy link, Delete… with ConfirmDialog → back to /problems). Key insight callout (gradient left bar, inline edit). Tabs Notes · Solutions (N) · History (N) with 1/2/3 and session memory (bodies arrive in 4.2–4.4). Sticky meta panel: patterns, tags (editable, link to filtered list), source/contest (editable, link to contest), activity counters, dates, platform + external id. Skeleton, not-found and error states. · Files: client/src/pages/problem-detail.tsx, client/src/features/problems/detail/*, client/src/lib/{revision-status.ts,ui-prefs.ts,query-client.ts}, client/src/components/common/revision-status-badge.tsx, client/src/features/problems/hooks/{use-problems,use-problem-mutations}.ts, client/src/components/ui/tabs.tsx · Verify: pnpm dev → open any problem from /problems: press r a few times (status cycles instantly), s (star fills), 2/3/1 (tabs); click the title, rename, Enter; click the key insight, edit, Enter; pencil on Tags → add one → Save → back on /problems the row shows it; more menu → Edit details → change rating → Ctrl+Enter; /problems/99999 shows "Problem not found". · Notes: driven in headless Chrome against a seeded scratch DB (all edits persisted, both themes screenshotted, no console errors).

  • 2026-11-28 · 4.2 · Markdown editor & viewer (§9.7): features/markdown/ — CodeMirror 6 editor (markdown + nested code languages, line wrap, token-only theme, Geist Mono) with toolbar (Bold, Italic, Code, C++ block, Link, List, Checklist, Math); viewer (GFM tables/task lists, KaTeX math, links in new tab, callout blockquotes, styled tables) with CodeBlock (Shiki, language label, Copy → "Copied" toast). .markdown typography in index.css. Notes tab: Edit / Split / Preview, mod+/ toggles, mod+s saves now, autosave 1.2 s with "Saving… / Saved / Not saved — Retry", e edits, unsaved-change guard. Key insight renders markdown. · Files: client/src/features/markdown/*, client/src/features/shortcuts/codemirror-keymap.ts, client/src/features/problems/detail/{notes-panel,notes-mode,save-status,use-notes-autosave,use-notes-controller,unsaved-notes-guard,key-insight-card,problem-detail-view}.tsx, client/src/index.css, client/src/app/router.tsx, client/package.json · Verify: pnpm dev → open a problem → press e → type a heading, $x^2$, a $$ … $$ block, a - [ ] item; press Ctrl+Shift+C and paste C++ → wait ~1 s, status shows "Saved"; Ctrl+/ → Preview shows highlighted C++ with Copy, rendered math, checkbox; switch the theme → code colours follow; pick Split and type, then click "← Problems" right away → the change is still there when you come back. · Notes: driven in headless Chrome on the scratch DB (autosave, mod+s, mod+/, mod+shift+c inside the editor, navigate-while-dirty saves, Copy) — no console errors.

  • 2026-11-28 · 4.3 · Solutions tab: approaches as draggable tabs (dnd-kit, optimistic reorder, persisted), [ / ] to switch, "+" adds an approach and opens it in edit mode; view shows name, Time O(…) / Space O(…) mono badges, rendered write-up with copyable Shiki code; edit mode = name + complexities + the shared markdown editor (mod+shift+c C++ block, mod+s save), Discard / Save; delete with ConfirmDialog; empty state with "Add approach". formatComplexity + 7 tests in shared. · Files: client/src/features/solutions/*, shared/src/utils/format.ts, shared/test/format.test.ts, client/src/features/problems/detail/{problem-tabs,unsaved-changes-guard}.tsx, client/package.json · Verify: open a problem → 2 → "+" → type a name, Tab, n log n, Tab, 1, click into the editor, Ctrl+Shift+C, paste code, Ctrl+S; add two more; press [ / ]; drag the last tab to the front and reload — order stays; Edit, type something, click "← Problems" → "Discard your unsaved solution?".

  • 2026-11-28 · 4.4 · History tab: vertical timeline (type icon on a rail, outcome badge, time taken, mistake chips, notes), per-item Edit… / Delete… menu, "Log attempt" button + a on the page (board follow-up toast after a revision / re-solve). Edit reuses the log attempt form. · Files: client/src/features/attempts/{history-panel,attempt-item,attempt-type-icon,log-attempt-dialog,log-attempt-form}.tsx, client/src/features/attempts/hooks/use-attempt-mutations.ts, client/src/features/problems/detail/{problem-detail-view,use-problem-page-shortcuts}.ts(x), client/src/app/router.tsx · Verify: on an unsolved problem press 3, a → "Solve", pick an outcome, Ctrl+Enter → timeline grows, meta panel "First solved: today"; Edit… that attempt → change the date to 3 days ago → "First solved" follows; Delete… it → back to "—" (a contest problem goes back to "Upsolve pending" and the sidebar Contests badge updates). On a solved problem on the board: a → Re-solve → follow-up toast "→ Confident / Keep"; Re-solves counter +1, Last activity "today". · Notes: 4.3/4.4 driven in headless Chrome on the scratch DB (3 approaches, [/], drag reorder + reload, solution guard, delete; solve → edit date → delete with derived dates and contest result checked through the API; stats solved 7d went 0 → 1) — no console errors. pnpm typecheck / lint / test (51 + 20) / build pass.

  • 2026-11-28 · 5.1 · Revision board (§9.9): three columns (colored header + count) with dnd-kit drag within / across columns (pointer + keyboard sensors, drag overlay with lift, drop animation, reduced-motion aware, screen-reader announcements with titles), optimistic moves with rollback + toast; cards with title, platform, difficulty, 2 pattern chips (+N), "3d in column", last activity and revision count; Platform + Pattern category filters in the URL; j/k/h/l select, shift+h/l move, enter open, x remove with Undo, mod+enter Start session; right-click menu (Open, Open problem link, Move to…, Start session with this, Remove from board); skeleton, empty board, filtered-empty, error states, empty-column hints. · Files: client/src/features/revision/board/*, client/src/pages/revision.tsx, client/src/components/common/{check-list,filter-popover}.tsx (moved), client/src/features/problems/list/* (imports) · Verify: pnpm dev → /revision: drag a To Revise card between two Revising cards, reload → it stays; press j, l, Shift+L (card jumps to Confident), Shift+H back; x → toast → Undo puts it back; right-click a card → Move to… → Confident; Platform = Codeforces → only CF cards; Ctrl+Enter → session.

  • 2026-11-28 · 5.2 · Revision session (§9.10): focus mode with top bar (logo, "3 / 12" + progress bar, Exit Esc), problem header (title, column, platform, difficulty, patterns, Open link o), Key insight / Solutions (complexities + write-ups with copyable code) / Notes hidden behind "Recall it first, then reveal" (space next, shift+space all, or click), sticky action bar: Log revision 1, Log re-solve… 2, then To Revise ← / Revising ↓ / Confident → (move + next); next problem prefetched; end screen with Revisions / Re-solves / Now confident and a per-problem list (attempts with outcome icons, column before → after). · Files: client/src/features/revision/session/*, client/src/pages/revision-session.tsx, client/src/features/attempts/{log-attempt-dialog,log-attempt-form}.tsx, client/src/app/router.tsx · Verify: /revision → Ctrl+Enter; for 5 problems: Space, Shift+Space, 1 (once also 2 → pick an outcome → Ctrl+Enter), then → / ↓ / ←; finish the rest with ↓ → summary; Esc → board shows the moves; the problems' History tabs show the logged revisions.

  • 2026-11-28 · 5.3 · Todos (§9.12): "Add a todo…" (Enter adds on top, focus stays, / focuses it), Active / Done tabs with counts (?tab=done), rows with drag handle (dnd-kit, optimistic reorder), checkbox, inline edit (double-click or e; Enter / blur saves, Esc cancels), linked problem chip (opens the problem, × unlinks), link via mod+l or the link button (inline search), delete button / Delete / Backspace with Undo; j/k/x/e; done rows show when they were done; skeleton / empty / error states. · Files: client/src/features/todos/*, client/src/pages/todos.tsx, client/src/lib/{dnd-modifiers,use-debounced-value}.ts, client/src/features/solutions/solution-tab-strip.tsx · Verify: /todos → /, add two todos with Enter; Esc, j, e, rename, Enter; Ctrl+L, type "coin", Enter → chip "LC Coin Change" (click → problem page); drag a row by its handle, reload → order kept; x → moves to Done; Delete on another → Undo → back in the same place.

  • 2026-11-28 · notes · 5.1–5.3 driven in headless Edge over the DevTools protocol on a seeded scratch DB (board: keyboard moves, pointer drag across / within / to column end, order after reload, forced 500 → optimistic then rolled back + toast, x + Undo, context menu, filters, enter, mod+enter, Space keyboard drag; session: 5 problems keyboard-only incl. a re-solve through the dialog, summary 5 / 1 / 2, start= first, Esc keeps filters; todos: everything in its Verify line) — both themes screenshotted, no console errors. pnpm typecheck / lint / test (51 + 20) / build pass.

  • 2026-11-28 · 6.1 · Contests list & detail (§9.11 without chart): /contests table (date, platform, name, Unrated tag, rank, rating after + colored Δ, solved/total · +upsolved · pending left with tooltips; row click or name opens), Upsolve queue card (oldest contest first, contest link + date, "Log upsolve"), New contest dialog (validation inline, live Δ, mod+enter); /contests/:id header (name, platform, full date, Rated, Open contest, Edit, Delete… keeping problems), stat row (rank, rating before → after, change, solved X / total + upsolve progress), problems with result badges + "Log upsolve" for pending, Add problem → quick add prefilled with the contest, Reflection markdown notes with autosave; skeletons, empty, error and not-found states. Problem notes now use the shared markdown notes pieces. · Files: client/src/features/contests/{form,list,detail}/*, client/src/features/contests/{upsolve-queue.tsx,hooks/use-contests.ts}, client/src/pages/{contests,contest-detail}.tsx, client/src/features/markdown/{use-markdown-autosave,use-markdown-notes,markdown-notes,save-status,notes-mode}.ts(x), client/src/components/common/{contest-result-badge,rating-delta,unsaved-changes-guard}.tsx, client/src/features/problems/{quick-add-dialog.tsx,quick-add/*,detail/problem-detail-view.tsx,detail/problem-header.tsx}, client/src/app/{router.tsx,layout/app-shell.tsx}, client/src/pages/problems.tsx · Verify: pnpm dev → /contests: 4 seed contests, queue lists 3 pending; open "Educational Codeforces Round 156" → "Decreasing String" shows Upsolve pending → Log upsolve → Solved alone → Ctrl+Enter → badge becomes Upsolved, "1 of 1 upsolved", sidebar Contests badge 3 → 2, queue on /contests drops it. New contest → Ctrl+Enter empty shows "Contest name is required"; fill in → Create → lands on the contest; Add problem → quick add shows Contest + this contest; Reflection → Edit → type → "Saved"; Edit → change rank; ⋯ → Delete contest… → back on /contests, the problem is still in /problems. /contests/99999 → "Contest not found". · Notes: driven in headless Edge over CDP on a seeded scratch DB (both themes screenshotted, problem-notes autosave re-checked after the refactor, no console errors). pnpm typecheck / lint / test (51 + 20) / build pass.

  • 2026-11-28 · 6.2 · Rating chart (§9.11): "Rating" card above the contests table — platform tabs with counts (URL ?platform=), current rating + last change + peak + rated-contest count, Recharts area/line on a time axis with brand-gradient stroke, Δ-colored dots, rich tooltip (contest name, full date, rating, colored Δ, rank, "Click to open"), click a point → contest page; skeleton, error with retry, and "No rating history yet" empty state with New contest. Contests table no longer scrolls sideways (fixed layout, names truncate with hover title). · Files: client/src/features/contests/rating/{rating-chart-card,rating-chart,rating-tooltip,rating-scale}.ts(x), client/src/components/ui/chart.tsx (shadcn), client/src/pages/contests.tsx, client/src/features/contests/list/contests-table.tsx, client/package.json, IMPLEMENTATION.md · Verify: pnpm dev → /contests: the Codeforces curve (3 points) shows current 1487 ↘ −44, peak 1531; hover a dot → tooltip with name, date, rating, Δ and rank; click it → that contest opens; back, click the CodeChef tab → URL gets ?platform=codechef, single point; reload keeps it; switch the theme — line, dots and tooltip read well in both; edit every contest to Unrated → "No rating history yet" with New contest. · Notes: driven in headless Chrome over CDP on a seeded scratch DB (both themes, hover, click-through, tab + URL, invalid ?platform= fallback, empty state) — no console errors. pnpm typecheck / lint / test (51 + 20) / build pass.

  • 2026-11-28 · 7.1–7.3 · Dashboard (§9.13). 7.1: greeting + date, source toggle (All / Practice / Contest, URL), window pills with the brand gradient on the selected one (1–6, remembered), six stat cards (common StatCard): Problems solved, Revisions, Re-solves (succeeded / total), Active days, Current streak (Flame, highlight when > 0, longest as subtitle), Honesty ratio (% + thin stacked outcome bar with a breakdown tooltip), deltas vs the previous window. 7.2: GitHub-style heatmap (custom SVG, 11px cells / 3px gap, Sun→Sat rows, month + Mon/Wed/Fri labels, --heat-*, today ringed in highlight), tooltip "4 activities on Thursday, Nov 27, 2026", All activity / Solves, Last 12 months + years with data, total + streaks + legend, click or Enter on a day → /problems?dateField=activity&from=D&to=D, arrow-key navigation. 7.3: Patterns by category with drill-down (top 8 + show more), Difficulty (Easy/Medium/Hard tiles + rating-bucket columns), Top mistakes (bars, "last 1w ago", description on hover), Weak patterns (struggle %, all time), Platforms, Revision board counts + Upsolve pending (links), Recent activity (last 10, links to problems). Every card: skeleton, empty, error + retry. · Files: client/src/pages/dashboard.tsx, client/src/features/stats/{dashboard,heatmap,breakdown}/*, client/src/features/stats/hooks/use-stats.ts, client/src/components/common/stat-card.tsx, client/src/lib/ui-prefs.ts, client/src/app/layout/app-shell.tsx, IMPLEMENTATION.md · Verify: pnpm dev → /: press 1…6 (pills and numbers change, deltas show ↑/↓; hover a delta for the previous window), reload → same window; click Contest → URL ?source=contest, cards and breakdowns change; hover heatmap cells → tooltip; Solves and the year menu; click a green day → problems list filtered to that day; Tab into the grid, arrows move, Enter opens; click a pattern category → its patterns, "All categories" back; window Today → empty states; switch the theme. · Notes: driven in headless Chrome over CDP on a seeded scratch DB at 1440 and 1024 px, both themes (keys, persistence, URL source, hover tooltip, click-through, year/mode, keyboard grid, drill-down, empty states) — no console errors; every card number matched /api/stats/*. This caught the page-wide horizontal scroll at 1024 px (fixed in the shell) and a stale drill-down after a window change (fixed). pnpm typecheck / lint / test (51 + 20) / build pass.

  • 2026-11-28 · 8.1 · Full-text search: custom migration 0001_problems_fts.sql (FTS5 over title, key insight, notes, solutions text; rowid = problem id); services/search.ts (syncProblemSearch after problem create/patch/delete and solution create/patch/delete, rebuildSearchIndex, ensureSearchIndex on server start, toMatchQuery, cleanSnippet, searchProblems with BM25 weights + marked snippets); GET /api/search; problems list q uses FTS from 2 chars (plus the title substring match). Shared FTS_MIN_QUERY_LENGTH, SNIPPET_MARK_START/END. Problems search placeholder now "Search titles, notes, solutions…". 10 tests in server/test/search.test.ts. · Files: server/drizzle/{0001_problems_fts.sql,meta/*}, server/src/services/{search,problems,solutions}.ts, server/src/routes/search.ts, server/src/{app,index}.ts, server/src/db/seed.ts, server/test/search.test.ts, shared/src/schemas/search.ts, client/src/features/problems/list/search-input.tsx, IMPLEMENTATION.md · Verify: pnpm dev (the server applies the migration and builds the index on start) → /problems, type binary → also lists problems that only mention it in notes / key insight (e.g. Koko Eating Bananas, Search in Rotated Sorted Array); type a word from one of your solution write-ups → that problem shows; http://localhost:5173/api/search?q=sliding%20window → ranked results, snippet with the hit wrapped in \u0002…\u0003; add a solution containing a made-up word, search it → found immediately; delete it → gone. · Notes: curl-checked on a seeded scratch DB (ranking, prefix, multi-word AND, FTS syntax in the query, empty q → 400, sync through the API) and the migration applied to a copy of server/data/cortex.db (still empty). pnpm typecheck / lint / test (51 + 30) / build pass.

  • 2026-11-28 · 8.2 · Command palette (§9.15): mod+k / top-bar Search opens a cmdk dialog — empty: Recent (last 5 opened problems), Actions (New problem N, New contest, Add todo, Start revision session, Switch to light/dark theme, Export backup — placeholder until 8.3), Navigate (all pages with their g … hints); typing: Problems from /api/search (debounced 150 ms, platform + difficulty badges, matched snippet with highlighted words, "Searching…" / error rows), then matching actions and pages; "Nothing matches" state; footer key hints; mod+k again closes it. Search results refresh after problem / solution edits. · Files: client/src/components/ui/command.tsx, client/src/features/command/*, client/src/features/todos/{focus-request.ts,todo-input.tsx}, client/src/app/layout/{app-shell,global-shortcuts}.tsx, client/src/features/problems/{detail/problem-detail-view.tsx,hooks/use-problem-mutations.ts}, client/src/lib/{query-keys,invalidate,ui-prefs}.ts, client/package.json, IMPLEMENTATION.md · Verify: pnpm dev → Ctrl+K anywhere; type a word that is only in a problem's notes (seed: monotone) → Koko Eating Bananas with the word highlighted → Enter opens it; Ctrl+K again → it is under Recent; Ctrl+K closes; type new c → Enter → New contest dialog; todo → Enter → /todos with the input focused; theme → Enter flips the theme; ↑/↓ wrap around; xyzzy → "Nothing matches". · Notes: driven in headless Chrome over CDP on a seeded scratch DB (both themes, 1440 + 1024 px, every action, recent order, toggle close, keyboard wrap) — no console errors. pnpm typecheck / lint / test (51 + 30) / build pass.

  • 2026-11-28 · 8.3 · Backups & export/import + Settings: startup backup (before migrations, cortex-YYYY-MM-DD.db, keep 14); GET /api/export/json (download cortex-backup-YYYY-MM-DD.json), POST /api/import/json (pre-import SQLite copy, then replace-all in one transaction, search index rebuilt, broken data → 400 with nothing changed), POST /api/export/markdown (server/exports/cortex-md-…/<platform>/<id>-<slug>.md with frontmatter, key insight, notes, solutions, history table), GET /api/backups. Settings page: Theme (Light / Dark / System), Download JSON, Import… (file checked in the browser → confirm with the file's counts → toast), Export Markdown (file count + folder path + copy), Automatic backups (folder + recent files with size, date, "before import" tag), About. Palette Export backup now downloads the file. 10 new tests. · Files: server/src/services/{backups,backup-json,markdown-export}.ts, server/src/routes/backup.ts, server/src/lib/dates.ts, server/src/{app,index,env}.ts, server/src/db/{client,seed}.ts, server/test/backup.test.ts, shared/src/schemas/backup.ts, client/src/features/settings/*, client/src/pages/settings.tsx, client/src/features/command/{recent-problems,use-palette-commands}.ts, client/src/lib/query-keys.ts, client/src/components/common/coming-soon.tsx (deleted), IMPLEMENTATION.md · Verify: restart pnpm dev → server/data/backups/cortex-<today>.db appears; /settings → it is listed under Automatic backups; Download → cortex-backup-<today>.json saved; Import… → pick that file → dialog shows its counts → Replace everything → toast, the dashboard/problems look the same, a "before import" copy is listed; pick any other JSON file → "That isn't a Cortex backup"; Export → "N files in …serverexportscortex-md-…" → open a .md file; theme buttons switch the theme; Ctrl+K → "export backup" → file saved. · Notes: curl-checked on a seeded scratch DB (export counts, byte-identical export → import → export, wrong version / garbage / broken FK → 400 with data unchanged, Markdown output read through) and driven in headless Chrome (both themes, download completed, file picker, confirm, toasts, palette action) — no console errors. The test Markdown exports were deleted from server/exports/; server/data/ was never touched. pnpm typecheck / lint / test (51 + 40) / build pass.

  • 2026-11-28 · fix · Dashboard heatmap: removed the "+ Log a problem" button from the empty footer. · Files: client/src/features/stats/heatmap/heatmap-card.tsx · Verify: on an empty DB (or the Today window with no activity), the Activity card footer just says "No activity in the last 12 months". pnpm typecheck / lint / build pass.

  • 2026-11-28 · fix · Heatmap today ring no longer clipped at the grid edge (drawn inside the cell). · Files: client/src/features/stats/heatmap/heatmap.tsx · Verify: dashboard → Activity card → the last cell (today) shows a full cyan outline the same size as the other squares, in both themes.

  • 2026-11-28 · 8.4 · Polish pass: all pages lazy (+ idle prefetch of page chunks) — initial JS ≈ 960 kB (was ≈ 1.25 MB; dnd-kit and all page code left the entry); /_ui preview and React Query devtools removed; global reduced-motion rule (spinners exempt); 1024px layout fixes (problem page, contests, problems list columns — two columns / Patterns from 1280px); memoized problem rows and board card bodies; shared KeyHints (problems list footer legend is new), "Reveal all" button in the revision session, ring focus on row-title links. Acceptance checked by curl on a seeded copy of the DB (scratch path via CORTEX_DB_PATH): /api/search?q=invariant finds "Longest Substring…" by a word that is only in its notes; startup backup appeared next to that DB; export → import → export is identical for every table (32 problems, 33 solutions, 103 attempts, 4 contests, 6 todos, patterns, tags, mistakes). Visual checks weren't possible from here (no browser) — see "Verify". · Files: client/src/app/{router.tsx,route-imports.ts,providers.tsx}, client/src/main.tsx, client/src/index.css, client/src/pages/{contests,todos}.tsx, client/src/pages/ui-preview.tsx (deleted), client/src/features/shortcuts/key-hints.tsx (new), client/src/features/problems/list/{problem-list,problem-row}.tsx, client/src/features/problems/detail/{problem-detail-view,problem-detail-skeleton,meta-panel}.tsx, client/src/features/revision/board/{board-card-body,board-key-hints}.tsx, client/src/features/revision/session/{session-section,session-problem}.tsx, client/src/features/contests/{upsolve-queue.tsx,list/contests-table.tsx,detail/contest-problems.tsx}, client/src/features/command/palette-body.tsx, client/package.json · Verify: (1) resize the window to 1024px wide with the sidebar open → Problems shows full titles (no Patterns column), the problem page puts the meta panel under the notes, Contests puts the upsolve queue under the table; at ≥1280px both are side by side and Patterns is back. (2) Problems list → footer shows the j k / enter / s / r / a legend; press j repeatedly — selection moves instantly. (3) Tab through the problems list / contests table → the focused title gets a ring. (4) Revision → Start session → "Reveal all ⇧Space" in the first hidden section reveals everything. (5) Windows Settings → Accessibility → Visual effects → Animation effects off → dialogs/popovers appear without zoom/fade, drags don't animate, spinners still turn. (6) Reload any page → sidebar and top bar stay, the page fills in; no floating React Query button. (7) Mod+K → search a word from a problem's notes → it's found.

  • 2026-11-28 · change · Removed the contests rating chart (+ its endpoint, schemas, hook, Recharts) and redesigned the dashboard Platforms card as a split bar with a legend of counts and shares. Initial JS unchanged (≈ 960 kB; Recharts was already lazy). · Files: client/src/features/stats/breakdown/platforms-card.tsx, client/src/pages/{dashboard,contests}.tsx, client/src/index.css (--series-1..4), client/src/features/contests/hooks/use-contests.ts, client/src/lib/query-keys.ts, client/src/features/contests/rating/ (deleted), client/src/components/ui/chart.tsx (deleted), client/package.json, server/src/{routes,services}/contests.ts, shared/src/schemas/contest.ts, IMPLEMENTATION.md, CLAUDE.md · Verify: Contests page opens straight on the table + upsolve queue (no Rating card). Dashboard → Platforms shows "N problems solved in the last 30 days", one bar split by platform (hover a segment → name · count · %), and rows with count and %; switch windows (1–6) — LeetCode keeps the same color; a platform like CSES appears as "Other". Check both themes.

  • 2026-11-28 · change · Contest rating fields removed from the UI and API inputs (rank + Rated kept; DB columns kept). Exercised on a seeded DB copy: GET /api/contests has no ratingDelta; POST with ratingBefore/After creates the contest with both null; PATCH {isRated:false} and DELETE work; JSON export still 200. · Files: client/src/features/contests/form/{contest-form,contest-form-state}.ts(x), client/src/features/contests/list/contests-table.tsx, client/src/features/contests/detail/{contest-stats,contest-detail-skeleton}.tsx, client/src/components/common/rating-delta.tsx (deleted), shared/src/schemas/contest.ts, server/src/services/contests.ts, server/src/db/{seed.ts,seed-data/contests.ts,seed-data/types.ts}, IMPLEMENTATION.md · Verify: Contests → New contest shows Name, Platform, Date, Link, Rated, Rank, Problems (no rating inputs); the table has Date · Contest · Rank · Problems; open a contest → three stats (Rank, Solved in contest, Upsolved); toggling Rated off shows "Unrated contest" under Rank and the "Unrated" badge in the table.

  • 2026-11-28 · change · Accent cleanup: tonal indigo logo + favicon, solid indigo bars everywhere else, window pills styled like the source toggle. · Files: client/src/index.css, client/public/favicon.svg, client/src/components/common/segmented-control.tsx, client/src/features/stats/dashboard/window-pills.tsx, client/src/app/layout/app-sidebar.tsx, client/src/features/problems/{list/problem-row,detail/key-insight-card}.tsx, client/src/features/revision/{board/sortable-board-card,session/session-top-bar}.tsx, client/src/features/todos/todo-row.tsx, CLAUDE.md, IMPLEMENTATION.md · Verify (both themes): sidebar logo is indigo light → dark with no purple; active nav bar is solid indigo; dashboard "30d" looks like the selected "All" chip next to it (white chip / lifted chip in dark), keys 1–6 still switch; select a row in Problems / Board / Todos → solid indigo bar; a problem's key-insight edge and the revision-session progress bar are solid indigo; browser tab icon matches the logo (hard-refresh if cached).

  • 2026-11-28 · change · Restore button for automatic backups + Todos alignment. Exercised on a seeded DB copy: restoring the day's backup (taken before seeding) → 0 problems; restoring the safety copy that restore created → 32 problems / 6 todos back; ..%2Fcortex.db → 400, unknown name → 404. · Files: server/src/services/{backup-restore,backups}.ts, server/src/routes/backup.ts, server/test/backup.test.ts, shared/src/schemas/backup.ts, client/src/features/settings/{backups-card,backup-row,backup-file}.ts(x), client/src/features/settings/hooks/use-backup.ts, client/src/pages/todos.tsx, client/src/features/todos/todo-row.tsx, IMPLEMENTATION.md · Verify: Settings → Automatic backups → each row has Restore → confirm → toast "Restored … N problems, …"; a new "safety copy" row appears at the top — Restore it to go back. Todos: the title, input, tabs and rows start at the same left edge as on Contests / Revision; each checkbox sits under the input's "+", hover a row → grip appears just left of it, drag still reorders.

  • 2026-11-28 · change · Sidebar count pills with text, sidebar 15rem, dashboard greeting → "Dashboard". · Files: client/src/app/layout/{app-sidebar.tsx,use-nav-counts.ts,app-shell.tsx}, client/src/features/stats/dashboard/dashboard-header.tsx, IMPLEMENTATION.md · Verify (both themes): sidebar shows "5 to revise", "3 to upsolve", "3 to do" pills next to Revision / Contests / Todos, matching the board, upsolve queue and active todos; finish all todos → the Todos pill disappears; Ctrl+B collapses the sidebar → small dots on those icons, hover → "Revision · 5 to revise"; sidebar is slightly narrower; dashboard header says "Dashboard" with the date under it.

  • 2026-11-28 · change · Collapsed sidebar: number badges on Revision / Contests / Todos icons. · Files: client/src/app/layout/app-sidebar.tsx, IMPLEMENTATION.md · Verify: Ctrl+B → small indigo circles with 5 / 3 / 3 on the top-right of those icons (both themes), hover → "Revision · 5 to revise"; expand again → the text pills are back and the circles are gone.

  • 2026-11-28 · change · Top bar title fades in only after the page heading scrolls away. · Files: client/src/lib/page-heading.ts (new), client/src/app/layout/topbar.tsx, client/src/components/common/page-header.tsx, client/src/pages/problems.tsx, client/src/features/stats/dashboard/dashboard-header.tsx, client/src/features/problems/detail/problem-header.tsx, client/src/features/contests/detail/contest-header.tsx, client/src/app/router.tsx, client/src/app/route-handle.ts (deleted), IMPLEMENTATION.md · Verify: open Dashboard / Problems / Revision / Contests / Todos / Settings / Shortcuts → top bar shows only the sidebar button on the left; scroll until the big title passes under the bar → the title fades in next to it; scroll back up → it fades out. Open a problem → scroll → top bar says the problem's name; rename it (click the title) → the top-bar title follows. Switch pages while scrolled → no stale title.

  • 2026-11-28 · change · Top bar title removed entirely (the scroll-to-reveal version was dropped). · Files: client/src/app/layout/topbar.tsx, client/src/components/common/page-header.tsx, client/src/features/stats/dashboard/dashboard-header.tsx, client/src/features/problems/detail/problem-header.tsx, client/src/features/contests/detail/contest-header.tsx, client/src/lib/page-heading.ts (deleted), IMPLEMENTATION.md · Verify: every page's top bar shows only the sidebar button on the left and search / New problem / theme on the right, also after scrolling; page headings unchanged (Problems still shows its count).

  • 2026-11-28 · change · Problems header: count as text in the description, duplicate New problem button removed. · Files: client/src/pages/problems.tsx, client/src/components/common/page-header.tsx, IMPLEMENTATION.md · Verify: Problems shows a plain "Problems" title with "32 problems · searchable by title, notes and solutions." under it; pick Difficulty → Hard → line reads "6 of 32 problems match these filters."; clear filters → back to the first text; only the top bar has a New problem button (empty DB / no-match states unchanged).

  • 2026-11-29 · refactor · Client lean-up: deleted unused shadcn badge.tsx; theme storage uses readPref/writePref; duplicate comment removed. No behaviour change. (A loop version of parseBoardFilters was tried and reverted: it needed an as BoardFilters cast for no saved lines.) · Files: client/src/components/ui/badge.tsx (deleted), client/src/lib/{theme.tsx,ui-prefs.ts,invalidate.ts} · Verify: switch theme Light / Dark / System and reload → choice kept.

  • 2026-11-29 · refactor · Shiki loads through shiki/core with the 9 grammars and 2 themes imported one by one, so the build no longer emits a chunk per Shiki language: client/dist/assets 547 files / 16 MB → 249 files / 6.7 MB. Same loaded languages (26, aliases included) and byte-identical HTML vs the old highlighter (checked in Node for cpp, c++, py, js, ts, sh, json, md, java and an unknown lang). · Files: client/src/features/markdown/shiki.ts · Verify: open a problem whose notes have a cpp block → highlighted in light and dark; a py or ```sh block is highlighted too; an unknown language shows plain text. pnpm lint / typecheck / build (client) pass. `pnpm lint / typecheck / build` (client) pass.

  • 2026-11-29 · security/refactor · Server audit items 1–4: API listens on 127.0.0.1 only; Host check against DNS rebinding; cors / @types/cors removed; one lib/group-by.ts replaces the four "rows → Map of lists" loops (patternsOf, tagsOf, mistakesOf, Markdown export). · Files: server/src/{app,env,index}.ts, server/src/lib/group-by.ts (new), server/src/services/{problems,attempts,markdown-export}.ts, server/package.json, pnpm-lock.yaml, client/vite.config.ts, IMPLEMENTATION.md · Verify: restart pnpm dev (the proxy target changed) → the app loads and saves as before; the server log says listening on http://127.0.0.1:3001; from a phone on the same Wi-Fi http://<pc-ip>:3001/api/health doesn't connect. Curl-checked on a scratch DB: 200 with Host 127.0.0.1 / localhost:5173 / [::1], 400 "Unexpected host" with evil.example, LAN IP refused; a problem with 2 patterns, 2 tags and an attempt with 2 mistakes returns them in the same order from detail, list, board, recent and Markdown export (test export deleted afterwards). pnpm --filter @cortex/server typecheck / test (42) and client lint / typecheck pass.

Known issues / tech debt

  • The API binds to 127.0.0.1 (server/src/index.ts). Phase 9 (Docker) needs 0.0.0.0 inside the container — add a HOST env setting then, and keep the Host check.

  • Search index stays correct only for writes through the API/services: rows edited directly (Drizzle Studio, raw SQL) are re-indexed only when the problem count changes (startup check) or on the next API edit of that problem.

  • Import validates enums/shape and referential integrity, not the domain rules the API enforces on edits (attempt order, contest fields): a hand-edited backup can import states the UI would never create.

  • Recent problems are a client-side list: a problem deleted outside the app (Drizzle Studio, import) stays in it until opened (the page then says "Problem not found").

  • Initial JS is ≈ 960 kB min across the entry and its preloaded chunks (react-dom, react-router, Base UI, TanStack Query, zod, date-fns, sonner). No app chunk is over 500 kB any more; Vite's warning now comes only from Shiki grammar chunks (cpp ≈ 785 kB, emacs-lisp), loaded on demand. Shiki loads all nine configured grammars on the first code block (cached afterwards).

  • Duplicate-URL detection compares the trimmed URL exactly — …/two-sum/ vs …/two-sum/description/ count as different. URL normalisation is in the backlog.

  • Board moves (and a column renormalize) bump problems.updated_at through Drizzle's $onUpdateFn — harmless today (nothing sorts by updatedAt), but "updated" isn't purely content edits.

  • Zod enum errors put the full list of allowed values in details (124 entries for a bad pattern id) — fine for an API, the client shows message.

  • The PROBLEM_ID raw-SQL workaround means correlated subqueries are written as SQL text; if the schema renames problems/contests, those strings must change too (typecheck won't catch it; the tests and curl checks would).

  • Problem page: deleting a problem within ~1 s of typing in its notes (autosave still pending) makes the leave guard try to save notes of a deleted problem → "couldn't be saved" prompt (Leave works). Rare; fix if it ever bites.

  • UnsavedChangesGuard (useBlocker) is one per page — a page with two independent drafts would need to combine them into one guard.

  • Undo of a todo delete re-creates it: new id, and a done todo's "done" date becomes now. Undo of a board removal isn't optimistic (the card is no longer in the cache) — it reappears after the refetch (instant on localhost).

  • Revision session progress lives in component state: reloading the session page starts over (with the board as it is then).

  • Dashboard heatmap mode/year and the pattern drill-down are card state — a reload goes back to All activity / Last 12 months / categories.

  • Dashboard date is computed at render; leaving the page open past midnight keeps yesterday's date (and the heatmap's "today" ring) until the next render or refetch.

  • Two-column layouts switch at the viewport xl breakpoint, not on the content width: with the sidebar collapsed at 1024–1279px the problem page and contests still stack although they would fit side by side.

Backlog (ideas — not in v1 scope)

  • Automatic spaced-repetition suggestions (opt-in) based on attempt history
  • Import solved lists from Codeforces API / LeetCode
  • Image paste in notes (stored under server/data/uploads)
  • Problem "similar to" links between problems
  • Contest virtual-participation timer
  • Weekly review page (what I learned this week, auto-generated from attempts + notes)
  • Motion library for list enter/exit and layout animations
  • Mobile / narrow layout
  • Normalise problem URLs (strip /description/, query, trailing slash) for duplicate detection