Plan: The adoption journey — one family from a report to termination of parental rights and adoption
Status
Done (2026-12-04) — the battery walks a second family to its outcome: from a maltreatment report through foster care, the mother’s surrender and the court’s termination of the father’s rights, to an adoption by the foster parents and a case closed for adoption, with the foster home’s pre-adoptive placement paid across the move; a second test shows the order the product enforces.
Closes: #3230.
Epic: &124. Relates to: #3187 (the programme; its rules R1 to R6 are in
docs/modules/ROOT/pages/plans/archive/lifecycle-journeys.adoc and bind this plan), #3188 (the first journey),
#1966 (adoption assistance), #3172. Tree: written against main at 69a7ec7e7.
Maintainer (2026-12-04, question 28): the next plan is a second outcome, termination of parental rights then
adoption; a gap the walk exposes becomes an issue or a plan step.
Erratum (2026-12-04): of D2. The new builders' re-entry is a third test of given-builders.spec.ts, "the adoption builders converge on re-entry, before and after the case closes", and not an extension of the outcome builders' test: that test walks to reunification, where the exit admits no adoptive answers, and it stays as it is.
Erratum (2026-12-04): of D2, where placement.ts was expected not to change. givenActivePlacement insisted that the placement it answered was active, so a walk retried after it had ended a placement stopped at that placement’s builder. It now also answers an ended one, which only a replay can be, and the adoption builders' re-entry test enters it again after the adoption.
Erratum (2026-12-04): of the Risks bullet on re-entry. The main walk asserts the family’s state as it stands at each beat (listed by the education agency, placed, in permanent custody), so a walk that has reached the adoption cannot be walked again under the same run id, as the first journey cannot; --repeat-each=2 holds for the refusal test and for the builders' re-entry tests. A retry of the main walk converges when the first attempt stopped before the adoption, which was shown by a first attempt made to fail after the move.
Erratum (2026-12-04): of D1’s per-diem oracle. Under Georgia’s layer as first pinned, the second placement was paid nothing: the product bills a pre-adoptive home under the pre_adoptive rate class, which Georgia’s schedule did not price and no layer’s schedule can (#3231); craig-financial raised a no_applicable_rate data-quality issue. The maintainer ruled that Georgia prices it. Georgia’s layer now states a rate-class policy without the pre-adoptive row (craig-config-georgia 39d04dee), so a pre-adoptive home bills under its own home type; step 2 pins it, and the oracle stands as approved.
Erratum (2026-12-04): at the close. Issues filed for what Scope left out and what the walk exposed: #3231 (a layer’s rate schedule prices only the three payment programs), #3232 (the record once an adoption is final), #3233 (partners told of a termination or an adoption), #3234 (the Court tab’s order form and the custody an order states), #3235 (the child’s parents of record after an adoption), #3236 (the outcomes still to walk, and a clock a journey can move); adoption assistance stays with #1966. Binding the spec to Georgia’s doe_lists_child_only_in_custody is briefed to Georgia’s agent once the spec is on main.
Context
The battery reaches one outcome. tests/e2e/specs/journey-lifecycle-reunification.spec.ts walks a family from a
report to reunification and meets three partner simulators on the way. No test closes a case for adoption, and no
row of compliance/scenario-inventory/ mentions adoption or the termination of parental rights.
The product can be driven along the adoption path through its APIs today:
-
Parents.
POST /v1/cases/persons/{id}/parentslinks a person to a child asmother,father,legal_guardianorputative_parent(services/craig-cases/src/api/ledgers/child_parents.rs). The parent need not be a member of the case’s household. -
The permanency goal.
POST /v1/cases/cases/{case_id}/children/{child_id}/permanency-plansrecords a goal (reunification,adoptionand five more) with the day it was established (services/craig-cases/src/api/ledgers/permanency_plans.rs). The case plan thatgivenApprovedPlanbuilds carries no goal. -
Termination.
POST …/children/{child_id}/parental-rights-actionsrecords one action per parent,voluntaryorinvoluntary, with the petition date and the termination date, and may name the order (services/craig-cases/src/api/ledgers/parental_rights_actions.rs,crates/craig-cases-contracts/src/parental_rights.rs). It refuses a person who is not a linked parent (400parent-not-linked) and an order that is not an activetermination_of_parental_rightsorder of the case (400parental-rights-order-invalid).POST …/{row_id}/correctionsrestates a row. -
The order.
POST /v1/cases/cases/{id}/court-orderstakesorder_type: termination_of_parental_rightsand an optionalcustody(children,status_token,effective_on;crates/craig-cases-contracts/src/court_orders.rs). For a child with an open custody episode the stated status joins that episode as a new legal-status row (services/craig-cases/tests/api/custody_orders.rs,a_custody_order_writes_restates_and_retires_by_rule, the leg read byorder_row_beside). Georgia’s vocabulary has the in-custody statusPCT(Permanent Court) and the not-in-custody statusNAF(Adoption Finalized); both appear inservices/craig-cases/tests/api/custody.rs. -
The adoptive placement. A placement’s foster-family-home categories (
ffh_types, among thempre_adoptive_home) are fixed when it is created (services/craig-placement/src/api/placements/requests.rs). A foster home that becomes the child’s pre-adoptive home is therefore a second placement in the same home. Two placements of one child may abut: the window constraintexcl_placements_child_arrangementcompares half-open ranges (services/craig-placement/migrations/20260925130000_removal_episodes_recut.sql). -
The per-diem. craig-financial bills a placement from its activation and, when the placement ends, settles its undisbursed per-diem to the days the child was in the home, whatever the end reason (
services/craig-financial/src/inbox/placement_billing.rs,placement_termination.rs). Georgia does not pay the day a child leaves. -
The exit.
POST /v1/placement/episodes/{id}/exitwithexit_reason: adoptiontakes the adoptive answers (ExitFacts,crates/craig-placement-contracts/src/episodes.rs), among them the two adoptive parents as craig-cases persons, and refuses while the episode holds an open placement (409episode-has-open-arrangement,services/craig-placement/src/api/exits.rs). The worker’s form for it has its own page tests (tests/e2e/specs/placement.spec.ts, the two adoption-exit tests). -
The close. A custody episode closes under a not-in-custody status, and a case closes with
closure_reason: adoptiononce no custody episode is open (409custody-openotherwise,services/craig-cases/src/api/cases/update.rs).
What does not exist: adoption assistance (no subsidy program, no agreement, no eligibility determination; #1966); anything that seals an adopted child’s record or gives the child a new name; a partner that is told of a termination or an adoption; a custody statement on the Court tab’s order form.
Scope
In: the shared walk helpers and the new builders (D2), the journey (D1), its education beat (D4), its refusal test (D3) and its corpus row (D5).
Out, each filed as an issue at the close unless it already has one:
-
Adoption assistance: #1966.
-
What happens to the record once an adoption is final (sealing, the child’s new name, who may still read the case). It needs a ruling before a plan.
-
Telling a partner of a termination or an adoption. The courts' conversation is the natural one, and its adapter is still aimed wrong (#3172).
-
The Court tab’s order form does not offer the custody statement the API takes; the journey states it through the API.
-
Recording the adoptive parents as the child’s parents after the adoption.
-
Other outcomes (guardianship, ageing out, an interstate placement, re-entry) and a controllable clock.
A defect the walk finds in a service is a fix: issue with its own branch and its own tests, as the programme’s
first plan ruled. The walk is then written to the corrected behaviour.
Design
D1. The story
Spec tests/e2e/specs/journey-lifecycle-adoption.spec.ts, test.describe('Journey: a report to adoption'), in the
journey project. Its main test is "a substantiated report ends with the child adopted by the foster parents".
The family is built through the given library as jane.doe. Business dates run backwards from business today (T),
as the first journey’s do, because the services refuse a future date; the story is compressed into two weeks, and
no service judges the time between its acts.
| Day | Act |
|---|---|
T−14 |
Report, screened-in referral, investigation, substantiated close, a case with the victim as its child. Two
persons are linked as the child’s mother and father from the child’s date of birth. The child is a student the
education agency knows (D4). Custody opens as |
T−13 |
The child is placed in a foster family home ( |
T−11 |
The permanency goal becomes |
T−10 |
A petition to terminate is filed against the father: an |
T−8 |
The mother surrenders her rights: a |
T−6 |
The court terminates the father’s rights: an order |
T−5 |
The foster parents will adopt. The placement ends ( |
T−1 |
The adoption is final. The second placement ends ( |
Every act is a builder (rule R6), so a retried walk replays each one. The walk reads the worker’s pages at two
points: after the order, the child’s custody panel on the case’s Federal facts tab lists the PCT row with its
court-order badge (custody-history, custody-court-order); after the adoption, the child’s episodes page shows
the episode exited to adoption (data-exit-reason) and its correction form holds the two adoptive parents the walk
named.
The main test asserts, through the service that owns each fact (the corpus keys of D5):
-
parental_rights_terminated_for_each_parent: the child’s live parental-rights rows are one per parent. The mother’s isvoluntarywith her termination date. The father’s isinvoluntarywith the petition date, the termination date and the order’s id, and it supersedes the petition-only row. -
custody_episode_survives_the_termination_order: after the order the child has one custody episode, open since T−14, and the child’s latest legal status is in custody, effective the order’s day, under the token the order stated. -
permanency_goal_in_force_follows_its_dates: the goal in force isreunificationas of T−12 andadoptionas of T−11 and as of today (GET …/permanency-plans?as_of=). -
perdiem_follows_the_child_across_the_move: once craig-financial has consumed both ends, the first placement’s per-diem runs from T−13 through the day before the move, and the second’s from the day of the move through the day before the adoption (each to the end of its own first period, when that came first). Each is priced at its own rate for exactly its days and is still pending. No day is in both rows, and no live per-diem of the child covers the adoption day or a later one. -
adoption_exit_names_the_adoptive_parents: the episode’s exit readsadoptionat noon of T−1 with the two adoptive parents' person ids,relationship_foster_parents: applies, and the marital status and jurisdiction the walk stated. -
custody_closes_on_exit_date: the custody episode’scustody_untilis the exit’s day, and the latest legal status is not in custody, under the token the walk closed with. -
case_closed_terminal_with_event: the case is closed withadoption, a reopen is refused, andcase.closedreaches the audit trail with that reason. -
cross_service_refs_resolve: both placements name the case, the child, the home and the episode; the father’s action names the order; each adoptive parent id reads back as a craig-cases person. -
occupancy_mismatch, by the post-journey sweep and by a read: the home’s occupancy is 1 while either placement is active, including just after the move, and 0 after the adoption.
D2. Shared helpers and builders
Shared walk helpers. The first journey’s spec holds helpers the second needs: investigateToCase,
recordStudent, LISTING_SEND, sendsSoFar, expectListed, auditedClosureReasons and expectClosedForGood.
They move to tests/e2e/lib/lifecycle-walk.ts with the constants they read (CHILD_BORN, GTID_FROM,
PARTNER_ROUND_TRIP), and both specs import them. Their bodies are unchanged; their signatures change only where
one took the first journey’s Family, which stays that spec’s own type: investigateToCase answers an exported
OpenedCase (the six ids it builds), expectListed takes the child and the GTID, and expectClosedForGood takes
the case and its closure reason. The first journey’s tests are otherwise untouched.
Builders, in tests/e2e/lib/given/, each replaying the real endpoint under the library’s request-id rule, so a
re-entered builder answers its first rows:
-
case.ts:givenParent(given, { child, role, from })creates a person and links it (POST /v1/cases/persons/{child}/parents); answers the parent’s person id.readParentsbeside it. -
permanency.ts(new):givenPermanencyGoal(given, { case, child, plan, establishedOn })andreadPermanencyGoal(given, case, child, asOf). -
court.ts(new):givenCourtOrder(given, { case, orderType, orderDate, custody? });givenParentalRightsAction(given, { case, child, parent, kind, petitionFiledOn?, terminatedOn?, courtOrder? });givenParentalRightsCorrectionfor the restated row;readParentalRights. -
outcome.ts:givenEpisodeExittakes optionalanswersoverEXIT_ANSWERS_UNANSWERED(tests/e2e/lib/given/placement.ts), among them the two adoptive parents. -
custody.ts: the tokensPERMANENT_COURT_CUSTODY(PCT) andADOPTION_FINALIZED(NAF) beside the two it has. -
placement.ts: no change expected.givenActivePlacementcalled twice with the samehomeoptions lands both placements in one home, becausegivenHomederives its request id from its body.
tests/e2e/specs/given-builders.spec.ts takes each new builder into "every builder round-trips: create → typed id
→ readable" and into "the outcome builders converge on re-entry, before and after the case closes".
D3. The order the product enforces
A second test, "an adoption cannot be finalised out of order", on its own family: parents linked, custody open, the child in an active placement. Each act below is refused with the status and problem type the service documents, and a read after it shows nothing changed:
-
a parental-rights action naming a person who is not the child’s parent: 400
parent-not-linked; the child has no parental-rights row; -
a parental-rights action for the father naming an order of another type: 400
parental-rights-order-invalid; the child has no parental-rights row; -
the adoption exit while the placement is active: 409
episode-has-open-arrangement; the episode has no exit; -
the case close with
adoptionwhile custody is open: 409custody-open; the case is open.
D4. The education agency
The main walk asks for the doe fixture (tests/e2e/lib/doe-education.ts), as the first journey does. The agency
lists the child once custody opens, still lists the child after the termination order (the custody episode is the
same one), and drops the child when custody closes on the adoption. The walk asserts that the sends to the
education agency are exactly the listing send and doe_slds.custody_closed, both accepted, and that the agency
holds no listing afterwards. That is Georgia’s oracle doe_lists_child_only_in_custody, of its row
georgia.exchange.doe-education-in-care; binding this spec to that row is Georgia’s change, briefed at the close.
The core row of D5 carries no partner oracle. No other partner is on this path today, which Scope records.
D5. The corpus row
core.permanency.report-to-adoption in compliance/scenario-inventory/permanency.toml: tier t1-core, level
journey, the nine oracles of D1, one e2e-spec binding to the spec’s describe. Enforcement classes:
store-only where a handler enforces the relation (parental_rights_terminated_for_each_parent,
adoption_exit_names_the_adoptive_parents, case_closed_terminal_with_event), reconcile for
cross_service_refs_resolve, blocking-invariant for occupancy_mismatch, and none for the four only the
journey holds. The spec records its footprint with JourneyLedger (tests/e2e/lib/journey.ts: cases, children,
placements, homes, payments, plans), which is what lets the binding name occupancy_mismatch. The ledger is
re-blessed with cargo xtask scenarios audit --bless.
Steps
Each step is one MR with its tests, docs and changelog fragment.
-
The shared helpers and the builders (D2), with the given-builders spec.
-
The journey and the close (D1, D3, D4, D5).
Risks
-
The walk meets a service that refuses an act the documented lifecycle allows, or allows one it should refuse (a second placement in the same home at the instant the first ends; a per-diem that pays the day of the move twice; an order’s status that opens a second custody episode) — fail-closed for the plan: the step stops, the defect is a
fix:issue with its own MR and tests, and the walk is written to the corrected behaviour. Mitigation: D1’s oracles name the expected facts, so a difference is a finding and is recorded on the issue. -
The journey passes while asserting less than it says — silent. Mitigation: every oracle is asserted on a value the walk produced (dates, ids, tokens), read through the owning service. Before step 2 merges, each of the nine oracles is shown to fail by one planted change to the walk (a wrong date, a swapped parent, a skipped act), and the list is in the MR.
-
An adoptive parent of another run is recorded — silent. Mitigation: the exit is a builder that sends the two person ids the walk created, and
adoption_exit_names_the_adoptive_parentscompares the stored ids with them. -
The education agency’s exact send list is disturbed by an act that changes the child’s record after a send is staged — fail-closed (the list assertion fails). Mitigation: the walk links the parents and records the GTID before custody opens, and changes nothing on the child’s own record afterwards.
-
A re-entered walk meets an act its first attempt completed — fail-closed (a builder is refused where the first attempt was not). Mitigation: every act is a builder under the run’s request ids; before step 2 merges the spec is run with
--repeat-each=2, which re-enters every act under one run id, and the result is in the MR. -
Moving the shared helpers changes the first journey — fail-closed (its assertions fail). Mitigation: the move is textual; the first journey’s spec is run on the devstack in step 1 and its result is in the MR.
Tests
-
Journey: the two tests of D1 and D3, with the education beat of D4.
-
Builders: the two given-builders tests named in D2 cover each new builder’s round trip and its re-entry.
-
Regression: the first journey (after the helper move) and the caseworker specs pass unchanged.
-
Re-entry and planted defects: runs made before step 2 merges (see Risks); they are evidence in the MR, and the battery keeps no test for them.
-
Contract, concurrency: none. No wire and no service code changes; a
fix:issue the walk raises carries its own.
Delivery
-
Canonical page:
docs/modules/ROOT/pages/testing-reference.adoc, the section "Lifecycle journeys (#3187)", gains the adoption walk, what it asserts and its builders; the given-library section lists the new builders. -
CHANGELOG entry: one
changelog.d/<issue>.<slug>.changed.adocfragment per step. -
The close: step 2’s MR closes the issue. This page is archived with its Status; the issues under Scope are filed and named on the page; Georgia’s agent is briefed on the education binding; a note goes on epic &124.