Skip to content

feat: implement AI-powered resume scoring#4387

Open
Gurkaran18 wants to merge 2 commits into
anurag3407:mainfrom
Gurkaran18:feat/ai-resume-scoring
Open

feat: implement AI-powered resume scoring#4387
Gurkaran18 wants to merge 2 commits into
anurag3407:mainfrom
Gurkaran18:feat/ai-resume-scoring

Conversation

@Gurkaran18

@Gurkaran18 Gurkaran18 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

User description

Description

Implemented AI-powered resume scoring to replace the previously hardcoded /score endpoint.

  • Created a new resumeService.js in the backend to handle AI generation and strict JSON parsing.
  • Updated the backend /api/resumes/score route to fetch dynamic scores.
  • Overhauled ResumeSectionStrengthAnalyzer.jsx on the frontend to fetch and render the real AI analysis, complete with loading, empty, and error states.
  • Updated Dashboard.jsx to pass the user's latest resume into the analyzer.

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Performance improvement
  • Other (describe)

Related Issue

Fixes #4365

Testing

  • Unit tests pass
  • Tested Locally
  • New tests added

Screenshots (MANDATORY for UI/UX changes)

  • N/A

Checklist

  • Code follows project style guidelines
  • Self-reviewed my code
  • Added comments where necessary
  • Updated documentation
  • No new warnings generated

Summary by CodeRabbit

  • New Features
    • Added AI-powered resume scoring tailored to the selected job role.
    • Resume analysis now provides overall and section-by-section scores, feedback, and actionable suggestions.
    • Dashboard analysis uses the available resume automatically.
  • Bug Fixes
    • Added clearer handling for missing resumes, loading states, invalid responses, and scoring failures.
    • Improved validation to prevent scoring blank resume content.

CodeAnt-AI Description

Show live AI resume section analysis with an overall score

What Changed

  • Resume section scores now reflect the uploaded resume instead of fixed sample values
  • The analyzer shows an overall score plus feedback for summary, skills, experience, education, and projects
  • Users now see loading, empty, and error states while the analysis runs
  • The dashboard passes the latest resume into the analyzer so the results match the current profile

Impact

✅ More accurate resume feedback
✅ Clearer scoring for uploaded resumes
✅ Fewer blank or misleading analyzer results

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@codeant-ai

codeant-ai Bot commented Jul 8, 2026

Copy link
Copy Markdown

CodeAnt AI is reviewing your PR.

@vercel

vercel Bot commented Jul 8, 2026

Copy link
Copy Markdown

@Gurkaran18 is attempting to deploy a commit to the Anurag Mishra's projects Team on Vercel.

A member of the Team first needs to authorize it.

@codeant-ai

codeant-ai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The resume scoring endpoint now validates input and uses an AI provider to generate structured scores and feedback. The frontend sends resume content to this endpoint and renders dynamic section results, overall score, loading states, and errors.

Changes

AI Resume Scoring Feature

Layer / File(s) Summary
Resume scoring AI service
backend/src/services/resumeService.js
Adds scoreResumeText to combine deterministic ATS scores with parsed AI feedback and actionable suggestions.
Route validation and error handling
backend/src/routes/resume.js
Validates resume text, selects the AI provider, invokes scoring, and standardizes error responses.
Frontend scoring integration
frontend/src/services/api.js, frontend/src/components/ResumeSectionStrengthAnalyzer.jsx, frontend/src/pages/Dashboard.jsx
Adds the scoring API call, passes the first resume to the analyzer, and renders dynamic results with loading, error, and overall-score states.

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

Sequence Diagram(s)

sequenceDiagram
  participant Dashboard
  participant Analyzer as ResumeSectionStrengthAnalyzer
  participant ResumeAPI as resumeApi.score
  participant ResumeRoute as /api/resumes/score
  participant ScoreService as scoreResumeText
  participant AIProvider
  Dashboard->>Analyzer: pass resumes[0]
  Analyzer->>ResumeAPI: score(resumeText, jobRole)
  ResumeAPI->>ResumeRoute: POST scoring request
  ResumeRoute->>ScoreService: scoreResumeText(...)
  ScoreService->>AIProvider: generateContent(prompt)
  AIProvider-->>ScoreService: structured feedback
  ScoreService-->>ResumeRoute: scoreData
  ResumeRoute-->>ResumeAPI: scoring response
  ResumeAPI-->>Analyzer: sections and overallScore
Loading

Possibly related PRs

