Skip to content

fix: improve recommendation input validation for unsupported values (#676)#677

Closed
mishtiagrawal02-cloud wants to merge 1 commit into
komalharshita:mainfrom
mishtiagrawal02-cloud:fix/input-validation-676
Closed

fix: improve recommendation input validation for unsupported values (#676)#677
mishtiagrawal02-cloud wants to merge 1 commit into
komalharshita:mainfrom
mishtiagrawal02-cloud:fix/input-validation-676

Conversation

@mishtiagrawal02-cloud
Copy link
Copy Markdown

Summary

This PR improves recommendation input validation by adding stricter checks for unsupported values in recommendation inputs.

Previously, validation only checked for missing fields, which allowed unsupported values (such as invalid time availability, unsupported experience levels, or unsupported interests) to reach recommendation logic and potentially cause inconsistent behavior. This update validates allowed values and returns meaningful validation errors. Additional tests were added to cover invalid input cases.

Related Issue

Closes #676

Type of Change

  • Bug fix — resolves a broken behaviour
  • Feature — adds new functionality
  • Data — adds new projects to data/projects.json
  • Documentation — updates docs, README, or code comments only
  • Style — CSS or visual changes only, no logic change
  • Refactor — restructures code without changing behaviour
  • Test — adds or updates tests

What Was Changed

File Change made
utils/recommender.py Added stricter validation for unsupported values in level, interest, and time availability
tests/test_basic.py Added test cases for invalid recommendation inputs

How to Test This PR

  1. Checkout this branch:
    git checkout fix/input-validation-676
    
  2. Run tests:
python tests/test_basic.py
  1. Verify:
  • Invalid level values are rejected
  • Invalid interest values are rejected
  • Invalid time availability values are rejected
  • Existing valid inputs continue working

Expected result:

44 passed, 0 failed out of 44 tests

Test Results

44 passed, 0 failed out of 44 tests

Self-Review Checklist

  • I have read CONTRIBUTING.md and followed guidelines
  • I ran tests locally
  • I have not introduced debug statements
  • I have not modified unrelated files outside issue scope

Notes for Reviewer

This PR improves recommendation input validation by rejecting unsupported values and adds test coverage for invalid input cases.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 28, 2026

@mishtiagrawal02-cloud is attempting to deploy a commit to the komalsony234-1530's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Thank you for submitting your first pull request to DevPath.

Before review:

  • Complete the PR template fully
  • Ensure all tests pass
  • Link your PR to an issue
  • Keep changes scoped to the issue

A maintainer will review your contribution soon.

@komalharshita
Copy link
Copy Markdown
Owner

Thank you for the contribution.

I reviewed the changes and appreciate the additional test coverage and effort to improve validation.

However, this implementation introduces hardcoded lists of supported interests, levels, and time values directly in the backend. This creates a maintenance burden and can easily become inconsistent with the actual options available in the application as new categories are added or existing ones change.

Because the validation logic relies on duplicated hardcoded values rather than a centralized source of truth, it may reject valid future inputs and make the system harder to maintain.

For these reasons, I’m closing this pull request. A future validation improvement should derive allowed values from a shared configuration rather than duplicating them in multiple places.

Thank you for contributing to DevPath.

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

Labels

gssoc:invalid This doesn't seem right gssoc-2026

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Improve recommendation input validation for unsupported values

2 participants