Services — index

The per-service catalog (endpoints, tables, events, state machines) lives in Antora, the canonical docs site. This file is only a thin per-service index, so agents know what exists and where to read the authoritative detail — it is not a catalog itself. Add or maintain detail in the Antora pages, not here. For anything not answered below, start at docs/modules/ROOT/index.adoc.

Ports + databases: Devstack § Services and Ports.

Service Port / DB Endpoints Tables State machines

craig-rules

8001 / craig_rules

api/craig-rules.adoc

data-model-rules.adoc

—

craig-cases

8002 / craig_cases

api/craig-cases.adoc

data-model-cases.adoc

state-machines.adoc

craig-placement

8003 / craig_placement

api/craig-placement.adoc

data-model-placement.adoc

state-machines.adoc

craig-exchange

8004 / craig_exchange

api/craig-exchange.adoc

data-model-exchange.adoc

state-machines.adoc

craig-financial

8005 / craig_financial

api/craig-financial.adoc

data-model-financial.adoc

state-machines.adoc

craig-reporting

8006 / craig_reporting

api/craig-reporting.adoc

data-model-reporting.adoc

state-machines.adoc

craig-security

8007 / craig_security

api/craig-security.adoc

data-model-security.adoc

state-machines.adoc

craig-security-issuer

8011 / craig_security (login craig_security_issuer; ADR-085 D2)

api/craig-security-issuer.adoc (GET /identity/jwks), /livez, /readyz; not yet trusted (see NOTE below)

data-model-security.adoc § Signing-key registry

—

craig-intake

8008 / — (stateless edge, ADR-017)

api/craig-intake.adoc

none — adrs/adr-017-stateless-intake.adoc

state-machines.adoc

craig-intake-keyring

8010 / craig_intake_keyring (ADR-042 §D8 amendment)

craig-intake-keyring.adoc

services/craig-intake-keyring/migrations/20260826120000_signer_keys_and_replay.sql

key lifecycle in craig-intake-keyring.adoc

craig-composition

8009 / craig_composition

api/craig-composition.adoc

adrs/adr-035-composition-layer-engine.adoc (composition_overrides §5)

—

craig-web

8080 / — (BFF, ADR-004)

adrs/adr-004-bff-pattern.adoc

none (stateless)

—

craig-portal

8080 (devstack host 8081) / — (caregiver portal BFF, ADR-076)

plans/archive/portals.adoc § Host

none (stateless)

—

craig-cli

binary craig

cli.adoc

—

—

