Plan: The re-entry journey — a child who went home comes back into care
Status
Done (2026-12-04) — the battery walks a family the product has seen before: journey-lifecycle-reentry.spec.ts takes a child into foster care and home again under one case, then back into care under a second after a second report names the same child. It asserts what the product and the partners do with a person they know: the second report tied to the child’s record at conversion, the first case still closed, a second custody episode and a second removal episode, the second placement’s own per-diem, the education agency’s second listing, the person index not asked again, and two Medicaid applications whose records each reach their own. The walk found no defect.
Closes: #3243.
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 reunification
journey, whose story this one takes further), #3236 (the outcomes still to walk).
Tree: written against branch test/guardianship-journey at d881200fc (main 1f5dac52f plus #3237’s two
steps, which are on the merge train).
Maintainer (2026-12-04, question 4): the next plan is re-entry: a child who went home comes back into care.
Maintainer (2026-12-04, question 5): the second report’s screener attests the family’s prior CPS history, so the
referral carries Georgia’s 24-hour response.
Erratum (2026-12-04): of D1 and D2. Georgia’s intake-screening ruleset answers a report about a family with prior CPS history within 24 hours, and the screener attests that fact; the product does not derive it. The second report’s decision attests it, so its referral carries PRIORITY_24HR where the first carries STANDARD: givenScreenedInReferral takes a third response, within24Hours, and investigateToCase takes the response beside the report’s options. The builder checks the derived priority, so the corpus row gains no oracle. That the product neither derives nor prompts prior history at screening is filed at the close.
Erratum (2026-12-04): of the Risks bullet on a retried walk. A retried walk converges when its first attempt stopped while the child was first in care, which is earlier than the re-entry: once the child has gone home, the first stay’s beats (the child listed, one school report) do not hold again.
Erratum (2026-12-04): at the close. Issues filed for what Scope left out: #3244 (a worker’s view of a child’s earlier stays in care across cases), #3245 (a re-entry on the day of the exit, on which the two services disagree) and #3246 (the request-id change for the other path-scoped builders, which are three: a trafficking report beside the two Scope names). The prior-history question of the first erratum is #3247. The outcomes still to walk after a re-entry, the person index’s conversation with a child it identified among them, are noted on #3236.
Context
The battery walks three families, each once: to reunification, to adoption, to guardianship. Every person in them is new to the product and to its partners. Nothing walks a person through care a second time.
What the product does with a child it has seen before, as the code stands:
-
The second report. A report names its children as entries (a name, a birth date). When a report is converted, craig-cases matches each entry against the people on file, by a name search over everyone (
services/craig-cases/src/matching/seed.rs), and links an entry to a person when the jurisdiction’s person-match ruleset is sure (ADR-019,docs/modules/ROOT/pages/adrs/adr-019-report-person-linking.adoc; the consumer isservices/craig-cases/src/inbox/report_converted.rs). Georgia’s ruleset is sure on an exact name with an exact birth date and on nothing less (target/config/layers/georgia/georgia-person-match.json). A worker may link an entry to any person (POST /v1/cases/reports/{id}/person-links). A person’s reports are the linked ones (services/craig-cases/src/api/reports/search.rs); a person’s referrals and investigations are found through their allegations.services/craig-cases/tests/api/convert_report_autolink.rsholds the link at conversion. No journey meets it: every journey’s report describes a child by the library’s default name and an age (DEFAULT_CHILD,tests/e2e/lib/given/report.ts), and its child’s record, named for the run, is made later. -
A second case. A closed case does not reopen: a case moves from open to closed or transferred and nowhere else (
can_case_transition,services/craig-cases/src/transitions.rs). A person may be a child of more than one case. -
A second custody episode. An episode belongs to one case and one child, and a child’s episodes may not share a day in any case. A re-entry opens the day after the earlier episode closed at the earliest; sooner is 409
custody-episode-overlap(ranges_meetandrefuse_overlap,services/craig-cases/src/store/custody_rules.rs; the store testsan_until_act_opens_then_closes_and_a_reentry_starts_the_next_dayandan_open_in_another_case_waits_on_the_child_lock_and_meets_the_episode,store/custody_acts.rs). -
A second removal episode. craig-placement keeps one window per child as well; an overlapping episode is 409
episode-overlap(insert_episode,services/craig-placement/src/store/removal_episodes.rs).tests/e2e/specs/placement.spec.ts("an episode exits through its form and the child re-enters at the same instant") exits an episode and opens a second on the page, within one case. -
The per-diem. craig-financial keys a per-diem on its placement, so a second placement of the same child bills as any placement does.
-
The education agency. A listing is sent when custody opens, and the send’s identity is the custody episode (
services/craig-exchange/src/triggers/events.rs), so a second episode is a second send. craig-placement keeps one live school report per child, stored only under a listing that has not ended (services/craig-placement/src/api/education_partner_reports.rs). -
The person index. A person who holds a live identifier of the index’s kind is not asked about again: 409
person-index-person-identified, answered before the index is asked (askable,services/craig-cases/src/api/person_index.rs). A person whose sex is not on record is refused earlier, with 409person-index-facts-missing(subject_of, same file). -
Medicaid. A custody episode takes one live application (
uq_medicaid_applications_episode_live,services/craig-cases/migrations/20261017120000_medicaid_applications.sql), so the second episode takes a second application and a second referral. A report from the eligibility system reaches the application whose receipt carries the report’s reference (services/craig-cases/src/store/medicaid_application_reports.rs), and an application that is not retracted takes it whether or not its custody is still open (apply,services/craig-cases/src/api/ledgers/medicaid_applications/partner_reports.rs). Georgia’s simulator makes every application of a person due again when its decision for the person changes (decide, the layer’spartners/src/crates/craig-partner-ies/src/mock.rs).
No end-to-end test puts one child through two cases, and no scenario row mentions a second episode.
The given library assumes a child meets a builder once. Four builders derive their request id from the run and
the body alone, while their case or report rides only in the path: the screening decision
(tests/e2e/lib/given/referral.ts), a household member and a Medicaid application (case.ts), and a case plan
(plan.ts). The services claim a request id together with that path (for example the case_id leg in
services/craig-cases/src/api/case_plans/plans.rs), so the builder entered for a second case of the same child
presents the first act’s id for another act and is refused: 409 idempotency-conflict.
Scope
In: the library (D2), the journey (D1), its refusal test (D3), the partners the second time (D4) and the corpus row (D5).
Out, each filed as an issue at the close unless it already has one:
-
A worker’s view of a person’s earlier custody and removal episodes across cases. The family chain page lists a person’s reports, referrals, investigations and cases; nothing lists the episodes.
-
Whether a re-entry on the day of the exit should be allowed, and whether the two services should agree on it: craig-placement takes a second removal episode at the instant the first exited; craig-cases takes a second custody episode the next day at the earliest. The walk re-enters days later and asserts craig-cases' rule as it is.
-
The same request-id change for builders this walk does not enter (a trafficking statement, per episode; a home’s training, per home).
-
The person index’s own conversation with a child it identified earlier. Here the worker records the child’s EMPI id, as the first journey’s Medicaid variants do; the index’s conversation is the first journey’s.
-
A second outcome after the re-entry, and a controllable clock (#3236).
A defect the walk finds in a service is a fix: issue with its own branch and tests; the walk is then written to
the corrected behaviour.
Design
D1. The story
Spec tests/e2e/specs/journey-lifecycle-reentry.spec.ts, test.describe('Journey: a child comes back into care'),
in the journey project. Its main test is "a child who went home is removed again under a second case". Custody,
placement and exit dates are stated, and run backwards from business today (T) as the first journey’s do. The
product stamps a report, an investigation and a case when they are made, which is when the walk runs.
| Day | Act |
|---|---|
T−12 |
The first time. A neighbour’s report describes a child by the library’s default name and age; nobody on file
matches. It is screened in, investigated and substantiated. The worker makes the child’s person record and
links the report’s entry to it; case A opens with the child. The child’s sex, GTID and EMPI id are on record;
the education agency knows the student and the eligibility system knows the child. Custody opens as |
T−11 |
The child is placed in a foster home; the first per-diem appears; case A has its case plan. The education agency’s weekly file is collected. The worker submits the Medicaid application; the eligibility system takes it and, on its call, approves it. |
T−7 |
The child goes home: the placement ends, the episode exits as a reunification, custody closes as |
(as the walk runs) |
A second report names the same child by full name and birth date. It is screened in, investigated and substantiated, and case B opens with the same child and caregiver. |
T−4 |
The second time. Custody opens in case B as |
T−3 |
The child is placed in the same foster home; a second per-diem appears; case B has its own case plan. The worker submits a second Medicaid application. |
The walk ends with the child in care. Every act is a builder (rule R6). The walk reads one worker page, the
child’s family chain page (services/craig-web/templates/cases/person_chain.html).
The main test asserts, through the service that owns each fact (the corpus keys of D5):
-
second_report_links_the_known_child: once the second report is converted, craig-cases links its entry to the child’s record: the child’s reports are the two (GET /v1/cases/reports?person_id=), the first linked by the worker and the second by no act of the walk. The family chain page then links eight things: the two reports, referrals, investigations and cases. -
first_case_stays_closed: after the re-entry case A still reads closed for reunification and refuses a reopen; the child’s cases are exactly A and B (GET /v1/cases/cases?person_id=). -
reentry_opens_a_second_custody_episode: the child has one custody episode in each case and they share no day: A’s from T−12 to T−7, B’s open from T−4. The child’s latest legal status in case B is in custody. -
custody_reentry_waits_a_day: asked before custody opens in case B, an open there dated T−7, the day case A’s episode closed, is refused with 409custody-episode-overlap, and case B has no episode after it. -
second_removal_episode_follows_the_first: the child’s removal episodes are two: the first in case A, exited as a reunification at noon of T−7; the second in case B, open from noon of T−4. -
second_placement_bills_its_own_perdiem: the second placement has its own pending per-diem from T−3, and the first placement’s per-diem stands as the reunification settled it: from T−11 through T−8, or to the end of its own period when that came first. -
cross_service_refs_resolve: each placement names its own case and episode, the one child and the one home; each case names its own investigation. -
occupancy_mismatch, by the post-journey sweep and by a read: the home holds one child while either placement is active and none between them.
D4 adds the row’s two remaining oracles.
D2. The library
Request ids. The four builders named in Context take the id their path carries into their builder name:
screening-decision:<report>, household:<case>:<person>, plan:<case> and
medicaid-application:<case>:<child>. A derived id never leaves the run that made it, so the change moves no
stored value, and a builder entered twice for one case still replays.
A report that names its child. GivenChild (tests/e2e/lib/given/report.ts) may state a birth date (bornOn)
in place of an age in years. investigateToCase (tests/e2e/lib/lifecycle-walk.ts) takes the report’s options
(its description and its children). The victim is a person named for the run, so it is the same child whichever
report the walk starts from.
A worker’s link. givenReportPersonLink(given, \{report, person, entry}) posts
/v1/cases/reports/{id}/person-links for the child entry at index entry, with no ruleset named, under a
builder name that carries the report.
The shared walk. The beats the re-entry walk shares with the reunification journey move from that spec
(tests/e2e/specs/journey-lifecycle-reunification.spec.ts) to lifecycle-walk.ts, with the types they read:
recording the child’s sex, into care (intoCare), going home (reunify), the per-diem settled at home
(expectPerDiemSettledAtHome) and a week’s collection from the education agency (collectTheWeek). The
reunification spec imports them and asserts what it did.
tests/e2e/specs/given-builders.spec.ts gains a test, "a builder entered for a second case of the same child
makes a second row": two reports, the second naming the child by birth date, each screened in and investigated;
the worker’s link on the first; two cases with the same child and caregiver, a plan in each, and, across a closed
and an open custody episode, a Medicaid application in each. Each builder entered again answers its own row.
D3. One custody at a time
A second test, "a child in custody is not taken into custody again", on its own family: two cases, each opened from its own report, with the same child; custody and a removal episode open in case A. Each act is refused with the status and problem type its service documents, and a read after it shows nothing written:
-
custody opened in case B: 409
custody-episode-overlap, its detail naming case A’s episode; case B has no custody episode; -
a removal episode opened in case B, once craig-placement knows the case: 409
episode-overlap; the child has one removal episode.
D4. The partners, the second time
The walk asks for the doe and returns fixtures (tests/e2e/lib/doe-education.ts,
tests/e2e/lib/returns-fixture.ts). The two core oracles below are the product’s rules. The rest is what
Georgia’s oracles (the layer’s scenarios/exchange.toml) say of the same acts; binding this spec to Georgia’s
rows is Georgia’s change, briefed at the close.
-
The education agency. Listed in care, dropped at the reunification with the school report withdrawn, and listed again once custody opens in case B: the agency’s listing then names case B’s custody episode, and the sends are exactly three, the listing, the delisting and a second listing whose leg is
doe_slds.custody_opened(Georgia’sdoe_lists_child_only_in_custody). The next week’s file is collected under the new listing, and the child again holds one live school report (Georgia’spartner_report_follows_the_weekly_fileandpartner_report_withdrawn_with_custody). -
The person index,
identified_child_is_not_asked_about_again: asked about the child from case B (POST /v1/cases/cases/{id}/persons/{person_id}/index-inquiries), craig-cases answers 409person-index-person-identified; the child still holds the one EMPI id. -
The eligibility system,
second_episode_takes_its_own_medicaid_application: application B is a second application, of case B’s custody episode, and gets a receipt of its own under another reference than A’s. The system then denies the child, and its call carries a record for each application. Each lands by its reference: application A holds its receipt, the approval and the denial; application B its receipt and the denial (Georgia’sies_referral_receipt_is_the_application_numberandies_status_reaches_the_application_by_its_number).
D5. The corpus row
core.permanency.reentry-after-reunification in compliance/scenario-inventory/permanency.toml: tier t1-core,
level journey, the ten oracles of D1 and D4, one e2e-spec binding to the spec’s describe. Enforcement
classes: db for reentry_opens_a_second_custody_episode, custody_reentry_waits_a_day,
second_removal_episode_follows_the_first and second_episode_takes_its_own_medicaid_application (a constraint
holds each); store-only for second_report_links_the_known_child, first_case_stays_closed and
identified_child_is_not_asked_about_again; none for second_placement_bills_its_own_perdiem; reconcile
for cross_service_refs_resolve; blocking-invariant for occupancy_mismatch. The spec records its footprint
with JourneyLedger (cases, children, placements, homes, payments, plans). 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 library (D2), with the given-builders spec.
-
The journey and the close (D1, D3, D4, D5).
Risks
-
A partner or a service mishandles the second time (the second report’s entry not linked, or linked to someone else; the second listing never sent; the school report refused under the new listing; the system’s record for application A refused, or filed on B; the second per-diem not born) — 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 and D4 name the expected facts, so a difference is a finding 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; before step 2 merges each of the ten oracles and the education agency’s beat is shown to fail by one planted change to the walk, and the list is in the MR.
-
Changing four builders' request ids breaks a spec that relied on the old ones — fail-closed (a builder is refused, or a builders test finds a second row). Mitigation: a derived id never leaves its run; the given-builders spec and every journey run in the car with step 1.
-
The matching links the wrong report, or nobody (the first report’s loose entry linked by the system, so the worker’s link is refused as a duplicate; or a second person of the child’s name and birth date on file, so the ruleset is not sure) — fail-closed: the builder is refused, or the child’s reports are not the two. Mitigation: the first entry carries the library’s default name and an age, neither of which is the child’s, and Georgia’s ruleset links only on an exact name with an exact birth date; a given person is named for its run, and no other test shares a run id.
-
The eligibility system’s simulator still owes an earlier test a record when the walk’s call is made — silent for the walk only if it asserted on the call’s contents. Mitigation: the walk asserts on its own two applications' reports, read from craig-cases, as the first journey does.
-
A retried walk meets an act its first attempt completed — fail-closed. Mitigation: every act is a builder under the run’s request ids. As with the other journeys, the beats that assert the family’s state as it stood the first time (listed once, one application, case B without custody) do not hold again after the re-entry, so a walk that has re-entered is not walked again under one run id.
Tests
-
Journey: the main test of D1 with the partner beats of D4, and the test of D3.
-
Builders: "a builder entered for a second case of the same child makes a second row", in the given-builders spec.
-
Regression: the three lifecycle journeys, the caseworker Medicaid spec and the rest of the given-builders spec pass with the library change.
-
Planted defects: evidence in step 2’s MR; 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 re-entry walk, and the section "The journey "given" library (#666, B2)" says which builders carry their case or report in their request id. -
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 its bindings; a note goes on epic &124.