Skip to content

refactor: improve grade route error handling and coverage#12

Draft
lautaropaske wants to merge 3 commits intomainfrom
fix/grade-error-handling
Draft

refactor: improve grade route error handling and coverage#12
lautaropaske wants to merge 3 commits intomainfrom
fix/grade-error-handling

Conversation

@lautaropaske
Copy link
Copy Markdown
Contributor

Summary

  • normalize app-generated /api/grade failures to structured JSON while preserving the existing client fallback for upstream plain-text 413 responses
  • add direct handler coverage for /api/grade success, invalid request, invalid PDF, and unexpected error paths plus regression coverage for the resume-checker error parser
  • add a minimal Vitest alias config so the route tests can import repo aliases without adding new dependencies

Testing

  • bunx vitest run src/pages/api/grade.test.ts
  • bunx vitest run src/resume-checker/utils.test.ts
  • bunx tsc --noEmit
  • local API QA via curl for GET /api/grade?url=public/a_resume.pdf, malformed multipart POST /api/grade, and PUT /api/grade

Known issue

  • bun run build still fails because the repo currently has a React version mismatch (react@19.2.0 vs react-dom@19.2.3); this branch does not change those dependencies

lautaropaske and others added 3 commits April 15, 2026 21:56
Normalize plain-text grade failures so oversized uploads and upstream text responses surface as user-readable errors instead of JSON parse exceptions.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Add direct handler coverage for the grade route and lock the client-side fallback cases so JSON and plain-text error paths stay verifiable without new test dependencies.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Return structured JSON for app-generated grade route failures so invalid request, invalid PDF, and unexpected error paths stay machine-readable while preserving the existing upload flow.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
open-silver Error Error Apr 16, 2026 3:26am

Request Review

@lautaropaske lautaropaske changed the title Improve grade route error handling and coverage refactor: improve grade route error handling and coverage Apr 16, 2026
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.

1 participant