Add scoring reports for the newz repo milestones M1 through M6, with verification notes and remediation steps for each. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
5.1 KiB
5.1 KiB
M2: Setup Backend - Score Report
Repository scored: ../newz (/home/daniel/Gitea/daniel/newz), backend/ working tree
Rubric: milestone/m2-setup-backend-scoring.md
Model: qwen3.5-9b
Total Score: 17 / 25 base (+3 bonus, 20 with bonus)
As delivered, the score is 0. backend/config.py defines both model_config and class Config, which Pydantic v2 rejects with PydanticUserError: "Config" and "model_config" cannot be used together. The application cannot be imported, so every test errors at collection. The rubric states that a score of 0 applies when "application won't run". The scores below assume that one line is fixed.
Scoring by Criterion
| Criterion | Score | Max | Notes |
|---|---|---|---|
| Application Structure | 2 | 2 | All expected folders and files present: api/v1, core, db, models, schemas, tests, main.py, config.py, requirements.txt, Dockerfile, .gitignore, pytest.ini, README.md. |
| Database Setup | 2 | 2 | SQLAlchemy engine and session configured for SQLite via DATABASE_URL. Volume mapping in docker-compose.yml. |
| Models Implementation | 2 | 2 | Article, Author and Category have the specified fields, foreign keys and relationships. No cascade deletes or extra indexes, so not 3. |
| Endpoints | 2 | 2 | GET /health and GET /api/v1/version return correct JSON. /api/v1/health is not implemented, though a test expects it. |
| Documentation | 2 | 2 | backend/README.md (200 lines) covers endpoints with examples, startup, configuration table and schema. It overstates some things: CORS is configured but no middleware is added, and it says foreign keys are enforced, which SQLite does not do by default. |
| Test Infrastructure | 3 | 3 | pytest.ini, conftest.py, and all three test files present. pytest and pytest-asyncio are in requirements.txt. |
| Test Coverage | 1 | 3 | 8 of 16 tests fail (see below). Coverage is 68%, which is above 50% but below the 70% target. |
| Docker Support | 1 | 2 | Dockerfile present and reasonable, but not built here. Once the config bug is fixed, the container should start. Also backend/.gitignore lists Dockerfile, so git ignores it and it would not be committed. |
| Code Quality | 2 | 3 | Type hints, docstrings, and separated models, schemas and session. Exception handlers exist for ValidationError and generic Exception. But RequestValidationError is not handled, so 422 responses use FastAPI's default format rather than the "standardized" format the README describes. |
| Base total | 17 | 25 |
Bonus
| Bonus | Awarded | Reason |
|---|---|---|
| +1 Schema-level input validation | Yes | Pydantic Field constraints on all schemas. |
| +2 README with startup instructions and config examples | Yes | Local and Docker startup, environment variable table. |
| +3 Docker Compose setup | Not counted | docker-compose.yml exists, but the rubric's +3 also lists performance optimizations, which are absent. |
Bonus total: +3.
Test Results
Run in a temporary copy with the config.py fix and httpx added. Results: 8 failed, 8 passed, 68% coverage.
Failures:
test_health.py::test_api_v1_health_exists:/api/v1/healthis not implemented.test_models.py::test_author_unique_constraintsandtest_category_unique_constraints: the duplicate-insert checks are fragile, and the assertion logic is wrong.test_models.py::test_article_creationandtest_article_default_published: SQLAlchemy errors when committing against the test database.test_models.py::test_tables_exist: the test database has no tables, so the fixture does not create them.test_models.py::test_foreign_keys_exist:NameError,db_engineis not in scope.test_version.py::test_version_format: asserts the version starts withv, but the endpoint returns0.1.0. The test and the README disagree.
Other Issues Found
config.pyimport failure. Remove theclass Configblock, which duplicatesmodel_config. This blocks the whole application.requirements.txtis missinghttpx. Starlette'sTestClientrequires it, so the test suite cannot collect without it.backend/.gitignoreignoresDockerfile. Remove that line so the Dockerfile is committed.- Git state.
backend/anddocker-compose.ymlare untracked. Them2commit onmaincontains only the prompt file. - Version format.
APP_VERSIONis0.1.0, but the test and the prompt's example expectv0.1.0. Pick one and align the test and the README. Dockerfilecopies the wholebackend/folder, includingtests/and any local.env. Consider a.dockerignore.
Path to a Higher Score
- Fix
config.py, addhttpxtorequirements.txt, and removeDockerfilefrombackend/.gitignore. - Make the
test_models.pytests create tables and use properIntegrityErrorassertions, and fix thedb_enginereference. - Align the version format between code, tests and README.
- Add
/api/v1/health, or remove its test and README reference. - Add a
RequestValidationErrorhandler that returns the standardized error format. - Build and run the Docker image to confirm it works.