Skip to content

feat: add resume analysis history tracking with database model and UI dashboard - #1606

Open
TanCodeX wants to merge 2 commits into
Canopus-Labs:mainfrom
TanCodeX:feat/resume-analysis-history
Open

feat: add resume analysis history tracking with database model and UI dashboard#1606
TanCodeX wants to merge 2 commits into
Canopus-Labs:mainfrom
TanCodeX:feat/resume-analysis-history

Conversation

@TanCodeX

@TanCodeX TanCodeX commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

📝 Pull Request Description

Related Issue

Closes #1531

Summary

Implemented a complete Resume Analysis History feature that allows users to revisit and manage their previous resume analysis results.

  • Added a new ResumeAnalysisHistory MongoDB model to persist analysis snapshots.
  • Automatically saves each resume analysis result for the authenticated user.
  • Added a backend API to retrieve the user's 50 most recent analyses.
  • Added a new /resume-analyzer/history frontend page with responsive history cards.
  • Added a View History button to the existing Resume Analyzer.
  • Added expandable analysis details for reviewing AI feedback and suggestions.
  • Added loading, empty-state, and error handling.
  • Preserved dark mode compatibility across the new UI.

This allows users to track their resume improvement over time and revisit previous ATS scores, missing skills, suggestions, and AI feedback.


Type of Change

  • 🐛 Bug fix (non-breaking change)
  • ✨ New feature
  • ♻️ Refactoring
  • 📝 Documentation update
  • 🎨 UI/UX improvement
  • 🔥 Other (please describe) _____

How Has This Been Tested?

Describe the testing steps performed.

  • Uploaded a resume through /resume-analyzer and completed an AI analysis.
  • Verified that the analysis result was persisted in the ResumeAnalysisHistory MongoDB collection.
  • Verified that GET /api/resume/analysis-history returns the authenticated user's analysis history.
  • Verified that analyses are returned in newest-to-oldest order and limited to the latest 50 records.
  • Navigated to /resume-analyzer/history and verified previous analyses are displayed correctly.
  • Tested the expandable/collapsible analysis details.
  • Verified loading and error states are rendered correctly.
  • Verified the empty history state displays the appropriate "Get Started" action.
  • Verified the View History button navigates correctly from the Resume Analyzer.
  • Verified the new UI remains compatible with dark mode.
  • Verified nested Gemini-generated analysis data is correctly stored and retrieved from MongoDB.

Screenshots (if applicable)

Screenshots/videos can be added to demonstrate:

  • Resume Analysis History page
  • Expanded analysis details
  • Empty history state
  • Dark mode UI
  • Resume Analyzer → View History navigation

Checklist

  • My code follows the project's guidelines
  • I have tested my changes
  • I have updated documentation where necessary
  • I have linked the related issue
  • My changes do not introduce new warnings or errors

Adds persistent Resume Analysis History for authenticated users.

  • Stores completed analyses in MongoDB.
  • Adds GET /api/resume/analysis-history with the 50 newest records.
  • Adds the protected /resume-analyzer/history page.
  • Supports expandable details, loading, empty, error, and dark-mode states.
  • Adds a View History link to the Resume Analyzer.

Looks good to me. Ready to merge.

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Resume analysis results are persisted per authenticated user. A protected API endpoint returns recent records. The frontend adds a protected history page with loading, error, empty, summary, and expandable detail states, plus navigation from the analyzer.

Changes

Resume Analysis History

Layer / File(s) Summary
Analysis persistence
backend/models/ResumeAnalysisHistory.js, backend/controllers/resumeController.js
Adds the ResumeAnalysisHistory schema and saves parsed analysis results for the authenticated user. Persistence failures are logged without failing the analysis response.
History retrieval API
backend/controllers/resumeController.js, backend/routes/resumeRoutes.js
Adds an authenticated GET /api/resume/analysis-history endpoint that returns up to 50 records sorted by newest first.
History page and navigation
frontend/src/utils/apiPaths.js, frontend/src/App.jsx, frontend/src/pages/ResumeBuilder/ResumeAnalysisHistory.jsx, frontend/src/pages/ResumeBuilder/ResumeAnalyzer.jsx
Adds the protected history route, API path, history page states and details, and a “View History” link from the analyzer.

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

Sequence Diagram(s)

sequenceDiagram
  participant ResumeAnalysisHistory
  participant resumeRoutes
  participant getResumeAnalysisHistory
  participant MongoDB
  ResumeAnalysisHistory->>resumeRoutes: GET /api/resume/analysis-history
  resumeRoutes->>getResumeAnalysisHistory: Delegate authenticated request
  getResumeAnalysisHistory->>MongoDB: Query 50 newest user records
  MongoDB-->>getResumeAnalysisHistory: Return analysis history
  getResumeAnalysisHistory-->>ResumeAnalysisHistory: Render history records
Loading

Possibly related PRs

  • Canopus-Labs/PrepPilot#1375: Adds a separate persistence-backed, user-specific history flow with authenticated API retrieval and frontend display.

Suggested labels: type:feature, type:accessibility, type:design

Suggested reviewers: tmdeveloper007, karanunique

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR implements persistent history, authenticated retrieval, and key analysis details required by #1531, but it lacks comparison or management actions. Add comparison and management actions, or clarify that #1531 only requires viewing and revisiting stored analyses.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the added persistent resume analysis history feature, database model, and UI dashboard.
Out of Scope Changes check ✅ Passed All changed files support #1531 by implementing persistence, authenticated retrieval, navigation, and presentation of resume analysis history.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Actionable comments posted: 2

🤖 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.

Inline comments:
In `@backend/controllers/resumeController.js`:
- Around line 158-172: Complete the missing-keywords history contract: in
backend/controllers/resumeController.js lines 158-172, update the required AI
JSON structure used before ResumeAnalysisHistory.create so missingKeywords is
required and reliably persisted; in
frontend/src/pages/ResumeBuilder/ResumeAnalysisHistory.jsx lines 149-207, render
item.missingKeywords in the expanded analysis details.

In `@frontend/src/pages/ResumeBuilder/ResumeAnalysisHistory.jsx`:
- Around line 111-141: Update the expandable summary around toggleExpand so the
clickable div is replaced or structured as a named button that invokes
toggleExpand(item._id) via keyboard and pointer interaction. Add an accessible
label, aria-expanded reflecting expandedId === item._id, and aria-controls
referencing the associated expanded-content element; ensure the nested icon
control does not create a redundant interactive button.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b0c94ff5-0c04-4eb7-b20a-1849c740ec43

📥 Commits

Reviewing files that changed from the base of the PR and between ef976aa and 87852e4.

📒 Files selected for processing (7)
  • backend/controllers/resumeController.js
  • backend/models/ResumeAnalysisHistory.js
  • backend/routes/resumeRoutes.js
  • frontend/src/App.jsx
  • frontend/src/pages/ResumeBuilder/ResumeAnalysisHistory.jsx
  • frontend/src/pages/ResumeBuilder/ResumeAnalyzer.jsx
  • frontend/src/utils/apiPaths.js

Comment thread backend/controllers/resumeController.js
Comment thread frontend/src/pages/ResumeBuilder/ResumeAnalysisHistory.jsx Outdated
@KaranUnique

Copy link
Copy Markdown
Contributor

@TanCodeX address the coderabbit suggestions

@github-actions github-actions Bot added the merge ready PR is mergeable and has no conflicts label Aug 8, 2026
@TanCodeX

TanCodeX commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

@TanCodeX address the coderabbit suggestions

@KaranUnique done.

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
backend/controllers/resumeController.js (2)

159-176: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Align persisted fields with the AI response contract.

The prompt declares an exact response shape, but it does not include formattingIssues, actionVerbs, or sections. A compliant response therefore causes Lines 167-172 to persist fallback empty values. Add required fields to the prompt, or remove them from the history contract.

🤖 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 `@backend/controllers/resumeController.js` around lines 159 - 176, Align the
ResumeAnalysisHistory persistence in the history creation block with the AI
response contract: either add formattingIssues, actionVerbs, and sections to the
prompt’s required response shape, or remove those fields from the persisted
history payload and contract. Ensure the selected approach prevents compliant AI
responses from being stored only as fallback empty values.

159-176: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Do not silently acknowledge failed history writes.

When ResumeAnalysisHistory.create fails, the controller logs the error and still returns a successful analysis response. The user then loses a history record without a retry path or notification. Return an explicit persistence failure, or return a machine-readable historySaved: false value that the client handles.

🤖 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 `@backend/controllers/resumeController.js` around lines 159 - 176, Update the
ResumeAnalysisHistory.create error path in the controller so failed persistence
is not silently treated as success: either return an explicit persistence error
response or include a machine-readable historySaved: false field that the client
can handle. Preserve the successful response behavior and mark historySaved true
when the record is created successfully.
🧹 Nitpick comments (1)
backend/controllers/resumeController.js (1)

284-301: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Add a compound index for history retrieval.

ResumeAnalysisHistory has a single-field user index but no { user: 1, createdAt: -1 } index. Add it to support the filter, sort, and limit efficiently.

🤖 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 `@backend/controllers/resumeController.js` around lines 284 - 301, Add a
compound index on the ResumeAnalysisHistory model for user ascending and
createdAt descending, so the query in getResumeAnalysisHistory can efficiently
filter, sort, and limit results. Define it alongside the model’s existing
indexes.
🤖 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.

Outside diff comments:
In `@backend/controllers/resumeController.js`:
- Around line 159-176: Align the ResumeAnalysisHistory persistence in the
history creation block with the AI response contract: either add
formattingIssues, actionVerbs, and sections to the prompt’s required response
shape, or remove those fields from the persisted history payload and contract.
Ensure the selected approach prevents compliant AI responses from being stored
only as fallback empty values.
- Around line 159-176: Update the ResumeAnalysisHistory.create error path in the
controller so failed persistence is not silently treated as success: either
return an explicit persistence error response or include a machine-readable
historySaved: false field that the client can handle. Preserve the successful
response behavior and mark historySaved true when the record is created
successfully.

---

Nitpick comments:
In `@backend/controllers/resumeController.js`:
- Around line 284-301: Add a compound index on the ResumeAnalysisHistory model
for user ascending and createdAt descending, so the query in
getResumeAnalysisHistory can efficiently filter, sort, and limit results. Define
it alongside the model’s existing indexes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 32de7fd7-0b4a-4e6a-86c9-3c84f22e6276

📥 Commits

Reviewing files that changed from the base of the PR and between 87852e4 and 18170a3.

📒 Files selected for processing (2)
  • backend/controllers/resumeController.js
  • frontend/src/pages/ResumeBuilder/ResumeAnalysisHistory.jsx

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

Labels

merge ready PR is mergeable and has no conflicts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Add a Resume Analysis History feature to PrepPilot.

2 participants