PH0.2 — API skeleton: core, router discovery, healthz, db + audit hook, alembic 0001, CLI #51
No reviewers
Labels
No labels
in-progress
in-review
ready-for-agent
seam-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
patrick/Polaris!51
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/api-skeleton"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
PH0.2 — API skeleton:
polaris.core,polaris.api(router discovery,/healthz,/metrics,request-id middleware, RFC 9457 problem-details handler),
polaris.db(models, session, auditbefore_flushhook), Alembic0001(task,audit_log,setting),polaris.cli(commanddiscovery,
api/openapisubcommands), sealed roottests/conftest.py,backend/Dockerfile.Closes #4. Row PH0.2 in
docs/12-implementation-plan.md.Acceptance criteria
GET /api/v1/healthzreturns green against a running Postgres;/metricsrespondsalembic upgrade headanddowngrade basesucceed for0001(task, audit_log, setting)urn:polaris:error:type and request idpolaris openapiwrites the spec;ruff,mypy --strictandpytestare green; backend Dockerfile buildsNotes for reviewers
backend/**exceptworker/andauth.py(both left untouched for #6/#7);polaris.contractsand
polaris.domainare not created here (later tickets).sa.Enum(..., create_type=False)silently dropscreate_typein the SQLAlchemyversion pinned by
uv.lock— the migration usespostgresql.ENUM(..., create_type=False)instead so the enum type isn't created twice by
create_table's own DDL event. Commit messageon the migration has the detail.
psycopg, alembic, ortools, structlog, apscheduler, pydantic-settings, httpx), so
/metricsis asmall hand-rolled Prometheus text exposition rather than
prometheus-client— swapping it inlater is a one-file change (
polaris/api/metrics.py).postgres:16-alpine(already cached locally) rather than the compose stack'spostgis/postgisimage: nothing before PH1.2 needs a PostGIS type, so tests don't depend onpulling a large image over the network. PH1.2 will need to switch this fixture's image when
geography-typed tables land.
Test plan
ruff check ./ruff format --check .— cleanmypy --strict(src/) — cleanpytest -m "not integration"— 22 passedpytest -m integration(testcontainers Postgres) — 8 passedalembic upgrade head/alembic downgrade baseagainst a real running Postgres containerpolaris openapiwritesbackend/openapi.json(committed)docker build backend/— succeeds; smoke-testedpolaris --helpandpolaris openapiinside the built image🤖 Generated with Claude Code
https://claude.ai/code/session_013YioTVKBPoE6thZqbnTtnM