Skip to content

feat: add robust validation and 100% branch coverage for _derive_grade#63

Open
BHOGALA-SRIKA wants to merge 2 commits into
jpdevhub:mainfrom
BHOGALA-SRIKA:feat/test-grade-derivation
Open

feat: add robust validation and 100% branch coverage for _derive_grade#63
BHOGALA-SRIKA wants to merge 2 commits into
jpdevhub:mainfrom
BHOGALA-SRIKA:feat/test-grade-derivation

Conversation

@BHOGALA-SRIKA
Copy link
Copy Markdown

Closes #10

Description

This PR resolves the issue tracking critical business logic testing for the backend grading utility. It introduces comprehensive validation checking and branch coverage for _derive_grade in main.py to prevent regression bugs.

Changes Made

  • Type Validation: Added explicit type checks using isinstance to catch and gracefully reject non-numeric inputs (str, NoneType, list, bool), raising a clean ValueError instead of unhandled runtime crashes.
  • Scale Boundaries: Implemented strict value limits ensuring inputs reside safely between 0 and 100 inclusive.
  • Test Isolation Mocks: Configured sys.modules interception in tests/test_ci.py to isolate tests from heavy third-party framework layers (torch binary paths and supabase network connections), dropping local CI suite test execution to < 2 seconds.

Checklist

  • npm run lint passes with no errors
  • npm run build compiles without TypeScript errors
  • python -m pytest passes (including new tests I added)
  • No .env files, API keys, secrets, model weights, or __pycache__ in this diff
  • Branch is rebased on main, not merged

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 2, 2026

@BHOGALA-SRIKA is attempting to deploy a commit to the karan3431's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 2, 2026

🎉 Thank you for your Pull Request! We're thrilled to have your contribution to FreshScan AI.

Before we review, please make sure you have:

  • Followed the CONTRIBUTING.md guidelines.
  • Ensured all automated CI checks (linting, tests) are passing.
  • Checked that your commit messages follow the Conventional Commits format.

A maintainer will review your code as soon as possible!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

QA-01: Unit Test Coverage for Grade Derivation Logic

1 participant