refactor(service): M2b — async ports + capabilities #6

Merged
charles merged 1 commit from feat/m2b-async into main 2026-06-17 12:50:19 +00:00
Owner

Roadmap M2b, step 1: make the service layer async so the real sqlx/Postgres persistence can do I/O behind the same ports. Self-contained, still offline-green (no DB yet).

Changes

  • ports: traits async via async-trait (dyn-compatible). TreeStore::put/get/set_owner return Result (DB writes can fail).
  • mem fakes: async signatures, sync bodies.
  • capabilities (validate_tree, build_trip, refine_trip, adopt_session, quota_remaining) now async; refund-on-failure restructured (no async closure).
  • import-slice handler awaits validate_tree; 5 gate/quota tests → #[tokio::test].

Verification

  • just qa green. Slice still serves (manual: 2-person GEDCOM → 2 places, anchors, relevance).

Next: sqlx Postgres impl behind a postgres feature + migrations + DATABASE_URL integration test (qa default stays DB-less). Traces: tech-spec 01/02.

Roadmap **M2b**, step 1: make the service layer **async** so the real sqlx/Postgres persistence can do I/O behind the same ports. Self-contained, **still offline-green** (no DB yet). ## Changes - `ports`: traits async via `async-trait` (dyn-compatible). `TreeStore::put/get/set_owner` return `Result` (DB writes can fail). - `mem` fakes: async signatures, sync bodies. - capabilities (`validate_tree`, `build_trip`, `refine_trip`, `adopt_session`, `quota_remaining`) now async; refund-on-failure restructured (no async closure). - import-slice handler awaits `validate_tree`; 5 gate/quota tests → `#[tokio::test]`. ## Verification - `just qa` green. Slice still serves (manual: 2-person GEDCOM → 2 places, anchors, relevance). Next: sqlx Postgres impl behind a `postgres` feature + migrations + DATABASE_URL integration test (qa default stays DB-less). Traces: tech-spec 01/02.
refactor(service): M2b — make ports + capabilities async
All checks were successful
qa / qa-1 (push) Successful in 41s
qa / qa (push) Successful in 0s
qa / qa-1 (pull_request) Successful in 2m11s
qa / qa (pull_request) Successful in 0s
2242adf4e0
Prerequisite for real (sqlx/Postgres) persistence. Ports and service
capabilities are now async (async-trait for dyn-compatibility); in-memory fakes
keep synchronous bodies behind async signatures. TreeStore::put/get/set_owner
now return Result (DB writes can fail). Capabilities, the import-slice handler,
and the 5 gate/quota tests updated to await; tests are #[tokio::test].

Behaviour unchanged — slice still serves (verified), just qa green. Still no DB:
the Postgres-backed impl lands next behind the same ports + a feature flag.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/geneatrip!6
No description provided.