Skip to content

[Bug/Improvement] Backend Crashes, Missing Validation, Logging & Test Count Fixes #1015

@Ketan444

Description

@Ketan444

@imDarshanGK

🐛 Bug Report & Code Quality Improvements

Summary

After reviewing the repository, here are several bugs, debugging issues, and improvements identified across the backend, frontend, and documentation.


🔴 Bugs

1. README / project tree references auth.py router that may not exist

  • File path: backend/app/routers/auth.py
  • If imported in main.py but missing, the app will crash on startup with ImportError
  • Fix: Either add the file or remove the reference from the README and main.py

2. No cold-start handling in frontend for Render free tier

  • First request after inactivity takes 30–60 seconds but the frontend shows no loading state
  • Users see a silent timeout/failure with no feedback
  • Fix: Add a "Server is waking up, please wait..." indicator with a 60s timeout

3. Language auto-detection has no documented failure behavior

  • When language is omitted and detection fails, there is no defined fallback response
  • Fix: Return a clear error or default to "unknown" with a warning in the response

🟡 Debugging / Code Quality

4. No input length validation on code field

  • Very large payloads can exhaust memory during pattern matching
  • Fix: Add a Pydantic validator e.g. max_length=50000 on the code field in schemas.py

5. Rate limiting breaks behind Render's reverse proxy

  • Per-IP rate limiting may treat all users as one IP behind a shared proxy
  • Fix: Use X-Forwarded-For header or switch to a token/session-based limiter

6. Test count in README is wrong (says 22, actually 52)

  • Misleads contributors about test coverage
  • Fix: Update README to reflect the real test count

7. No structured logging

  • Errors in production are invisible without logging or loguru
  • Fix: Add a basic logging setup in main.py with request/response logging middleware

8. CI Python versions may not match Dockerfile

  • CI tests 3.11 + 3.12 but Dockerfile base image version is unverified
  • Fix: Pin the same Python version in both ci.yml and Dockerfile

🟢 Improvements

9. No frontend paste size limit

  • Users can paste unlimited code; add a client-side size check before sending

10. Quality score breakdown not exposed

  • The 0–100 score is opaque; expose sub-scores (documentation, error handling, types, tests) in the API response

11. Add CHANGELOG.md

  • With 248+ commits and active GSSoC contributors, a changelog helps track progress

12. LLM code paths have zero test coverage in CI

  • Add mock-based tests for ai_provider.py so LLM integration doesn't silently break

Environment

  • Backend: FastAPI 0.115+, Python 3.12
  • Frontend: Vanilla JS / HTML5
  • Deployment: Render (free tier)

Labels suggested

bug, documentation, good first issue, enhancement

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions