Data Model: Placement

Overview

The placement service manages foster homes, removal episodes and the living arrangements (placements) inside them, and kinship evaluations. Foster home occupancy is derived automatically by a database trigger (#761): a home’s current_occupancy always equals the count of its placements in active status, recomputed on every placement insert/delete and on any update that changes foster_home_id or status (#1161 — an update changing neither is a provable no-op for the count, so the WHEN guard skips the recompute and its home-row lock instead of serializing unrelated placement writes behind open same-home transactions). It therefore stays correct across all transitions — create, planned → active, end, and (#2018) cancel — and cannot drift. A cancel moves planned → cancelled: the WHEN guard still fires on the status change, but a planned row never occupied a bed, so the recount leaves the count unchanged. #2020: a retract of an active row decrements the home (it leaves active), a retract of an ended row recounts unchanged, and a historical record inserts an ended row, so the INSERT recount leaves the count unchanged and even a full home admits it. The trigger locks the home row (PERFORM …​ FOR UPDATE) in its own statement before the recount (#1117): under READ COMMITTED, a recompute UPDATE that instead blocked on the home row directly would resume via EvalPlanQual with its original statement snapshot — writing a COUNT that predates the very commit it waited for (the #1056 stale-clobber forensics: a third transaction re-wrote occupancy 2 after two endings had committed). Lock-first forces the wait before the counting statement begins, so the recount’s snapshot always postdates the peer’s commit. Any future COUNT-maintaining trigger must follow this lock-first shape (deterministic pin: tests/constraints/occupancy_recompute_race.rs). Activation (create-active or planned → active) is capacity-guarded under a SELECT …​ FOR UPDATE lock. Since #2018 both activation paths stamp activated_at = now() write-once (the transaction’s instant), and both refuse a start outside [removal_at, now()] of the placement’s removal episode with the 400 activation-start-out-of-range (see Removal episodes, exits and living arrangements (P-B1, #2018–#2024, ADR-079 D2–D4)). As a DB-level backstop (#861), CHECK (current_occupancy >= 0 AND current_occupancy ⇐ max_capacity) and CHECK (max_capacity >= 0) reject any write — from any present or future writer — that would drive occupancy negative or past licensed capacity.

Cross-service references to cases.cases(id) and cases.persons(id) are stored as plain UUIDs — no foreign key constraints across databases.

Sensitive facts (#2000). craig-placement keeps no field registry and encrypts no column. Its sensitive non-identifier facts — health (child_health_facts, health_records, health_record_revisions), the (d)(4) removal circumstances (removal_responses.circumstance_*), trafficking (the two ledgers) and ICWA (the group (i) columns of placements, placement_fact_revisions, removal_responses and exit_responses) — are Plaintext by decision, not deferral: ADR-049 § Amendment — #2000 (ruled 2026-10-06). The guarded tables among them stay scheme-frozen.

The fleet-standard platform tables also live in this schema and are documented centrally: event_outbox / event_inbox / event_inbox_collisions (ADR-022 and the ADR-062 §A attempt machine), request_claims (ADR-062 §B), and schema_compat_floor (ADR-063). A claim’s actor is the ADR-085 D3 column pair (#2740): request_claims.created_by_sub holds a worker’s UUID and created_by_sub_service a service’s service:<name> encoding, with a CHECK that exactly one is set.

Tables

Table Purpose

foster_homes

Licensed foster care providers — a family home or, since #2055, a congregate facility (provider_kind, immutable; plan afcars-placement-facts D2, R-B36) — with capacity, age range, and ICWA compliance tracking

foster_home_training

Training records for foster parents (pre-service, CPR, trauma-informed, etc.); the three staff writes re-check the home’s unit under the home’s lock (#2075, Training writes and home-target decisions (#2075))

foster_home_expiry_notices

#1641: the once-per-key expiry notice ledger — (foster_home_id FK ON DELETE CASCADE, kind ∈ license_expiring | license_expired | training_expiring | training_expired, training_type NULL for the license kinds, expires_on, days_delta, initiated_by, noticed_at); UNIQUE (foster_home_id, kind, expires_on, COALESCE(training_type, '')). The sweep inserts ON CONFLICT DO NOTHING and stages the foster_home.* event in the SAME transaction only when the row landed, so each event fires exactly once per key (a renewal is a new key). Since #1642 the training kinds are LIVE: one row per (home, training_type, expires_on), expires_on being the type’s effective expiry (max(expires_at) over active, dated, completed rows)

placements

#2018 (ADR-079 D3): a child’s living arrangement inside one removal episode — episode_id NOT NULL, with case_id / child_id held to the episode’s by the composite FK fk_placements_episode; status planned | active | ended | cancelled | retracted (#2020: retracted is an activated arrangement entered in error, kept as the record); activated_at (write-once, set on activation, or at birth by the historical record); the cancel columns cancelled_at / cancelled_by / cancel_note; the retract trio retracted_at / retracted_by / retract_note (set exactly when retracted); replaces_placement_id (#2020 R-B21: the retracted arrangement this row re-records, written only at INSERT); kinship_household_id (#2058: FK kinship_households (id) ON DELETE RESTRICT — a home-less family row’s household, written only at INSERT; see Kinship households (P-B2 U5, #2058)). The columns, CHECKs, EXCLUDE and deferred trigger are in Removal episodes, exits and living arrangements (P-B1, #2018–#2024, ADR-079 D2–D4). #1724: the activation provenance pair (activation_evaluation_id, activation_rule_set_revision) — the rules-side rule_evaluations row of the ONE <j>-placement-eligibility consult that admitted the activation — stamped write-once at BOTH activation sites (birth-active create, planned → active): with a home, the verdict bound under the home row lock (context_type = placement-eligibility, context_id = the home); without a home (a caregiving setting), since #972 the child-only criteria consult (context_type = placement-matching-criteria, context_id = the child — a home-less activation still proves the child’s membership, DOB and matchability); CHECK placements_activation_provenance_all_or_none; NULL where no consult ran (a planned birth until it activates, a cancelled one, a #2020 historical record, which runs no consult, or a non-caregiving activation, which runs none since #2057 — see non-caregiving activation; the #2018 re-cut refused on any existing row, so no row predates #1724 or #972). Cross-DB pointer, no FK. #1901 (ADR-077 D6): admin_unit TEXT NULL — the case’s administrative unit STAMP, copied at birth from the case_assignments projection’s FOR SHARE re-read (under the per-case advisory lock, see that table) or filled afterwards by the inbox’s unit-only heal / the backfill; NULL = outside every unit scope (fail-closed) until filled, never cleared by an event; partial index idx_placements_admin_unit. #2024: permanency_goal is dropped, and its CHECK with it; a child’s permanency plan lives on craig-cases' permanency_plans (ADR-078 D4); the 16 nullable arrangement-fact columns ((e)(5)–(e)(8), (i)(5)–(i)(8); NULL = unanswered; #2080, Arrangement facts (P-B3 U1, #2080)).

kinship_options

Relative/kinship placements evaluated during the matching process. #1901: carries the same admin_unit stamp as placements (birth copy under the case lock, unit-only heal, backfill; partial index idx_kinship_options_admin_unit).

removal_episodes

#2018 (ADR-079 D2): one removal of a child under a case — the current removal_at / exit_at, the ADR-077 admin_unit stamp, and a RETIRE (retracted) naming its retirer. Insert-only except three UPDATE shapes (row guard refuse_episode_row_mutation()). See Removal episodes, exits and living arrangements (P-B1, #2018–#2024, ADR-079 D2–D4).

removal_responses

#2018 (ADR-079 D2): the removal event ledger (FIRST_RECORDED) — the removal instant and its removal_manner; a correction supersedes its predecessor. Insert-only except a RETIRE (refuse_event_row_mutation()). See Removal episodes, exits and living arrangements (P-B1, #2018–#2024, ADR-079 D2–D4); the 43 nullable removal-answer columns ((d)(3), (d)(4), (i)(1), (i)(4); NULL = unanswered; #2081, Removal facts (P-B3 U2, #2081)).

exit_responses

#2019 (ADR-079 D4): the exit event ledger (FIRST_RECORDED), the one home of AFCARS (g)(1)–(g)(4) — the exit instant, its exit_reason and, for a transfer, the transfer_agency_type; a correction supersedes its predecessor; one live exit per episode. Insert-only except a RETIRE (refuse_event_row_mutation()). See Removal episodes, exits and living arrangements (P-B1, #2018–#2024, ADR-079 D2–D4); the 21 nullable adoption / guardianship exit-answer columns ((h) less (h)(14), (i)(10)–(i)(13); NULL = unanswered; #2083, The adoption / guardianship exit (P-B3 U4, #2083)).

episode_trafficking_statements

#2082: the (d)(5)–(d)(6)(i) event ledger — a statement dated stated_on and its five nullable answers; many roots per episode; a correction supersedes its predecessor. Insert-only except a RETIRE (refuse_event_row_mutation()). See Trafficking (P-B3 U3, #2082).

trafficking_law_enforcement_reports

#2082: the (d)(6)(ii) event ledger — one row per report to law enforcement, dated reported_on; many roots per episode; a correction supersedes its predecessor. Insert-only except a RETIRE (refuse_event_row_mutation()). See Trafficking (P-B3 U3, #2082).

placement_end_reason_rewrites

#2023 (ADR-079 D4): the audit of the one sanctioned touch of an ended row’s end reason — one row per arrangement the U6c migration rewrote to left_care (from_reason, the live exit_response_id that carries the reason, rewritten_at). Append-only for every role; the serving role never writes it. See Removal episodes, exits and living arrangements (P-B1, #2018–#2024, ADR-079 D2–D4).

placement_fact_revisions

#2188 (plan afcars-source-history D5): the prior arrangement facts — one row per facts PUT that changed any of the sixteen, holding the values that stood until superseded_at, and the acting worker whose PUT superseded them (superseded_by, #2000). Insert-only for every role (refuse_revision_mutation()). See Arrangement facts (P-B3 U1, #2080).

education_records

Educational enrollment and IEP/Section 504 tracking per child (Phase 4 expansion); #1909 (b): the custody-unit stamp admin_unit / unit_episode_id (Child-keyed records: the custody-unit stamp (#1909 b, ADR-077 D5/D6))

education_partner_reports

#3188: what a partner (an education agency) reported about a child’s schooling. One live row per child and partner interface; written only by the service-only partner-report route and read only through its own view-only read. See Partner-reported education records (#3188).

ended_partner_listings

#3188: the craig-exchange listings announced as ended (exchange.listing_ended). A partner report that names one is refused. See Partner-reported education records (#3188).

health_records

Health visits, immunizations, diagnoses, and overdue-appointment tracking per child (Phase 4 expansion); since #2084 the (b)(9) visit flag health_assessment (Child facts: health and education (P-B3 U5, #2084)); #1909 (b): the custody-unit stamp admin_unit / unit_episode_id (Child-keyed records: the custody-unit stamp (#1909 b, ADR-077 D5/D6))

health_record_revisions

#2188: the prior visit — one row per health-record PUT that changed visit_date or health_assessment, holding the pair that stood until superseded_at, and the acting worker whose PUT superseded it (superseded_by, #2231). Insert-only for every role (refuse_revision_mutation()). See Child facts: health and education (P-B3 U5, #2084).

child_health_facts

#2084: the (b)(10) per-child WINDOW ledger — condition_status and eleven nullable condition_<category> answers over [effective_from, effective_until); live windows never overlap per child and at most one is open; a correction supersedes its predecessor. Insert-only except a CLOSE or a RETIRE (refuse_fact_row_mutation()). See Child facts: health and education (P-B3 U5, #2084).

child_education_facts

#2084: the (b)(11), (b)(12), (b)(14) per-child WINDOW ledger — school_enrollment, educational_level, special_education over [effective_from, effective_until); the same window, correction and guard rules as child_health_facts. See Child facts: health and education (P-B3 U5, #2084).

home_documents

Uploaded documents (licenses, home-study reports, background checks) per foster home, stored in object storage via craig-store; the staff delete re-checks the home’s unit under the home’s lock (#2232, Home-document delete lock (#2232))

upload_attempts

ADR-062 §U upload-attempt tombstones (SU2 #1248): one immutable row per client upload operation, id = the client-held request id; generation-fenced CAS state machine + replay decision table live in craig-store::attempts (shared crates); kinds here: home_document. 31 d terminal retention (reconciler-pruned); no FK — target_id is polymorphic by design. The claimant is the ADR-085 D3 column pair (#2740): created_by holds a worker’s UUID and created_by_service a service’s service:<name> encoding, with a CHECK that exactly one is set.

case_assignments

#1213: the event-projected authoritative case assignment (case_id → (assigned_worker_sub, supervisor_sub, assignment_revision) — the supervisor half landed with #1084), fed by case.created (revision 0 seed) and case.assignment_changed (#1214 strictly-greater upsert; ONE revision orders the whole pair). The create handlers DERIVE assigned_worker_sub from here (FOR SHARE in the claim transaction) instead of trusting the caller’s sub, and the subsidy-eligibility S2S read serves the coherent triple to craig-financial (#1084 creation-time stamp); no FK — case_id is cross-service. As-built: ADR-060 § Amendment #1213. #1367: placements and kinship_options rows carry the same (assigned_worker_sub, supervisor_sub, assignment_revision) denorm triple (event-applied under the strict guard; creation-stamped from this projection’s FOR SHARE read), making the TX i_supervises rows and the AssignedSupervisor list scope real for placement surfaces. #1901 (ADR-077 D6): admin_unit TEXT NULL rides the projection — seeded from case.created (whose payload carries the case’s unit; the seed’s conflict arm is DO UPDATE SET admin_unit = EXCLUDED.admin_unit WHERE admin_unit IS NULL, the pair and the revision never touched by it) and from case.assignment_changed’s OPTIONAL `admin_unit key (COALESCE(EXCLUDED.admin_unit, admin_unit) inside the revision-guarded upsert — a retained pre-upgrade six-key envelope applies the pair and leaves the unit as it stands; an event without the key never clears it). The unit is not an authorization identity ordered by the revision: absent = NULL = fail-closed until a unit-bearing event or the backfill fills it. Lock protocol (supersedes the #1213 projection-first contract): the per-case advisory lock `pg_advisory_xact_lock(hashtext('case-assign:'

case_id))` (store::case_assignments::lock_case_assignment, ported verbatim from craig-financial) is the FIRST statement of both inbox handlers, and every root birth — a removal-episode open (#2018), a placement create, a kinship create — takes it right after claim_first and BEFORE its FOR SHARE re-read (then, for a placement, the episode and the home, each FOR NO KEY UPDATE) — FOR SHARE on a still-absent projection row locks nothing, so only the advisory lock serializes a birth against the case’s FIRST case.created (the birth either reads the committed seed or the handler’s heal sees the committed row). Heals: the SEPARATE unit-only statements SET admin_unit = ca.admin_unit … WHERE admin_unit IS NULL (never the pair or the revision), parents first — #2018: removal_episodes → (#1909 b) education_records / health_records, each from its source episode (unit_episode_id) of the case, not the projection (Child-keyed records: the custody-unit stamp (#1909 b, ADR-077 D5/D6)) → placements → kinship_options, the episode heal with no retired filter (a retracted episode still carries its case’s unit) — run by case.created after the seed and BEFORE the pair heals, and by case.assignment_changed after the projection upsert and BEFORE the two reassigns (behaviour-identical to heal-last: the heals read the projection the upsert just wrote and the reassigns never touch admin_unit; episodes first means no delivery locks a placement before its episode, the arrangement acts' order); the pair predicates are byte-identical to their pre-#1901 shape. Backfill: craig-manage backfill-assignments’s revision-independent unit-fill pass (#2018: its `removal_episodes leg runs before the placements leg; #1909 b: the two child-record legs follow the episode leg and fill a record only from a source episode carrying the case’s unit).

caregiver_bindings

#1848 (ADR-076 D5–D7): the caregiver binding ledger — a CAREGIVING UNIT (exactly one of foster_home_id / kinship_household_id, CHECK caregiver_bindings_unit_xor; #2058: the household replaces the former placement_id) bound to a cases person (person_id, no FK — existence verified through the #1847 display-name arm), effective-dated on the jurisdiction clock (current iff effective_from ⇐ today AND (ended_on IS NULL OR ended_on > today)); never deleted — ending sets ended_on (effective_from ⇐ ended_on ⇐ today; ended_on = effective_from cancels an entry that never took effect, #1879). #2058: one person’s bindings on one unit never overlap — EXCLUDE excl_caregiver_bindings_person_unit_window over daterange(effective_from, ended_on, '[)') (409 caregiver-binding-overlap); a cancel is an empty range and overlaps nothing. A binding keys the household, not an arrangement, so no arrangement state gates a create and no binding blocks a retract (the #2018 placement-row lock is retired). #2187: the end or cancel also stamps ended_recorded_at = statement_timestamp() (in no response body), set exactly when ended_on is (caregiver_bindings_recorded_pairing) and never before created_at (caregiver_bindings_recorded_after_creation). See Kinship households (P-B2 U5, #2058)

kinship_households

#2058 (P-B2 U5): the case-less setting identity of a home-less family arrangement — id, admin_unit (fixed at mint), created_by, created_at; a trigger refuses every UPDATE and DELETE. See Kinship households (P-B2 U5, #2058)

portal_invitations

#1848: hashed one-time enrollment codes issued on a binding — code_hash (SHA-256 of 128 random bits; the plaintext is returned ONCE and never stored), code_prefix, expires_at (7 d), redeemed_at / redeemed_by_sub, revoked_at (redeemed and revoked are mutually exclusive by CHECK), and the ADR-062 one-time-secret lifetime backstop pair create_request_id / create_request_hash (one invitation per client request id, forever)

caregiver_identities

#1848: the Keycloak subject ↔ person enrolment a redemption creates — ONE live identity per subject_sub and per person_id (partial uniques WHERE revoked_at IS NULL); revocation keeps the row, re-enrolment is a new invitation; revoking it needs authority over every unit the person holds an open binding on (#2053, Caregiver ledger locks (#2053))

pending_edits_foster_home_portal

#634 (ADR-037 §6, ADR-076 D10): the propose-approve queue of the foster_home_portal field-ownership surface — one row per caregiver proposal on a shared field. The unit (unit_kind ∈ home | kinship_household since #2058, CHECK pending_edits_fhp_unit_kind; unit_id), the target row (target_table ∈ education_records | health_records | foster_homes, CHECK pending_edits_fhp_target_table; target_id — no FK, the id is polymorphic and education / health rows are soft-deleted), the governed field token (CHECK pending_edits_fhp_field: split_part(field, '.', 1) = target_table AND length(field) ⇐ 64), the canonicalised proposed_value (CHECK pending_edits_fhp_value: = btrim(proposed_value), length 1–200) and the SERVER-READ previous_value (the stored text at propose; NULL = the field was unset), proposed_by_sub / proposed_at, decision ∈ pending | accepted | rejected (default pending, CHECK pending_edits_fhp_decision) with decided_by / decided_at (CHECK pending_edits_fhp_decided_pair: both NULL iff pending) and the optional reason (CHECK pending_edits_fhp_reason: ≤ 500). proposed_by_sub / decided_by are IdP subjects — no FK, cross-realm. Partial UNIQUE pending_edits_fhp_one_open (target_id, field) WHERE decision = 'pending' — one OPEN proposal per field (the typed 409). Retention: rows are RETAINED after a decision (the audit); a stale accept, or an education / health target-gone accept (409 field-proposal-target-gone), is drained by REJECT, never by a delete; a proposal whose FOSTER-HOME row is gone answers 404 foster home on accept and reject before the authorization check (#1902, ADR-077 D5 existence-first) — such a row therefore stays pending for the retention lifetime with no drain (homes have no delete path, so it only arises from a dangling target_id)

Recorder attribution (#2033, ADR-028). Every row a staff act creates names the ACTING worker: placements.created_by / created_by_name (the live create and the historical record), education_records.recorded_by / recorded_by_name, health_records.recorded_by / recorded_by_name and kinship_options.recorded_by. The values are the sub and preferred_username of claims.acting_worker(); under a BFF-lifted token that is the worker, never the service principal. The actor token carries no full name, so a *_name is the username, as on a direct token. Rows written before #2033 keep theirs.

Providers (P-B2 U2, #2055). Migration 20260927100000_foster_home_provider_kind WIDENS the schema — it adds foster_homes.provider_kind (family_home | congregate_facility, NOT NULL, no default, every existing row family_home, immutable by trigger trg_foster_homes_provider_kind_immutable) and makes license_type NULL iff congregate_facility (chk_foster_homes_license_type_iff_family) — and ends with a voluntary floor bump. A congregate provider takes no caregiver binding and records no training (both 422); the portal reaches a provider only through a binding, so it is closed to a congregate provider too. The update refuses a kind change and a license_type on a congregate provider (400 structural-mismatch). Matching filters by the required provider_kind. The with-home consult, occupancy, the capacity guard and per-diem billing are unchanged.

Setting vocabulary and identity (P-B2 U3, #2056). Migration 20260927120000_placement_setting_vocabulary re-cuts placements.placement_type (chk_placements_placement_type) to foster_family_home plus the 14 federal (e)(4) tokens verbatim, with no crosswalk; it refuses any existing placements row (dev: cargo xtask dev reseed) and bumps the floor. craig-reference PlacementType::setting_class() sorts every setting into one of three classes (SettingClass):

  • family — foster_family_home; names a family_home provider or, with none, a kinship household (Kinship households (P-B2 U5, #2058));

  • congregate — the three group_home_* tokens, residential_treatment_center, qualified_residential_treatment_program, child_care_institution, child_care_institution_shelter_care, supervised_independent_living; names a congregate_facility provider;

  • non-caregiving (D3) — runaway, whereabouts_unknown, placed_at_home, juvenile_justice_facility, medical_or_rehabilitative_facility, psychiatric_hospital; names no provider. PlacementType::is_caregiving() is false for exactly these six.

A family row carries the six (e)(3) flags ffh_type_licensed_home, ffh_type_therapeutic_foster_family_home, ffh_type_shelter_care_foster_family_home, ffh_type_relative_foster_family_home, ffh_type_pre_adoptive_home, ffh_type_kin_foster_family_home (applies | does_not_apply; NOT NULL iff family, chk_placements_ffh_types_iff_family); the wire carries them as ffh_types, the list of categories that apply. foster_family_home ((e)(2), yes | no) is GENERATED from placement_type. chk_placements_setting_identity (re-cut by #2058) requires exactly one of foster_home_id / kinship_household_id on a family row, a foster_home_id and no household on a congregate row, and neither on a non-caregiving row; the BEFORE trigger ck_placements_setting_provider_kind requires a named home’s provider_kind to be the class’s (SQLSTATE 23514 with the constraint name). The create and historical acts refuse before the database does, in this order (all 400):

  1. a family setting without ffh_types — required-field-missing (an empty list when no category applies);

  2. ffh_types on a congregate or non-caregiving setting — structural-mismatch;

  3. a category named twice in ffh_types — structural-mismatch;

  4. a congregate setting without a foster_home_id — required-field-missing;

  5. a non-caregiving setting naming a foster_home_id — structural-mismatch.

A named home of the wrong provider kind is 400 setting-provider-mismatch, checked on the home row the act holds FOR UPDATE; the arrangement-write mapping answers a constraint or trigger hit (23514) as 400 — the provider-kind trigger as setting-provider-mismatch, the setting-identity and ffh_types checks as structural-mismatch (belts the pre-checks above reach first). Since #2058 a caregiver binding keys a foster home or a kinship household, never a placement (Kinship households (P-B2 U5, #2058)).

Non-caregiving activation (P-B2 U4, #2057). A non-caregiving arrangement (plan D3, R-B25) — a run (runaway), whereabouts unknown, a trial home visit (placed_at_home), or a juvenile-justice, medical or psychiatric stay — is an ordinary row. It names no setting identity, sits under the episode’s containment and the child’s non-overlap like any row (a child on the run when responsibility arrives is a runaway row with started_at = removal_at), and ends by an ordinary end_reason. Its activation, on the birth-active create and on planned → active alike, runs neither the craig-cases placement-facts read nor a craig-rules consult: the #1724 provenance pair stays NULL, and a rules or cases outage never blocks recording it. The child’s membership was proven when the episode opened, so for these six settings the activation no longer re-checks cases' case read, the child’s membership, the DOB or ICWA (accepted, R-B25), nor the case’s lifecycle state (#2029: a closed case does not refuse it). craig-financial bills nothing for it and stages no financial.payment_generation_skipped; a caregiving home-less activation still stages missing_foster_home. Respite is not a row (R-B16), nor is a short stay while the base arrangement is held open (#1073).

Kinship households (P-B2 U5, #2058)

A kinship household is the case-less setting identity of a home-less family arrangement (plan afcars-placement-facts D4): every foster_family_home row with no foster_home_id names one in placements.kinship_household_id. The household belongs to no case, so siblings of two cases placed with the same relatives share one household, and its caregivers are bound to it once.

The table. kinship_households: id (UUID PK), admin_unit (TEXT NOT NULL, fixed at mint), created_by (UUID, the minting actor), created_at. The BEFORE trigger trg_kinship_households_immutable refuses every UPDATE and DELETE: a household has no lifecycle, and placements and bindings reference it ON DELETE RESTRICT. Migration 20260928120000_kinship_households.sql mints one household per existing home-less family row of any status (its id, admin_unit, created_by and created_at are the row’s) and refuses, before any change, a binding keying anything but such a row, such a row with a NULL admin_unit or a non-UUID created_by, and two overlapping bindings of one person on one unit.

The choice. The create (POST /v1/placement/placements) and the historical record both take an optional kinship_household: {"existing": <id>} reuses a household, {"new": {"admin_unit"?}} mints one, and an absent choice reuses the replaced row’s household on a re-record (replaces_placement_id) and mints one otherwise. The minted unit is the episode’s admin_unit stamp; while the stamp is NULL it is the body’s new.admin_unit, run through the foster-home canonical-name belt. The refusals:

  • 400 structural-mismatch on kinship_household — a choice on any row but a home-less foster_family_home one;

  • 400 structural-mismatch on kinship_household.new.admin_unit — a body unit when the episode is stamped;

  • 400 required-field-missing on kinship_household.new.admin_unit — no stamp and no body unit (a household without a unit is unrepresentable, so an absent choice on an unstamped episode is refused too, unless it re-records a household row, whose household it reuses);

  • 409 invalid-kinship-household — existing names no household (the FK hit in the transaction answers the same);

  • 403 — existing names a household the actor cannot read.

The unit source is a RISK: a household minted after a case transfer carries the episode’s unit, a migrated household its row’s.

Authority. A household is a home. Its reads authorize foster_home refs (admin_unit, no assignment pair); a binding act on it authorizes a foster_home_caregiver ref of the same home shape. No caregiving-unit ref carries a case’s assignment pair, so a Texas supervisor holds no binding authority on any caregiving unit; a Texas regional director holds it only on the units in her bound counties, through the unit CHECK on the ref’s admin_unit (#1928, ADR-077 D7).

The routes. GET /v1/placement/kinship-households/{id} (200, 403, 404) and GET /v1/placement/kinship-households?person_id= — the households whose bindings name the person, paged, under the foster-home list scope; person_id is required (400 required-field-missing: no unfiltered enumeration). Both refuse a pure service principal (403).

Bindings. caregiver_bindings.kinship_household_id replaces placement_id (caregiver_bindings_unit_xor, the open-person unique caregiver_bindings_household_person_open). The EXCLUDE excl_caregiver_bindings_person_unit_window keeps one person’s bindings on one unit from overlapping (409 caregiver-binding-overlap; a second OPEN binding still answers 409 duplicate-resource from the unique). A cancel (ended_on = effective_from) is an empty range and overlaps nothing. A binding keys the household, not an arrangement, so a cancelled, retracted or ended arrangement leaves its household’s bindings as they are, and no open binding blocks a retract.

Arrangement facts (P-B3 U1, #2080)

The arrangement’s own AFCARS facts, (e)(5)–(e)(8) and (i)(5)–(i)(8) (plan afcars-placement-elements D1), are sixteen nullable TEXT columns on placements (migration 20260929100000_arrangement_facts.sql); NULL = unanswered, and every column is Plaintext. Each token set is a CHECK (<col> IN (…)); each gate on a nullable column is IS NOT DISTINCT FROM (a bare = passes on a NULL gate). Four columns of each of (i)(5) / (i)(8) carry their plan D5 slug, since the <prefix>_<category> name exceeds 63 bytes.

Column Element Tokens (CHECK) Gate (CHECK)

arrangement_location

(e)(5)

out_of_state_or_out_of_tribal_service_area | in_state_or_in_tribal_service_area | out_of_country | runaway_or_whereabouts_unknown (chk_placements_arrangement_location; craig-reference ArrangementLocation)

chk_placements_arrangement_location_runaway: the runaway token exactly on a runaway / whereabouts_unknown row

arrangement_jurisdiction

(e)(6)

free text, 1–255 characters, trimmed (chk_placements_arrangement_jurisdiction_text); until #1973

chk_placements_arrangement_jurisdiction_gate: only beside an out_of_state_or_out_of_tribal_service_area or out_of_country (e)(5)

foster_parents_marital_status

(e)(7)

married_couple | unmarried_couple | separated | single_adult (chk_placements_foster_parents_marital_status; FosterParentsMaritalStatus)

chk_placements_foster_parents_marital_status_family: only on a foster_family_home row

relationship_to_foster_parents

(e)(8)

relatives | non_relatives | kin (chk_placements_relationship_to_foster_parents; FosterParentsRelationship)

chk_placements_relationship_to_foster_parents_family: only on a foster_family_home row

icwa_available_a_member_of_the_indian_childs_extended_family, icwa_available_tribe_licensed_foster_home, icwa_available_indian_foster_home_non_indian_licensed, icwa_available_indian_institution, icwa_available_tribe_order_of_preference

(i)(5)

yes | no | not_applicable (YesNoNotApplicable), each chk_placements_<col> except chk_placements_icwa_available_extended_family and chk_placements_icwa_available_non_indian_licensed

none (ungated by setting until #1073)

icwa_preference_met

(i)(6)

the five (i)(5) categories plus placement_does_not_meet_icwa_placement_preferences (chk_placements_icwa_preference_met; IcwaFosterCarePreference)

none (ungated by setting until #1073)

icwa_good_cause

(i)(7)

yes | no (chk_placements_icwa_good_cause; YesNo)

chk_placements_icwa_good_cause_gate: only when (i)(6) is placement_does_not_meet_icwa_placement_preferences

icwa_good_cause_basis_parents_request, icwa_good_cause_basis_request_of_the_indian_child, icwa_good_cause_basis_no_suitable_placement, icwa_good_cause_basis_extraordinary_needs, icwa_good_cause_basis_sibling_attachment

(i)(8)

yes | no (YesNo), each chk_placements_<col> except chk_placements_icwa_good_cause_basis_child_request

chk_placements_icwa_good_cause_basis_gate, one family CHECK: num_nonnulls(<the five columns>) = 0 OR icwa_good_cause IS NOT DISTINCT FROM 'yes'

Required keys. The create (POST /v1/placement/placements), the historical record and the read carry the sixteen keys flat (craig_placement_contracts::arrangements::ArrangementFacts, #[serde(flatten)]; the key list is ARRANGEMENT_FACT_KEYS). On a write every key must be present and null = unanswered (craig_validation::required_nullable): a body missing a key is refused 422 validation-failed at the extractor (missing field <key> ), before any claim is read. A bad token is serde’s 422 too, so the token CHECKs stay unmapped.

The PUT. PUT /v1/placement/placements/{id} takes an optional arrangement_facts: absent or null = unchanged; present = the complete state of all sixteen keys, which replaces every column. It edits a planned, active or ended row only (else 400 invalid-state-transition on arrangement_facts), and a row of a retracted episode is 409 episode-retracted, as a status change is. Nothing here is governed: the edit stages no event and no field audit. It is attributed on the revision it records (superseded_by, below; #2000); an identical PUT changes no fact and records none.

Prior values (#2188, plan afcars-source-history D5). When a facts PUT changes any of the sixteen columns, the same statement (update_arrangement_facts, a CTE over Postgres 18’s RETURNING old) inserts the sixteen it replaced into placement_fact_revisions, stamped superseded_at = clock_timestamp() after the row lock, so a later edit always sorts after the one it waited on. An identical PUT lands and records nothing; no trigger writes a revision. The table (migration 20261005130000_placement_revisions.sql) is id UUID PRIMARY KEY DEFAULT uuidv7(), placement_id (REFERENCES placements ON DELETE RESTRICT), the sixteen facts as nullable TEXT with no copied CHECK, and superseded_at TIMESTAMPTZ NOT NULL, superseded_by UUID NOT NULL (#2000: the acting worker — claims.acting_worker(), so under craig-web the relayed worker — whose facts PUT superseded the values, bound into the same INSERT; no FK, the recorded_by posture), indexed on (placement_id, superseded_at, id). refuse_revision_mutation() (trg_placement_fact_revisions_insert_only, trg_placement_fact_revisions_no_truncate) refuses UPDATE, DELETE and TRUNCATE for every role (integrity_constraint_violation), so the table is SCHEME-FROZEN; every column is Plaintext. No backfill: an edit made before the migration kept no prior value. The migration bumped schema_compat_floor. Migration 20261008120000_placement_fact_revision_actor.sql (#2000; -- devstack: wipe-before-apply) added superseded_by: it refuses to apply while any revision exists (nothing recorded names the worker behind one), adds the column NOT NULL with no default, and bumps schema_compat_floor to 20261008120000 LAST (required: an N−1 facts edit omits the column). Rollback is N−1 images AND a database restore.

Refusal order. The create, the historical record and the PUT (against the row’s immutable placement_type) share one pure check, refuse_arrangement_facts, which trims arrangement_jurisdiction in place and then refuses, in this order (all 400 structural-mismatch, naming the field):

  1. a blank arrangement_jurisdiction after the trim (send null when unanswered);

  2. an arrangement_jurisdiction over 255 characters after the trim;

  3. an arrangement_location that disagrees with the setting — runaway_or_whereabouts_unknown exactly on a runaway or whereabouts_unknown setting (field arrangement_location);

  4. an arrangement_jurisdiction without an out_of_state_or_out_of_tribal_service_area or out_of_country arrangement_location;

  5. a foster_parents_marital_status or relationship_to_foster_parents off a foster_family_home setting (field: that column);

  6. an icwa_good_cause unless icwa_preference_met is placement_does_not_meet_icwa_placement_preferences;

  7. any icwa_good_cause_basis_<category> answer unless icwa_good_cause is yes (field icwa_good_cause).

The arrangement-write mapping answers a gate hit (23514) the same way, with the same detail and field (the text CHECK as rule 2); these are belts the pre-check reaches first.

The (i) block by setting. (i)(5)–(i)(8) are admitted on a row of any setting: no gate ties them to the setting class until #1073 rules which settings an ICWA placement preference applies to. Only their sibling gates (rules 6 and 7) hold.

Removal facts (P-B3 U2, #2081)

The removal’s own AFCARS facts, (d)(3), (d)(4), (i)(1) and (i)(4) (plan afcars-placement-elements D2), are forty-three nullable TEXT columns on removal_responses (migration 20260929110000_removal_facts.sql); NULL = unanswered, and every column is Plaintext. Each token set is a CHECK (<col> IN (…)) named chk_removal_responses_<col>, except nine (d)(4) CHECKs named chk_removal_responses_circumstance_<short tail> (the full name would exceed 63 bytes); each gate on a nullable column is IS NOT DISTINCT FROM (a bare = passes on a NULL gate). Two (d)(4) columns (circumstance_caretakers_impairment_physical_emotional, circumstance_family_conflict_orientation_gender_identity) and all three (i)(1)(iii) columns carry their plan D5 slug, since the <prefix>_<category> name exceeds 63 bytes.

Column Element Tokens (CHECK) Gate (CHECK)

environment

(d)(3)

parent_household | relative_household | legal_guardian_household | relative_legal_guardian_household | justice_facility | medical_mental_health_facility | other (craig-reference RemovalEnvironment)

none

circumstance_<category> ×34

(d)(4)

applies | does_not_apply (SourceApplies)

none

icwa_transfer_requested

(i)(1)(i)

yes | no (YesNo)

none

icwa_transfer_denied

(i)(1)(ii)

yes | no (YesNo)

chk_removal_responses_icwa_transfer_denied_gate: only on an icwa_transfer_requested of yes

icwa_denial_parents_objected, icwa_denial_tribal_court_declined, icwa_denial_state_court_good_cause

(i)(1)(iii)

applies | does_not_apply (SourceApplies)

chk_removal_responses_icwa_denial_gate, one family CHECK: num_nonnulls(<the three columns>) = 0 OR icwa_transfer_denied IS NOT DISTINCT FROM 'yes'

icwa_clear_and_convincing_evidence, icwa_qualified_expert_witness, icwa_active_efforts

(i)(4)

yes | no (YesNo)

none

Required keys. The episode open (POST /v1/placement/episodes), the historical episode, the removal correction and EpisodeRow.removal carry the forty-three keys flat (craig_placement_contracts::episodes::RemovalFacts; the key list is REMOVAL_ANSWER_KEYS, and RemovalFacts::unanswered builds a removal with every answer null). On a write every key must be present and null = unanswered (craig_validation::required_nullable): a body missing a key is refused 422 validation-failed at the extractor (missing field <key> ), before any claim is read.

Refusals. The three writes share one pure check, refuse_removal_facts, which refuses (both 400 structural-mismatch, field icwa_transfer_denied) an icwa_transfer_denied answer without an icwa_transfer_requested of yes first, then any icwa_denial_<reason> answer without an icwa_transfer_denied of yes. The removal-response write mapping answers a gate hit (23514) the same way; it is a belt the pre-check reaches first. A bad token is serde’s 422, so the token CHECKs stay unmapped.

The correction is the complete state. A removal correction restates every answer: one it sends as null is cleared on the successor row. The successor keeps the removal’s (d)(2) first_recorded_at.

Not gated. Whether (i)(1)(i) and (i)(4) apply at all turns on the (b)(6)(i) ICWA applicability, a craig-cases fact placement cannot read; that applicability is P-D’s.

Trafficking (P-B3 U3, #2082)

The episode’s AFCARS trafficking facts, (d)(5)–(d)(6)(ii) (plan afcars-placement-elements D2), live on two event ledgers from migration 20260930100000_trafficking_ledgers.sql, each keyed by episode_id (FK to removal_episodes, ON DELETE RESTRICT): episode_trafficking_statements (a statement dated stated_on holding five nullable answers, NULL = unanswered) and trafficking_law_enforcement_reports (one row per report of the in-care victimization to law enforcement, dated reported_on). Each carries the lifted core’s row columns (recorded_at, recorded_by, supersedes_id, retired_at, retired_reason ∈ corrected | retracted, retired_note, retired_by): a correction supersedes and retires its predecessor, at most once. An episode holds many roots on each ledger (no one-live index). Both are insert-only except a RETIRE naming its retirer (refuse_event_row_mutation()), and both carry the ck_episode_current_instants constraint trigger. Each gate on a nullable column is IS NOT DISTINCT FROM.

Column Element Tokens Gate (CHECK)

episode_trafficking_statements.prior_victim

(d)(5)

yes | no (YesNo)

none

prior_reported

(d)(5)(i)

yes | no (YesNo)

chk_episode_trafficking_statements_prior_reported_gate: only on a prior_victim of yes

prior_reported_on

(d)(5)(ii)

a date

chk_episode_trafficking_statements_prior_reported_on_gate: only on a prior_reported of yes; chk_episode_trafficking_statements_prior_reported_on_bound: on or before stated_on

in_care_victim

(d)(6)

yes | no (YesNo)

none

in_care_reported

(d)(6)(i)

yes | no (YesNo)

chk_episode_trafficking_statements_in_care_reported_gate: only on an in_care_victim of yes

trafficking_law_enforcement_reports.reported_on

(d)(6)(ii)

a date, one row per report

none (P-D applies the (d)(6)(i) gate)

Required keys. Every statement body (the record and the correction, craig_placement_contracts::trafficking::TraffickingStatementRequest, deny_unknown_fields) carries stated_on and every answer key (TRAFFICKING_ANSWER_KEYS); null = unanswered. A body missing an answer key is refused 422 validation-failed at the extractor, before any claim is read. A report body (TraffickingReportRequest) carries reported_on. An all-null statement is admissible: nothing was known yet on stated_on.

Refusals. Every record and correction runs the pure checks (api/trafficking/rules.rs) before its claim: 400 ledger-date-after-today (a stated_on or reported_on after the jurisdiction’s today); 400 ledger-fact-date-after-event (a prior_reported_on after its stated_on); then 400 structural-mismatch naming the leaf answered without its parent’s yes (prior_reported, prior_reported_on or in_care_reported). The statement write mapping answers a gate or bound hit (23514) the same way; it is a belt the pre-check reaches first. A bad token is serde’s 422. Every act on a retracted episode is 409 episode-retracted; a correction or retract naming a row that is not a live row of the episode’s ledger is 404 ledger-row-not-found.

A statement is the complete state known on its stated_on. A changed answer is a new statement; a correction restates every answer, and one it sends as null is cleared on the successor row.

Reads. GET /v1/placement/episodes/{id}/trafficking answers every live statement, latest-dated first; with ?as_of= it answers the statement in force on that date (the live statement with the latest stated_on ≤ as_of, at most one; store::event::at_anchor). GET /v1/placement/episodes/{id}/trafficking-reports answers every live report, latest-dated first; with ?as_of= every live report dated ≤ as_of, newest first (store::event::live_through, EventThroughQuery).

No cross-ledger gate. A report may stand while the statement in force answers (d)(6)(i) no: a report is a fact, and P-D’s applicability, not an act rule, applies the (d)(6)(i) gate to (d)(6)(ii) at export.

The episode retract retires the live rows of both ledgers as retracted, with the retract’s note, in its one transaction, and still publishes ONE removal_episodes / retracted event.

The anchor (⁂ #1073). For a reporting period P-D reads the latest live statement with stated_on ≤ the period’s to, and every live report dated ≤ it.

Sensitivity. Plaintext by decision ([sensitive-facts]; ADR-049 § Amendment — #2000); the trafficking answers are PII (plan A6).

The adoption / guardianship exit (P-B3 U4, #2083)

The adoption / guardianship exit’s own AFCARS facts, (h) less (h)(14) and (i)(10)–(i)(13) (plan afcars-placement-elements D3), are twenty-one nullable columns on exit_responses (migration 20260930120000_adoption_exit_facts.sql); NULL = unanswered, and every column is Plaintext. Each token set is a CHECK (<col> IN (…)) named chk_exit_responses_<col>, except seven CHECKs named with a short tail (the full name would exceed 63 bytes): chk_exit_responses_adoptive_available_other_indian_families, chk_exit_responses_adoptive_available_tribe_order, chk_exit_responses_adoptive_basis_parents_request, chk_exit_responses_adoptive_basis_child_request, chk_exit_responses_adoptive_basis_no_suitable_placement, chk_exit_responses_adoptive_basis_extraordinary_needs and chk_exit_responses_adoptive_basis_sibling_attachment. Each gate on a nullable column is IS NOT DISTINCT FROM (a bare = passes on a NULL gate). Three (i)(10) columns (adoptive_icwa_available_extended_family, adoptive_icwa_available_tribe_members, adoptive_icwa_available_tribe_order_of_preference) and four (i)(13) columns (adoptive_icwa_good_cause_basis_parents_request, adoptive_icwa_good_cause_basis_no_suitable_placement, adoptive_icwa_good_cause_basis_extraordinary_needs, adoptive_icwa_good_cause_basis_sibling_attachment) carry their plan D5 slug, since the <prefix>_<category> name exceeds 63 bytes.

Column Element Tokens (CHECK) Gate (CHECK)

adoptive_marital_status

(h)(1)

married_couple | married_but_individually_adopting_or_obtaining_legal_guardianship | separated | unmarried_couple | single_adult (craig-reference AdoptiveMaritalStatus)

chk_exit_responses_h_adoption_or_guardianship, one family CHECK over the ten (h) columns: num_nonnulls(<the ten>) = 0 OR exit_reason IN ('adoption', 'guardianship')

relationship_<category> ×4 (relatives, kin, non_relatives, foster_parents)

(h)(2)

applies | does_not_apply (SourceApplies)

the (h) family CHECK

first_adoptive_parent_person_id

(h)(3)–(h)(7)

a craig-cases person id (UUID, no FK: another database)

the (h) family CHECK

second_adoptive_parent_person_id

(h)(8)–(h)(12)

a craig-cases person id (UUID, no FK)

the (h) family CHECK; chk_exit_responses_second_adoptive_parent: only beside a first, never the same person

jurisdiction_kind

(h)(13)

interjurisdictional_adoption_or_guardianship | intercountry_adoption_or_guardianship | intrajurisdictional_adoption_or_guardianship (craig-reference AdoptionJurisdiction)

the (h) family CHECK

siblings_in_home

(h)(15)

INTEGER, BETWEEN 0 AND 999

the (h) family CHECK; chk_exit_responses_siblings_count_or_not_applicable: never beside siblings_not_applicable

siblings_not_applicable

(h)(15)

BOOLEAN, TRUE or NULL (chk_exit_responses_siblings_not_applicable)

the (h) family CHECK; never beside siblings_in_home

adoptive_icwa_available_<category> ×4

(i)(10)

yes | no | not_applicable (YesNoNotApplicable)

chk_exit_responses_i_adoption_only, one family CHECK over the eleven (i) columns: num_nonnulls(<the eleven>) = 0 OR exit_reason = 'adoption'

adoptive_icwa_preference_met

(i)(11)

a_member_of_the_indian_childs_extended_family | other_members_of_the_indian_childs_tribe | other_indian_families | a_placement_that_complies_with_the_order_of_preference_for_adoptive_placements_established_by_an_indian_childs_tribe | placement_does_not_meet_icwa_placement_preferences (craig-reference IcwaAdoptivePreference)

the (i) family CHECK

adoptive_icwa_good_cause

(i)(12)

yes | no (YesNo)

the (i) family CHECK; chk_exit_responses_adoptive_icwa_good_cause_gate: only when adoptive_icwa_preference_met is placement_does_not_meet_icwa_placement_preferences

adoptive_icwa_good_cause_basis_<category> ×5

(i)(13)

yes | no (YesNo)

the (i) family CHECK; chk_exit_responses_adoptive_icwa_good_cause_basis_gate, one family CHECK: num_nonnulls(<the five>) = 0 OR adoptive_icwa_good_cause IS NOT DISTINCT FROM 'yes'

Required keys. The exit (POST /v1/placement/episodes/{id}/exit), the exit correction, the historical episode’s exit and EpisodeRow.exit carry the twenty-one keys flat beside exit_at / exit_reason / transfer_agency_type (craig_placement_contracts::episodes::ExitFacts; the key list is EXIT_ANSWER_KEYS, and ExitFacts::unanswered builds an exit with every answer null). On a write every key must be present and null = unanswered (craig_validation::required_nullable): a body missing a key is refused 422 validation-failed at the extractor (missing field <key> ), before any claim is read. transfer_agency_type stays optional.

Refusals. The three writes share one pure check, refuse_exit_facts (api/exit_facts.rs), which refuses, each 400 structural-mismatch and in this order: an (h) answer on an exit that is neither an adoption nor a guardianship (field exit_reason); an (i) answer on an exit that is not an adoption (field exit_reason); a siblings_in_home count beside siblings_not_applicable (field siblings_not_applicable); an adoptive_icwa_good_cause unless adoptive_icwa_preference_met is placement_does_not_meet_icwa_placement_preferences (field adoptive_icwa_good_cause); an adoptive_icwa_good_cause_basis_<category> answer unless adoptive_icwa_good_cause is yes (field adoptive_icwa_good_cause, the family gate’s). A (h)(15) count outside 0–999 and a false siblings_not_applicable are 422 validation-failed (serde and garde), as is a bad token, so the token, range and indicator CHECKs stay unmapped. refuse_adoptive_slots then refuses, each 422 on the slot’s field (the binding create’s shape), a second slot without a first, a second naming the first’s person, and either slot naming the episode’s child (the child refusal). A slot craig-cases does not know is 422 no such person; a fresh act naming a slot while craig-cases is down is 503 person-lookup-unavailable (fail-closed; retry). The exit-response write mapping (map_exit_response_write) answers a family, gate or slot CHECK hit (23514) the same way; it is a belt the pre-checks reach first.

The adoptive slots. first_adoptive_parent_person_id and second_adoptive_parent_person_id name craig-cases persons, with no FK (another database). A fresh exit, correction or historical episode naming one checks every named person through the cases projection with one display-names read (verify_adoptive_slots), after the ADR-062 precheck: a committed exit or correction replays from its claim before any cross-service read, so a replay answers while craig-cases is down. A body naming no slot reads nothing. The second slot is the other member of the couple and need not adopt.

The correction is the complete state. An exit correction restates every answer: one it sends as null is cleared on the successor row, so a correction to another reason carries none of the (h) or (i) answers its reason does not admit. An (h)-only correction republishes placement.episode_exited with an unchanged current; craig-financial’s log-only WARN on it is accepted.

Captured, never derived. (h)(13) and (h)(15) are the worker’s answers, recorded on the exit, never computed from other rows (⁂ #1073). (h)(14) is P-E’s (OWNED_ELSEWHERE).

Child facts: health and education (P-B3 U5, #2084)

The child’s AFCARS health and education facts, (b)(9)–(b)(12) and (b)(14) (plan afcars-placement-elements D4), land in migration 20260930140000_child_facts.sql: (b)(9) is a visit flag on health_records; (b)(10)–(b)(12) and (b)(14) live on two per-child WINDOW ledgers, child_health_facts and child_education_facts (R-B31: window ledgers, not columns on the update-in-place records). The migration is additive.

(b)(9) — the health assessment. health_records.health_assessment (BOOLEAN NOT NULL DEFAULT false) records that the visit was a health assessment. POST /v1/placement/health REQUIRES it (a bool; a missing key or a null is 422 validation-failed); PUT /v1/placement/health/{id} takes it optional (absent or null = unchanged); every health read serves it. The create’s idempotency intent is the request itself (ADR-062 § #2310), so it includes health_assessment. The DEFAULT stays: an N−1 replica’s create omits the column and records false. The report rule is episode-bounded, a Named override: (b)(9) is yes iff an active health_records row flagged health_assessment has its visit_date within the episode the record reports, from removal_at to the earlier of exit_at and the anchor (P-D evaluates it, #1965, joining on child_id and dropping retired episodes).

Prior visits (#2188). When PUT /v1/placement/health/{id} changes visit_date or health_assessment, the same statement (update_health_record) inserts the prior pair into health_record_revisions (id uuidv7, health_record_id REFERENCES health_records ON DELETE RESTRICT, visit_date DATE NOT NULL, health_assessment BOOLEAN NOT NULL, superseded_at TIMESTAMPTZ NOT NULL, superseded_by UUID NOT NULL; index (health_record_id, superseded_at, id)), stamped clock_timestamp() after the row lock. A gate miss and an edit leaving the pair unchanged (a notes-only PUT) record nothing. The same guard as placement_fact_revisions (trg_health_record_revisions_insert_only, trg_health_record_revisions_no_truncate).

The visit’s worker (#2231). superseded_by is the acting worker (claims.acting_worker(): the relayed worker when a service relays the PUT) whose edit superseded the pair, bound into the same revision INSERT; no FK (the recorded_by posture). It attributes a visit_date or health_assessment edit, which placement.health.updated does not (its payload is health_record_id alone) and the field audit does only when the same PUT changes next_due_date. Migration 20261008130000_health_record_revision_actor.sql (-- devstack: wipe-before-apply) added it: it refuses to apply while any revision exists (no revision records its worker, and no recorded fact joins to one by key), adds the column NOT NULL with no default, and bumps schema_compat_floor to 20261008130000 LAST (required: an N−1 health edit omits the column). Rollback is N−1 images AND a database restore.

The window ledgers. Each is keyed by child_id (a craig-cases person, no FK: another database) and holds a window [effective_from, effective_until) (effective_until NULL = open; chk_<table>_window_ordered) with the lifted core’s row columns (recorded_at, recorded_by, supersedes_id, closed_at, closed_by, retired_at, retired_reason ∈ corrected | retracted, retired_note, retired_by). Every answer is nullable, NULL = unanswered, and each gate on a nullable column is IS NOT DISTINCT FROM.

Column Element Tokens (CHECK) Gate (CHECK)

child_health_facts.condition_status

(b)(10)

child_has_a_diagnosed_condition | no_exam_or_assessment_conducted | exam_or_assessment_conducted_and_none_of_the_conditions_apply | exam_or_assessment_conducted_but_results_not_received (craig-reference ConditionStatus)

none

condition_<category> ×11 (intellectual_disability, autism_spectrum_disorder, visual_impairment_and_blindness, hearing_impairment_and_deafness, orthopedic_impairment_or_other_physical_condition, mental_emotional_disorders, attention_deficit_hyperactivity_disorder, serious_mental_disorders, developmental_delay, developmental_disability, other_diagnosed_condition; no slug)

(b)(10)

existing | previous | does_not_apply (ConditionHistory), each chk_child_health_facts_<col> except four with a short tail (the full name would exceed 63 bytes): …_condition_visual_blindness, …_condition_hearing_deafness, …_condition_orthopedic_physical, …_condition_adhd

chk_child_health_facts_condition_gate, one family CHECK: num_nonnulls(<the eleven>) = 0 OR condition_status IS NOT DISTINCT FROM 'child_has_a_diagnosed_condition'

child_education_facts.school_enrollment

(b)(11)

elementary | secondary | post_secondary_education_or_training | college | not_school_age | not_enrolled (SchoolEnrollment)

none

educational_level

(b)(12)

seventeen tokens: not_school_age, kindergarten, 1st_grade … 12th_grade, ged, post_secondary_education_or_training, college (EducationalLevel)

none

special_education

(b)(14)

yes | no (YesNo: an IEP or an IFSP)

none

Required keys. Every record and correction body (craig_placement_contracts::child_facts::ChildFactsRecordRequest / ChildFactsCorrectRequest over HealthFacts or EducationFacts, deny_unknown_fields) carries client_request_id, the window bounds and every answer key (HEALTH_FACT_KEYS, twelve; EDUCATION_FACT_KEYS, three); null = unanswered. A body missing an answer key, or naming an unknown one, is refused 422 validation-failed at the extractor, before any claim is read; a bad token is serde’s 422. A correction’s omitted bound is copied from its predecessor.

The acts. POST /v1/placement/children/{child_id}/health-facts records a window: with no effective_until it is a CHANGE (the open window closes where the new one starts), with one a BACKFILL of a free period. POST …/health-facts/{row_id}/corrections restates a live row (the successor supersedes it, retired corrected, at most once), …/{row_id}/retract retires it retracted with a note, and …/{row_id}/close ends the open window at effective_until (on or before today). The education acts are the twins under …/education-facts. Every act answers 200 and is claimed (ADR-062): a record or correction hashes its bounds and facts whole (craig_ledger::intents::statement_spec). Each is authorized HealthRecord / EducationRecord Update on the child id (a read, Read); placement holds no person row, so no case-open guard applies.

Refusals. The pure checks run before the claim: 400 ledger-date-after-today (a bound after the jurisdiction’s today); 400 ledger-window-invalid (an unordered window); for health, 400 structural-mismatch naming condition_status when a condition_<category> is answered without a child_has_a_diagnosed_condition status (api/child_facts/rules.rs; the write mapping answers a family-gate hit, 23514, the same way — a belt the pre-check reaches first). A window overlapping a live window, or a second open window, is 409 ledger-window-overlap; a CHANGE dated on or before the open window’s start is 400 ledger-not-a-change (the detail names the corrections path); a correction, retract or close naming a row that is not a live row of the child’s ledger is 404 ledger-row-not-found.

Reads. GET /v1/placement/children/{child_id}/health-facts?as_of= (and …/education-facts) answers the live window in force on as_of (default: today on the jurisdiction clock) — 200 with the row, or 204 when none. There is no history route.

The guard. Both ledgers are insert-only except a CLOSE naming its closer or a RETIRE naming its retirer: refuse_fact_row_mutation() (placement’s first copy of the ADR-078 D1 fact-ledger guard) refuses a DELETE and any other UPDATE. excl_<table>_window keeps a child’s live windows apart and uq_<table>_one_open admits one open window per child (both mapped to 409 ledger-window-overlap); uq_<table>_one_successor corrects a row at most once.

Sensitivity. Plaintext by decision ([sensitive-facts]; ADR-049 § Amendment — #2000); the health answers are PII (plan A6). No event is published for any act (plan D4).

Caregiver ledger locks (#2053)

Lock order. Every act on an existing binding — the end, the invitation issue (after its claim_first), the invitation revoke and the identity revoke — takes its unit first: the foster home row FOR SHARE, then the binding FOR NO KEY UPDATE or the invitation / identity FOR UPDATE. A kinship household takes no lock: its admin_unit is fixed at mint. SHARE waits for a home update’s FOR NO KEY UPDATE and admits a sibling act’s SHARE and a child insert’s FK KEY SHARE. No home locker (the home update, the placement create and transitions, the arrangement acts, the training trigger, the expiry sweep, a field-proposal accept) takes a ledger row, and the §U upload finalizer (ledger rows, then the home’s KEY SHARE through its home_documents insert) is compatible with SHARE, so the order cannot cycle. The binding create takes no unit lock.

The re-check. Each act authorizes a foster_home_caregiver ref read before its transaction, then re-reads the home’s admin_unit under the lock: a unit moved in between is 409 concurrent-modification ("re-read and retry"), never a commit under the stale ref.

Identity revoke. An identity is person-wide (one live identity per person_id), so DELETE /v1/placement/caregivers/{id}/identity needs update on the binding’s unit AND on every unit where the person holds an open binding — in effect or not yet (daterange(effective_from, ended_on, '[)') meets [today, ∞); an ended binding or a cancel does not count). Any deny is 403 and nothing changes. Under the locks it re-reads that set: a binding gained meanwhile on a unit it did not check is 409 concurrent-modification; a binding ended meanwhile is not. It is the one request path that locks several homes, and takes them in ascending id order; a later multi-home locker must too.

Home-document delete lock (#2232)

DELETE /v1/placement/homes/{home_id}/documents/{doc_id} authorizes a home_document ref that carries the home’s admin_unit, read before its transaction. The transaction’s first statement locks the foster home row FOR SHARE (the Caregiver ledger locks (#2053) lock) and re-reads admin_unit: a unit moved in between is 409 concurrent-modification ("re-read and retry"), and the document row and its blob stay as they were. The soft delete of the home_documents row follows under that lock; the blob half runs after commit. The ref’s other live attribute, license_status, is consulted by no shipped ruleset, so the compare covers admin_unit alone (ADR-060 D5 is the trigger that extends it).

Lock order. The home, then the document row: while the delete waits for the home it holds nothing, and once it holds the home it waits only on the document row. No other home locker (the home update, the placement create and transitions, the arrangement acts, the training trigger, the expiry sweep, a field-proposal accept, the caregiver-ledger acts) takes a home_documents row; the blob-janitor’s stamp takes no home lock; the §U finalizer’s insert takes the home’s FK KEY SHARE, which SHARE admits. The order cannot cycle. The staff upload is a create and takes no unit lock (the #2053 precedent); list and download are reads.

Training writes and home-target decisions (#2075)

The three training writes (POST /v1/placement/homes/{id}/training, PUT and DELETE /v1/placement/training/{id}) and the accept and reject of a proposal whose target is a foster home authorize a foster_home ref that carries the home’s admin_unit, read before their transaction. Each re-reads admin_unit under a lock on the home row in its write transaction: a unit moved in between is 409 concurrent-modification ("re-read and retry") and nothing is written — no training row is inserted or changed, and no claim, field value or decision commits. The ref’s other live attribute, license_status, is consulted by no shipped ruleset, so the compare covers admin_unit alone (as on the home-document delete; ADR-060 D5 is the trigger that extends it).

The training lock. A training write takes the home FOR NO KEY UPDATE as its transaction’s first domain statement (the record: right after claim_first): the strength trg_foster_home_training_lock_home already takes on every row it writes — no new lock strength, now taken first; a no-op or zero-row write now takes it too. A FOR SHARE first (the caregiver-ledger lock) would deadlock two training writes on one home when each trigger upgraded it. Recording training is an act on an existing home, authorized as update on it, so unlike the staff document upload it re-checks.

The decision lock. A decision keeps the #1909 (b) order — claim_first, the proposal FOR UPDATE, then the target home FOR NO KEY UPDATE (the accept writes the home) — and compares the home’s admin_unit with the one the check read.

Lock order. A training write: (claim_first) → the home → its training row. A decision: claim_first → the proposal → the home. No other home locker (the home update, the placement create and transitions, the arrangement acts, the expiry sweep, the caregiver-ledger acts, the home-document delete) takes a training row or a proposal row, the portal propose and the inbox heal take no home, and no path now takes a training row before its home, so neither order can cycle.

Child-keyed records: the custody-unit stamp (#1909 b, ADR-077 D5/D6)

Migration 20261009120000_child_record_unit_stamp.sql (plan child-record-unit-stamp U1, #2233). education_records and health_records each gain admin_unit TEXT NULL and unit_episode_id UUID NULL (REFERENCES removal_episodes (id) ON DELETE RESTRICT), with two partial indexes per table: idx_<table>_admin_unit (admin_unit) WHERE admin_unit IS NOT NULL (the unit-scoped list binds) and idx_<table>_unit_heal (unit_episode_id) WHERE admin_unit IS NULL (the heals' join). Both columns are Plaintext. On the wire admin_unit is a nullable string on both record views (the Placement shape); unit_episode_id is a column only — no model field reads it and it never reaches the wire.

The source. A record’s stamp is the child’s latest live episode — not retracted, the greatest removal_at (the open episode when there is one, since a child’s live windows never overlap) — and that episode’s admin_unit. A child with no live episode gives NULL/NULL (an unsourced record, which no heal fills); an episode with no unit yet gives a NULL unit with unit_episode_id set. The create is never refused for either. The education placement_id never sources the unit: it is caller-supplied and unchecked against child_id.

The child lock. lock_child_episodes takes pg_advisory_xact_lock(hashtext('child-episodes:' || child_id)). Every caller of the four episode writers takes it in its route guard, after the case-level locks and the pair compare and before any episode row lock: the open and the historical episode (which insert the episode) through the open’s guard; the removal correction, the retraction and the three exit acts through the episode guard, before its FOR NO KEY UPDATE (the trafficking acts share that guard and take it too). A create handler reads the selection unlocked before its transaction; inside it, after claim_first, the create takes the child lock, re-reads the selection FOR SHARE and inserts the record with that episode and its live unit. A selection that moved in between — another episode, or one appearing or vanishing — is 409 concurrent-modification ("re-read and retry") and writes nothing; the same episode whose unit was filled in between stamps the filled unit.

The heal. Both case-assignment inbox handlers run, right after the episode heal and in the same transaction, one unit-only statement per table: SET admin_unit = e.admin_unit from the record’s source episode of the case, only where the record’s unit is NULL and the episode’s is not. craig-manage backfill-assignments runs the two legs after its episode leg and fills a record with the case’s unit only when its source episode carries that unit (the inbox heal covers a source stamped otherwise). The create’s FOR SHARE makes an episode fill wait for a racing create’s commit, so the record heal that follows sees the record. No other SQL writes the column.

Backfill and invariant. The migration sets both columns on every existing record from the child’s live episode with the greatest removal_at at or before the record’s created_at (best-effort; none = NULL/NULL), then bumps schema_compat_floor to 20261009120000 as its last statement (voluntary, taken: an N−1 replica inserts unsourced records and writes episodes without the child lock). Rollback is N−1 images AND a restore. The BLOCKING invariant child_record_admin_unit_from_episode (severity high, grace 0 s) reports a sourced record whose admin_unit is distinct from its source episode’s — a missed heal or a differing stamp. It reads no timestamp, so a later recut cannot trip it.

Authorization (U2, #2234). Every check on education_record / health_record carries the record’s stamp as attrs.admin_unit through ONE builder per type (api/child_records.rs; a NULL stamp leaves the key absent, never Null): the read, update and delete refs read the row; a create’s check and field consult carry the unit of the child’s latest live episode read before the transaction; a field-proposal decision loads the target record first, soft-deleted included, and an absent record is 404 before the check; the child-fact routes carry the child’s latest live episode unit. A create replay answers the stored record only after read on its ref (403 otherwise). The three lists (GET /v1/placement/education, /health, /health/overdue) bind a unit scope as ($n::TEXT[] IS NULL OR admin_unit = ANY($n)) in page and count — a NULL stamp never matches; the worker and supervisor scopes keep the empty page (#1912); the portal’s record reads bind none. Re-checks (ADR-060). The update and the soft delete lock the live row FOR NO KEY UPDATE and compare its admin_unit with the pre-read the check consumed; a field-proposal accept and reject lock the target record FOR NO KEY UPDATE (soft-deleted included) under the held proposal lock and compare its stamp with the one the check consumed (a foster-home target is locked the same way and its admin_unit compared, Training writes and home-target decisions (#2075)); a child-fact act takes the child lock, re-reads the child’s latest live episode FOR SHARE and compares its id and whether its unit is filled with what the check read. A difference is 409 concurrent-modification and nothing is written.

Lock order. A record create: claim_first → the child lock → the episode FOR SHARE → its record. An episode writer: claim_first → the case-level locks → the child lock → the episode. The inbox heal: the case lock → the projection → the episodes → the records → the placements, never the child lock. The inbox waits on a create only at the episode row (its UPDATE waits behind the create’s FOR SHARE); a create holding that share lock then needs only its own new record row, the FK KEY SHARE on the episode it already holds and on the education placement_id (which conflicts only with FOR UPDATE, which nothing takes on placements), and its outbox and audit inserts — none of which the heal holds. No path takes the child lock while holding an episode or record row, so the order cannot cycle. A child-fact act: claim_first → the child lock → the episode FOR SHARE → its window rows. The update and the delete lock only the record; a decision locks the proposal, then the target. The arrangement acts lock the episode FOR NO KEY UPDATE without the child lock, so a child-fact act’s FOR SHARE waits on them; they take no child lock, record or proposal. None takes the child lock while holding an episode or record row, and nothing locks a proposal or an episode after a record, so the order still cannot cycle with the heal.

Removal episodes, exits and living arrangements (P-B1, #2018–#2024, ADR-079 D2–D4)

Migration 20260925130000_removal_episodes_recut.sql. A removal episode is the unit of care; every placement is a living arrangement inside one. The migration is REFUSE-ON-DATA (it raises on any existing placements row and synthesizes no episode), drops removal_date, removal_reason, ctw_finding, ctw_finding_date, ctw_days_from_removal, reasonable_efforts, reasonable_efforts_date and the dormant sibling_placements table (#1778) without moving values, installs btree_gist (both window EXCLUDEs compare the child_id UUID with = in a GiST index), and bumps craig-placement’s schema_compat_floor to 20260925130000 as its last statement. Every new column is Plaintext.

Migration 20260925150000_exit_responses.sql (#2019, ADR-079 D4) is ADDITIVE: it creates exit_responses, replaces the check_episode_current_instants() body (attaching its constraint trigger to the new table), and widens chk_placements_end_reason to a superset. No existing row can fail it and an N−1 craig-placement neither writes an exit nor decodes end_reason strictly, so it has no refuse-on-data guard and does not bump schema_compat_floor. Every new column is Plaintext.

Migration 20260925170000_retracted_arrangements.sql (#2020, ADR-079 D3) is a WIDENING: it adds the retract trio retracted_at / retracted_by / retract_note and replaces_placement_id, widens placements_status_vocab and placements_activated_pairing by retracted, adds placements_retract_all_or_none, replaces placements_ended_pairing and placements_end_reason_only_when_ended with the three ended CHECKs below, and adds fk_placements_replaces and uq_placements_one_replacement. Every existing row satisfies the new set, so it has no refuse-on-data guard and no devstack wipe marker. It bumps schema_compat_floor to 20260925170000 as its last statement (voluntary, and required: an N−1 craig-placement decodes status through the strict PlacementStatus enum and cannot read a retracted row). Rollback is N−1 images AND a restore. Every new column is Plaintext.

Migration 20260926120000_end_reason_narrowing.sql (#2023, ADR-079 D4) is DESTRUCTIVE and refuses on data. It SHARE-locks placements, removal_episodes and exit_responses for the file. It then REWRITES each exit-token end_reason (reunification, adoption, aging_out, guardianship, emancipation, death) to left_care where the arrangement is its episode’s latest effective arrangement (by started_at, then id; activated and not retracted) and the live episode holds a live exit, recording one placement_end_reason_rewrites row per rewritten arrangement; nothing else of the row changes. Its guard then refuses on ANY remaining exit-token row, retracted rows included. It narrows chk_placements_end_reason and bumps schema_compat_floor to 20260926120000 as its last statement (voluntary: an N−1 craig-placement would meet the narrowed CHECK as a 500). The file is one transaction, so a refusal applies nothing. Rollback is N−1 images AND a restore. Every new column is Plaintext.

Migration 20260926180000_placement_goal_drop.sql (#2024, plan D6 R-B10; ADR-079 § Consequences) is DESTRUCTIVE: it drops placements.permanency_goal without moving a value (a child’s permanency plan lives on craig-cases' permanency_plans, ADR-078 D4), and the column’s single-column CHECK chk_placements_permanency_goal drops with it. It has no refuse-on-data guard. It waits at most 10 s for its lock and bumps schema_compat_floor to 20260926180000 as its last statement (mandatory, ADR-063 D3: an N−1 craig-placement reads and writes the column). The governed token placements.permanency_goal leaves the foster_home_portal roster (seven tokens → six). Rollback is N−1 images AND a restore.

removal_episodes — id, child_id, case_id, admin_unit (the ADR-077 stamp, NULL until filled), removal_at TIMESTAMPTZ NOT NULL, exit_at (on a live episode, its live exit response’s; NULL while the child is in care), recorded_at / recorded_by, and the RETIRE columns retired_at / retired_by / retired_reason / retired_note. No updated_at (a touch would break every shape comparison). CHECKs: chk_removal_episodes_exit_after_removal (exit_at > removal_at), …_retired_paired and …_retired_by_paired (all-or-none with retired_at), …_retired_reason (only retracted), …_retired_note (a note only on a retired row). UNIQUE (id, child_id, case_id) is the composite FK target. excl_removal_episodes_child_window: EXCLUDE USING gist (child_id WITH =, tstzrange(removal_at, exit_at, '[)') WITH &&) WHERE (retired_at IS NULL) — a child’s live episodes never overlap (409 episode-overlap). The range is half-open, so an exit and a re-entry (the child’s next episode) on one instant are adjacent, not overlapping. The row guard refuse_episode_row_mutation() refuses DELETE and admits an UPDATE only as (1) the current instants (removal_at, exit_at) on a live episode, (2) a RETIRE naming its retirer, or (3) the admin_unit fill (state-free, so a retracted episode heals too). An episode is keyed by the child ("each removal of a child", §1355.44(d)(1)) and keeps its case_id for life; every arrangement of the episode takes it through fk_placements_episode. A transfer of responsibility to another agency is an exit (transfer_to_another_agency); a move to another case of the same agency during an episode is not supported, a final ruling (2026-10-06, #2028; ADR-079 § Open questions): an in-agency transfer is a worker reassignment on the same case. #1804’s legal custody is a separate craig-cases fact.

removal_responses — the removal event ledger: episode_id (FK, ON DELETE RESTRICT), removal_at d)(1, removal_manner (CHECK: voluntary_placement_agreement or court_ordered_removal, the RemovalManner vocabulary), recorded_at / recorded_by, first_recorded_at d)(2, supersedes_id (self-FK; CHECK never itself), the RETIRE columns (retired_reason ∈ corrected or retracted, paired as on the episode) and the removal answers (Removal facts (P-B3 U2, #2081)). FIRST_RECORDED: the BEFORE INSERT trigger removal_responses_first_recorded_at() sets a root’s first_recorded_at to its recorded_at and copies a correction’s from the response it supersedes, which must belong to the same episode (INTO STRICT refuses otherwise). refuse_event_row_mutation() (the craig-cases ADR-078 D1 text, byte-for-byte) refuses DELETE and admits an UPDATE only as a RETIRE. Partial uniques: uq_removal_responses_one_successor (supersedes_id) and uq_removal_responses_one_live (episode_id WHERE retired_at IS NULL) — one live response per episode.

exit_responses (#2019) — the exit event ledger, the one home of AFCARS (g)(1)–(g)(4): episode_id (FK, ON DELETE RESTRICT), exit_at g)(1, exit_reason g)(3); CHECK: the eight ExitReason tokens reunify_with_parents_legal_guardians, live_with_other_relatives, adoption, emancipation, guardianship, runaway_or_whereabouts_unknown, death_of_child, transfer_to_another_agency — never not_applicable, which a report answers from "no live exit"), transfer_agency_type ((g)(4); CHECK: the seven TransferAgencyType tokens state_title_iv_e_agency, tribal_title_iv_e_agency, indian_tribe_or_tribal_agency_non_iv_e, juvenile_justice_agency, mental_health_agency, other_public_agency, private_agency; chk_exit_responses_transfer_paired holds it NOT NULL exactly when exit_reason is transfer_to_another_agency), recorded_at / recorded_by, first_recorded_at ((g)(2, supersedes_id (self-FK; CHECK never itself) and the RETIRE columns (retired_reason ∈ corrected or retracted, retired_at / retired_reason / retired_by paired, a note only on a retired row). FIRST_RECORDED as on removal_responses: the BEFORE INSERT trigger exit_responses_first_recorded_at() sets a root’s first_recorded_at to its recorded_at and copies a correction’s from the exit it supersedes, which must belong to the same episode. refuse_event_row_mutation() is attached (not re-defined): insert-only except a RETIRE. Partial uniques: uq_exit_responses_one_successor (supersedes_id) and uq_exit_responses_one_live (episode_id WHERE retired_at IS NULL) — one live exit per episode. An exit retraction ends its chain: an exit recorded after it is a new root response with its own first_recorded_at (R-B18). #2083 adds the twenty-one nullable adoption / guardianship exit answers — (h)(1), (h)(2), the two adoptive-parent slots for (h)(3)–(h)(12), (h)(13), (h)(15) and (i)(10)–(i)(13) — with their token CHECKs, the (h) and (i) family CHECKs on exit_reason, the slot, siblings and good-cause gates; see The adoption / guardianship exit (P-B3 U4, #2083).

R14 (both response ledgers). recorded_at is DEFAULT now() and no act body carries it (the open, removal correction, exit record or correction and historical bodies are strict, deny_unknown_fields, so a client-sent recorded_at is refused, never stored; the two retractions reuse the lenient LedgerRetractRequest and write no response row); the seed supplies its own. A correction may not move the event date past the date of the chain’s first_recorded_at (400 response-after-recording). A late entry through the API — an open with a past removal_at, or a historical episode, whose stamps are now() too — is therefore honestly tardy: its (d)(2) / (g)(2) are the recording dates.

placement_end_reason_rewrites (#2023) — the audit of the one sanctioned end-reason rewrite: placement_id (PK, FK placements (id) ON DELETE RESTRICT), from_reason (CHECK chk_placement_end_reason_rewrites_from_reason: the six exit tokens reunification, adoption, aging_out, guardianship, emancipation, death), exit_response_id (FK exit_responses (id) ON DELETE RESTRICT, the live exit that carries the reason) and rewritten_at (default now()). The trigger trg_placement_end_reason_rewrites_append_only (refuse_end_reason_rewrite_mutation()) refuses every UPDATE and DELETE with SQLSTATE 23000, for every role, the owner included; the migrate gate revokes INSERT, UPDATE, DELETE and TRUNCATE from every non-owner grantee on every successful verdict (#2337; the migration’s own revoke names only the devstack role craig_placement_app). Only migration 20260926120000_end_reason_narrowing.sql writes it, and the service never reads it.

ck_episode_current_instants (constraint trigger, DEFERRABLE INITIALLY DEFERRED, on removal_episodes, removal_responses, exit_responses and (#2082) both trafficking ledgers): at COMMIT a live episode’s removal_at equals its live removal response’s and its exit_at equals its live exit response’s (NULL when it has none); a retired episode is inert — it holds no live removal, exit or trafficking row, or the trigger refuses.

placements (the arrangement) — new columns episode_id UUID NOT NULL, activated_at, cancelled_at, cancelled_by, cancel_note; index idx_placements_episode. #2020 adds retracted_at, retracted_by, retract_note and replaces_placement_id (all Plaintext), the FK fk_placements_replaces and the partial unique index uq_placements_one_replacement. Constraints (as of #2020):

  • fk_placements_episode: (episode_id, child_id, case_id) REFERENCES removal_episodes (id, child_id, case_id) ON DELETE RESTRICT — the placement’s child and case are the episode’s.

  • placements_status_vocab: planned, active, ended, cancelled, retracted (#2020 widened it).

  • placements_activated_pairing: (activated_at IS NOT NULL) = (status IN ('active', 'ended', 'retracted')) — a retracted row keeps its activated_at.

  • placements_started_by_activation: activated_at IS NULL OR started_at ⇐ activated_at.

  • placements_cancel_all_or_none: the three cancel columns are all set exactly when status = 'cancelled'.

  • placements_retract_all_or_none (#2020): the retract trio retracted_at / retracted_by / retract_note is all set exactly when status = 'retracted'.

  • placements_ended_has_ended_at (#2020; with the next two it replaces #1583’s placements_ended_pairing and placements_end_reason_only_when_ended): status <> 'ended' OR ended_at IS NOT NULL — an ended row always carries its end instant.

  • placements_ended_at_when_ended_or_retracted (#2020): ended_at IS NULL OR status IN ('ended', 'retracted') — a retract of an ended row keeps ended_at as the record.

  • placements_end_reason_when_ended_or_retracted (#2020): end_reason IS NULL OR status IN ('ended', 'retracted') — likewise end_reason.

  • fk_placements_replaces (#2020): replaces_placement_id REFERENCES placements (id) ON DELETE RESTRICT.

  • uq_placements_one_replacement (#2020, partial unique index): (replaces_placement_id) WHERE replaces_placement_id IS NOT NULL AND status <> 'cancelled' — at most one non-cancelled replacement per retracted arrangement (a cancelled planned replacement frees the slot). It is the unmapped DB twin of the API’s 409 invalid-replacement, which refuses first under the episode lock; a write that reaches the index keeps the house error mapping.

  • placements_ended_after_started: now ended_at IS NULL OR ended_at > started_at (a zero-length arrangement is refused; the PUT refuses it first, a generic 400 bad request).

  • excl_placements_child_arrangement: EXCLUDE USING gist (child_id WITH =, tstzrange(started_at, ended_at, '[)') WITH &&) WHERE (activated_at IS NOT NULL AND status <> 'retracted') — a child’s effective arrangements never overlap (409 arrangement-overlap). Effective means activated and not retracted: a retracted row keeps its activated_at but leaves the exclusion (and ck_arrangement_in_episode), so its instants are free for the re-record.

  • ck_arrangement_in_episode (constraint trigger, deferred, fired by a placement write and by a change to the episode’s removal_at / exit_at): an activated arrangement of a live episode starts at or after removal_at and ends at or before exit_at (an open end needs an open exit); 409 arrangement-outside-episode. The exit acts move exit_at, so they re-run it.

  • chk_placements_end_reason (#2019 widened it, #2023 narrowed it): end_reason is NULL or one of transfer, disruption, runaway, left_care. left_care ends the arrangement because the agency’s placement and care responsibility ended; the reason the child left care lives only on the episode’s exit (ADR-079 D4).

  • placements_ended_recorded_pairing (#2187): (ended_at IS NULL) = (ended_recorded_at IS NULL). ended_recorded_at (TIMESTAMPTZ, Plaintext, in no response body) is the DB instant of the statement that wrote ended_at: the ending PUT stamps statement_timestamp() (COALESCEd, write-once), a historical record now() (its own activated_at). Migration 20261005120000_end_record_stamps backfilled every earlier end with activated_at (a binding’s with created_at) and bumped schema_compat_floor.

  • placements_ended_recorded_after_activation (#2187): ended_recorded_at >= activated_at. The PUT stamps statement_timestamp(), not now(): an end whose transaction began before a racing activation runs its UPDATE after the locked read that saw the activation.

The writers run SET CONSTRAINTS ck_arrangement_in_episode, ck_episode_current_instants IMMEDIATE (store::removal_episodes::check_deferred) before staging their events, so neither fires at COMMIT, where a failure would be a redacted 500 (ADR-079 D2, plan erratum E1). Both trigger functions raise SQLSTATE 23514 naming their constraint: ck_arrangement_in_episode answers the typed 409 arrangement-outside-episode; ck_episode_current_instants stays a redacted 500, because the acts write an episode and its responses in step and a disagreement is a server defect no request can trip.

Lock order. claim_first → (the episode open, the historical episode and the placement create: the per-case advisory lock) → (the episode and exit acts and the placement create: the projection FOR SHARE re-read and pair compare) → (the episode, exit and trafficking acts, the open and the historical episode included: the child-episode advisory lock, Child-keyed records: the custody-unit stamp (#1909 b, ADR-077 D5/D6)) → the episode FOR NO KEY UPDATE (every act but the open and the historical episode, which insert it) → the placement → the foster home. The PUT, the cancel and the retract (#2020) lock episode → placement (→ home) and take no projection lock: the placement row carries its own assignment pair, re-compared under its lock. The retract checks no caregiver binding (#2058: a binding keys the kinship household, not the arrangement); an active → retracted flip decrements the home through the occupancy trigger, after the placement lock. The historical record (#2020) takes the root-birth order of the placement create: the per-case advisory lock and the projection re-read, then the episode, then (when it names replaces_placement_id) the replaced placement, then the foster home. The live create’s replacement check locks the replaced placement at the same point, after the episode and before the home.

The replacement chain (#2020, R-B21). A re-record — the live create or the historical record — may name in replaces_placement_id only a retracted arrangement of the same episode that no non-cancelled row already replaces; anything else is one 409 invalid-replacement, so ids cannot be probed across episodes. A retracted replacement still holds its slot, so a second correction names the retracted replacement, not the original: X ← Y ← Z. Financial re-anchors a subsidy agreement along the chain, X → Y, then Y → Z.

Acts and routes (full contracts: craig-placement API):

Route Act

POST /v1/placement/episodes

Open: the episode and its root removal response in one transaction. 400 ledger-instant-after-now (a future removal_at); 409 episode-overlap; the child is verified against craig-cases' placement facts (503 when it does not answer).

POST /v1/placement/episodes/{id}/removal/{row_id}/corrections

Correct the live removal response: the successor supersedes and retires it and the episode’s removal_at moves. 400 ledger-instant-after-now (a future removal_at), response-after-recording (the corrected removal date is after the chain’s first_recorded_at date), exit-before-removal (the new removal_at is at or after the episode’s live exit); 404 ledger-row-not-found; 409 episode-retracted, episode-overlap, arrangement-outside-episode.

POST /v1/placement/episodes/{id}/retract

Retract an episode entered in error: its live removal response, its live exit response (if any) and the episode are retired retracted. 409 episode-has-arrangements while a planned, active or ended arrangement references it.

POST /v1/placement/episodes/{id}/exit

Record the exit (#2019): the root exit response, and the episode’s exit_at is set. 400 ledger-instant-after-now (a future exit_at), exit-before-removal (exit_at at or before the removal); 409 episode-retracted, episode-already-exited (correct or retract the live exit instead), episode-has-open-arrangement (a planned or active arrangement — end or cancel it first), arrangement-outside-episode (an ended arrangement runs past the exit); 422 when transfer_agency_type is not given exactly for transfer_to_another_agency.

POST /v1/placement/episodes/{id}/exit/{row_id}/corrections

Correct the live exit response: the successor supersedes and retires it and the episode’s exit_at moves. 400 ledger-instant-after-now, response-after-recording (the corrected exit date is after the chain’s first_recorded_at date), exit-before-removal; 404 ledger-row-not-found; 409 episode-retracted, episode-overlap (the moved exit reaches the child’s later episode), arrangement-outside-episode; 422 as on the record.

POST /v1/placement/episodes/{id}/exit/{row_id}/retract

Retract the live exit response entered in error (with a note): it is retired retracted and the episode’s exit_at is cleared, re-opening it. 404 ledger-row-not-found; 409 episode-retracted, later-episode-exists (the re-opened window would overlap the child’s later live episode — retract or correct that first).

POST /v1/placement/episodes/historical

Record an already-ended episode (#2019): the episode, its root removal response and its root exit response in one transaction; 201 on a fresh call and on its replay. 400 ledger-instant-after-now, exit-before-removal; 409 episode-overlap; 422 as on the exit record; the child is verified against craig-cases' placement facts as on the open (503 when it does not answer).

GET /v1/placement/children/{child_id}/episodes

The child’s live episodes, each with its live removal response and its live exit response (exit, null while the child is in care); an unreadable episode is omitted.

POST /v1/placement/placements/{id}/cancel

Cancel a planned placement (planned → cancelled, with a note); 400 invalid-state-transition otherwise.

POST /v1/placement/placements/{id}/retract

Retract an active or ended placement entered in error (#2020; → retracted, with a 1–1000 character note); 200 PlacementRetracted (the same answer on a replay), retracted_from naming the origin. The row is kept as the record (activated_at, ended_at, end_reason stay) and leaves the effective set, so an active row frees its bed. 400 invalid-state-transition otherwise; 403 for a service principal; 404; 409 concurrent-modification. A caregiver binding never blocks it (#2058: bindings key the kinship household).

POST /v1/placement/placements/historical

Record a missed past arrangement (#2020): born ended with ended_at and end_reason set at birth and activated_at = the transaction instant; it never activates, never occupies (even a full home admits it; existence is the only home check) and never bills. Optional replaces_placement_id; #2058: optional kinship_household on a home-less family row (Kinship households (P-B2 U5, #2058)); #2080: + the 16 arrangement-fact keys (required, nullable; Arrangement facts (P-B3 U1, #2080)). 201 PlacementRecorded on a fresh call and on its replay. 400 when ended_at is not after started_at, ledger-instant-after-now (ended_at after the transaction’s instant); 403 for a service principal; 404 for an unknown episode or foster home; 409 episode-retracted (an exited episode is admitted), arrangement-overlap, arrangement-outside-episode, invalid-replacement, concurrent-modification.

POST /v1/placement/placements

Now requires episode_id; case_id / child_id come from the episode. 404 for an unknown episode; 409 episode-retracted / episode-closed (the episode has a live exit); a birth-active create also answers 400 activation-start-out-of-range and 409 arrangement-overlap / arrangement-outside-episode. #2020: optional replaces_placement_id (the retracted arrangement of the same episode it re-records; 409 invalid-replacement otherwise, checked after activation-start-out-of-range and before the home). #2058: optional kinship_household on a home-less family row (Kinship households (P-B2 U5, #2058)). #2080: + the 16 arrangement-fact keys (required, nullable; Arrangement facts (P-B3 U1, #2080)).

PUT /v1/placement/placements/{id}

Moves only planned → active and active → ended; arrangement_facts edits a planned, active or ended row; started_at is accepted only on the activation; an activation also answers 409 arrangement-overlap / arrangement-outside-episode, and a status change or a facts edit on a retracted episode 409 episode-retracted; the removal, CTW and reasonable-efforts fields are gone (#2018), and so is permanency_goal (#2024). #2080: the optional arrangement_facts arm — absent or null = unchanged, present = the complete state of all sixteen keys (Arrangement facts (P-B3 U1, #2080)). #2044: an ended_at after the transaction’s instant is refused 400 ledger-instant-after-now on ended_at (the historical record’s rule; an end AT that instant is admitted). An end is recorded when it happens, never scheduled. craig-web’s end form, like its exit form, reads "today" on the deployment’s business clock (the active bundle’s declared zone, #2215). It sends a date-only value on or before that day as min(noon UTC, now), so a same-day end entered before noon UTC is the moment of the request. It sends a later date unclamped, for this PUT to refuse. The exit form can then record the exit at that date at once, because its own clamp lands at or after the end. An earlier date keeps the #1111 noon UTC (in a zone at UTC+12 or beyond, where noon UTC is already the next business day, the date’s local noon stands in for noon UTC throughout).

Every write above except the PUT also answers 403 for a pure service principal (before any lookup), 409 concurrent-modification when the case assignment changed between the authorization check and the lock, 409 on an ADR-062 client_request_id reuse with a different body, and 422 on a missing client_request_id. The open and the historical episode (and a caregiving birth-active create or planned → active) relay craig-cases' placement-facts refusals (400 child-not-in-case / placement-facts-clock-drift, 409 case-closed for a closed or transferred case (#2029), 422 child-dob-missing) and answer 503 when craig-cases does not answer that read. The lifecycle check is advisory: placement holds no case lock, so a case can close between the read and the write’s commit. The acts that read no facts stay admitted on a closed case: a non-caregiving activation, a birth-planned create, the historical arrangement record (POST /v1/placement/placements/historical), the exit act, the plain end, and the removal and exit corrections. A replay of a committed act still answers its stored row after the case closes, because the replay precheck runs before the read.

Every episode act answers the resulting EpisodeRow { id, child_id, case_id, admin_unit, removal_at, exit_at, recorded_at, removal, exit } — 201 for the open and the historical episode (a fresh call and its replay alike), 200 for the other acts. removal and exit are ResponseRow`s: the shared event row (its id, `episode_id, the facts and the provenance) flattened beside first_recorded_at. exit is null exactly when exit_at is null; otherwise it is the exit response exit_at is from — the live one on a live episode, the one retired with it on a retracted episode. admin_unit is the unit the episode is stamped with (ADR-077 D6), null until craig-placement’s case-assignment projection knows the case (#2065). The open, correction, exit and historical bodies are strict (deny_unknown_fields); the two retractions reuse the lenient LedgerRetractRequest and write no response row; the answers are lenient.

Authority: an episode is authorized as a Placement (no new resource type, no ruleset row) over the case’s case_assignments pair and the episode’s admin_unit — for the open and the historical episode, which have no episode row yet, the case’s current unit, the one the new episode is stamped with. Those two are Action::Create, every other episode and exit write Action::Update; the child list checks Action::Read per episode and omits a denied row. The cancel and the retract are Action::Update on the placement (dual-state check); the historical record is Action::Create on the episode’s case, as the create.

Events (each staged in the act’s transaction through the outbox; ids, closed tokens and instants only, never a removal fact; placement.episode_exited alone carries the exit’s date and reason (fleet vocabulary, not PII); deny_unknown_fields): placement.episode_facts_changed { episode_id, child_id, case_id, ledger, row_id, act, user_id } — one per episode, exit or (#2082) trafficking act (ledger is removal_episodes, removal_responses, exit_responses, episode_trafficking_statements or trafficking_law_enforcement_reports; act is recorded, corrected or retracted; the open and the episode retraction name the episode, a correction its successor response, an exit record its root exit response, an exit retraction the retired exit response, a trafficking record the new row, its correction the successor and its retraction the retired row; an episode retraction that also retires a live exit or live trafficking rows still publishes only its removal_episodes / retracted event), except the historical episode, which publishes two (removal_episodes / recorded naming the episode, then exit_responses / recorded naming its exit response) — and placement.cancelled { placement_id, episode_id, child_id, case_id, user_id } (the note stays on the row). #2020 adds placement.retracted { placement_id, episode_id, child_id, case_id, retracted_from, user_id } (retracted_from is active or ended; the note stays on the row) and placement.recorded { placement_id, episode_id, child_id, case_id, started_at, replaces_placement_id?, user_id } — the historical record’s one lifecycle event (no placement.created, placement.activated or placement.ended; the #634 placement.field_written audit of its status is staged beside it). placement.activated gains an optional field replaces_placement_id, present only when the activated row re-records a retracted one, so a plain activation carries no such key. #2056 (plan afcars-placement-facts D2, D5): placement.activated carries placement_type as the federal setting token (foster_family_home or an (e)(4) token) and gains the optional ffh_types (the applying (e)(3) categories, omitted off a family row), and placement.recorded becomes { placement_id, episode_id, child_id, case_id, started_at, placement_type, ffh_types?, replaces_placement_id?, user_id }; craig-financial derives the rate class from the pair. #2058 adds kinship_household_id to placement.created (not to placement.recorded). #2021 adds placement.episode_exited { episode_id, child_id, case_id, arrangement_ids, current: { exit_on, exit_reason } | null, act_id, act_at, user_id } — one per exit record, correction and retraction and one from the historical episode (an episode retraction publishes none), staged after the act’s placement.episode_facts_changed; current is the episode’s live exit after the act (null after a retraction), arrangement_ids every live arrangement (planned, active, ended, by started_at then id; empty for a historical episode), act_at the act’s clock_timestamp() under the episode lock. Strict at its top level; current is the lenient EpisodeExit the subsidy-eligibility read also serves.

#2017 (plan D6, R-B11) lands the routing key placement.afcars_released: the AFCARS release audit, strict payload { requestor, purpose, child_ids, child_count, from, to, as_of } — requestor the closed token craig-reporting, purpose the closed token afcars-2020 federal reporting, child_ids the released children, child_count their number, and the resolved report window and read instant (never a placement fact). craig-security parses it (read, placement). #2119 (P-D1 of #1965) adds its emitter, the service-only GET /v1/placement/afcars-export. It stages one event per non-empty page. child_ids is the page’s distinct children, ascending. The event is staged in the page’s read transaction, before the no-store body is built. An empty page stages none.

AFCARS export reads (#2119, #2120). The export reads removal_episodes, removal_responses, exit_responses and placements, all as of the request’s as_of. #2120 adds episode_trafficking_statements, trafficking_law_enforcement_reports, child_health_facts, child_education_facts, caregiver_bindings and health_records, read the same way. Each table falls in one of two as-of classes, and two column sets read through their revisions:

  • Class 1, the ledger rows (removal_episodes, removal_responses, exit_responses): a row is live when recorded_at ⇐ as_of and it is not retired by then (retired_at null or after as_of).

  • Class 2, the arrangements (placements): a row counts when activated_at ⇐ as_of and it is not retracted by then (status <> 'retracted' or retracted_at after as_of). Planned and cancelled rows have no activated_at, so they drop out. An arrangement’s ended_at counts only when ended_recorded_at ⇐ as_of (#2187); an end recorded later reads open, and an end written before the stamp migration reads as known from activated_at.

  • Revisions (#2188): an arrangement’s sixteen facts and a health record’s visit_date and health_assessment read as they stood at as_of: the earliest placement_fact_revisions / health_record_revisions row with superseded_at > as_of (by superseded_at, then id), else the live row. A revision’s NULL is an answer, never COALESCEd. The history starts with migration 20261005130000_placement_revisions. started_at (fixed at activation, which class 2 fences), placement_type, the ffh_type_* columns and the setting (fixed at insert) are never edited in place, so no placement column reads current and the pages of one walk agree.

The cohort is closed at from: a child is in when a live removal falls before to and its live exit is absent or not before from. The cohort uses the live responses' instants, never the episode row’s current ones. An episode’s exit is served only when its exit_at is before to. Rows come in (child_id, kind, row_id) order. The export answers no _note, created_by, cancelled_by or retracted_by column: the narrow row structs omit them. The episode and exit reads load the whole response row and serialize only its element columns; the arrangement read never selects them.

The #2120 tables, by class (plan afcars-pipeline-sources D3):

Table Class Live at as_of when Reads current

episode_trafficking_statements, trafficking_law_enforcement_reports

1

recorded_at ⇐ as_of and not retired by then

nothing (insert-only)

child_health_facts, child_education_facts

1 + close

the same; effective_until is normalized at as_of (below)

nothing

caregiver_bindings

2

created_at ⇐ as_of

nothing (ended_on reads only once ended_recorded_at ⇐ as_of, #2187)

health_records

2

created_at ⇐ as_of and not deleted by then (deleted_at null or after as_of). active is never read: it is current-time.

nothing (visit_date and health_assessment read through health_record_revisions, #2188)

placements (the slot inputs)

2

as above

nothing (started_at fixed at activation; placement_type and the setting fixed at insert; the facts read through placement_fact_revisions, #2188)

Window normalization. A health or education window closed after as_of reads open: the export serves effective_until as null when closed_at > as_of, and every in-force test treats such a window as open.

The five appended kinds (#2120). After episode (1) and arrangement (2) come five more. Ordinals are append-only and the cursor version stays 0x01. to_d is the local date of to on the jurisdiction clock, and period_end is the day before to_d. An episode here is a live removal (before to) of a cohort child; an exit is answered when its exit_at is before to. Each kind’s anchor:

  • trafficking_statement (3): per episode, the one latest statement live at as_of with stated_on before to_d (latest by stated_on, then recorded_at, then id). Its facts are raw; the (d)(6)(i) gate is reporting’s.

  • law_enforcement_report (4): every report live at as_of with reported_on before to_d.

  • health_window (5): the health window in force at period_end.

  • education_window (6): the education window in force at period_end, and the one in force at the local date of each answered exit with exit_at at or after from.

  • health_assessment_visit (7): every visit flagged health_assessment at as_of, existing at as_of and dated (as at as_of) before to_d, from the removal’s local date through the answered exit’s local date (inclusive at both ends; an unanswered exit leaves the window open). The row carries only visit_date, as at as_of (#2188); reporting holds removal_at and exit_at and decides (b)(9).

A key reached through two anchors or two episodes is served once. No kind 3–7 row selects retired_note, retired_by, recorded_by, closed_by, notes, diagnosis, treatment_plan, medications, provider_name, recorded_by_name or immunization_name.

The arrangement’s slots (#2120, P-B2 D6). An arrangement row also carries first_caregiver_person_id and second_caregiver_person_id, the (e)(9)–(e)(13) and (e)(14)–(e)(18) persons; both serialize as null, never skipped. They are filled for a foster_family_home arrangement only; any other placement type (including a congregate row with a foster_home_id) answers null / null. With d the local date of started_at, a binding counts when it is on the arrangement’s unit (the same foster_home_id or kinship_household_id), was created by as_of, and covers d half-open: effective_from ⇐ d AND (ended_on IS NULL OR ended_on > d) AND ended_on IS DISTINCT FROM effective_from, with ended_on read as of as_of (CASE WHEN ended_recorded_at ⇐ as_of THEN ended_on END, #2187: an end or cancel recorded later reads open). The covering bindings run primary first, then by effective_from, created_at and id; the first two distinct persons fill First and Second, and fewer persons leave the rest null. This is the Caregiver slots rule below, fenced at as_of.

The setting on the eligibility read (#2056, plan afcars-placement-facts D5). PlacementSubsidyEligibility also serves ffh_types, the applying (e)(3) categories, exactly for a foster_family_home setting (typed: an unknown category fails the decode; serde-defaulted); craig-financial’s ERR rule reads them.

The exit, read (#2021, ADR-079 D4). GET /v1/placement/placements/{id}/subsidy-eligibility (PlacementSubsidyEligibility) gains the additive episode_exit { exit_on, exit_reason } | null: the episode’s live exit, served when the placement is its episode’s latest effective arrangement (by started_at, then id; activated and not retracted — the arrangement an exit leaves from is derived, never stored) or, since #2059, its residence run’s last member is; null otherwise; exit_on is the jurisdiction’s business date of exit_at. #2022: with ?as_of= absent, the read’s caregivers are evaluated at exit_on whenever episode_exit is served, else at the placement’s evidence date (the business date while planned/active, ended_on once ended), never ahead of the business date; craig-financial’s guardianship witness requires residence.ended_on == exit_on (#2059; the placement’s ended_on before) and takes exit_on as the transfer. U6a’s report-only invariant guardianship_ending_without_exit stated the same "latest effective" rule for U6b’s data gate (#2022). #2023 retired it: after the narrowing no arrangement can end guardianship, so it matched nothing by construction. The #2023 migration’s rewrite states that latest-effective rule instead (pinned apart from the projection’s run read by a unit test since #2059); it requires no ended_on == exit_on match, so a rewritten row need not satisfy the witness. #2046: the report-only invariant left_care_ending_without_exit (severity medium, grace 0 s) lists each live episode’s latest effective arrangement (that same rule) that ended left_care while the episode holds no live exit; any live exit clears it, whatever its reason or instant (ck_arrangement_in_episode already holds the exit at or after the end). It stays outside BLOCKING_INVARIANTS: an API or CLI left_care end records no exit, and a web end whose exit act was refused (#2047) leaves the arrangement ended without one. Journeys enforce it in their footprint (journey_sweep::SELECTORS). Until the exit is recorded, the witness refuses the anchor (NO_EXIT).

The residence run (#2059, plan afcars-placement-facts D5, R-B27; ADR-079 and ADR-056 § Amendment (2026-09-26, #2026)). The subsidy-eligibility read gains the additive residence { started_on, ended_on, arrangement_ids } | null (ResidenceRun). For an effective caregiving placement X it is the maximal sequence of X’s episode’s effective arrangements, by started_at then id, containing X, whose first and last members are caregiving, whose caregiving members all name X’s setting identity (foster_home_id or kinship_household_id), and in which each member starts on the jurisdiction date the previous one ended (date_of(next.started_at) = date_of(prev.ended_at)); non-caregiving members sit only between. started_on is the first member’s start, ended_on the last member’s end (null while open), arrangement_ids the members in order — never a unit id; null for a planned, cancelled, retracted or non-caregiving placement. It is derived on every read from ONE statement over the episode’s effective arrangements (store::exit_responses::episode_arrangements, then the DB-free residence::residence_run), so a correction, retraction, historical record or replacement changes it at once; nothing stores it, no event carries it, and no agreement moves (ADR-052’s re-anchor is unchanged). The read’s caregivers, dated exit_on whenever the exit is served, are the run’s: every caregiving member names X’s identity. A run or hospital row between caregiving members counts inside the run’s span (⁂ #1073). craig-financial’s residence floor measures from residence.started_on; SG / NRSG creates refuse a non-caregiving anchor (422 subsidy-anchor-not-caregiving).

AFCARS element → column map (craig_placement_contracts::afcars::AFCARS_ELEMENT_COLUMNS at AFCARS_CAPTURE_STAGE = B3U5 (= LAST_UNIT), written in the shared craig_reporting_contracts::afcars_capture::Mapping with its own PlacementCaptureUnit stage enum — one variant per landing unit, B1U3 … B3U5; OWNED_ELEMENTS names all 67 keys placement owns, each on its unit: (d)(1), (d)(2) and (e)(1) at B1U3, (g)(1)–(g)(4) at B1U4, (e)(9)–(e)(18) and (b)(20) at B2U1, (e)(2)–(e)(4) at B2U3, (b)(21) at B2U5, (e)(5)–(e)(8) and (i)(5)–(i)(8) at B3U1, (d)(3), (d)(4), (i)(1) and (i)(4) at B3U2, (d)(5)–(d)(6)(ii) at B3U3, (h)(1)–(h)(13), (h)(15) and (i)(10)–(i)(13) at B3U4, (b)(9)–(b)(12), (b)(14) at B3U5). craig-placement’s tests/afcars_elements.rs checks each entry against its dictionary row’s atom and cardinality (every_due_key_maps_to_a_column_its_dictionary_row_fits; an Each column is <prefix>_<category>, or, only where that name exceeds 63 bytes, a non-empty <prefix>_<slug> that fits — the P-B3 D5 slug rule, an_unneeded_or_overlong_slug_is_a_problem), probes that at the last unit every owned key is mapped (at_the_last_unit_every_owned_key_is_mapped), pins the stored exit token sets to the dictionary’s less not_applicable, and, against a migrated devstack, checks that every mapped placement column exists with a type its atom admits and that every Derived placement input exists. cargo xtask rules check’s AFCARS partition finding (`xtask/src/cmd/afcars_partition.rs, plan D11) holds every dictionary key in exactly one of craig-cases' and craig-placement’s OWNED_ELEMENTS and OWNED_ELSEWHERE (142 = 57 + 67 + 18), every listed key in the dictionary, a map at its LAST_UNIT complete, and every Person / Derived cases half registered; placement’s map is held complete (P3) from P-B3 U5 (LAST_UNIT = B3U5, #2084). Every reported date is the column’s instant on the jurisdiction clock (BusinessClock::date_of). P-B3 (#2052) completes the map:

Element key Mapping Column

oohc.d1.2022-10-01

Column

removal_responses.removal_at (the live removal response)

oohc.d2.2022-10-01

Column

removal_responses.first_recorded_at (the date the removal chain was first recorded, R14)

oohc.d3.2022-10-01

Column

removal_responses.environment (#2081; seven RemovalEnvironment tokens)

oohc.d4.2022-10-01

Each

removal_responses.circumstance_<category> (#2081), 34 applies | does_not_apply columns; two carry their D5 slug: circumstance_caretakers_impairment_physical_emotional, circumstance_family_conflict_orientation_gender_identity

oohc.d5.2022-10-01

Column

episode_trafficking_statements.prior_victim (#2082; the live statement with stated_on ≤ the period’s to)

oohc.d5i.2022-10-01

Column

episode_trafficking_statements.prior_reported (#2082; the live statement with stated_on ≤ the period’s to)

oohc.d5ii.2022-10-01

Column

episode_trafficking_statements.prior_reported_on (#2082; the live statement with stated_on ≤ the period’s to)

oohc.d6.2022-10-01

Column

episode_trafficking_statements.in_care_victim (#2082; the live statement with stated_on ≤ the period’s to)

oohc.d6i.2022-10-01

Column

episode_trafficking_statements.in_care_reported (#2082; the live statement with stated_on ≤ the period’s to)

oohc.d6ii.2022-10-01

Column

trafficking_law_enforcement_reports.reported_on (#2082; every live report dated ≤ the period’s to; P-D applies the (d)(6)(i) gate)

oohc.e1.2022-10-01

Column

placements.started_at alone (the arrangement’s business start)

oohc.e2.2022-10-01

Column

placements.foster_family_home (GENERATED: yes iff placement_type = foster_family_home)

oohc.e3.2022-10-01

Each

placements.ffh_type_<category>, the six (e)(3) flags (NULL off a family row)

oohc.e4.2022-10-01

Column

placements.placement_type (P-D blanks it when (e)(2) is yes, D2)

oohc.e5.2022-10-01

Column

placements.arrangement_location (#2080; the runaway token exactly on a runaway / whereabouts setting)

oohc.e6.2022-10-01

Column

placements.arrangement_jurisdiction (#2080; free text beside an out-of-state or out-of-country (e)(5), until #1973)

oohc.e7.2022-10-01

Column

placements.foster_parents_marital_status (#2080; NULL off a family row)

oohc.e8.2022-10-01

Column

placements.relationship_to_foster_parents (#2080; NULL off a family row)

oohc.i1i.2028-10-01

Column

removal_responses.icwa_transfer_requested (#2081)

oohc.i1ii.2028-10-01

Column

removal_responses.icwa_transfer_denied (#2081; only on an (i)(1)(i) yes)

oohc.i1iii.2028-10-01

Each

removal_responses.icwa_denial_<category> (#2081), three applies | does_not_apply columns, only on an (i)(1)(ii) yes; all three carry their D5 slug: icwa_denial_parents_objected, icwa_denial_tribal_court_declined, icwa_denial_state_court_good_cause

oohc.i4i.2028-10-01

Column

removal_responses.icwa_clear_and_convincing_evidence (#2081)

oohc.i4ii.2028-10-01

Column

removal_responses.icwa_qualified_expert_witness (#2081)

oohc.i4iii.2028-10-01

Column

removal_responses.icwa_active_efforts (#2081)

oohc.i5.2028-10-01

Each

placements.icwa_available_<category> (#2080), five yes | no | not_applicable columns; four carry their D5 slug: icwa_available_tribe_licensed_foster_home, icwa_available_indian_foster_home_non_indian_licensed, icwa_available_indian_institution, icwa_available_tribe_order_of_preference

oohc.i6.2028-10-01

Column

placements.icwa_preference_met (#2080)

oohc.i7.2028-10-01

Column

placements.icwa_good_cause (#2080; only when (i)(6) misses the preferences)

oohc.i8.2028-10-01

Each

placements.icwa_good_cause_basis_<category> (#2080), five yes | no columns, only on an (i)(7) yes; four carry their D5 slug: icwa_good_cause_basis_parents_request, icwa_good_cause_basis_no_suitable_placement, icwa_good_cause_basis_extraordinary_needs, icwa_good_cause_basis_sibling_attachment

oohc.i10.2028-10-01

Each

exit_responses.adoptive_icwa_available_<category> (#2083), four yes | no | not_applicable columns, only on an adoption exit; three carry their D5 slug: adoptive_icwa_available_extended_family, adoptive_icwa_available_tribe_members, adoptive_icwa_available_tribe_order_of_preference

oohc.i11.2028-10-01

Column

exit_responses.adoptive_icwa_preference_met (#2083; five IcwaAdoptivePreference tokens, only on an adoption exit)

oohc.i12.2028-10-01

Column

exit_responses.adoptive_icwa_good_cause (#2083; only when (i)(11) misses the preferences)

oohc.i13.2028-10-01

Each

exit_responses.adoptive_icwa_good_cause_basis_<category> (#2083), five yes | no columns, only on an (i)(12) yes; four carry their D5 slug: adoptive_icwa_good_cause_basis_parents_request, adoptive_icwa_good_cause_basis_no_suitable_placement, adoptive_icwa_good_cause_basis_extraordinary_needs, adoptive_icwa_good_cause_basis_sibling_attachment

oohc.g1.2022-10-01

Column

exit_responses.exit_at (the live exit)

oohc.g2.2022-10-01

Column

exit_responses.first_recorded_at (R14; an exit recorded after a retraction is a new root, R-B18)

oohc.g3.2022-10-01

Column

exit_responses.exit_reason (never not_applicable, which a report answers from "no live exit")

oohc.g4.2022-10-01

Column

exit_responses.transfer_agency_type (stored exactly for transfer_to_another_agency)

oohc.h1.2022-10-01

Column

exit_responses.adoptive_marital_status (#2083; five AdoptiveMaritalStatus tokens, only on an adoption or guardianship exit)

oohc.h2.2022-10-01

Each

exit_responses.relationship_<category> (#2083), four applies | does_not_apply columns (relatives, kin, non_relatives, foster_parents; no slug), only on an adoption or guardianship exit

oohc.h13.2022-10-01

Column

exit_responses.jurisdiction_kind (#2083; three AdoptionJurisdiction tokens; captured, never derived)

oohc.h15.2022-10-01

DateWithIndicator

exit_responses.siblings_in_home (#2083; 0–999) with the indicator exit_responses.siblings_not_applicable (TRUE or NULL, never both; captured, never derived)

oohc.b9.2022-10-01

Named

health_records.health_assessment, visit_date, active; removal_episodes.removal_at, exit_at (#2084; yes iff an active flagged visit falls within the episode, Child facts: health and education (P-B3 U5, #2084); P-D evaluates it)

oohc.b10.2022-10-01

Gated

child_health_facts.condition_status and its eleven condition_<category> answers (#2084; each only on child_has_a_diagnosed_condition; the live window containing the period’s end)

oohc.b11.2022-10-01

Column

child_education_facts.school_enrollment (#2084; the live window containing the earlier of the period’s end and the exit)

oohc.b12.2022-10-01

Column

child_education_facts.educational_level (#2084; the live window containing the period’s end)

oohc.b14.2022-10-01

Column

child_education_facts.special_education (#2084; the live window containing the period’s end)

oohc.e9.2022-10-01 … oohc.e13.2022-10-01

Person

first caregiver slot → persons.birth_year else year_of_birth_declared; person_demographic_facts.tribal_member; its seven race_* (not race_abandoned); ethnicity; persons.sex

oohc.e14.2022-10-01 … oohc.e18.2022-10-01

Person

the same five facts, second caregiver slot

oohc.h3.2022-10-01

Person

first adoptive slot (exit_responses.first_adoptive_parent_person_id, #2083) → persons.date_of_birth (a declared year alone leaves it missing)

oohc.h4.2022-10-01

Person

first adoptive slot → person_demographic_facts.tribal_member

oohc.h5.2022-10-01

Person

first adoptive slot → its seven race_* (not race_abandoned)

oohc.h6.2022-10-01

Person

first adoptive slot → ethnicity

oohc.h7.2022-10-01

Person

first adoptive slot → persons.sex

oohc.h8.2022-10-01

Person

second adoptive slot (exit_responses.second_adoptive_parent_person_id, #2083) → persons.date_of_birth (a declared year alone leaves it missing)

oohc.h9.2022-10-01

Person

second adoptive slot → person_demographic_facts.tribal_member

oohc.h10.2022-10-01

Person

second adoptive slot → its seven race_* (not race_abandoned)

oohc.h11.2022-10-01

Person

second adoptive slot → ethnicity

oohc.h12.2022-10-01

Person

second adoptive slot → persons.sex

oohc.b20.2022-10-01

Derived

cases person_siblings; placement removal_episodes, placements (the count is P-D’s, R-B32)

oohc.b21.2022-10-01

Derived

the (b)(20) inputs plus placements.foster_home_id, placements.kinship_household_id (the setting identity; a non-caregiving row shares none; the count is P-D’s, R-B32)

Caregiver slots (plan afcars-placement-facts D6, R-B28). (e)(9)–(e)(18) are no column. On a family arrangement’s (e)(1) date d, the covering bindings of its setting identity (foster_home_id or kinship_household_id) are those with effective_from ⇐ d AND (ended_on IS NULL OR ended_on > d) AND ended_on IS DISTINCT FROM effective_from. Slots are distinct persons: each person takes its first covering binding by role (primary, then co), effective_from, created_at, id, and the first two persons in that order fill First and Second (excl_caregiver_bindings_person_unit_window makes one person’s overlap unrepresentable). A caregiver bound after d is not reported for that arrangement (⁂ #1073); an adult’s abandoned race or ethnicity is P-D missing data. A non-family arrangement has no slot. P-D’s export computes the slots (#1965); one_person_fills_one_slot pins distinct persons and the devstack seed gives every seeded family arrangement a first slot at its start (#2060).

Person slots (plan afcars-placement-elements D3, #2083). (h)(3)–(h)(12) are no column of their own: the live exit’s first_adoptive_parent_person_id names the person whose five cases facts answer (h)(3)–(h)(7), and second_adoptive_parent_person_id the person for (h)(8)–(h)(12) (PersonVia::Column, where the caregiver slots use a binding window). Each is a craig-cases person id with no FK, verified against the cases projection when a fresh act names it; neither may name the episode’s child, and a second needs a first and names another person (the second is the other member of the couple and need not adopt). (h)(3) / (h)(8) are a date element, so they read the full persons.date_of_birth: a declared year alone leaves them missing. The (h)(4)–(h)(7) / (h)(9)–(h)(12) facts are the caregiver slots' (the ethnicity—​oohc_h6 / ethnicity—​oohc_h11 and sex—​oohc_h7 / sex—​oohc_h12 crosswalks serve (h)). The devstack seed derives an adoption or guardianship exit’s slots from the leaving family home’s caregivers (the primary first, a co second); an exit leaving a kinship household or a congregate row has none.

The (e)(1) exception: a child already in a living arrangement when the agency’s responsibility arrives is recorded with that arrangement’s started_at = removal_at — the voluntary placement agreement or court order that gives responsibility is the removal (§1355.44(e)(1), (d)(1)). A child on the run at that moment is P-B2’s (runaway rows).

The AFCARS export (P-D1, #2119, #2120)

P-D1 built GET /v1/placement/afcars-export (#2119; #2120 added the fact kinds). Its full read rules are under Removal episodes, exits and living arrangements (P-B1, #2018–#2024, ADR-079 D2–D4). Only the bare craig-reporting service principal may call it: any other caller, or a relayed (channel) token, is 403 before any read.

  • Cohort. Each child with an episode live at as_of whose removal is before to and whose exit is absent or not before from. from and to are local midnights; as_of is at least 5 minutes in the past.

  • Rows. episode, arrangement, trafficking_statement, law_enforcement_report, health_window, education_window and health_assessment_visit, under the kind tag, in (child_id, kind, row_id) order. limit bounds rows (1..=1000); next is an opaque cursor over the last row, present only when the page is full.

  • As of. Ledger rows read as they stood at as_of. Arrangements, caregiver bindings and health records are fenced on their stamps, and so are the two ends (ended_recorded_at, #2187). The arrangement facts and a health record’s visit read through their prior-value revisions (#2188). No placement column reads current, so the pages of one walk agree. A page’s statements run in one REPEATABLE READ transaction (#2422), so a commit landing mid-page is wholly seen or wholly unseen by that page.

  • Audit. Each non-empty page stages one placement.afcars_released in its read transaction: requestor, purpose, child_ids (the page’s distinct children), child_count, from, to, as_of. The body is Cache-Control: no-store.

Partner-reported education records (#3188)

Migration 20261129140000_education_partner_reports.sql (plan lifecycle-journeys D4). An education agency’s report about a child is kept apart from education_records. A worker’s record is read by caregivers through the portal, open to their change proposals and scoped by admin unit; the partner’s data is view only, for the staff assigned to the child. So it has its own table, its own authorization resource type (education_partner_report) and no route in common with the worker’s record.

  • A report lives as long as its listing. craig-exchange admits a partner’s record only under an open listing: a row of its recipient ledger, the child as this deployment named them to the partner under one custody episode. education_partner_reports.listing_id is that row’s id. A listing ends once (custody closes, the identifier the partner knows the child by ends, the child leaves the stage), and craig-exchange stages exchange.listing_ended in the transaction that ends it.

  • The write. POST /v1/placement/education/partner-reports admits only the bare craig-exchange service principal. In one transaction it answers listing_ended (200) for a listing recorded in ended_partner_listings, stale (200) when the child’s live row for the interface is as of a later day or is this same report, and applied (201) otherwise: the held facts on a later day move the row’s as_of (and its listing_id, when the child was listed again), and different facts withdraw the row as superseded and insert a new one. received_at is when the facts were first received, so a row is one stretch of unchanged facts. The body carries no idempotency key: posting a report twice leaves one row.

  • The end of a listing. The inbox handler of exchange.listing_ended records the listing in ended_partner_listings and withdraws the live rows under it as listing_ended.

  • Either order. The write and the handler both take pg_advisory_xact_lock on the child (education-partner-reports:<child>) and then on the listing (partner-listing:<listing>). A report that waits behind its listing’s end finds the listing recorded and is refused; an end that waits behind a report finds the row and withdraws it. The child lock also keeps two posts from racing to be the one live row, which uq_education_partner_reports_live ((child_id, interface) WHERE withdrawn_at IS NULL) holds in the database.

  • The read. GET /v1/placement/education/partner-reports?child_id= answers the child’s live rows after a read check on education_partner_report. The check’s ref carries the worker and supervisor of the child’s case: the case_assignments row of the case of the child’s latest live removal episode. A child with no live episode, or one whose case the projection does not know, has neither, so only a rule keyed on a role alone admits. The check runs before the read, so a refused caller learns nothing about whether a report exists.

  • Events. placement.education_report_received (report_id, child_id, listing_id, interface, as_of; the posting service’s create, or its update when the report moved a held row) and placement.education_report_withdrawn (the same ids, interface and reason; the posting service’s act when its report superseded the row, the system’s when the listing ended). Neither carries a school, a district or a grade.

  • Nothing else reaches the rows. The worker’s education list, the caregiver portal’s projection, the field-proposal flow and the unit heals read and write education_records only.

Every column is Plaintext: a school’s name, a district and a grade for a child id; no name, date of birth or identifier value.

ER Diagram

foster_homesuuididPKtextnametextaddresstextadmin_unittextprovider_kindfamily_home|congregate_facility (NOT NULL, no default, immutable by trigger trg_foster_homes_provider_kind_immutable, #2055)textphonetextlicense_numberUKtextlicense_statuspending|active|suspended|revoked|expired (STORED)textlicense_typeregular|therapeutic|specialized|kinship; NULL iff congregate_facility (chk_foster_homes_license_type_iff_family)datelicensed_atdatelicense_expireseffective_license_status DERIVED on every read: active AND license_expires < business date => expired (#1641)integermax_capacityintegercurrent_occupancyintegeraccepts_ages_minintegeraccepts_ages_maxbooleanaccepts_sibling_groupsbooleanicwa_complianttextprimary_contactbigintversionIf-Match CAS counter (ADR-062 §G2)timestamptzcreated_attimestamptzupdated_atfoster_home_traininguuididPKuuidfoster_home_idFKtexttraining_typecpr_first_aid|trauma_informed_care|medication_management|cultural_competency|pre_service|in_servicedatecompleted_atdateexpires_atread by the #1642 training-evidence derivation (max over active, dated, completed rows) and the sweep's training legfloathoursCHECK: finite and > 0textverified_bybooleanactivesoft-delete flagtimestamptzdeleted_atremoval_episodesuuididPKuuidchild_idcross-service; UNIQUE (id, child_id, case_id)uuidcase_idcross-servicetextadmin_unit#1901 stamp; filled by the unit-only heal / backfilltimestamptzremoval_atthe live removal response's (ck_episode_current_instants)timestamptzexit_atthe live exit response's, NULL while in care (ck_episode_current_instants); > removal_attimestamptzrecorded_atuuidrecorded_bytimestamptzretired_atRETIRE: retracteduuidretired_bytextretired_reasonretractedtextretired_noteremoval_responsesuuididPKuuidepisode_idFKtimestamptzremoval_at(d)(1)textremoval_mannervoluntary_placement_agreement|court_ordered_removaltimestamptzrecorded_attimestamptzfirst_recorded_at(d)(2) FIRST_RECORDED: inherited through supersedes_iduuidrecorded_byuuidsupersedes_idFKone successor; one live per episodetimestamptzretired_attextretired_reasoncorrected|retractedtextretired_noteuuidretired_bytextenvironment#2081 (d)(3): 7 tokenstextcircumstance_x34(d)(4): applies | does_not_applytexticwa_transfer_requested(i)(1)(i)texticwa_transfer_denied(i)(1)(ii): on a requested yestexticwa_denial_x3(i)(1)(iii): on a denied yestexticwa_findings_x3(i)(4)exit_responsesuuididPKuuidepisode_idFKtimestamptzexit_at(g)(1)textexit_reason(g)(3): the 8 ExitReason tokens, never not_applicabletexttransfer_agency_type(g)(4): the 7 TransferAgencyType tokens; NOT NULL iff transfer_to_another_agencytimestamptzrecorded_attimestamptzfirst_recorded_at(g)(2) FIRST_RECORDED: inherited through supersedes_iduuidrecorded_byuuidsupersedes_idFKone successor; one live per episodetimestamptzretired_attextretired_reasoncorrected|retractedtextretired_noteuuidretired_bytextadoptive_marital_status#2083 (h)(1): 5 tokens; (h) only on adoption|guardianshiptextrelationship_x4(h)(2): applies | does_not_applyuuidfirst_adoptive_parent_person_id(h)(3)-(h)(7): cross-service craig-cases person, no FKuuidsecond_adoptive_parent_person_id(h)(8)-(h)(12): only beside a first, never the same persontextjurisdiction_kind(h)(13): 3 tokensintegersiblings_in_home(h)(15): 0-999, never beside siblings_not_applicablebooleansiblings_not_applicable(h)(15): TRUE or NULLtextadoptive_icwa_available_x4(i)(10): yes | no | not_applicable; (i) only on adoptiontextadoptive_icwa_preference_met(i)(11): 5 tokenstextadoptive_icwa_good_cause(i)(12): only when (i)(11) misses the preferencestextadoptive_icwa_good_cause_basis_x5(i)(13): on a good cause yesplacement_end_reason_rewritesuuidplacement_idPKFK placements (RESTRICT)textfrom_reasonthe six exit tokensuuidexit_response_idFKtimestamptzrewritten_atplacement_fact_revisionsuuididPKuuidv7uuidplacement_idFKplacements (RESTRICT)textfacts_x16the sixteen arrangement facts: nullable TEXT, no CHECKstimestamptzsuperseded_atNOT NULL: the values stood until thenuuidsuperseded_byNOT NULL (#2000): the acting worker whose facts PUT superseded the valuesplacementsuuididPKuuidepisode_idFK#2018: (episode_id, child_id, case_id) -> removal_episodesuuidcase_idthe episode'suuidchild_idthe episode'suuidfoster_home_idFKnullabletextplacement_typefoster_family_home|group_home_family_operated|group_home_staff_operated|group_home_shelter_care|residential_treatment_center|qualified_residential_treatment_program|child_care_institution|child_care_institution_shelter_care|supervised_independent_living|juvenile_justice_facility|medical_or_rehabilitative_facility|psychiatric_hospital|runaway|whereabouts_unknown|placed_at_hometextffh_type_licensed_home#2056 (e)(3): applies|does_not_apply; NOT NULL iff foster_family_hometextffh_type_therapeutic_foster_family_home#2056 (e)(3)textffh_type_shelter_care_foster_family_home#2056 (e)(3)textffh_type_relative_foster_family_home#2056 (e)(3)textffh_type_pre_adoptive_home#2056 (e)(3)textffh_type_kin_foster_family_home#2056 (e)(3)textfoster_family_home#2056 (e)(2): yes|no, GENERATED from placement_typetextarrangement_location#2080 (e)(5): 4 tokens; runaway token iff runaway/whereaboutstextarrangement_jurisdiction#2080 (e)(6): 1..255 chars, trimmed; only beside out-of-state/out-of-countrytextfoster_parents_marital_status#2080 (e)(7): 4 tokens; only on foster_family_hometextrelationship_to_foster_parents#2080 (e)(8): relatives|non_relatives|kin; only on foster_family_hometexticwa_available_a_member_of_the_indian_childs_extended_family#2080 (i)(5): yes|no|not_applicabletexticwa_available_tribe_licensed_foster_home#2080 (i)(5), D5 slugtexticwa_available_indian_foster_home_non_indian_licensed#2080 (i)(5), D5 slugtexticwa_available_indian_institution#2080 (i)(5), D5 slugtexticwa_available_tribe_order_of_preference#2080 (i)(5), D5 slugtexticwa_preference_met#2080 (i)(6): 6 tokenstexticwa_good_cause#2080 (i)(7): yes|no; only when icwa_preference_met misses the preferencestexticwa_good_cause_basis_parents_request#2080 (i)(8): yes|no; only on icwa_good_cause yes; D5 slugtexticwa_good_cause_basis_request_of_the_indian_child#2080 (i)(8)texticwa_good_cause_basis_no_suitable_placement#2080 (i)(8), D5 slugtexticwa_good_cause_basis_extraordinary_needs#2080 (i)(8), D5 slugtexticwa_good_cause_basis_sibling_attachment#2080 (i)(8), D5 slugtextstatusplanned|active|ended|cancelled|retractedtimestamptzstarted_at(e)(1); <= activated_attimestamptzended_at> started_attimestamptzended_recorded_at#2187: set iff ended_at; >= activated_attimestamptzactivated_at#2018: write-once; set iff active, ended or retractedtimestamptzcancelled_at#2018: the cancel trio, all set iff cancelleduuidcancelled_bytextcancel_notetimestamptzretracted_at#2020: the retract trio, all set iff retracteduuidretracted_bytextretract_noteuuidreplaces_placement_idFK#2020: the retracted arrangement this row re-records; INSERT onlyuuidkinship_household_idFK#2058: a home-less family row's household; INSERT onlytextend_reasontransfer|disruption|runaway|left_careuuidactivation_evaluation_id#1724: rules-side rule_evaluations id of the admitting consult; NULL = no consult ranbigintactivation_rule_set_revision#1724: the placement-eligibility revision that answered; all-or-none with the idtextadmin_unit#1901: the case's administrative unit, copied from case_assignments at birth or filled by the unit-only heal / backfill; NULL = outside every unit scopeuuidassigned_worker_subPlan A D6 / #1213: the case's worker, stamped from the case_assignments FOR SHARE re-read; NULL = case unknown to it (case.created's pair heal fills it); caseworker authz fails closeduuidsupervisor_sub#1367: the case's supervisor, the same stamp; the i_supervises inputbigintassignment_revision#1214: NOT NULL DEFAULT 0; case.assignment_changed applies the pair only at a strictly greater revisiontextcreated_bytextcreated_by_name#2033: the acting worker's preferred_username; nullabletimestamptzcreated_attimestamptzupdated_atkinship_optionsuuididPKuuidcase_idcross-service FKuuidchild_idcross-service FKtextrelative_nametextrelationshipbooleanevaluatedbooleanapprovedtextrejection_reasontimestamptzevaluated_attextrecorded_bytextadmin_unit#1901: the case's administrative unit stamp (see placements)uuidassigned_worker_subthe case's worker, stamped from case_assignmentsuuidsupervisor_sub#1367: the case's supervisor, the same stampbigintassignment_revision#1214, NOT NULL DEFAULT 0booleanactivesoft delete, NOT NULL DEFAULT truetimestamptzdeleted_atnullableeducation_partner_reportsuuididPKuuidchild_idcross-service FKuuidlisting_idcraig-exchange recipient rowtextinterfacetextidentifier_kinddateas_oftextschool_nametextschool_districttextgrade_leveldateenrollment_datetimestamptzreceived_attimestamptzwithdrawn_atnullable; paired with withdrawn_reasontextwithdrawn_reasonsuperseded|listing_endedended_partner_listingsuuidlisting_idPKtextinterfaceuuidperson_idcross-service FKtimestamptzended_ateducation_recordsuuididPKuuidchild_idcross-service FKtextschool_nametextschool_typepublic|private|charter|homeschooltextgrade_levelbooleaniepbooleansection_504dateenrollment_datedatewithdrawal_datetextrecorded_bytextrecorded_by_namenullabletimestamptzcreated_attimestamptzupdated_attextadmin_unit#1909 b: the source episode's unit; NULL = outside every unit scopeuuidunit_episode_idFKremoval_episodes (RESTRICT); NULL = unsourcedhealth_recordsuuididPKuuidchild_idcross-service FKtextrecord_typephysical_exam|dental|vision|mental_health|developmental|immunizationtextprovider_namedatevisit_datebooleanhealth_assessment(b)(9) visit flag, NOT NULL DEFAULT false (#2084)textdiagnosistextimmunization_namedateimmunization_datedatenext_due_dateoverdue alert drivertextrecorded_bytextrecorded_by_namenullabletimestamptzcreated_attimestamptzupdated_attextadmin_unit#1909 b: the source episode's unit; NULL = outside every unit scopeuuidunit_episode_idFKremoval_episodes (RESTRICT); NULL = unsourcedhealth_record_revisionsuuididPKuuidv7uuidhealth_record_idFKhealth_records (RESTRICT)datevisit_dateNOT NULLbooleanhealth_assessmentNOT NULLtimestamptzsuperseded_atNOT NULL: the pair stood until thenuuidsuperseded_byNOT NULL (#2231): the acting worker whose PUT superseded the pairchild_health_factsuuididPKuuidchild_idcraig-cases person, no FK (#2084)dateeffective_fromdateeffective_untilNULL = opentextcondition_status(b)(10), 4 tokenstextcondition_categoryx11 condition_<category>: existing|previous|does_not_apply, gate chk_child_health_facts_condition_gatetimestamptzrecorded_atuuidrecorded_byuuidsupersedes_idFKtimestamptzclosed_atuuidclosed_bytimestamptzretired_attextretired_reasoncorrected|retractedtextretired_noteuuidretired_bychild_education_factsuuididPKuuidchild_idcraig-cases person, no FK (#2084)dateeffective_fromdateeffective_untilNULL = opentextschool_enrollment(b)(11), 6 tokenstexteducational_level(b)(12), 17 tokenstextspecial_education(b)(14), yes|notimestamptzrecorded_atuuidrecorded_byuuidsupersedes_idFKtimestamptzclosed_atuuidclosed_bytimestamptzretired_attextretired_reasoncorrected|retractedtextretired_noteuuidretired_byhome_documentsuuididPKuuidfoster_home_idFKtextdocument_typelicense|home_study|background_check|training_certificate|othertextobject_keycraig-store pathtextoriginal_filenamebigintsize_bytestextcontent_typeuuiduploaded_byactor subtextuploaded_by_namenullable; #1251 attempt-substrate rows leave it NULLtimestamptzuploaded_atfoster_home_expiry_noticesuuididPKuuidfoster_home_idFKtextkindlicense_expiring|license_expired|training_expiring|training_expiredtexttraining_typeNULL for the license kinds (CHECK pairs it with the training kinds)dateexpires_onintegerdays_deltadays until (expiring, >= 0) or past (expired, >= 1)textinitiated_bysystem or the triggering worker's subtimestamptznoticed_atcaregiver_bindingsuuididPKuuidfoster_home_idFKXOR kinship_household_id (CHECK caregiver_bindings_unit_xor)uuidkinship_household_idFK#2058: a kinship household (was placement_id)uuidperson_idcases person; existence via the #1847 arm, no FKtextroleprimary|codateeffective_fromdateended_onNULL = open; CHECK ended_on >= effective_from (equal = cancelled)timestamptzended_recorded_at#2187: set iff ended_on; >= created_atuuidcreated_bykinship_householdsuuididPKtextadmin_unitfixed at mintuuidcreated_bytimestamptzcreated_atno UPDATE or DELETE (trg_kinship_households_immutable)portal_invitationsuuididPKuuidbinding_idFKtextcode_hashUKSHA-256 hex; plaintext never storedtextcode_prefixtimestamptzexpires_atuuidissued_bytimestamptzredeemed_atCHECK never both with revoked_atuuidredeemed_by_subtimestamptzrevoked_atuuidcreate_request_idUKADR-062 lifetime backstoptextcreate_request_hashv1:<64 hex>caregiver_identitiesuuididPKuuidsubject_subONE live per subjectuuidperson_idONE live per personuuidinvitation_idFKtimestamptzenrolled_attimestamptzrevoked_atuuidrevoked_bypending_edits_foster_home_portaluuididPKtextunit_kindhome|kinship_household (CHECK pending_edits_fhp_unit_kind)uuidunit_idfoster_homes.id or kinship_households.id; no FKtexttarget_tableeducation_records|health_records|foster_homesuuidtarget_idpolymorphic; no FKtextfieldtable.column; first segment = target_table; <= 64textproposed_valuetrimmed; 1-200textprevious_valueserver-read at propose; NULL = was unsetuuidproposed_by_subIdP subject; no FKtimestamptzproposed_attextdecisionpending|accepted|rejected; one OPEN per (target_id, field)uuiddecided_byIdP subject; NULL iff pending (CHECK pending_edits_fhp_decided_pair)timestamptzdecided_attextreason<= 500trainedhostsattached tonoticedarrangement in (RESTRICT)#2020: replaces_placement_id re-records (RESTRICT)removal recorded by (RESTRICT)supersedesexit recorded by (RESTRICT)supersedes#2084: supersedes (RESTRICT)#2084: supersedes (RESTRICT)#2023: rewritten by (RESTRICT)#2023: carries the reason of (RESTRICT)#2188: prior facts of (RESTRICT)#2188: prior visit of (RESTRICT)#1909 b: unit source of (RESTRICT)#1909 b: unit source of (RESTRICT)unit (RESTRICT)#2058: kinship unit (RESTRICT)#2058: setting of (RESTRICT)issued on (RESTRICT)redeemed into (RESTRICT)

Key Indexes

  • idx_placements_case — find placements by case

  • idx_placements_child — find placements by child

  • idx_placements_foster_home — find placements by home

  • idx_placements_foster_home_active — #1132 partial index (foster_home_id) WHERE status = 'active': the occupancy recompute

  • idx_placements_status — filter by placement status

  • idx_placements_created_at / idx_foster_homes_created_at — #3170 (created_at): the placement list’s and the home list’s default sort (ORDER BY created_at DESC LIMIT n), read in index order so a page’s cost does not grow with the table

  • idx_placements_episode — #2018 (episode_id): an episode’s arrangements (the retraction’s arrangement probe, the episode-side ck_arrangement_in_episode scan)

  • idx_placements_kinship_household — #2058 partial (kinship_household_id) WHERE kinship_household_id IS NOT NULL: a household’s arrangements (the portal child scope, the internal bindings read)

  • excl_placements_child_arrangement — #2018 GiST exclusion (child_id =, tstzrange(started_at, ended_at, '[)') &&) WHERE activated_at IS NOT NULL AND status <> 'retracted': a child’s effective arrangements never overlap (409 arrangement-overlap)

  • uq_placements_one_replacement — #2020 partial UNIQUE (replaces_placement_id) WHERE replaces_placement_id IS NOT NULL AND status <> 'cancelled': at most one non-cancelled replacement per retracted arrangement (the unmapped DB twin of 409 invalid-replacement, whose replacement_taken probe reads the same predicate)

  • idx_removal_episodes_child / idx_removal_episodes_case — #2018 (child_id, removal_at DESC) for the child’s episode list, (case_id) for the case-keyed heals

  • excl_removal_episodes_child_window — #2018 GiST exclusion (child_id =, tstzrange(removal_at, exit_at, '[)') &&) WHERE retired_at IS NULL: a child’s live episodes never overlap (409 episode-overlap)

  • uq_removal_responses_one_successor / uq_removal_responses_one_live — #2018 partial UNIQUE (supersedes_id) WHERE supersedes_id IS NOT NULL (a response has at most one successor) and (episode_id) WHERE retired_at IS NULL (one live removal response per episode)

  • uq_exit_responses_one_successor / uq_exit_responses_one_live — #2019 partial UNIQUE (supersedes_id) WHERE supersedes_id IS NOT NULL (an exit response has at most one successor) and (episode_id) WHERE retired_at IS NULL (one live exit response per episode)

  • idx_foster_homes_admin_unit — admin-unit-based home search (county/tribal region)

  • idx_foster_homes_status — license status filtering (matching algorithm)

  • foster_homes_active_license_expires_idx — #1641 partial index (license_expires) WHERE license_status = 'active': the effective-status derivation’s scan and the expiry sweep’s candidate selection

  • foster_home_training_type_expires_idx — #1641 partial index (foster_home_id, training_type, expires_at) WHERE active: the #1642 currency derivation AND the sweep’s training candidate selection (GROUP BY (foster_home_id, training_type), HAVING max(expires_at) ⇐ today + lead_days)

  • foster_home_expiry_notices_once_per_key — #1641 UNIQUE (foster_home_id, kind, expires_on, COALESCE(training_type, '')): the once-per-key notice ledger; foster_home_expiry_notices_home_idx is the FK-side per-home index (the cascade delete and per-home lookups)

  • idx_kinship_options_case — kinship options by case

  • idx_placements_assigned_worker / idx_kinship_options_assigned_worker — partial indexes (assigned_worker_sub) WHERE assigned_worker_sub IS NOT NULL: the assigned-worker list scope

  • idx_placements_supervisor_sub / idx_kinship_options_supervisor_sub — #1367 partial indexes (supervisor_sub) WHERE supervisor_sub IS NOT NULL: the supervisor list scope

  • idx_placements_admin_unit / idx_kinship_options_admin_unit — #1901 partial indexes (admin_unit) WHERE admin_unit IS NOT NULL: the U2 (#1903) admin_unit = ANY($n) list binds of the unit scopes (the assigned_worker_sub precedent); case_assignments.admin_unit has none — the projection is read by case_id (PK) only

  • idx_education_records_child — educational history by child

  • uq_education_partner_reports_live — #3188 partial unique (child_id, interface) WHERE withdrawn_at IS NULL: one live partner report per child and interface

  • idx_education_partner_reports_listing — #3188 partial (listing_id) WHERE withdrawn_at IS NULL: the withdrawal on a listing’s end

  • idx_health_records_child — health visit history by child

  • idx_health_records_next_due — partial index on next_due_date < now() for the overdue-appointments endpoint

  • idx_education_records_admin_unit / idx_health_records_admin_unit — #1909 (b) partial indexes (admin_unit) WHERE admin_unit IS NOT NULL: the unit-scoped list binds

  • idx_education_records_unit_heal / idx_health_records_unit_heal — #1909 (b) partial indexes (unit_episode_id) WHERE admin_unit IS NULL: the unit heals' join

  • idx_placement_fact_revisions_placement_superseded / idx_health_record_revisions_record_superseded — #2188 (<parent>_id, superseded_at, id): the export’s as-of probe (the earliest revision superseded after as_of)

  • excl_child_health_facts_window / excl_child_education_facts_window — #2084 GiST exclusion (child_id =, daterange(effective_from, effective_until, '[)') &&) WHERE retired_at IS NULL: a child’s live windows never overlap (409 ledger-window-overlap)

  • uq_child_health_facts_one_open / uq_child_education_facts_one_open — #2084 partial UNIQUE (child_id) WHERE effective_until IS NULL AND retired_at IS NULL: at most one live open window per child (409 ledger-window-overlap)

  • uq_child_health_facts_one_successor / uq_child_education_facts_one_successor — #2084 partial UNIQUE (supersedes_id) WHERE supersedes_id IS NOT NULL: a row is corrected at most once

  • idx_child_health_facts_child_window / idx_child_education_facts_child_window — #2084 (child_id, effective_from): the open-row, at-date and overlap reads per child

  • idx_home_documents_foster_home — documents by foster home

  • caregiver_bindings_home_person_open / caregiver_bindings_household_person_open (#2058; was caregiver_bindings_placement_person_open) — #1848 partial UNIQUE (unit, person_id) WHERE ended_on IS NULL: one OPEN binding per caregiver per unit (a second create is the typed 409); caregiver_bindings_person_idx serves the portal scope join

  • excl_caregiver_bindings_person_unit_window — #2058 GiST exclusion (COALESCE(foster_home_id, kinship_household_id) WITH =, person_id WITH =, daterange(effective_from, ended_on, '[)') WITH &&): one person’s bindings on one unit never overlap (409 caregiver-binding-overlap; created after the open-person unique, so a second OPEN binding still answers 409 duplicate-resource; a cancel is an empty range)

  • portal_invitations_open_by_binding — #1848 partial index (binding_id) WHERE redeemed_at IS NULL AND revoked_at IS NULL: the end-binding cascade and the "newest open invitation" projection

  • portal_invitations_create_request_id — #1848 UNIQUE: the ADR-062 one-time-secret LIFETIME backstop (a replayed client_request_id can never mint a second code once the 30-day claim window has pruned the claim)

  • caregiver_identities_subject_live / caregiver_identities_person_live — #1848 partial UNIQUE WHERE revoked_at IS NULL: one live portal identity per subject and per person (the enrolment 409)

  • pending_edits_fhp_one_open — #634 partial UNIQUE (target_id, field) WHERE decision = 'pending': one OPEN proposal per governed field of a row — a second propose while one waits is the typed 409 field-proposal-pending (the store maps the violation by constraint NAME); a decision frees the slot

  • pending_edits_fhp_queue — #634 (decision, proposed_at): the staff queue GET /v1/placement/field-proposals?decision= (oldest first)

  • pending_edits_fhp_unit — #634 (unit_id, decision, proposed_at): the portal unit detail’s proposals ride-along (pending rows + those decided in the last 30 days)

Edit this page · latest