Skip to content

PRD stories US-01 to US-11, US-13, US-14: raw SQL, CRUD, attempts, review queue, Bruno, README - #28

Merged
Kauakb merged 7 commits into
developfrom
feature/prd-must-stories
Oct 31, 2026
Merged

Kauakb merged 7 commits into
developfrom
feature/prd-must-stories

Conversation

@Kauakb

@Kauakb Kauakb commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

Implements the PRD's Must stories (US-01 to US-10, US-13, US-14) and the Should story US-11 (review queue). Only US-12 (stats, Could) is not included.

Review it commit by commit

Commit Stories
0374f2c US-01 /health + DATABASE_URL, US-02 raw SQL (schema.sql, repository.py, test database), US-03 standard errors
22e2c4c US-04 to US-08: problems CRUD, filters, 404/409
0e904c5 US-09, US-10: attempts and history
319a90e US-13: Bruno Errors folder and folder order
2af80b5 US-14: README (+ CLAUDE.md)
df8f658 US-11: GET /review with the PRD formula, Bruno Insights folder, README section (formula, sorted vs heapq)

Big changes

  • SQLAlchemy is gone. The PRD forbids an ORM: SQL is hand-written in repository.py, always with parameters.
  • Layers: route (main.py) → service (services.py) → repository (repository.py).
  • Data model follows the PRD: a single topic, UNIQUE (title, platform), created_at as a date, ON DELETE CASCADE.
  • Tests use a separate database (TEST_DATABASE_URL). CI gets a postgres:18 service.
  • The placeholder routes / and /about and the old review list are removed.

Checks

  • ruff check, ruff format --check, pytest (56 tests) and pip-audit pass locally.
  • The Bruno Runner passed for US-01 to US-10 (before US-11). It needs one more run for the new Insights folder.
  • Still to do by hand: validate the README from a fresh clone (T-14.2) and prepare the demo (T-14.3).

Part of #13, #14, #15, #16, #17, #18, #19, #20, #21, #22, #23, #25, #26, #27. The issues close with the develop → main PR.

🤖 Generated with Claude Code

Kauakb and others added 6 commits October 31, 2026 02:47
…-02, US-03)

- GET /health; the API refuses to start without DATABASE_URL
- schema.sql with NOT NULL, CHECK, UNIQUE (title, platform) and
  ON DELETE CASCADE, run on startup
- repository.py: the only place with SQL, always parameterized (psycopg);
  replaces the SQLAlchemy ORM, as the PRD requires
- services.py domain errors + errors.py handlers: every error is
  {error, message} (+ fields on 422) with the right status
- tests run on a separate test database; CI gets a PostgreSQL service
- placeholder routes / and /about and the old review list are removed

Part of #13, #14, #15

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- POST /problems: title/topic trimmed, topic lowercased, 409 when the
  title already exists on the same platform
- GET /problems with optional topic, difficulty and platform filters
- GET, PATCH (only the fields sent, at least one) and DELETE (204,
  attempts deleted by cascade) on /problems/{problem_id}
- Bruno Problems folder with response tests; Create problem saves
  problem_id for the next requests

Part of #16, #17, #18, #19, #20

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- POST /problems/{problem_id}/attempts: minutes 1-600, confidence 1-5,
  solved strictly true/false, notes optional (default "", max 500),
  created_at is today's date; 404 if the problem doesn't exist
- GET /problems/{problem_id}/attempts: newest first, [] without attempts
- Bruno Attempts folder with response tests

Part of #21, #22

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- one request per error code (404, 405, 409, 422) with response tests
- folders ordered Health, Problems, Attempts, Errors (folder.bru seq),
  so the Runner creates the problem before the requests that use it

Part of #25

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Also updates CLAUDE.md for the raw SQL layers, the test database and CI.

Part of #26, #27

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- review.py: pure functions; urgency = +50 if not solved, +10 per
  confidence point below 5, +1 per day since the attempt (max 30)
- repository.latest_attempts: newest attempt per problem (DISTINCT ON);
  problems without attempts are left out
- GET /review?limit=5 (1-50): highest score first, ties by smaller id
- Bruno Insights folder (/review and /review?limit=2), Errors moved last
- README: endpoint, formula, example, and why sorted over heapq
  (O(n log n) vs O(n log k))

Part of #23

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Kauakb Kauakb changed the title PRD Must stories: raw SQL, problems CRUD, attempts, errors, Bruno, README PRD stories US-01 to US-11, US-13, US-14: raw SQL, CRUD, attempts, review queue, Bruno, README Oct 31, 2026
@Kauakb
Kauakb merged commit fdbc519 into develop Oct 31, 2026
4 checks passed
Kauakb added a commit that referenced this pull request Oct 31, 2026
…3 to US-15) (#31)

Release of the Interview Preparation Tracker v1.0 (PRD) from `develop`
to `main`.

## What's in it
Everything from #28:
- **US-01** `GET /health`; the API refuses to start without
`DATABASE_URL`
- **US-02** PostgreSQL with hand-written SQL (`schema.sql`,
`repository.py`); tests on a separate database
- **US-03** standard error JSON (`NOT_FOUND`, `METHOD_NOT_ALLOWED`,
`CONFLICT`, `VALIDATION_ERROR`, `INTERNAL_ERROR`)
- **US-04 to US-08** problems CRUD with filters, 404 and 409
- **US-09, US-10** attempts and history
- **US-11** review queue `GET /review?limit=5` with the PRD formula
- **US-13** complete Bruno collection (15 requests, all passing in the
Runner)
- **US-14** README
- **US-15** CI: ruff, pytest (with a PostgreSQL service) and pip-audit

## Checks
- 56 pytest tests, ruff and pip-audit pass. CI was green on #28.
- Bruno Runner: 15/15 passed.

## Not included
- **US-12** statistics by topic (#24), a "Could" story. Not built.
- **US-14** stays open until the README is checked in a fresh clone
(T-14.2) and the demo is ready (T-14.3).

Closes #13
Closes #14
Closes #15
Closes #16
Closes #17
Closes #18
Closes #19
Closes #20
Closes #21
Closes #22
Closes #23
Closes #25
Closes #27

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant