feat: add provider-independent quiz output validation rules#415
Open
Xenon010101 wants to merge 2 commits into
Open
feat: add provider-independent quiz output validation rules#415Xenon010101 wants to merge 2 commits into
Xenon010101 wants to merge 2 commits into
Conversation
- Pydantic schemas for MCQ and SUBJECTIVE question types - Field validation: option count, unique options, correct-answer membership - Presence validation for explanations, marks boundary checks - Cross-question duplicate detection via difflib similarity - Rejection of unsupported question types - Field-level ValidationErrorDetail with repair hints - 26 parameterized test cases covering valid and invalid fixtures
|
@Xenon010101 is attempting to deploy a commit to the Adarsh's projects Team on Vercel. A member of the Team first needs to authorize it. |
- Python export script (scripts/export-openapi.py) generates FastAPI OpenAPI schema without DB, model downloads, or Groq - Golden spec (openapi.golden.json) as committed baseline - TypeScript contract tests (src/__tests__/contract.test.ts) validate: - All expected path/method combinations exist - Response schemas and status codes match golden spec - Auth headers (X-Internal-API-Key) are correctly applied - Error response schemas (HTTPValidationError, ValidationError) - Enum values match TypeScript expectations - Breaking path/field/nullability changes are detected - CI job exports spec from FastAPI and runs contract tests - One-command regeneration: pnpm contract:update-golden - Documentation in services/ai/README.md
MRIARC-08
requested changes
Jun 25, 2026
MRIARC-08
left a comment
Owner
There was a problem hiding this comment.
@Xenon010101 The Python quiz validation part looks solid, but this PR also includes the shared contract-test scaffolding, and that part fails the Node checks.
Local checks:
- From
services/ai,.venv/bin/python -m pytestpasses: 31 tests. - From
services/ai,.venv/bin/python -m ruff check .passes. pnpm exec tsc --noEmitfails insrc/__tests__/contract.test.ts: missingbeforeAllimport,OpenApiSpec.securityis not typed,specis used outside its scope, andpathItemisunknown.pnpm exec eslint src/__tests__/contract.test.tsfails on explicitanytypes and an unusedpathvariable.pnpm test src/__tests__/contract.test.tsfails from a clean checkout becauseservices/ai/openapi.jsonis missing, then the idempotency suite referencesspecout of scope.
Please either fix the contract-test scaffolding here or split this PR so the Python quiz validation can be reviewed independently from the OpenAPI contract test work.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #374
Summary
Implements provider-independent quiz output validation for the AI backend, covering all acceptance criteria from the issue.
What's included
Pydantic schemas (\schemas/quiz.py)
Validation rules
epair_hint\ for controlled repair
Tests (26 cases)