backend: cargo workspace and api skeleton #3

Open
opened 2026-11-15 22:24:07 -05:00 by forgejo_admin · 2 comments
Owner

Workspace crates/dongba-{core,api,collab,worker} with rgxr's lint policy (no unwrap/expect).

  • axum api: /healthz, /readyz (MariaDB + RGW), /api/v1/version, /api-docs serving openapi.yaml
  • sqlx MySQL pool; every connection runs SET time_zone = '+00:00'
  • UUIDv7 ids (uuid crate) mapped to BINARY(16)
  • database errors are caught and handled in the api (the database only rolls back and re-raises):
    • SQLSTATE 45000 / 1644 <kind>: <detail> → Error.code + HTTP status
    • 1062 duplicate → 409; 1451/1452 foreign key → 409/400
    • 1213 deadlock and 1205 lock wait timeout → retry the transaction up to 3 times with jittered backoff, then 503
    • lost connection → 503 and /readyz red
    • the mapping table documented in docs/reference.md (it goes into the informe)
  • config from env (DONGBA_*), documented in docs/reference.md

Conventions — CLAUDE.md and PLAN.md at the repo root.

Workspace `crates/dongba-{core,api,collab,worker}` with rgxr's lint policy (no unwrap/expect). - [ ] axum api: `/healthz`, `/readyz` (MariaDB + RGW), `/api/v1/version`, `/api-docs` serving openapi.yaml - [ ] sqlx MySQL pool; every connection runs `SET time_zone = '+00:00'` - [ ] UUIDv7 ids (`uuid` crate) mapped to `BINARY(16)` - [ ] database errors are caught and handled in the api (the database only rolls back and re-raises): - SQLSTATE 45000 / 1644 `<kind>: <detail>` → `Error.code` + HTTP status - 1062 duplicate → 409; 1451/1452 foreign key → 409/400 - 1213 deadlock and 1205 lock wait timeout → retry the transaction up to 3 times with jittered backoff, then 503 - lost connection → 503 and `/readyz` red - the mapping table documented in docs/reference.md (it goes into the informe) - [ ] config from env (`DONGBA_*`), documented in docs/reference.md **Conventions** — CLAUDE.md and PLAN.md at the repo root.
Collaborator

@yuuhikaze this issue blocks #45, #10, #4 and has not been started (16 h).

— automation (scripts/watch.py)

@yuuhikaze this issue blocks #45, #10, #4 and has not been started (16 h). — automation (scripts/watch.py) <!-- watch:ready:2026-11-17T00:00:00+00:00:1 -->
Collaborator

@yuuhikaze this issue blocks #45, #10, #4 and has not been started (32 h). Escalated to #40.

— automation (scripts/watch.py)

@yuuhikaze this issue blocks #45, #10, #4 and has not been started (32 h). Escalated to #40. — automation (scripts/watch.py) <!-- watch:ready:2026-11-17T00:00:00+00:00:2 -->
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
k8s-services/dongba#3
No description provided.