craig-cases hosts the service-only AFCARS persons export, POST /v1/cases/persons/afcars-export (#2121, plan afcars-pipeline-sources D5): craig-reporting only (a relayed actor refused), no-store, keyed by (child, case) and (adult, role) with anchors; one case.person_pii_exported per page that releases a person.
craig-cases serves the IV-E determination input surface, GET /v1/cases/ive-surface (#1719, plan ive-determination-inputs D5). It returns the inputs the configured {j}-ive-eligibility ruleset declares, with the ruleset’s full (rule_set_id, revision) identity, and the determination act refuses an answer the surface does not declare. The declaration is documented in Rule Set Patterns § metadata.ive.
craig-cases serves the safety assessment fact surface, GET /v1/cases/safety-surface (#3104). It returns the facts the configured {j}-safety-assessment ruleset declares, with the ruleset’s full (rule_set_id, revision) identity. The safety-assessment act evaluates exactly those facts: it refuses an answer the surface does not declare and an answer set that leaves a declared fact out, and it stores the facts with the identity of the evaluation that decided them. The declaration is documented in Rule Set Patterns § metadata.safety.
craig-placement also hosts the caregiver portal surface /v1/placement/portal/* (ADR-076): the enrollment act (#1848) and the projections (#1851 — the five reads units / units/{unit} / …/training / …/documents / …/documents/{doc_id}/download and the training-certificate upload), plus the service-only GET /v1/placement/internal/caregiver-bindings?sub= craig-financial reads per request (outside the portal path allowlist). #634 (ADR-037 §4–§7, ADR-076 D10): the same host is the first field-ownership tenant — the caregiver’s POST …/portal/units/{unit}/proposals, the staff queue GET /v1/placement/field-proposals + …/{id}/accept / reject, the pending_edits_foster_home_portal table and the fail-closed field_ownership.toml (the jurisdiction layer’s) boot gate (placement is a state-bundle consumer since #634). The two-token channel’s test helper lives in craig_test_lib::portal_subject. #2119 (P-D1 of #1965): the service-only GET /v1/placement/afcars-export serves the AFCARS source rows to craig-reporting only (a relayed token is refused), answers no-store, and stages one placement.afcars_released audit per non-empty page.
craig-financial hosts the portal’s second surface, GET /v1/financial/portal/units/{unit}/payments (#1852 — the nine-key payments projection, authorised on every request by the placement bindings read above, audited as financial.portal_read), and the knob-gated caregiver hard check at ERR create-active / SG-NRSG activation (CRAIG_FINANCIALSUBSIDY_CAREGIVER_CHECKENABLED, default OFF = report-only; configuration-reference.adoc). #2123 (P-D1 of #1965): craig-financial’s first service-only route, GET /v1/financial/afcars-facts, answers craig-reporting only (a relayed token is refused), answers no-store, pages the child ids behind AFCARS (b)(18) (a title IV-E maintenance payment issued in the window, Federal reimbursement claimed or intended) and stages no audit (ids only).
craig-security hosts the worker→admin-unit registry (#1899, ADR-077 D1–D2) under /v1/security/admin/workers/{sub}/admin-units: POST (assign — body { client_request_id, admin_unit_id }, ADR-062 claim security.assign_worker_admin_unit; typed 400 ADMIN_UNIT_NOT_BINDABLE for a non-county / inactive row, 404 for an unknown registry id, 409 ADMIN_UNIT_ALREADY_BOUND for a live duplicate pair), GET (the worker’s LIVE bindings), GET …/{id} (live OR revoked) and DELETE …/{id} (soft revoke, If-Match = version REQUIRED, replay 200) — authority ResourceType::WorkerAdminUnit (admin; readonly read / list; service DENY). A registry row with a live binding refuses PUT / DELETE /v1/security/admin/units/{id} with 409 ADMIN_UNIT_BOUND. Both acts land in audit_log as assign_admin_unit / revoke_admin_unit on worker_admin_unit / {binding_id}. Operator surface: craig worker-unit assign | revoke | list (cli.adoc); tables in data-model-security.adoc. GET /v1/security/worker-identities/admin-units?jurisdiction=<key> (#1900, ADR-077 D4) is the service-only snapshot { registry_generation, units: { sub → [unit_name] } } of the QUERY jurisdiction’s LIVE county bindings — generation read FIRST, then the rows, in one transaction; Cache-Control: no-store; a worker bearer, direct or relayed (X-Craig-Actor), 403 before the engine (#2339), an unknown key 400 INVALID_ENUM_VALUE (jurisdiction); admitted by the {j}-authz-worker_identity 1.3.0 admin_units projection row for every service principal (403 until promoted). PUT /v1/security/admin/workers/{sub}/contact (#1857) is the admin-only write of a caseworker’s agency work line ({ contact_phone }: E.164 sets, null clears, anything else 422; a never-seen worker 404) — it answers the WorkerContact card under Cache-Control: no-store and stages security.worker_identity.contact_changed. POST /v1/security/worker-identities/contacts (#1857) is the service-only batched contact projection (≤ 50 subs → { sub → { display_name, contact_phone } }, no-store) that craig-placement’s portal unit projection reads, admitted by the #1857 {j}-authz-worker_identity contact row (403 until promoted). The #1850 POST /v1/security/worker-identities/display-names arm it replaced is retired (#2525) and answers 404.
craig-security-issuer (#2741, plan internal-token-issuer U4, ADR-085 D2) is craig-security’s image run as craig-security issuer: the internal token issuer’s own process, which depends on its database alone (no RabbitMQ, craig-rules, Keycloak or object store) and logs in as craig_security_issuer (never the app login; a boot probe refuses any login outside D2’s matrix, and a craig_security_app pool by name). It makes itself non-dumpable first, then probes, checks the schema and publishes its first in-memory ES256 key into identity_signing_keys. It binds its listener only once that key’s 60 s staged lead has passed, so a booting replica refuses connections instead of answering token requests it cannot sign (#3152); /readyz then answers 200 while the database answers and a key signs. It serves only /identity/, /livez and /readyz. GET /identity/jwks (#2742, U5, ADR-085 D9) is unauthenticated: the registry’s published, unrevoked keys by the database clock (created_at ≤ now < publish_until, so a staged key before it signs and a retiring one until publish_until), newest first, at most 64, as ES256 JWKs within 64 KiB, read through the issuer login (SELECT only), never from a replica’s ring. Each replica memoizes the set for under 5 s, single-flight, and sends the read’s age in Age (Cache-Control: no-cache); a failed read is a 503 problem and clears the memo, never an older set. The issuer’s own subject-token checks (U12) resolve a kid through the same memo (identity::key_source). The issuer has its own OpenAPI document (#2978, ADR-085 D9), printed by craig-security issuer --print-openapi and rendered by cargo xtask api-docs as api/craig-security-issuer.adoc; it lists the /identity/ routes and craig-security’s ordinary document lists none of them. The registration gate holds a craig-security handler on a path the issuer’s router claims to the issuer’s document alone, and the JWKS’s // authz: skip row is keyed craig-security-issuer. The token endpoint arrives with U6. Not yet trusted: no receiver trusts it and no sender calls it until the switch (ADR-085 D15).

All paths are under docs/modules/ROOT/pages/. Events (each service’s published/subscribed routing keys) are documented in adrs/adr-003-rabbitmq-topology.adoc; the security service subscribes to everything as the wildcard # audit subscriber. Shared/library crates are indexed separately, in shared-crates.adoc.

Cross-cutting conventions (agent guidance — detail in Antora)

  • Sort & search: every paginated list endpoint accepts search (ILIKE), sort_by (whitelisted via validated_sort_column() — sort columns are format!()-injected only AFTER whitelist validation, never from raw input), and sort_dir (asc/desc, default DESC). See implementation-guide.adoc § Pagination.

  • Pagination: PageRequest/PageResponse<T> — default page=1, per_page=25, max 500 (implementation-guide.adoc § Pagination).

  • Worker supervision & readiness (#1186, ADR-061): every background worker registers on the process Supervisor, per a per-service manifest. A worker marked Critical dying triggers a fail-fast nonzero exit; one that’s knob-disabled shows up as a visible Disabled instead. /readyz gates on workers, the DB, and the MQ link (both the parent connection and the publisher channel, since #1235), returning a discriminating not ready: <checks> body when something’s down; /healthz carries the typed checks.workers block. Detail: deployment-guide.adoc § Health Checks + shared-crates.adoc § craig-api.

  • Role hierarchy: caseworker_or_above = caseworker/supervisor/admin; supervisor_or_above = supervisor/admin; helper require_role(claims, role). See idp-integration.adoc.

  • Service init / orchestrator shape: bootstrap → deps → spawn_workers → build_router → ApiServer::serve (~50–80 LOC main); see developer-guide.adoc § Service Initialization + architecture.adoc.

  • Healthz: every service exposes public GET /healthz (not counted in the api/ endpoint catalogs, which list #[utoipa::path] business endpoints only).

  • Version (#2952, ADR-087): every service — the eight core services through ApiServer::router, plus craig-intake, craig-intake-keyring, craig-web and craig-portal on their own routers — exposes public, unauthenticated GET /version beside /healthz, with one shared handler and body (craig_common::version): {service, build, commit, config: [{name, sha}], verified}. build is the workspace crate version, compiled in. commit (#2896) is the commit the binary was built from: the release image build passes it as the CRAIG_GIT_SHA build argument (docker-bake.hcl, from CI_COMMIT_SHA), and a binary built without it, which includes every local and devstack build, reports unknown rather than a checkout-derived value that would go stale between commits. config lists the configuration layers the process loaded at boot, lowest precedence first, each with its commit SHA or path for an unverified working copy; verified is false when any layer is path, and true with an empty list for a service that loads no configuration. In the devstack craig-placement and craig-composition report the layers they load at their config-sources.lock commits with verified: true (until U4, #2955, they reported [{name: "georgia", sha: "path"}] / false, the in-repo rulesets/georgia/ tree); a service that loads no configuration reports [] / true. Like /healthz, it is not in the api/ endpoint catalogs. Settings: configuration-reference.adoc (CRAIG_CONFIG_SOURCE, CRAIG_CONFIG_ALLOW_UNVERIFIED).

  • OpenAPI: #[derive(OpenApi)] ApiDoc + SecurityAddon Bearer scheme; Swagger UI at /swagger-ui (implementation-guide.adoc § OpenAPI).

  • Outbox/inbox durability: transactional outbox + idempotent inbox + DLQ per adrs/adr-022-event-durability-and-idempotency.adoc.

craig-test-lib gotchas (testing convention)

The craig-test-lib API surface is in shared-crates.adoc; these are the easy-to-miss specifics:

  • No CaseBuilder/InvestigationBuilder — use serde_json::json!({"admin_unit": "Fulton", "assigned_worker": "jane.doe"}).

  • Builder constructors: PlacementBuilder::new(episode_id) (#2018: open the child’s removal episode first — given_removal_episode, or the raw fixture_episode(case_id, child_id)), IcpcRequestBuilder::new(case_id, child_id), AgreementBuilder::new(partner_id).

  • ExchangePartnerBuilder (not PartnerBuilder), .partner_name() (not .name()).

  • list_case_plans(case_id) returns a plain array (NOT {"data": […]}); other list endpoints return paginated PageResponse.

  • List signatures take &[(&str, &str)] query pairs: search_persons, list_referrals, list_cases.

  • Agreement transitions: draft → active → expired|terminated (no draft → approved).

  • Safety-assessment via CLI may 500 if the required rule set isn’t loaded — tests tolerate this.

  • Global-property tests race under nextest concurrency — sequence them in ONE test.

Edit this page · latest