PH0.2 — API skeleton: core, router discovery, healthz, db + audit hook, alembic 0001, CLI #4

Closed
opened 2026-09-11 09:02:07 +00:00 by bart · 2 comments
Collaborator

Parent

Row PH0.2 in docs/12-implementation-plan.md (branch, owned paths and doc section are defined there).

What to build

The backend package runs as a FastAPI app with all dependencies declared up front, discovers routers and CLI commands by package walk (no registration lists), answers /api/v1/healthz and /metrics, returns RFC 9457 problem details with urn:polaris:error:<code>, and migrates the platform tables task, audit_log, setting. The audit before_flush hook and the sealed root test conftest are in place.

Acceptance criteria

  • GET /api/v1/healthz returns green against a running Postgres; /metrics responds
  • A router module dropped into the routers package is mounted without editing any shared file
  • alembic upgrade head and downgrade base succeed for 0001 (task, audit_log, setting)
  • An unhandled domain error is returned as a problem-details body with a urn:polaris:error: type and request id
  • polaris openapi writes the spec; ruff, mypy --strict and pytest are green; backend Dockerfile builds

Blocked by

  • None (can start immediately)
## Parent Row **PH0.2** in `docs/12-implementation-plan.md` (branch, owned paths and doc section are defined there). ## What to build The backend package runs as a FastAPI app with all dependencies declared up front, discovers routers and CLI commands by package walk (no registration lists), answers `/api/v1/healthz` and `/metrics`, returns RFC 9457 problem details with `urn:polaris:error:<code>`, and migrates the platform tables `task`, `audit_log`, `setting`. The audit `before_flush` hook and the sealed root test conftest are in place. ## Acceptance criteria - [x] `GET /api/v1/healthz` returns green against a running Postgres; `/metrics` responds - [x] A router module dropped into the routers package is mounted without editing any shared file - [x] `alembic upgrade head` and `downgrade base` succeed for `0001` (task, audit_log, setting) - [x] An unhandled domain error is returned as a problem-details body with a `urn:polaris:error:` type and request id - [x] `polaris openapi` writes the spec; `ruff`, `mypy --strict` and `pytest` are green; backend Dockerfile builds ## Blocked by - None (can start immediately)
Author
Collaborator

Starting PH0.2 on branch feature/api-skeleton.

Owns (per docs/12-implementation-plan.md row PH0.2): backend/** except worker/ and auth.py. Delivering backend/pyproject.toml (all backend deps up front), polaris.core, polaris.api (app factory, router discovery, /api/v1/healthz, /metrics, request-id middleware, RFC 9457 handler), polaris.db (engine/session/Base/audit before_flush hook), Alembic 0001 (task, audit_log, setting), polaris.cli (discovery + openapi command), sealed root backend/tests/conftest.py, backend/Dockerfile.

Not touching worker/ or auth.py (left for #6 / #7), and not creating polaris.contracts / polaris.domain yet (later tickets).

Starting PH0.2 on branch `feature/api-skeleton`. Owns (per docs/12-implementation-plan.md row PH0.2): `backend/**` except `worker/` and `auth.py`. Delivering `backend/pyproject.toml` (all backend deps up front), `polaris.core`, `polaris.api` (app factory, router discovery, `/api/v1/healthz`, `/metrics`, request-id middleware, RFC 9457 handler), `polaris.db` (engine/session/Base/audit `before_flush` hook), Alembic `0001` (task, audit_log, setting), `polaris.cli` (discovery + `openapi` command), sealed root `backend/tests/conftest.py`, `backend/Dockerfile`. Not touching `worker/` or `auth.py` (left for #6 / #7), and not creating `polaris.contracts` / `polaris.domain` yet (later tickets).
bart stopped working 2026-09-11 10:15:09 +00:00
24 minutes 16 seconds
Author
Collaborator

PR opened: #51 (branch feature/api-skeleton -> develop). All acceptance criteria checked above; ruff/mypy --strict/pytest (unit + testcontainers integration) green, alembic upgrade head/downgrade base verified against a real running Postgres, docker build backend/ succeeds. Stopwatch stopped.

PR opened: https://git.xor.nu/patrick/Polaris/pulls/51 (branch `feature/api-skeleton` -> `develop`). All acceptance criteria checked above; ruff/mypy --strict/pytest (unit + testcontainers integration) green, `alembic upgrade head`/`downgrade base` verified against a real running Postgres, `docker build backend/` succeeds. Stopwatch stopped.
bart closed this issue 2026-09-11 10:17:35 +00:00
Sign in to join this conversation.
No labels
ready-for-agent
No milestone
No project
No assignees
1 participant
Notifications
Total time spent: 24 minutes 16 seconds
bart
24 minutes 16 seconds
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
patrick/Polaris#4
No description provided.