Suggested labels: type:feature, level:intermediate

Suggested reviewers: anurag3407

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR implements the #4365 requirements: AI scoring service, strict JSON parsing, route replacement, and frontend rendering.
Out of Scope Changes check ✅ Passed The changes stay focused on resume scoring backend, API, and UI integration, with no obvious unrelated additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: replacing mocked resume scoring with AI-powered scoring.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Jul 8, 2026
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
putComment timed out

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (1)
backend/src/services/resumeService.js (1)

42-72: 🎯 Functional Correctness | 🔵 Trivial | 🏗️ Heavy lift

Section-to-score mapping is semantically mismatched.

The deterministic breakdown scores are mapped to sections in a way that doesn't align semantically:

  • summary uses breakdown.formatting (a formatting metric, not summary-specific)
  • projects uses breakdown.keywordMatch (keyword match measures role keyword coverage, not project quality)
  • education is hardcoded to 80 with no deterministic basis

This means the per-section scores don't accurately reflect each section's quality, potentially misleading users. Consider either computing section-specific scores in computeATSScore or clearly documenting why these proxies are used.

🤖 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/src/services/resumeService.js` around lines 42 - 72, The per-section
score mapping in resumeService.js is semantically off because scoreData is
assigning proxy metrics to unrelated sections. Update the mapping in the
scoreData builder so each section in sections (summary, skills, experience,
education, projects) uses a score that actually reflects that section, ideally
by adding section-specific values in computeATSScore or by deriving them from
matching deterministicScoring breakdown fields; if proxies must remain, document
that explicitly in the scoreData construction. Ensure the unique symbols
scoreData, deterministicScoring.breakdown, and computeATSScore are used to keep
the implementation aligned and easy to locate.
🤖 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/src/routes/resume.js`:
- Around line 579-599: The `/score` endpoint in `router.post` is missing the
same authentication guard used by the other resume routes. Update the
`router.post('/score', ...)` handler in the resume routes to include
`verifyToken` before `asyncHandler`, matching the existing middleware pattern in
this file. Keep the current `scoreResumeText` and `getDefaultProvider` logic
unchanged, but ensure only authenticated requests can reach `scoreResumeText` by
applying `verifyToken` to this route.

In `@backend/src/services/resumeService.js`:
- Line 19: Add a defensive guard in resumeService’s content generation flow
before calling provider.generateContent(prompt) so missing or invalid provider
values do not throw a raw TypeError. In the resumeService function that invokes
provider.generateContent, verify provider exists and that generateContent is a
function, then throw an ApiError with a clear message such as the AI provider
being unavailable; keep the existing call path unchanged for valid providers.
- Line 35: The JSON parse error log in resumeService currently includes the raw
AI response text, which can leak echoed resume PII into server logs. Update the
error handling around the resume score parsing flow to stop logging the full
text value in the console.error call, and keep only the parse error plus a
minimal safe context message in resumeService so the failure is still
diagnosable without exposing AI output.

In `@frontend/src/components/ResumeSectionStrengthAnalyzer.jsx`:
- Around line 11-39: The `useEffect` in `ResumeSectionStrengthAnalyzer` needs
cleanup to avoid calling `setSections`, `setOverallScore`, `setLoading`, or
`setError` after unmount while `resumeApi.score()` is still pending. Add an
abort/mounted guard inside `fetchScore` and return a cleanup function from the
effect so state updates are skipped if the component unmounts. Also handle the
success path where `res.data.sections` is missing by setting an error (instead
of silently doing nothing) and make sure `setLoading(false)` still runs safely
in all paths.

---

Nitpick comments:
In `@backend/src/services/resumeService.js`:
- Around line 42-72: The per-section score mapping in resumeService.js is
semantically off because scoreData is assigning proxy metrics to unrelated
sections. Update the mapping in the scoreData builder so each section in
sections (summary, skills, experience, education, projects) uses a score that
actually reflects that section, ideally by adding section-specific values in
computeATSScore or by deriving them from matching deterministicScoring breakdown
fields; if proxies must remain, document that explicitly in the scoreData
construction. Ensure the unique symbols scoreData,
deterministicScoring.breakdown, and computeATSScore are used to keep the
implementation aligned and easy to locate.
🪄 Autofix (Beta)

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: defaults

Review profile: CHILL

Plan: Pro

Run ID: f490bd44-bfe5-4f00-910f-75c5a4bae1b3

📥 Commits

Reviewing files that changed from the base of the PR and between 42206c8 and 733a3b6.

📒 Files selected for processing (5)
  • backend/src/routes/resume.js
  • backend/src/services/resumeService.js
  • frontend/src/components/ResumeSectionStrengthAnalyzer.jsx
  • frontend/src/pages/Dashboard.jsx
  • frontend/src/services/api.js

Comment thread backend/src/routes/resume.js Outdated
Comment thread backend/src/services/resumeService.js
Comment thread backend/src/services/resumeService.js Outdated
Comment thread frontend/src/components/ResumeSectionStrengthAnalyzer.jsx
Comment thread backend/src/routes/resume.js Outdated
Comment thread backend/src/routes/resume.js Outdated
Comment thread frontend/src/components/ResumeSectionStrengthAnalyzer.jsx
@codeant-ai

codeant-ai Bot commented Jul 8, 2026

Copy link
Copy Markdown

CodeAnt AI finished reviewing your PR.

@codeant-ai

codeant-ai Bot commented Jul 11, 2026

Copy link
Copy Markdown

CodeAnt AI is running Incremental review

@codeant-ai

codeant-ai Bot commented Jul 11, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai Bot added size:L This PR changes 100-499 lines, ignoring generated files and removed size:L This PR changes 100-499 lines, ignoring generated files labels Jul 11, 2026
@codeant-ai

codeant-ai Bot commented Jul 11, 2026

Copy link
Copy Markdown

CodeAnt AI Incremental review completed.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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/src/routes/resume.js`:
- Line 580: Add the existing verifyToken middleware to the router.post('/score',
...) middleware chain before extractAIProvider, preserving the current handler
and AI provider extraction behavior while requiring authentication for score
requests.
🪄 Autofix (Beta)

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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5c0c90f1-0b4d-4942-8402-22535da92487

📥 Commits

Reviewing files that changed from the base of the PR and between 733a3b6 and a4d3cac.

📒 Files selected for processing (3)
  • backend/src/routes/resume.js
  • backend/src/services/resumeService.js
  • frontend/src/components/ResumeSectionStrengthAnalyzer.jsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • backend/src/services/resumeService.js
  • frontend/src/components/ResumeSectionStrengthAnalyzer.jsx

Comment thread backend/src/routes/resume.js
@anuragmishrainsights

Copy link
Copy Markdown
Collaborator

Code Review — PR #4387 (AI-powered resume scoring)

Checked out the branch and reviewed the full diff + supporting code (atsScorer.js, aiKey.js middleware). Overall a clean, well-scoped feature.

🔴 Critical

None — no security leaks, no injection, no crashes on the happy path.

⚠️ Warnings

  1. Hardcoded education score (backend/src/services/resumeService.js): the education section score is hardcoded to 80 for everyone, while the other four sections pull real deterministic ATS values. Either surface a real metric or label it honestly — a constant 80 for every resume undercuts the "deterministic scores" design.
  2. Score↔label mismatch (resumeService.js): projects score is wired to breakdown.keywordMatch and summary to breakdown.formatting. So the "Summary" number is actually a formatting score and "Projects" reflects keyword-match. Labels and numbers describe different things — users will misread them.
  3. No test coverage for the new scoreResumeText service (JSON-parse hardening, 502 path, markdown-strip) or the /score route. CI passes but no tests reference them, and the PR checklist leaves "New tests added" unchecked.

💡 Suggestions

  • JSON extraction is solid (fence-strip → brace-match → parse → 502), but a { inside resume text could make the greedy brace-match grab the wrong span. Low risk.
  • Frontend fetchScore uses AbortController + guarded setState correctly. Minor: the comment says "we might pass abortController.signal" but resumeApi.score doesn't forward it, so the in-flight request isn't cancelled at the network level (harmless given the state guards).

✅ Looks Good

  • Clean removal of the hardcoded /score fake data.
  • Reuses extractAIProvider middleware → no new auth surface; BYOK handling stays consistent.
  • Frontend loading / empty / error states are properly separated (real improvement over the static placeholder).
  • overallScore and breakdown.* keys all exist in atsScorer.js, so no undefined-score bug.

Verdict: Approve with notes — no blockers. The two logic warnings (hardcoded education score, label/score mismatch) are worth fixing before this reaches real users, but neither breaks functionality.

Reviewed via Hermes Agent

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

Labels

size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Implement AI-Powered Resume Scoring (Replace Hardcoded Endpoint)

2 participants