Skip to content

⚡ Bolt: Scope lesson progress queries - #87

Open
projectamazonph wants to merge 1 commit into
mainfrom
perf/scope-lesson-progress-1688226821116498244
Open

⚡ Bolt: Scope lesson progress queries#87
projectamazonph wants to merge 1 commit into
mainfrom
perf/scope-lesson-progress-1688226821116498244

Conversation

@projectamazonph

@projectamazonph projectamazonph commented Jul 27, 2026

Copy link
Copy Markdown
Owner

💡 What: Scoped db.lessonProgress queries on the dashboard, courses catalog, and certificate pending pages to only fetch progress for visible/applicable lesson IDs instead of loading the user's entire completion history.

🎯 Why: Previously, any page displaying user progress or pending lessons fetched every single lessonProgress record ever created for that user. This doesn't scale as the curriculum expands, leading to bloated query payloads, high database memory consumption, and unnecessary CPU mapping overhead on the Prisma client.

📊 Impact: Significantly reduces database network transfer and memory overhead on highly visited dashboard pages. For a student with many courses/lessons, this avoids redundant scans and caps DB response size to the small set of visible items.

🔬 Measurement: Verified that pages still correctly display progress and pending lessons, and ran unit/integration tests (pnpm test) to ensure zero regression.


PR created automatically by Jules for task 1688226821116498244 started by @projectamazonph

Summary by CodeRabbit

  • Performance Improvements
    • Improved course, dashboard, and certificate page loading by limiting lesson-progress data to lessons included in the relevant courses.
    • Reduced unnecessary data processing and resource usage, especially for users with extensive lesson histories.
    • Preserved existing progress tracking, completion counts, and certificate eligibility behavior.
    • Pages now avoid progress lookups when no lessons are available.

Co-authored-by: projectamazonph <286085559+projectamazonph@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI review requested due to automatic review settings July 27, 2026 13:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Lesson progress queries in the dashboard, courses index, and certificate pages now restrict results to visible course lessons. Empty lesson sets skip database lookups, and a Bolt journal entry documents the query-scoping approach.

Changes

Lesson progress query scoping

Layer / File(s) Summary
Scope progress loading to visible lessons
src/app/(dashboard)/dashboard/page.tsx, src/app/(dashboard)/courses/page.tsx, src/app/(dashboard)/courses/[courseSlug]/certificate/page.tsx, .jules/bolt.md
Dashboard and courses pages derive lesson IDs from published courses before querying lessonProgress; certificate completion checks use course lesson IDs; empty lesson sets produce empty progress results. The Bolt journal records the same query-scoping pattern.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: copilot

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main performance change: scoping lesson progress queries.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch perf/scope-lesson-progress-1688226821116498244

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/app/(dashboard)/courses/page.tsx (1)

42-42: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Make this comment explain the reason.

It restates the filter. Say that it avoids loading progress from unrelated or hidden courses, or remove it.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/app/`(dashboard)/courses/page.tsx at line 42, Update the comment near the
course lesson progress query to explain that scoping progress to course lessons
prevents loading progress from unrelated or hidden courses, or remove the
comment if that context is sufficiently clear from the code.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/app/`(dashboard)/courses/page.tsx:
- Line 42: Update the comment near the course lesson progress query to explain
that scoping progress to course lessons prevents loading progress from unrelated
or hidden courses, or remove the comment if that context is sufficiently clear
from the code.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1e99382a-f3a3-48bc-8142-62d40c608d41

📥 Commits

Reviewing files that changed from the base of the PR and between dabee94 and bfd3b7d.

📒 Files selected for processing (4)
  • .jules/bolt.md
  • src/app/(dashboard)/courses/[courseSlug]/certificate/page.tsx
  • src/app/(dashboard)/courses/page.tsx
  • src/app/(dashboard)/dashboard/page.tsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants